/dev/tomkiewicz/new-smileys: 9ca5f50773f5: Remote smileys: rip o...

Tomasz Wasilczyk twasilczyk at pidgin.im
Fri Apr 4 06:34:56 EDT 2014


Changeset: 9ca5f50773f5629d7c50ed06ee905f385be69949
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-04 12:34 +0200
Branch:	 default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/9ca5f50773f5

Description:

Remote smileys: rip off old implementation

diffstat:

 finch/gntconv.c                      |   3 -
 libpurple/conversation.c             |  53 -------------------------------
 libpurple/conversation.h             |  61 ------------------------------------
 libpurple/example/nullclient.c       |   3 -
 libpurple/protocols/jabber/message.c |   4 ++
 libpurple/protocols/msn/msg.c        |   4 ++
 pidgin/gtkconv.c                     |  25 ++++++--------
 7 files changed, 19 insertions(+), 134 deletions(-)

diffs (truncated from 316 to 300 lines):

diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -1199,9 +1199,6 @@ static PurpleConversationUiOps conv_ui_o
 	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,
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -792,59 +792,6 @@ purple_conversation_send_confirm(PurpleC
 		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)
 {
diff --git a/libpurple/conversation.h b/libpurple/conversation.h
--- a/libpurple/conversation.h
+++ b/libpurple/conversation.h
@@ -238,9 +238,6 @@ struct _PurpleConversationClass {
  * @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 @@ struct _PurpleConversationUiOps
 	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 @@ gpointer purple_conversation_get_ui_data
 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.
  *
diff --git a/libpurple/example/nullclient.c b/libpurple/example/nullclient.c
--- a/libpurple/example/nullclient.c
+++ b/libpurple/example/nullclient.c
@@ -144,9 +144,6 @@ static PurpleConversationUiOps null_conv
 	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,
diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c
--- a/libpurple/protocols/jabber/message.c
+++ b/libpurple/protocols/jabber/message.c
@@ -482,6 +482,7 @@ jabber_message_add_remote_smileys(Jabber
 	}
 }
 
+#if 0
 static void
 jabber_message_request_data_cb(JabberData *data, gchar *alt,
     gpointer userdata)
@@ -497,6 +498,7 @@ jabber_message_request_data_cb(JabberDat
 
 	g_free(alt);
 }
+#endif
 
 void jabber_message_parse(JabberStream *js, PurpleXmlNode *packet)
 {
@@ -659,6 +661,7 @@ void jabber_message_parse(JabberStream *
 
 					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 @@ void jabber_message_parse(JabberStream *
 							    jabber_message_request_data_cb, conv);
 						}
 					}
+#endif
 					g_free(ref->cid);
 					g_free(ref->alt);
 					g_free(ref);
diff --git a/libpurple/protocols/msn/msg.c b/libpurple/protocols/msn/msg.c
--- a/libpurple/protocols/msn/msg.c
+++ b/libpurple/protocols/msn/msg.c
@@ -896,6 +896,7 @@ msn_p2p_msg(MsnCmdProc *cmdproc, MsnMess
 		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 @@ got_emoticon(MsnSlpCall *slpcall,
 	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 @@ void msn_emoticon_msg(MsnCmdProc *cmdpro
 			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;
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -7235,10 +7235,10 @@ add_custom_smiley_for_webview(PidginWebV
 }
 #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 @@ pidgin_conv_custom_smiley_add(PurpleConv
 		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 @@ pidgin_conv_custom_smiley_write(PurpleCo
 		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 @@ pidgin_conv_custom_smiley_close(PurpleCo
 		g_object_unref(G_OBJECT(smiley->loader));
 		smiley->loader = gdk_pixbuf_loader_new();
 	}
-#endif /* if 0 */



More information about the Commits mailing list