/dev/tomkiewicz/new-smileys: e5fb5dd15044: Smileys: MSN: reimple...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Fri Apr 4 20:40:07 EDT 2014
Changeset: e5fb5dd15044e7bcc70707e1ca297c65c0e641d2
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-04-05 02:40 +0200
Branch: default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/e5fb5dd15044
Description:
Smileys: MSN: reimplement find_valid_emoticon for better (new) API usage
diffstat:
libpurple/protocols/msn/slpcall.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diffs (50 lines):
diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c
--- a/libpurple/protocols/msn/slpcall.c
+++ b/libpurple/protocols/msn/slpcall.c
@@ -232,33 +232,35 @@ get_token(const char *str, const char *s
/* XXX: this could be improved if we tracked custom smileys
* per-protocol, per-account, per-session or (ideally) per-conversation
+ *
+ * Note: it should be tracked on the msn prpl side.
*/
static PurpleStoredImage *
find_valid_emoticon(PurpleAccount *account, const char *path)
{
- GList *smileys;
+ GList *smileys, *it;
if (!purple_account_get_bool(account, "custom_smileys", TRUE))
return NULL;
- smileys = purple_smiley_list_get_all(purple_smiley_custom_get_list());
+ smileys = purple_smiley_list_get_unique(
+ purple_smiley_custom_get_list());
- // TODO: rewrite it with XXX
-
- for (; smileys; smileys = g_list_delete_link(smileys, smileys)) {
- PurpleSmiley *smiley;
- PurpleStoredImage *img;
-
- smiley = smileys->data;
- img = purple_smiley_get_image(smiley);
+ for (it = smileys; it; it = g_list_next(it)) {
+ PurpleSmiley *smiley = it->data;
if (g_strcmp0(path, purple_smiley_get_path(smiley)) == 0) {
+ PurpleStoredImage *img;
+
g_list_free(smileys);
+ img = purple_smiley_get_image(smiley);
purple_imgstore_ref(img);
return img;
}
}
+ g_list_free(smileys);
- purple_debug_error("msn", "Received illegal request for file %s\n", path);
+ purple_debug_error("msn", "Received illegal request for file %s", path);
+
return NULL;
}
More information about the Commits
mailing list