/soc/2015/mmcc/main: 8931e2e2c10e: merge with pidgin/main

Michael McConville mmcconville at mykolab.com
Tue Jun 23 16:02:34 EDT 2015


Changeset: 8931e2e2c10edb27c7ec440b9a9030039ba37f77
Author:	 Michael McConville <mmcconville at mykolab.com>
Date:	 2015-06-19 16:18 -0400
Branch:	 default
URL: https://hg.pidgin.im/soc/2015/mmcc/main/rev/8931e2e2c10e

Description:

merge with pidgin/main

diffstat:

 COPYRIGHT               |   1 +
 libpurple/proxy.c       |   3 +++
 libpurple/server.c      |   2 +-
 pidgin/plugins/notify.c |  48 ++++++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 51 insertions(+), 3 deletions(-)

diffs (122 lines):

diff --git a/COPYRIGHT b/COPYRIGHT
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -486,6 +486,7 @@ Carsten Schaar
 Toby Schaffer
 Jonathan Schleifer <js-pidgin at webkeks.org>
 Luke Schierer
+Sebastian Schmidt <yath at yath.de>
 Ralph Schmieder
 David Schmitt
 Heiko Schmitt
diff --git a/libpurple/proxy.c b/libpurple/proxy.c
--- a/libpurple/proxy.c
+++ b/libpurple/proxy.c
@@ -575,6 +575,9 @@ purple_win32_proxy_get_info(void)
 static void
 purple_proxy_connect_data_destroy(PurpleProxyConnectData *connect_data)
 {
+	if (!PURPLE_PROXY_CONNECT_DATA_IS_VALID(connect_data))
+		return;
+
 	handles = g_slist_remove(handles, connect_data);
 
 	if (connect_data->query_data != NULL)
diff --git a/libpurple/server.c b/libpurple/server.c
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -767,7 +767,7 @@ PurpleChatConversation *purple_serv_got_
 
 	chat = purple_conversations_find_chat_with_account(name, account);
 	if (!chat) {
-	    chat = purple_chat_conversation_new(account, name);
+		chat = purple_chat_conversation_new(account, name);
 	}
 	g_return_val_if_fail(chat != NULL, NULL);
 
diff --git a/pidgin/plugins/notify.c b/pidgin/plugins/notify.c
--- a/pidgin/plugins/notify.c
+++ b/pidgin/plugins/notify.c
@@ -262,13 +262,34 @@ message_displayed_cb(PurpleConversation 
 {
 	PurpleMessageFlags flags = purple_message_get_flags(msg);
 
+	/* Ignore anything that's not a received message or a system message */
+	if (!(flags & (PURPLE_MESSAGE_RECV|PURPLE_MESSAGE_SYSTEM)))
+		return FALSE;
+	/* Don't highlight for delayed messages */
+	if ((flags & PURPLE_MESSAGE_RECV) && (flags & PURPLE_MESSAGE_DELAYED))
+		return FALSE;
+	/* Check whether to highlight for system message for either chat or IM */
+	if (flags & PURPLE_MESSAGE_SYSTEM) {
+		if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
+			if (!purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_sys"))
+				return FALSE;
+		} else if (PURPLE_IS_IM_CONVERSATION(conv)) {
+			if (!purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im_sys"))
+				return FALSE;
+		} else {
+			/* System message not from chat or IM, ignore */
+			return FALSE;
+		}
+	}
+	
+	/* If it's a chat, check if we should only highlight when nick is mentioned */
 	if ((PURPLE_IS_CHAT_CONVERSATION(conv) &&
 	     purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_nick") &&
 	     !(flags & PURPLE_MESSAGE_NICK)))
 	    return FALSE;
 
-	if ((flags & PURPLE_MESSAGE_RECV) && !(flags & PURPLE_MESSAGE_DELAYED))
-		notify(conv, TRUE);
+	/* Nothing speaks against notifying, do so */
+	notify(conv, TRUE);
 
 	return FALSE;
 }
@@ -691,6 +712,17 @@ get_config_frame(PurplePlugin *plugin)
 	g_signal_connect(G_OBJECT(toggle), "toggled",
 	                 G_CALLBACK(type_toggle_cb), "type_im");
 
+	ref = toggle;
+	toggle = gtk_check_button_new_with_mnemonic(_("\t_Notify for System messages"));
+	gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
+	                            purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im_sys"));
+	g_signal_connect(G_OBJECT(toggle), "toggled",
+	                 G_CALLBACK(type_toggle_cb), "type_im_sys");
+	gtk_widget_set_sensitive(toggle, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ref)));
+	g_signal_connect(G_OBJECT(ref), "toggled",
+	                 G_CALLBACK(pidgin_toggle_sensitive), toggle);
+
 	toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows"));
 	gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
@@ -709,6 +741,16 @@ get_config_frame(PurplePlugin *plugin)
 	g_signal_connect(G_OBJECT(ref), "toggled",
 	                 G_CALLBACK(pidgin_toggle_sensitive), toggle);
 
+	toggle = gtk_check_button_new_with_mnemonic(_("\tNotify for _System messages"));
+	gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
+	                            purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_sys"));
+	g_signal_connect(G_OBJECT(toggle), "toggled",
+	                 G_CALLBACK(type_toggle_cb), "type_chat_sys");
+	gtk_widget_set_sensitive(toggle, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ref)));
+	g_signal_connect(G_OBJECT(ref), "toggled",
+	                 G_CALLBACK(pidgin_toggle_sensitive), toggle);
+
 	toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows"));
 	gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
@@ -876,8 +918,10 @@ plugin_load(PurplePlugin *plugin, GError
 	purple_prefs_add_none("/plugins/gtk/X11/notify");
 
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE);
+	purple_prefs_add_bool("/plugins/gtk/X11/notify/type_im_sys", FALSE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat_nick", FALSE);
+	purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat_sys", FALSE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE);
 	purple_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)");



More information about the Commits mailing list