cpw.attention_ui: 82531060: Make it work again after the merge from ...

malu at pidgin.im malu at pidgin.im
Mon Mar 2 18:40:55 EST 2009


-----------------------------------------------------------------
Revision: 825310603146ebe7a9b519bf45b1b7989fb7a3f5
Ancestor: 525f34a632083b49784f6f4ecac4bdcf2fed3854
Author: malu at pidgin.im
Date: 2009-03-02T23:34:48
Branch: im.pidgin.cpw.attention_ui
URL: http://d.pidgin.im/viewmtn/revision/info/825310603146ebe7a9b519bf45b1b7989fb7a3f5

Modified files:
        libpurple/protocols/jabber/jabber.c
        libpurple/protocols/jabber/message.c
        libpurple/protocols/msn/msn.c pidgin/pidginstock.c

ChangeLog: 

Make it work again after the merge from i.p.p.... :)
Had to duplicate some stuff from prpl.c in jabber.c to output the attention
message when sending one using the /buzz command, until I figure out a better
way of doing it...

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	dd16e1382d9743b803f04863a7c9fd36f3fb0f5a
+++ libpurple/protocols/jabber/jabber.c	644e77fa05741bf002f287e15148298f0bbbf692
@@ -2523,6 +2523,11 @@ static PurpleCmdRet jabber_cmd_buzz(Purp
 {
 	JabberStream *js = conv->account->gc->proto_data;
 	const gchar *who;
+	gchar *description;
+	PurpleBuddy *buddy;
+	const char *alias;
+	PurpleAttentionType *attn = 
+		purple_get_attention_type_from_code(conv->account, 0);
 
 	if (!args || !args[0]) {
 		/* use the buddy from conversation, if it's a one-to-one conversation */
@@ -2535,27 +2540,19 @@ static PurpleCmdRet jabber_cmd_buzz(Purp
 		who = args[0];
 	}
 
-	if (_jabber_send_buzz(js, who, error)) {
-		const gchar *alias;
-		gchar *str;
-		PurpleBuddy *buddy =
-			purple_find_buddy(purple_connection_get_account(conv->account->gc),
-				who);
-
-		if (buddy != NULL)
-			alias = purple_buddy_get_contact_alias(buddy);
-		else
-			alias = who;
-
-		str = g_strdup_printf(_("Buzzing %s..."), alias);
-		purple_conversation_write(conv, NULL, str,
-			PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
-		g_free(str);
-
-		return PURPLE_CMD_RET_OK;
-	} else {
-		return PURPLE_CMD_RET_FAILED;
-	}
+	buddy = purple_find_buddy(conv->account, who);
+	if (buddy != NULL)
+		alias = purple_buddy_get_contact_alias(buddy);
+	else
+		alias = who;
+	
+	description = 
+		g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias);
+	purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL));
+	purple_conversation_write(conv, NULL, description, 
+		PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM, time(NULL));
+	g_free(description);
+	return _jabber_send_buzz(js, who, error)  ? PURPLE_CMD_RET_OK : PURPLE_CMD_RET_FAILED;
 }
 
 GList *jabber_attention_types(PurpleAccount *account)
============================================================
--- libpurple/protocols/jabber/message.c	540d6e21c311ee9e858346a21ce744ebbea3c940
+++ libpurple/protocols/jabber/message.c	7e8acffb4fe319c94e970d9a4dc22b06ddb18cc0
@@ -118,7 +118,7 @@ static void handle_chat(JabberMessage *j
 				}
 			}
 			serv_got_typing_stopped(jm->js->gc, from);
-
+			
 		} else {
 			serv_got_typing_stopped(jm->js->gc, from);
 		}
@@ -138,7 +138,7 @@ static void handle_chat(JabberMessage *j
 				g_free(jbr->thread_id);
 			jbr->thread_id = g_strdup(jbr->thread_id);
 		}
