--- a/libpurple/conversation.c Fri Apr 04 11:29:55 2014 +0200 +++ b/libpurple/conversation.c Fri Apr 04 12:15:37 2014 +0200 @@ -34,6 +34,7 @@ #include "prpl.h" #include "request.h" #include "signals.h" +#include "smiley-list.h" #include "util.h" #define PURPLE_CONVERSATION_GET_PRIVATE(obj) \ @@ -60,6 +61,11 @@ PurpleConversationMessage's */ PurpleE2eeState *e2ee_state; /* End-to-end encryption state. */ + + /* The list of remote smileys. This should be per-buddy (PurpleBuddy), + * but we don't have any class for people not on our buddy + * list (PurpleDude?). So, if we have one, we should switch to it. */ + PurpleSmileyList *remote_smileys; }; /* @@ -989,6 +995,42 @@ return prpl_info->get_max_message_size(conv); } +PurpleRemoteSmiley * +purple_conversation_add_remote_smiley(PurpleConversation *conv, + const gchar *shortcut) +{ + PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv); + PurpleSmiley *smiley; + + g_return_val_if_fail(priv != NULL, NULL); + g_return_val_if_fail(shortcut != NULL, NULL); + g_return_val_if_fail(shortcut[0] != '\0', NULL); + + if (priv->remote_smileys == NULL) + priv->remote_smileys = purple_smiley_list_new(); + + smiley = purple_smiley_list_get_by_shortcut( + priv->remote_smileys, shortcut); + if (!PURPLE_IS_REMOTE_SMILEY(smiley)) { + purple_debug_warning("conversation", "Invalid type of smiley " + "stored in remote smileys list"); + return NULL; + } + + return PURPLE_REMOTE_SMILEY(smiley); +} + +PurpleSmileyList * +purple_conversation_get_remote_smileys(PurpleConversation *conv) +{ + PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv); + + g_return_val_if_fail(priv != NULL, NULL); + + return priv->remote_smileys; +} + + /************************************************************************** * GObject code **************************************************************************/