changeset 11901:077f956e41a1

[gaim-migrate @ 14192] Patch 1342474 from Francesco Fracassi - add buddy signon & signoff to the buddy state notification plugin committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 30 Oct 2005 17:18:20 +0000
parents 21719fc8ea2d
children 391acec18e46
files plugins/statenotify.c
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)