diff src/conversation.c @ 10526:55e7d72fc09a

[gaim-migrate @ 11843] maquina writes: This patch implements a custom smiley API, and it also implements custom smileys for the msn protocol. As it stands, it is not able to cache custom smileys, and is not able to redefine a custom smiley without opening a new conversation. I modified it quite a bit, and didn't test it at all, so it probably doesn't work anymore. I'm not quite done with it yet either. Also, this is just receiving custom smileys. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 18 Jan 2005 18:31:32 +0000
parents 1a97d5e88d12
children 4829abdc5c35
line wrap: on
line diff
--- a/src/conversation.c	Tue Jan 18 15:36:39 2005 +0000
+++ b/src/conversation.c	Tue Jan 18 18:31:32 2005 +0000
@@ -1755,6 +1755,51 @@
 	common_send(gaim_conv_im_get_conversation(im), message);
 }
 
+gboolean
+gaim_conv_custom_smiley_add(GaimConversation *conv, const char *smile,
+                            const char *cksum_type, const char *chksum)
+{
+	if (conv == NULL || 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 (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_add !=NULL) {
+		return conv->ui_ops->custom_smiley_add(conv, smile);
+	} else {
+		gaim_debug_info("conversation", "Could not find add custom smiley function");
+		return FALSE;
+	}
+
+}
+
+void
+gaim_conv_custom_smiley_write(GaimConversation *conv, const char *smile,
+                                   const char * data, gint64 size)
+{
+	g_return_if_fail(conv != NULL);
+	g_return_if_fail(smile != NULL && *smile);
+
+	if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_write != NULL)
+		conv->ui_ops->custom_smiley_write(conv, smile, data, size);
+	else
+		gaim_debug_info("conversation", "Could not find the smiley write function");
+}
+
+void
+gaim_conv_custom_smiley_close(GaimConversation *conv, const char *smile)
+{
+	g_return_if_fail(conv != NULL);
+	g_return_if_fail(smile != NULL && *smile);
+
+	if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_close != NULL)
+		conv->ui_ops->custom_smiley_close(conv, smile);
+	else
+		gaim_debug_info("conversation", "Could not find custom smiley close function");
+}
+
+
 /**************************************************************************
  * Chat Conversation API
  **************************************************************************/