-
+		
 		if (jm->js->googletalk && jm->xhtml == NULL) {
 			char *tmp = jm->body;
 			jm->body = jabber_google_format_to_html(jm->body);
@@ -289,6 +289,8 @@ static void handle_buzz(JabberMessage *j
 static void handle_buzz(JabberMessage *jm) {
 	PurpleBuddy *buddy;
 	PurpleAccount *account;
+	PurpleConversation *c;
+	char *username;
 
 	/* Delayed buzz MUST NOT be accepted */
 	if(jm->delayed)
@@ -303,8 +305,16 @@ static void handle_buzz(JabberMessage *j
 	if ((buddy = purple_find_buddy(account, jm->from)) == NULL)
 		return; /* Do not accept buzzes from unknown people */
 
+	c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, jm->from, account);
+	if (c == NULL)
+		c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, jm->from);
+
+	username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
 	/* xmpp only has 1 attention type, so index is 0 */
 	purple_prpl_got_attention(jm->js->gc, jm->from, 0);
+	purple_conversation_attention(c, jm->from, 0, PURPLE_MESSAGE_RECV, time(NULL));
+
+	g_free(username);
 }
 
 /* used internally by the functions below */
============================================================
--- libpurple/protocols/msn/msn.c	5596dfb933ab5031878f344456e08bef32b61af2
+++ libpurple/protocols/msn/msn.c	c117d6ad0ef283054602b50175481b436a4a8500
@@ -162,6 +162,8 @@ msn_cmd_nudge(PurpleConversation *conv, 
 	username = purple_conversation_get_name(conv);
 
 	purple_prpl_send_attention(gc, username, MSN_NUDGE);
+	purple_conversation_attention(conv, username, 0, PURPLE_MESSAGE_SEND,
+		time(NULL));
 
 	return PURPLE_CMD_RET_OK;
 }
============================================================
--- pidgin/pidginstock.c	b500b711585f2f2baa610b56c126295c7c19d73b
+++ pidgin/pidginstock.c	f5a548afbc24ffb5313dff7dc96922cb25ef0869
@@ -197,7 +197,8 @@ const SizedStockIcon sized_stock_icons [
 	{ PIDGIN_STOCK_TOOLBAR_UNBLOCK,		"toolbar", "unblock.png",	 FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL  },
 	{ PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR,	"toolbar", "select-avatar.png",	 FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, NULL  },
 	{ PIDGIN_STOCK_TOOLBAR_SEND_FILE,	"toolbar", "send-file.png",	 FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL  },
-	{ PIDGIN_STOCK_TOOLBAR_TRANSFER,	"toolbar", "transfer.png",	 FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL  }
+	{ PIDGIN_STOCK_TOOLBAR_TRANSFER,	"toolbar", "transfer.png",	 FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL  },
+	{ PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, "toolbar", "get-attention.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL  }
 };
 
 const SizedStockIcon sized_status_icons [] = {
@@ -277,52 +278,6 @@ find_file(const char *dir, const char *b
 	return ret;
 }
 
-static void
-add_sized_icon(GtkIconSet *iconset, GtkIconSize sizeid, const char *dir, 
-	       gboolean rtl, const char *size, const char *file)
-{
-	char *filename;
-	GtkIconSource *source;	
-
-	filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir, size, file, NULL);
-	source = gtk_icon_source_new();
-        gtk_icon_source_set_filename(source, filename);
-	gtk_icon_source_set_direction(source, GTK_TEXT_DIR_LTR);
-        gtk_icon_source_set_direction_wildcarded(source, !rtl);
-	gtk_icon_source_set_size(source, sizeid);
-        gtk_icon_source_set_size_wildcarded(source, FALSE);
-        gtk_icon_source_set_state_wildcarded(source, TRUE);
-        gtk_icon_set_add_source(iconset, source);
-	gtk_icon_source_free(source);
-
-	if (sizeid == gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)) {
-		source = gtk_icon_source_new();
-	        gtk_icon_source_set_filename(source, filename);
-        	gtk_icon_source_set_direction_wildcarded(source, TRUE);
-	        gtk_icon_source_set_size(source, GTK_ICON_SIZE_MENU);
-	        gtk_icon_source_set_size_wildcarded(source, FALSE);
-        	gtk_icon_source_set_state_wildcarded(source, TRUE);
-	        gtk_icon_set_add_source(iconset, source);
-	        gtk_icon_source_free(source);
-	}
-        g_free(filename);
-
-       if (rtl) {
-		filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir, size, "rtl", file, NULL);
-                source = gtk_icon_source_new();
-                gtk_icon_source_set_filename(source, filename);
-                gtk_icon_source_set_direction(source, GTK_TEXT_DIR_RTL);
-                gtk_icon_source_set_size(source, sizeid);
-                gtk_icon_source_set_size_wildcarded(source, FALSE);
-                gtk_icon_source_set_state_wildcarded(source, TRUE);
-                gtk_icon_set_add_source(iconset, source);
-		g_free(filename);
-		gtk_icon_source_free(source);
-        }
-
-
-}
-
 /* Altered from do_colorshift in gnome-panel */
 static void
 do_alphashift(GdkPixbuf *dest, GdkPixbuf *src)


More information about the Commits mailing list