Fri, 04 Apr 2014 12:34:47 +0200
Remote smileys: rip off old implementation
--- a/finch/gntconv.c Fri Apr 04 12:15:37 2014 +0200 +++ b/finch/gntconv.c Fri Apr 04 12:34:47 2014 +0200 @@ -1199,9 +1199,6 @@ finch_chat_update_user, finch_conv_present, /* present */ finch_conv_has_focus, /* has_focus */ - NULL, /* custom_smiley_add */ - NULL, /* custom_smiley_write */ - NULL, /* custom_smiley_close */ NULL, /* send_confirm */ NULL, NULL,
--- a/libpurple/conversation.c Fri Apr 04 12:15:37 2014 +0200 +++ b/libpurple/conversation.c Fri Apr 04 12:34:47 2014 +0200 @@ -792,59 +792,6 @@ G_CALLBACK(purple_conversation_send_confirm_cb), _("Cancel"), NULL); } -gboolean -purple_conversation_custom_smiley_add(PurpleConversation *conv, const char *smile, - const char *cksum_type, const char *chksum, - gboolean remote) -{ - PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv); - - g_return_val_if_fail(priv != NULL, FALSE); - - if (smile == NULL || !*smile) { - return FALSE; - } - - /* TODO: check if the icon is in the cache and return false if so */ - /* TODO: add an icon cache (that doesn't suck) */ - if (priv->ui_ops != NULL && priv->ui_ops->custom_smiley_add !=NULL) { - return priv->ui_ops->custom_smiley_add(conv, smile, remote); - } else { - purple_debug_info("conversation", "Could not find add custom smiley function"); - return FALSE; - } - -} - -void -purple_conversation_custom_smiley_write(PurpleConversation *conv, const char *smile, - const guchar *data, gsize size) -{ - PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv); - - g_return_if_fail(priv != NULL); - g_return_if_fail(smile != NULL && *smile); - - if (priv->ui_ops != NULL && priv->ui_ops->custom_smiley_write != NULL) - priv->ui_ops->custom_smiley_write(conv, smile, data, size); - else - purple_debug_info("conversation", "Could not find the smiley write function"); -} - -void -purple_conversation_custom_smiley_close(PurpleConversation *conv, const char *smile) -{ - PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv); - - g_return_if_fail(priv != NULL); - g_return_if_fail(smile != NULL && *smile); - - if (priv->ui_ops != NULL && priv->ui_ops->custom_smiley_close != NULL) - priv->ui_ops->custom_smiley_close(conv, smile); - else - purple_debug_info("conversation", "Could not find custom smiley close function"); -} - GList * purple_conversation_get_extended_menu(PurpleConversation *conv) {
--- a/libpurple/conversation.h Fri Apr 04 12:15:37 2014 +0200 +++ b/libpurple/conversation.h Fri Apr 04 12:34:47 2014 +0200 @@ -238,9 +238,6 @@ * @has_focus: If this UI has a concept of focus (as in a windowing system) and * this conversation has the focus, return %TRUE; otherwise, return * %FALSE. - * @custom_smiley_add: Add a custom smiley - * @custom_smiley_write: Write a custom smiley - * @custom_smiley_close: Close a custom smiley * @send_confirm: Prompt the user for confirmation to send @message. This * function should arrange for the message to be sent if the user * accepts. If this field is %NULL, libpurple will fall back to @@ -285,12 +282,6 @@ void (*present)(PurpleConversation *conv); gboolean (*has_focus)(PurpleConversation *conv); - gboolean (*custom_smiley_add)(PurpleConversation *conv, const char *smile, - gboolean remote); - void (*custom_smiley_write)(PurpleConversation *conv, const char *smile, - const guchar *data, gsize size); - void (*custom_smiley_close)(PurpleConversation *conv, const char *smile); - void (*send_confirm)(PurpleConversation *conv, const char *message); /*< private >*/ @@ -645,58 +636,6 @@ void purple_conversation_send_confirm(PurpleConversation *conv, const char *message); /** - * purple_conversation_custom_smiley_add: - * @conv: The conversation to associate the smiley with. - * @smile: The text associated with the smiley - * @cksum_type: The type of checksum. - * @chksum: The checksum, as a NUL terminated base64 string. - * @remote: %TRUE if the custom smiley is set by the remote user (buddy). - * - * Adds a smiley to the conversation's smiley tree. If this returns - * %TRUE you should call purple_conversation_custom_smiley_write() one or more - * times, and then purple_conversation_custom_smiley_close(). If this returns - * %FALSE, either the conv or smile were invalid, or the icon was - * found in the cache. In either case, calling write or close would - * be an error. - * - * Returns: %TRUE if an icon is expected, else FALSE. Note that - * it is an error to never call purple_conversation_custom_smiley_close if - * this function returns %TRUE, but an error to call it if - * %FALSE is returned. - */ - -gboolean purple_conversation_custom_smiley_add(PurpleConversation *conv, const char *smile, - const char *cksum_type, const char *chksum, - gboolean remote); - -/** - * purple_conversation_custom_smiley_write: - * @conv: The conversation associated with the smiley. - * @smile: The text associated with the smiley. - * @data: The actual image data. - * @size: The length of the data. - * - * Updates the image associated with the current smiley. - */ - -void purple_conversation_custom_smiley_write(PurpleConversation *conv, - const char *smile, - const guchar *data, - gsize size); - -/** - * purple_conversation_custom_smiley_close: - * @conv: The purple conversation associated with the smiley. - * @smile: The text associated with the smiley - * - * Close the custom smiley, all data has been written with - * purple_conversation_custom_smiley_write, and it is no longer valid - * to call that function on that smiley. - */ - -void purple_conversation_custom_smiley_close(PurpleConversation *conv, const char *smile); - -/** * purple_conversation_get_extended_menu: * @conv: The conversation. *
--- a/libpurple/example/nullclient.c Fri Apr 04 12:15:37 2014 +0200 +++ b/libpurple/example/nullclient.c Fri Apr 04 12:34:47 2014 +0200 @@ -144,9 +144,6 @@ NULL, /* chat_update_user */ NULL, /* present */ NULL, /* has_focus */ - NULL, /* custom_smiley_add */ - NULL, /* custom_smiley_write */ - NULL, /* custom_smiley_close */ NULL, /* send_confirm */ NULL, NULL,
--- a/libpurple/protocols/jabber/message.c Fri Apr 04 12:15:37 2014 +0200 +++ b/libpurple/protocols/jabber/message.c Fri Apr 04 12:34:47 2014 +0200 @@ -482,6 +482,7 @@ } } +#if 0 static void jabber_message_request_data_cb(JabberData *data, gchar *alt, gpointer userdata) @@ -497,6 +498,7 @@ g_free(alt); } +#endif void jabber_message_parse(JabberStream *js, PurpleXmlNode *packet) { @@ -659,6 +661,7 @@ purple_debug_info("jabber", "about to add custom smiley %s to the conv\n", alt); +#if 0 if (purple_conversation_custom_smiley_add(conv, alt, "cid", cid, TRUE)) { const JabberData *data = @@ -679,6 +682,7 @@ jabber_message_request_data_cb, conv); } } +#endif g_free(ref->cid); g_free(ref->alt); g_free(ref);
--- a/libpurple/protocols/msn/msg.c Fri Apr 04 12:15:37 2014 +0200 +++ b/libpurple/protocols/msn/msg.c Fri Apr 04 12:34:47 2014 +0200 @@ -896,6 +896,7 @@ purple_debug_warning("msn", "P2P message failed to parse.\n"); } +#if 0 static void got_emoticon(MsnSlpCall *slpcall, const guchar *data, gsize size) @@ -917,6 +918,7 @@ if (purple_debug_is_verbose()) purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); } +#endif void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) { @@ -989,9 +991,11 @@ conv = PURPLE_CONVERSATION(purple_im_conversation_new(session->account, who)); } +#if 0 if (purple_conversation_custom_smiley_add(conv, smile, "sha1", sha1, TRUE)) { msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); } +#endif msn_object_destroy(obj, FALSE); obj = NULL;
--- a/pidgin/gtkconv.c Fri Apr 04 12:15:37 2014 +0200 +++ b/pidgin/gtkconv.c Fri Apr 04 12:34:47 2014 +0200 @@ -7235,10 +7235,10 @@ } #endif +#if 0 static gboolean pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gboolean remote) { -#if 0 PidginConversation *gtkconv; struct PidginSmileyList *list; const char *sml = NULL, *conv_sml; @@ -7270,16 +7270,16 @@ if (!add_custom_smiley_for_webview(PIDGIN_WEBVIEW(gtkconv->entry), sml, smile)) return FALSE; + return TRUE; +} #endif - return TRUE; -} - + +#if 0 static void pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, const guchar *data, gsize size) { /* TODO WEBKIT */ -#if 0 PidginConversation *gtkconv; GtkIMHtmlSmiley *smiley; const char *sml; @@ -7314,14 +7314,14 @@ g_object_unref(G_OBJECT(smiley->loader)); smiley->loader = gdk_pixbuf_loader_new(); } -#endif /* if 0 */ -} - +} +#endif + +#if 0 static void pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) { /* TODO WEBKIT */ -#if 0 PidginConversation *gtkconv; GtkIMHtmlSmiley *smiley; const char *sml; @@ -7358,8 +7358,8 @@ g_object_unref(G_OBJECT(smiley->loader)); smiley->loader = gdk_pixbuf_loader_new(); } -#endif /* if 0 */ -} +} +#endif static void pidgin_conv_send_confirm(PurpleConversation *conv, const char *message) @@ -7854,9 +7854,6 @@ pidgin_conv_chat_update_user, /* chat_update_user */ pidgin_conv_present_conversation, /* present */ pidgin_conv_has_focus, /* has_focus */ - pidgin_conv_custom_smiley_add, /* custom_smiley_add */ - pidgin_conv_custom_smiley_write, /* custom_smiley_write */ - pidgin_conv_custom_smiley_close, /* custom_smiley_close */ pidgin_conv_send_confirm, /* send_confirm */ NULL, NULL,