Thu, 03 Aug 2000 05:35:13 +0000
[gaim-migrate @ 602]
this really cool guy sent a patch to convert %n, %d and %t to things in
away messages. i just wish i could remember his name.
| 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 | ||
|
192
d6188af92003
[gaim-migrate @ 202]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
191
diff
changeset
|
14 | if (!strcmp(*what, LAGOMETER_STR)) |
|
d6188af92003
[gaim-migrate @ 202]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
191
diff
changeset
|
15 | return; |
|
d6188af92003
[gaim-migrate @ 202]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
191
diff
changeset
|
16 | |
| 191 | 17 | if (cnv == NULL) |
| 18 | cnv = new_conversation(*who); | |
| 19 | ||
| 20 | win = (GtkWindow *)cnv->window; | |
| 21 | ||
| 22 | g_snprintf(buf, sizeof(buf), "%s", win->title); | |
| 23 | if (!strstr(buf, "(*) ")) { | |
| 24 | g_snprintf(buf, sizeof(buf), "(*) %s", win->title); | |
| 25 | gtk_window_set_title(win, buf); | |
| 26 | } | |
| 27 | } | |
| 28 | ||
| 29 | void sent_im(char *who, char **what, void *m) { | |
| 30 | char buf[256]; | |
| 31 | struct conversation *c = find_conversation(who); | |
| 32 | GtkWindow *win = (GtkWindow *)c->window; | |
| 33 | ||
| 34 | g_snprintf(buf, sizeof(buf), "%s", win->title); | |
| 35 | if (strstr(buf, "(*) ")) { | |
| 36 | g_snprintf(buf, sizeof(buf), "%s", &win->title[4]); | |
| 37 | gtk_window_set_title(win, buf); | |
| 38 | } | |
| 39 | } | |
| 40 | ||
| 41 | void gaim_plugin_init(void *hndl) { | |
| 42 | handle = hndl; | |
| 43 | ||
| 44 | gaim_signal_connect(handle, event_im_recv, received_im, NULL); | |
| 45 | gaim_signal_connect(handle, event_im_send, sent_im, NULL); | |
| 46 | } | |
| 47 | ||
| 48 | char *name() { | |
| 49 | return "Visual Notification"; | |
| 50 | } | |
| 51 | ||
| 52 | char *description() { | |
| 53 | return "Puts an asterisk in the title bar of all conversations" | |
| 54 | " where you have not responded to a message yet."; | |
| 55 | } |