comparison plugins/notify.c @ 191:948100a8cb23

[gaim-migrate @ 201] Wrote a plugin for IcedSoal to put an asterisk in the titlebar of conversations where you haven't replied to the person yet (e.g. you weren't the last person to say something). committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 27 Apr 2000 12:14:16 +0000
parents
children e9ca9146ebf1
comparison
equal deleted inserted replaced
190:3a8809beb5ce 191:948100a8cb23
1 #define GAIM_PLUGINS
2 #include "gaim.h"
3
4 #include <gtk/gtk.h>
5
6 void *handle;
7
8 void received_im(char **who, char **what, void *m) {
9 char buf[256];
10 struct conversation *cnv = find_conversation(*who);
11 GtkWindow *win;
12
13 if (cnv == NULL)
14 cnv = new_conversation(*who);
15
16 win = (GtkWindow *)cnv->window;
17
18 g_snprintf(buf, sizeof(buf), "%s", win->title);
19 if (!strstr(buf, "(*) ")) {
20 g_snprintf(buf, sizeof(buf), "(*) %s", win->title);
21 gtk_window_set_title(win, buf);
22 }
23 }
24
25 void sent_im(char *who, char **what, void *m) {
26 char buf[256];
27 struct conversation *c = find_conversation(who);
28 GtkWindow *win = (GtkWindow *)c->window;
29
30 g_snprintf(buf, sizeof(buf), "%s", win->title);
31 if (strstr(buf, "(*) ")) {
32 g_snprintf(buf, sizeof(buf), "%s", &win->title[4]);
33 gtk_window_set_title(win, buf);
34 }
35 }
36
37 void gaim_plugin_init(void *hndl) {
38 handle = hndl;
39
40 gaim_signal_connect(handle, event_im_recv, received_im, NULL);
41 gaim_signal_connect(handle, event_im_send, sent_im, NULL);
42 }
43
44 char *name() {
45 return "Visual Notification";
46 }
47
48 char *description() {
49 return "Puts an asterisk in the title bar of all conversations"
50 " where you have not responded to a message yet.";
51 }