diff libpurple/plugins/joinpart.c @ 23870:13ca254ea7db

In the Join/Part plugin, add the ability to apply the rules to buddies. By default, joins and parts for buddies are still shown.
author Richard Laager <rlaager@wiktel.com>
date Wed, 20 Aug 2008 21:10:01 +0000
parents 22fce0be8ed0
children 7f552614ec8a
line wrap: on
line diff
--- a/libpurple/plugins/joinpart.c	Wed Aug 20 21:09:50 2008 +0000
+++ b/libpurple/plugins/joinpart.c	Wed Aug 20 21:10:01 2008 +0000
@@ -41,6 +41,10 @@
 #define THRESHOLD_PREF "/plugins/core/joinpart/threshold"
 #define THRESHOLD_DEFAULT 20
 
+/* Hide buddies */
+#define HIDE_BUDDIES_PREF "/plugins/core/joinpart/hide_buddies"
+#define HIDE_BUDDIES_DEFAULT FALSE
+
 struct joinpart_key
 {
 	PurpleConversation *conv;
@@ -89,8 +93,8 @@
 	if (g_list_length(purple_conv_chat_get_users(chat)) < threshold)
 		return FALSE;
 
-	/* We always care about our buddies! */
-	if (purple_find_buddy(purple_conversation_get_account(conv), name))
+	if (!purple_prefs_get_bool(HIDE_BUDDIES_PREF) &&
+	    purple_find_buddy(purple_conversation_get_account(conv), name))
 		return FALSE;
 
 	/* Only show the notice if the user has spoken recently. */
@@ -233,12 +237,15 @@
 	purple_plugin_pref_set_bounds(ppref, 0, 1000);
 	purple_plugin_pref_frame_add(frame, ppref);
 
-
 	ppref = purple_plugin_pref_new_with_name_and_label(DELAY_PREF,
 	                                                 _("User Inactivity Timeout (in minutes)"));
 	purple_plugin_pref_set_bounds(ppref, 0, 8 * 60); /* 8 Hours */
 	purple_plugin_pref_frame_add(frame, ppref);
 
+	ppref = purple_plugin_pref_new_with_name_and_label(HIDE_BUDDIES_PREF,
+	                                                 _("Apply hiding rules to buddies"));
+	purple_plugin_pref_frame_add(frame, ppref);
+
 	return frame;
 }
 
@@ -300,6 +307,7 @@
 
 	purple_prefs_add_int(DELAY_PREF, DELAY_DEFAULT);
 	purple_prefs_add_int(THRESHOLD_PREF, THRESHOLD_DEFAULT);
+	purple_prefs_add_bool(HIDE_BUDDIES_PREF, HIDE_BUDDIES_DEFAULT);
 }
 
 PURPLE_INIT_PLUGIN(joinpart, init_plugin, info)