# HG changeset patch # User Stu Tomlinson # Date 1130692700 0 # Node ID 077f956e41a17c585a6a11ce301314ff63b4a6c0 # Parent 21719fc8ea2df06e06588d2e4ba1b35ba43d556c [gaim-migrate @ 14192] Patch 1342474 from Francesco Fracassi - add buddy signon & signoff to the buddy state notification plugin committer: Tailor Script diff -r 21719fc8ea2d -r 077f956e41a1 plugins/statenotify.c --- a/plugins/statenotify.c Sun Oct 30 17:10:22 2005 +0000 +++ b/plugins/statenotify.c Sun Oct 30 17:18:20 2005 +0000 @@ -63,6 +63,20 @@ write_status(buddy, _("%s is no longer idle.")); } +static void +buddy_signon_cb(GaimBuddy *buddy, void *data) +{ + if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_signon")) + write_status(buddy, _("%s has signed on.")); +} + +static void +buddy_signoff_cb(GaimBuddy *buddy, void *data) +{ + if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_signon")) + write_status(buddy, _("%s has signed off.")); +} + static GaimPluginPrefFrame * get_plugin_pref_frame(GaimPlugin *plugin) { @@ -80,6 +94,9 @@ ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_idle", _("Buddy Goes _Idle")); gaim_plugin_pref_frame_add(frame, ppref); + ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_signon", _("Buddy _Signs On/Off")); + gaim_plugin_pref_frame_add(frame, ppref); + return frame; } @@ -96,6 +113,10 @@ plugin, GAIM_CALLBACK(buddy_idle_cb), NULL); gaim_signal_connect(blist_handle, "buddy-unidle", plugin, GAIM_CALLBACK(buddy_unidle_cb), NULL); + gaim_signal_connect(blist_handle, "buddy-signed-on", + plugin, GAIM_CALLBACK(buddy_signon_cb), NULL); + gaim_signal_connect(blist_handle, "buddy-signed-off", + plugin, GAIM_CALLBACK(buddy_signoff_cb), NULL); return TRUE; } @@ -144,6 +165,7 @@ gaim_prefs_add_none("/plugins/core/statenotify"); gaim_prefs_add_bool("/plugins/core/statenotify/notify_away", TRUE); gaim_prefs_add_bool("/plugins/core/statenotify/notify_idle", TRUE); + gaim_prefs_add_bool("/plugins/core/statenotify/notify_signon", TRUE); } GAIM_INIT_PLUGIN(statenotify, init_plugin, info)