# HG changeset patch # User Sadrul Habib Chowdhury # Date 1210183994 0 # Node ID 9aa105267f465241939b1fda87e421b29ba14415 # Parent 9c0a47402f7a14fbf1921fdfffa36166d27a8ede Show the custom smileys only on accounts that support it. References #1187. diff -r 9c0a47402f7a -r 9aa105267f46 libpurple/connection.h --- a/libpurple/connection.h Wed May 07 04:05:19 2008 +0000 +++ b/libpurple/connection.h Wed May 07 18:13:14 2008 +0000 @@ -43,6 +43,7 @@ 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; diff -r 9c0a47402f7a -r 9aa105267f46 libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Wed May 07 04:05:19 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Wed May 07 18:13:14 2008 +0000 @@ -892,7 +892,8 @@ 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); diff -r 9c0a47402f7a -r 9aa105267f46 libpurple/protocols/msnp9/msn.c --- a/libpurple/protocols/msnp9/msn.c Wed May 07 04:05:19 2008 +0000 +++ b/libpurple/protocols/msnp9/msn.c Wed May 07 18:13:14 2008 +0000 @@ -763,7 +763,8 @@ 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); diff -r 9c0a47402f7a -r 9aa105267f46 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Wed May 07 04:05:19 2008 +0000 +++ b/pidgin/gtkconv.c Wed May 07 18:13:14 2008 +0000 @@ -6375,6 +6375,11 @@ 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)); diff -r 9c0a47402f7a -r 9aa105267f46 pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Wed May 07 04:05:19 2008 +0000 +++ b/pidgin/gtkimhtml.c Wed May 07 18:13:14 2008 +0000 @@ -5263,6 +5263,11 @@ 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); } diff -r 9c0a47402f7a -r 9aa105267f46 pidgin/gtkimhtmltoolbar.c --- a/pidgin/gtkimhtmltoolbar.c Wed May 07 04:05:19 2008 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Wed May 07 18:13:14 2008 +0000 @@ -718,7 +718,6 @@ 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 @@ 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);