Mon, 18 Sep 2000 19:13:27 +0000
[gaim-migrate @ 938]
Yo
| 191 | 1 | #define GAIM_PLUGINS |
| 2 | #include "gaim.h" | |
| 3 | ||
| 4 | #include <gtk/gtk.h> | |
|
192
d6188af92003
[gaim-migrate @ 202]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
191
diff
changeset
|
5 | #include <string.h> |
| 191 | 6 | |
| 7 | void *handle; | |
| 8 | ||
| 9 | void received_im(char **who, char **what, void *m) { | |
| 10 | char buf[256]; | |
| 11 | struct conversation *cnv = find_conversation(*who); | |
| 12 | GtkWindow *win; | |
| 13 | ||
| 14 | if (cnv == NULL) | |
| 15 | cnv = new_conversation(*who); | |
| 16 | ||
| 17 | win = (GtkWindow *)cnv->window; | |
| 18 | ||
| 19 | g_snprintf(buf, sizeof(buf), "%s", win->title); | |
| 20 | if (!strstr(buf, "(*) ")) { | |
| 21 | g_snprintf(buf, sizeof(buf), "(*) %s", win->title); | |
| 22 | gtk_window_set_title(win, buf); | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | void sent_im(char *who, char **what, void *m) { | |
| 27 | char buf[256]; | |
| 28 | struct conversation *c = find_conversation(who); | |
| 29 | GtkWindow *win = (GtkWindow *)c->window; | |
| 30 | ||
| 31 | g_snprintf(buf, sizeof(buf), "%s", win->title); | |
| 32 | if (strstr(buf, "(*) ")) { | |
| 33 | g_snprintf(buf, sizeof(buf), "%s", &win->title[4]); | |
| 34 | gtk_window_set_title(win, buf); | |
| 35 | } | |
| 36 | } | |
| 37 | ||
| 38 | void gaim_plugin_init(void *hndl) { | |
| 39 | handle = hndl; | |
| 40 | ||
| 41 | gaim_signal_connect(handle, event_im_recv, received_im, NULL); | |
| 42 | gaim_signal_connect(handle, event_im_send, sent_im, NULL); | |
| 43 | } | |
| 44 | ||
| 45 | char *name() { | |
| 46 | return "Visual Notification"; | |
| 47 | } | |
| 48 | ||
| 49 | char *description() { | |
| 50 | return "Puts an asterisk in the title bar of all conversations" | |
| 51 | " where you have not responded to a message yet."; | |
| 52 | } |