pidgin.custom_smiley: 36cd05a9: Show the custom smileys only on accounts...

sadrul at pidgin.im sadrul at pidgin.im
Wed May 7 14:26:00 EDT 2008


-----------------------------------------------------------------
Revision: 36cd05a9f41bff52a2f943c0cd2d3c0b66e02e4a
Ancestor: 230dccf2c8ea29f62c32e122ea727b9c36cc8d1d
Author: sadrul at pidgin.im
Date: 2008-05-07T18:13:14
Branch: im.pidgin.pidgin.custom_smiley
URL: http://d.pidgin.im/viewmtn/revision/info/36cd05a9f41bff52a2f943c0cd2d3c0b66e02e4a

Modified files:
        libpurple/connection.h libpurple/protocols/msn/msn.c
        libpurple/protocols/msnp9/msn.c pidgin/gtkconv.c
        pidgin/gtkimhtml.c pidgin/gtkimhtmltoolbar.c

ChangeLog: 

Show the custom smileys only on accounts that support it. References
#1187.

-------------- next part --------------
============================================================
--- libpurple/connection.h	c3fed808d1ad12de763ce0a7f93bfc39b6292275
+++ libpurple/connection.h	fbfaa03fb804c624ec79557e575fc398e5d83755
@@ -43,6 +43,7 @@ typedef enum
 	PURPLE_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
 	PURPLE_CONNECTION_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */ 
 	PURPLE_CONNECTION_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
+	PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY = 0x0100, /**< Connection supports sending and receiving custom smileys */
 
 } PurpleConnectionFlags;
 
============================================================
--- libpurple/protocols/msn/msn.c	fca221179c431e89ee65728571b91a3b0aa531f4
+++ libpurple/protocols/msn/msn.c	a02246e57c7498ca063e2000df2b1bdc57a7dbbe
@@ -892,7 +892,8 @@ msn_login(PurpleAccount *account)
 	session = msn_session_new(account);
 
 	gc->proto_data = session;
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR |
+		PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY;
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
 
============================================================
--- libpurple/protocols/msnp9/msn.c	7980d72962c49531617927f8619a66b65e5b3028
+++ libpurple/protocols/msnp9/msn.c	1271ff03e985e11a0488c3cdb86b93b21cccde72
@@ -763,7 +763,8 @@ msn_login(PurpleAccount *account)
 	session = msn_session_new(account);
 
 	gc->proto_data = session;
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR |
+		PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY;
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
 
============================================================
--- pidgin/gtkconv.c	60d05056a239662a9c800c2672b472ea3cb03869
+++ pidgin/gtkconv.c	93b30b71bf96512950d5802e6f4590b9c9924533
@@ -6375,6 +6375,11 @@ gray_stuff_out(PidginConversation *gtkco
 		if(conv->features & PURPLE_CONNECTION_NO_IMAGES)
 			buttons &= ~GTK_IMHTML_IMAGE;
 
+		if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)
+			buttons |= GTK_IMHTML_CUSTOM_SMILEY;
+		else
+			buttons &= ~GTK_IMHTML_CUSTOM_SMILEY;
+
 		gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons);
 		if (account != NULL)
 			gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account));
============================================================
--- pidgin/gtkimhtml.c	fe616b64b959852518f6146bc828ed584f48649e
+++ pidgin/gtkimhtml.c	b1179768c210e928234d3ebf2b3bd41ee05d85b0
@@ -5263,6 +5263,11 @@ void gtk_imhtml_setup_entry(GtkIMHtml *i
 	if (flags & PURPLE_CONNECTION_NO_IMAGES)
 		buttons &= ~GTK_IMHTML_IMAGE;
 
+	if (flags & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)
+		buttons |= GTK_IMHTML_CUSTOM_SMILEY;
+	else
+		buttons &= ~GTK_IMHTML_CUSTOM_SMILEY;
+
 	gtk_imhtml_set_format_functions(imhtml, buttons);
 }
 
============================================================
--- pidgin/gtkimhtmltoolbar.c	6105660bae011611cdcc1c24017d9b495839b8af
+++ pidgin/gtkimhtmltoolbar.c	37b13dfe5266b9d261562199cb034b01c9704636
@@ -718,7 +718,6 @@ insert_smiley_cb(GtkWidget *smiley, GtkI
 	GtkWidget *dialog;
 	GtkWidget *smiley_table = NULL;
 	GSList *smileys, *unique_smileys = NULL;
-	GSList *custom_smileys = NULL;
 
 	if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) {
 		destroy_smiley_dialog(toolbar);
@@ -740,13 +739,17 @@ insert_smiley_cb(GtkWidget *smiley, GtkI
 		smileys = smileys->next;
 	}
 
-	custom_smileys = pidgin_smileys_get_all();
+	if (toolbar->imhtml &&
+			(gtk_imhtml_get_format_functions(GTK_IMHTML(toolbar->imhtml)) & GTK_IMHTML_CUSTOM_SMILEY)) {
+		GSList *custom_smileys = NULL;
+		custom_smileys = pidgin_smileys_get_all();
 
-	while (custom_smileys) {
-		GtkIMHtmlSmiley *smiley = custom_smileys->data;
-		unique_smileys = g_slist_append(unique_smileys, smiley);
-		
-		custom_smileys = custom_smileys->next;
+		while (custom_smileys) {
+			GtkIMHtmlSmiley *smiley = custom_smileys->data;
+			unique_smileys = g_slist_append(unique_smileys, smiley);
+
+			custom_smileys = custom_smileys->next;
+		}
 	}
 
 	dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE);


More information about the Commits mailing list