Mercurial > pidgin
annotate plugins/notify.c @ 1848:e246a4bd1141
[gaim-migrate @ 1858]
More bug fixen.
IRC colorus work properly too.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Tue, 15 May 2001 00:43:51 +0000 |
parents | 34afd5adaae8 |
children | bd9d403fb15b |
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) | |
1835 | 22 { |
23 if (general_options & OPT_GEN_QUEUE_WHEN_AWAY) | |
24 return; | |
25 | |
191 | 26 cnv = new_conversation(*who); |
1835 | 27 } |
191 | 28 |
29 win = (GtkWindow *)cnv->window; | |
30 | |
31 g_snprintf(buf, sizeof(buf), "%s", win->title); | |
32 if (!strstr(buf, "(*) ")) { | |
33 g_snprintf(buf, sizeof(buf), "(*) %s", win->title); | |
34 gtk_window_set_title(win, buf); | |
35 } | |
36 } | |
37 | |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
663
diff
changeset
|
38 void sent_im(struct gaim_connection *gc, char *who, char **what, void *m) { |
191 | 39 char buf[256]; |
40 struct conversation *c = find_conversation(who); | |
41 GtkWindow *win = (GtkWindow *)c->window; | |
42 | |
43 g_snprintf(buf, sizeof(buf), "%s", win->title); | |
44 if (strstr(buf, "(*) ")) { | |
45 g_snprintf(buf, sizeof(buf), "%s", &win->title[4]); | |
46 gtk_window_set_title(win, buf); | |
47 } | |
48 } | |
49 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
50 char *gaim_plugin_init(GModule *hndl) { |
191 | 51 handle = hndl; |
52 | |
53 gaim_signal_connect(handle, event_im_recv, received_im, NULL); | |
54 gaim_signal_connect(handle, event_im_send, sent_im, NULL); | |
1052
25f121faa75e
[gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
55 |
25f121faa75e
[gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
56 return NULL; |
191 | 57 } |
58 | |
59 char *name() { | |
60 return "Visual Notification"; | |
61 } | |
62 | |
63 char *description() { | |
64 return "Puts an asterisk in the title bar of all conversations" | |
65 " where you have not responded to a message yet."; | |
66 } |