cpw.attention_ui: 3299913a: Added active conversation on GtkIMHtmlTo...

malu at pidgin.im malu at pidgin.im
Mon Oct 27 19:15:44 EDT 2008


-----------------------------------------------------------------
Revision: 3299913a3dbd223f05ac0895ff0daf7bb076c370
Ancestor: 1f7fd6e0dbb02f2cffee61e4dac98c81c4518f7d
Author: malu at pidgin.im
Date: 2008-10-27T23:12:03
Branch: im.pidgin.cpw.attention_ui
URL: http://d.pidgin.im/viewmtn/revision/info/3299913a3dbd223f05ac0895ff0daf7bb076c370

Modified files:
        libpurple/protocols/jabber/jabber.c pidgin/gtkconv.c
        pidgin/gtkimhtmltoolbar.c pidgin/gtkimhtmltoolbar.h

ChangeLog: 

Added active conversation on GtkIMHtmlToolbar
Connect "Attention" button on toolbar to attention action
Print error message when failing to send attention on XMPP using prpl API

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	b19f0f480def325ce4a9f42f176d32b2f292d524
+++ libpurple/protocols/jabber/jabber.c	25c5dc2195195c24fa521b7522018bbb3c945bca
@@ -2388,7 +2388,13 @@ gboolean jabber_send_attention(PurpleCon
 	gchar *error = NULL;
 
 	if (!_jabber_send_buzz(js, username, &error)) {
+		PurpleAccount *account = purple_connection_get_account(gc);
+		PurpleConversation *conv = 
+			purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY,
+				username, account);
 		purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)");
+		purple_conversation_write(conv, username, error,
+			PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
 		g_free(error);
 		return FALSE;
 	}
============================================================
--- pidgin/gtkconv.c	57d3d7d0dec018d162aba31dadc7270ae348f554
+++ pidgin/gtkconv.c	a483bc054857558ae519d2a07b8b6ef73adec44d
@@ -2242,6 +2242,11 @@ pidgin_conv_switch_active_conversation(P
 	gtkconv = PIDGIN_CONVERSATION(conv);
 	old_conv = gtkconv->active_conv;
 
+	purple_debug_info("gtkconv", "setting active conversation on toolbar %p\n",
+		conv);
+	gtk_imhtmltoolbar_switch_active_conversation(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), 
+		conv);
+	
 	if (old_conv == conv)
 		return;
 
============================================================
--- pidgin/gtkimhtmltoolbar.c	e28c99eaa887f257a3cb3458d53b33c13ef048f4
+++ pidgin/gtkimhtmltoolbar.c	b9e8f5d6be3dbedcf85406c560bca6b3cb242fba
@@ -33,6 +33,7 @@
 #include "request.h"
 #include "pidginstock.h"
 #include "util.h"
+#include "debug.h"
 
 #include "gtkdialogs.h"
 #include "gtkimhtmltoolbar.h"
@@ -915,7 +916,12 @@ static void send_attention_cb(GtkWidget 
 
 static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar)
 {
+	PurpleConversation *conv = toolbar->active_conv;
+	const gchar *who = purple_conversation_get_name(conv);
+	PurpleConnection *gc = purple_conversation_get_gc(conv);
 	
+	purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL));
+	purple_prpl_send_attention(gc, who, 0);
 }
 
 static void update_buttons_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar)
@@ -1547,3 +1553,13 @@ void gtk_imhtmltoolbar_associate_smileys
 	g_free(toolbar->sml);
 	toolbar->sml = g_strdup(proto_id);
 }
+
+void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar,
+	PurpleConversation *conv)
+{
+	purple_debug_info("gtkimhtmltoolbar", "switch active conversation to %p\n",
+		conv);
+	toolbar->active_conv = conv;
+	// gray out buttons...
+}
+
============================================================
--- pidgin/gtkimhtmltoolbar.h	c439504fbbfc92406edc3e72c9452725df35d21d
+++ pidgin/gtkimhtmltoolbar.h	36d55596a6920ec49a61282b5355359e78db4413
@@ -77,6 +77,8 @@ struct _GtkIMHtmlToolbar {
 	char *sml;
 	GtkWidget *strikethrough;
 	GtkWidget *insert_hr;
+	
+	PurpleConversation *active_conv;
 };
 
 struct _GtkIMHtmlToolbarClass {
@@ -90,6 +92,8 @@ void gtk_imhtmltoolbar_associate_smileys
 void gtk_imhtmltoolbar_attach    (GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml);
 void gtk_imhtmltoolbar_associate_smileys (GtkIMHtmlToolbar *toolbar, const char *proto_id);
 
+void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar,
+	PurpleConversation *conv);
 
 #ifdef __cplusplus
 }


More information about the Commits mailing list