Mercurial > pidgin
annotate plugins/notify.c @ 1563:393b23c8f494
[gaim-migrate @ 1573]
notify when people add you to their list
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sun, 11 Mar 2001 00:38:37 +0000 |
parents | 25f121faa75e |
children | 34afd5adaae8 |
rev | line source |
---|---|
191 | 1 #define GAIM_PLUGINS |
2 #include "gaim.h" | |
3 | |
4 #include <gtk/gtk.h> | |
192
e9ca9146ebf1
[gaim-migrate @ 202]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
191
diff
changeset
|
5 #include <string.h> |
191 | 6 |
7 void *handle; | |
8 | |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
663
diff
changeset
|
9 void received_im(struct gaim_connection *gc, char **who, char **what, void *m) { |
191 | 10 char buf[256]; |
11 struct conversation *cnv = find_conversation(*who); | |
12 GtkWindow *win; | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
13 char *me = g_strdup(normalize(gc->username)); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
14 |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
15 if (!strcmp(me, normalize(*who))) { |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
16 g_free(me); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
17 return; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
18 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
19 g_free(me); |
191 | 20 |
21 if (cnv == NULL) | |
22 cnv = new_conversation(*who); | |
23 | |
24 win = (GtkWindow *)cnv->window; | |
25 | |
26 g_snprintf(buf, sizeof(buf), "%s", win->title); | |
27 if (!strstr(buf, "(*) ")) { | |
28 g_snprintf(buf, sizeof(buf), "(*) %s", win->title); | |
29 gtk_window_set_title(win, buf); | |
30 } | |
31 } | |
32 | |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
663
diff
changeset
|
33 void sent_im(struct gaim_connection *gc, char *who, char **what, void *m) { |
191 | 34 char buf[256]; |
35 struct conversation *c = find_conversation(who); | |
36 GtkWindow *win = (GtkWindow *)c->window; | |
37 | |
38 g_snprintf(buf, sizeof(buf), "%s", win->title); | |
39 if (strstr(buf, "(*) ")) { | |
40 g_snprintf(buf, sizeof(buf), "%s", &win->title[4]); | |
41 gtk_window_set_title(win, buf); | |
42 } | |
43 } | |
44 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
45 char *gaim_plugin_init(GModule *hndl) { |
191 | 46 handle = hndl; |
47 | |
48 gaim_signal_connect(handle, event_im_recv, received_im, NULL); | |
49 gaim_signal_connect(handle, event_im_send, sent_im, NULL); | |
1052
25f121faa75e
[gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
50 |
25f121faa75e
[gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
51 return NULL; |
191 | 52 } |
53 | |
54 char *name() { | |
55 return "Visual Notification"; | |
56 } | |
57 | |
58 char *description() { | |
59 return "Puts an asterisk in the title bar of all conversations" | |
60 " where you have not responded to a message yet."; | |
61 } |