Mercurial > pidgin
annotate plugins/statenotify.c @ 5798:217d24d11b6e
[gaim-migrate @ 6223]
<SimGuy> it was partly my stupidity :)
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 07 Jun 2003 09:09:11 +0000 |
parents | dae79aefac8d |
children | 059d95c67cda |
rev | line source |
---|---|
5267 | 1 #include "gaim.h" |
2 | |
3 static void | |
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
4 write_status(GaimConnection *gc, char *who, const char *message) |
5267 | 5 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5587
diff
changeset
|
6 GaimConversation *conv; |
5267 | 7 struct buddy *b; |
8 char buf[256]; | |
9 | |
10 conv = gaim_find_conversation_with_account(who, gc->account); | |
11 | |
12 if (conv == NULL) | |
13 return; | |
14 | |
15 if ((b = gaim_find_buddy(gc->account, who)) != NULL) | |
16 who = gaim_get_buddy_alias(b); | |
17 | |
18 g_snprintf(buf, sizeof(buf), "%s %s", who, message); | |
19 | |
20 gaim_conversation_write(conv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); | |
21 } | |
22 | |
23 static void | |
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
24 buddy_away_cb(GaimConnection *gc, char *who, void *data) |
5267 | 25 { |
26 write_status(gc, who, "has gone away."); | |
27 } | |
28 | |
29 static void | |
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
30 buddy_unaway_cb(GaimConnection *gc, char *who, void *data) |
5267 | 31 { |
32 write_status(gc, who, "is no longer away."); | |
33 } | |
34 | |
35 static void | |
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
36 buddy_idle_cb(GaimConnection *gc, char *who, void *data) |
5267 | 37 { |
38 write_status(gc, who, "has become idle."); | |
39 } | |
40 | |
41 static void | |
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
42 buddy_unidle_cb(GaimConnection *gc, char *who, void *data) |
5267 | 43 { |
44 write_status(gc, who, "is no longer idle."); | |
45 } | |
46 | |
47 static gboolean | |
48 plugin_load(GaimPlugin *plugin) | |
49 { | |
50 gaim_signal_connect(plugin, event_buddy_away, buddy_away_cb, NULL); | |
51 gaim_signal_connect(plugin, event_buddy_back, buddy_unaway_cb, NULL); | |
52 gaim_signal_connect(plugin, event_buddy_idle, buddy_idle_cb, NULL); | |
53 gaim_signal_connect(plugin, event_buddy_unidle, buddy_unidle_cb, NULL); | |
54 | |
55 return TRUE; | |
56 } | |
57 | |
58 static GaimPluginInfo info = | |
59 { | |
60 2, /**< api_version */ | |
61 GAIM_PLUGIN_STANDARD, /**< type */ | |
62 NULL, /**< ui_requirement */ | |
63 0, /**< flags */ | |
64 NULL, /**< dependencies */ | |
65 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
66 | |
67 NULL, /**< id */ | |
68 N_("Buddy State Notification"), /**< name */ | |
69 VERSION, /**< version */ | |
70 /** summary */ | |
71 N_("Notifies in a conversation window when a buddy goes or returns from " | |
72 "away or idle."), | |
73 /** description */ | |
74 N_("Notifies in a conversation window when a buddy goes or returns from " | |
75 "away or idle."), | |
76 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
77 WEBSITE, /**< homepage */ | |
78 | |
79 plugin_load, /**< load */ | |
80 NULL, /**< unload */ | |
81 NULL, /**< destroy */ | |
82 | |
83 NULL, /**< ui_info */ | |
84 NULL /**< extra_info */ | |
85 }; | |
86 | |
87 static void | |
88 __init_plugin(GaimPlugin *plugin) | |
89 { | |
90 } | |
91 | |
92 GAIM_INIT_PLUGIN(statenotify, __init_plugin, info); |