[gaim-migrate @ 14192]

Sun, 30 Oct 2005 17:18:20 +0000

author
Francesco Fracassi <ffracassi@users.sourceforge.net>
date
Sun, 30 Oct 2005 17:18:20 +0000
changeset 11901
34394921fe76
parent 11900
26ddf2b8a8fe
child 11902
d542dcc06a40

[gaim-migrate @ 14192]
Patch 1342474 from Francesco Fracassi - add buddy signon & signoff to the
buddy state notification plugin

committer: Stu Tomlinson <nosnilmot@pidgin.im>

plugins/statenotify.c file | annotate | diff | comparison | revisions
--- 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)

mercurial