Mercurial > pidgin
annotate plugins/statenotify.c @ 5872:059d95c67cda
[gaim-migrate @ 6304]
The legendary Header File Cleanup! Files now only include what they need.
This should reduce the number of files that must recompile when a header
file changes. It's a lot nicer. Trust me on it. I also added a couple new
header files. I hope I didn't break TOO much!
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sat, 14 Jun 2003 23:21:02 +0000 |
| parents | dae79aefac8d |
| children | a18e88c4dace |
| rev | line source |
|---|---|
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1 #include "internal.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2 |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3 #include "blist.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4 #include "conversation.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5 #include "debug.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
6 |
| 5267 | 7 #include "gaim.h" |
| 8 | |
| 9 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
10 write_status(GaimConnection *gc, char *who, const char *message) |
| 5267 | 11 { |
|
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5587
diff
changeset
|
12 GaimConversation *conv; |
| 5267 | 13 struct buddy *b; |
| 14 char buf[256]; | |
| 15 | |
| 16 conv = gaim_find_conversation_with_account(who, gc->account); | |
| 17 | |
| 18 if (conv == NULL) | |
| 19 return; | |
| 20 | |
| 21 if ((b = gaim_find_buddy(gc->account, who)) != NULL) | |
| 22 who = gaim_get_buddy_alias(b); | |
| 23 | |
| 24 g_snprintf(buf, sizeof(buf), "%s %s", who, message); | |
| 25 | |
| 26 gaim_conversation_write(conv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); | |
| 27 } | |
| 28 | |
| 29 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
30 buddy_away_cb(GaimConnection *gc, char *who, void *data) |
| 5267 | 31 { |
| 32 write_status(gc, who, "has gone away."); | |
| 33 } | |
| 34 | |
| 35 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
36 buddy_unaway_cb(GaimConnection *gc, char *who, void *data) |
| 5267 | 37 { |
| 38 write_status(gc, who, "is no longer away."); | |
| 39 } | |
| 40 | |
| 41 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
42 buddy_idle_cb(GaimConnection *gc, char *who, void *data) |
| 5267 | 43 { |
| 44 write_status(gc, who, "has become idle."); | |
| 45 } | |
| 46 | |
| 47 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
48 buddy_unidle_cb(GaimConnection *gc, char *who, void *data) |
| 5267 | 49 { |
| 50 write_status(gc, who, "is no longer idle."); | |
| 51 } | |
| 52 | |
| 53 static gboolean | |
| 54 plugin_load(GaimPlugin *plugin) | |
| 55 { | |
| 56 gaim_signal_connect(plugin, event_buddy_away, buddy_away_cb, NULL); | |
| 57 gaim_signal_connect(plugin, event_buddy_back, buddy_unaway_cb, NULL); | |
| 58 gaim_signal_connect(plugin, event_buddy_idle, buddy_idle_cb, NULL); | |
| 59 gaim_signal_connect(plugin, event_buddy_unidle, buddy_unidle_cb, NULL); | |
| 60 | |
| 61 return TRUE; | |
| 62 } | |
| 63 | |
| 64 static GaimPluginInfo info = | |
| 65 { | |
| 66 2, /**< api_version */ | |
| 67 GAIM_PLUGIN_STANDARD, /**< type */ | |
| 68 NULL, /**< ui_requirement */ | |
| 69 0, /**< flags */ | |
| 70 NULL, /**< dependencies */ | |
| 71 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 72 | |
| 73 NULL, /**< id */ | |
| 74 N_("Buddy State Notification"), /**< name */ | |
| 75 VERSION, /**< version */ | |
| 76 /** summary */ | |
| 77 N_("Notifies in a conversation window when a buddy goes or returns from " | |
| 78 "away or idle."), | |
| 79 /** description */ | |
| 80 N_("Notifies in a conversation window when a buddy goes or returns from " | |
| 81 "away or idle."), | |
| 82 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
| 83 WEBSITE, /**< homepage */ | |
| 84 | |
| 85 plugin_load, /**< load */ | |
| 86 NULL, /**< unload */ | |
| 87 NULL, /**< destroy */ | |
| 88 | |
| 89 NULL, /**< ui_info */ | |
| 90 NULL /**< extra_info */ | |
| 91 }; | |
| 92 | |
| 93 static void | |
| 94 __init_plugin(GaimPlugin *plugin) | |
| 95 { | |
| 96 } | |
| 97 | |
| 98 GAIM_INIT_PLUGIN(statenotify, __init_plugin, info); |
