/dev/tomkiewicz/new-smileys: 77cec2a188ee: Smileys: add PurpleCo...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Fri Apr 4 12:29:05 EDT 2014
Changeset: 77cec2a188eedbaaa9f72b4cbf53259c3ba101b7
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-04-04 18:28 +0200
Branch: default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/77cec2a188ee
Description:
Smileys: add PurpleConversation to the parser callback
diffstat:
libpurple/smiley-parser.c | 7 +++----
libpurple/smiley-parser.h | 4 +++-
pidgin/gtkconv.c | 8 ++------
3 files changed, 8 insertions(+), 11 deletions(-)
diffs (77 lines):
diff --git a/libpurple/smiley-parser.c b/libpurple/smiley-parser.c
--- a/libpurple/smiley-parser.c
+++ b/libpurple/smiley-parser.c
@@ -26,6 +26,7 @@
typedef struct
{
+ PurpleConversation *conv;
PurpleSmileyParseCb cb;
gpointer ui_data;
} PurpleSmileyParseData;
@@ -59,7 +60,7 @@ static gboolean purple_smiley_parse_cb(G
PurpleSmileyParseData *parse_data = _parse_data;
PurpleSmiley *smiley = _smiley;
- parse_data->cb(out, smiley, parse_data->ui_data);
+ parse_data->cb(out, smiley, parse_data->conv, parse_data->ui_data);
return TRUE;
}
@@ -125,9 +126,7 @@ purple_smiley_parse(PurpleConversation *
tries = &tries_theme;
}
- /* XXX: should we parse custom smileys,
- * if protocol doesn't support it? */
-
+ parse_data.conv = conv;
parse_data.cb = cb;
parse_data.ui_data = ui_data;
diff --git a/libpurple/smiley-parser.h b/libpurple/smiley-parser.h
--- a/libpurple/smiley-parser.h
+++ b/libpurple/smiley-parser.h
@@ -25,7 +25,7 @@
#include "purple.h"
typedef void (*PurpleSmileyParseCb)(GString *out, PurpleSmiley *smiley,
- gpointer ui_data);
+ PurpleConversation *conv, gpointer ui_data);
gboolean
purple_smiley_parse_escape(void);
@@ -33,6 +33,8 @@ purple_smiley_parse_escape(void);
/* XXX: this shouldn't be a conv for incoming messages - see
* PurpleConversationPrivate#remote_smileys.
* For outgoing, we could pass conv in ui_data (or something).
+ *
+ * @ui_data is passed to @cb and #purple_smiley_theme_get_smileys.
*/
gchar *
purple_smiley_parse(PurpleConversation *conv, const gchar *message,
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -6584,11 +6584,8 @@ replace_message_tokens(
static void
pidgin_conv_write_smiley(GString *out, PurpleSmiley *smiley,
- gpointer _proto_name)
-{
-#if 0
- const gchar *proto_name = _proto_name;
-#endif
+ PurpleConversation *conv, gpointer _proto_name)
+{
gchar *escaped_shortcut;
const gchar *path = purple_smiley_get_path(smiley);
@@ -6609,7 +6606,6 @@ pidgin_conv_write_smiley(GString *out, P
PURPLE_STORED_IMAGE_PROTOCOL "%d\" />",
escaped_shortcut, escaped_shortcut, imgid);
} else {
- /* TODO: remove this background, maybe put something into css file? */
g_string_append_printf(out,
"<span class=\"emoticon pending\">%s</span>",
escaped_shortcut);
More information about the Commits
mailing list