summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@pidgin.im>2008-05-07 18:13:14 +0000
committerSadrul Habib Chowdhury <sadrul@pidgin.im>2008-05-07 18:13:14 +0000
commit8b3d66ec9768be0fc8ebc4fe423abd4d935e4fc3 (patch)
treedb18e2aa46a1ded05172844bdf8b9b38611bca4c
parentb3fefc8271ef3b157e7b0c3bed244cb7780ca14b (diff)
downloadpidgin-8b3d66ec9768be0fc8ebc4fe423abd4d935e4fc3.tar.gz
Show the custom smileys only on accounts that support it. References
#1187.
-rw-r--r--libpurple/connection.h1
-rw-r--r--libpurple/protocols/msn/msn.c3
-rw-r--r--libpurple/protocols/msnp9/msn.c3
-rw-r--r--pidgin/gtkconv.c5
-rw-r--r--pidgin/gtkimhtml.c5
-rw-r--r--pidgin/gtkimhtmltoolbar.c17
6 files changed, 25 insertions, 9 deletions
diff --git a/libpurple/connection.h b/libpurple/connection.h
index 59585d4f4f..6d237169ff 100644
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -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;
diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c
index 28db369d09..8af7d7da64 100644
--- a/libpurple/protocols/msn/msn.c
+++ b/libpurple/protocols/msn/msn.c
@@ -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);
diff --git a/libpurple/protocols/msnp9/msn.c b/libpurple/protocols/msnp9/msn.c
index 8105a7ac54..3fec2aad34 100644
--- a/libpurple/protocols/msnp9/msn.c
+++ b/libpurple/protocols/msnp9/msn.c
@@ -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);
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
index 2c71b7edbf..3ac8b8a96e 100644
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -6375,6 +6375,11 @@ gray_stuff_out(PidginConversation *gtkconv)
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 --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c
index 52be600eee..e5f2d78069 100644
--- a/pidgin/gtkimhtml.c
+++ b/pidgin/gtkimhtml.c
@@ -5263,6 +5263,11 @@ void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags)
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 --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c
index 9c58c7bad5..e469448490 100644
--- a/pidgin/gtkimhtmltoolbar.c
+++ b/pidgin/gtkimhtmltoolbar.c
@@ -718,7 +718,6 @@ insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar)
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, GtkIMHtmlToolbar *toolbar)
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);