/soc/2015/jgeboski/facebook: 36e822e078c8: facebook: only set bu...
James Geboski
jgeboski at gmail.com
Sat Jun 6 02:19:51 EDT 2015
Changeset: 36e822e078c861ec56b03343b39ceb0a0fac98fb
Author: James Geboski <jgeboski at gmail.com>
Date: 2015-06-05 22:38 -0400
Branch: facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/36e822e078c8
Description:
facebook: only set buddy icons, not account icons
diffstat:
libpurple/protocols/facebook/facebook.c | 43 +++++++++++++-------------------
1 files changed, 18 insertions(+), 25 deletions(-)
diffs (88 lines):
diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c
--- a/libpurple/protocols/facebook/facebook.c
+++ b/libpurple/protocols/facebook/facebook.c
@@ -166,17 +166,18 @@ static void
fb_cb_icon_fetch(PurpleHttpConnection *con, PurpleHttpResponse *res,
gpointer data)
{
+ const gchar *name;
const gchar *str;
- const gchar *name = data;
FbApi *api;
GError *err;
gsize size;
guchar *idata;
PurpleAccount *acct;
+ PurpleBuddy *bdy = data;
PurpleConnection *gc;
- gc = purple_http_conn_get_purple_connection(con);
- acct = purple_connection_get_account(gc);
+ acct = purple_buddy_get_account(bdy);
+ gc = purple_account_get_connection(acct);
api = purple_connection_get_protocol_data(gc);
if (!fb_http_error_chk(res, &err)) {
@@ -185,14 +186,10 @@ fb_cb_icon_fetch(PurpleHttpConnection *c
return;
}
+ name = purple_buddy_get_name(bdy);
str = purple_http_response_get_data(res, &size);
+
idata = g_memdup(str, size);
-
- if (G_UNLIKELY(name == NULL)) {
- purple_buddy_icons_set_account_icon(acct, idata, size);
- return;
- }
-
purple_buddy_icons_set_for_user(acct, name, idata, size, NULL);
}
@@ -200,7 +197,6 @@ static void
fb_cb_api_contacts(FbApi *api, GSList *users, gpointer data)
{
const gchar *alias;
- const gchar *name;
FbApiUser *user;
FbId muid;
gchar uid[FB_ID_STRMAX];
@@ -225,25 +221,22 @@ fb_cb_api_contacts(FbApi *api, GSList *u
FB_ID_TO_STR(user->uid, uid);
if (G_UNLIKELY(user->uid == muid)) {
- if (G_UNLIKELY(alias == NULL)) {
- purple_account_set_private_alias(acct,
- user->name);
+ if (G_UNLIKELY(alias != NULL)) {
+ continue;
}
- name = NULL;
- } else {
- bdy = purple_blist_find_buddy(acct, uid);
-
- if (bdy == NULL) {
- bdy = purple_buddy_new(acct, uid, user->name);
- purple_blist_add_buddy(bdy, NULL, grp, NULL);
- }
-
- name = purple_buddy_get_name(bdy);
+ purple_account_set_private_alias(acct, user->name);
+ continue;
}
- purple_http_get(gc, fb_cb_icon_fetch, (gchar *) name,
- user->icon);
+ bdy = purple_blist_find_buddy(acct, uid);
+
+ if (bdy == NULL) {
+ bdy = purple_buddy_new(acct, uid, user->name);
+ purple_blist_add_buddy(bdy, NULL, grp, NULL);
+ }
+
+ purple_http_get(gc, fb_cb_icon_fetch, bdy, user->icon);
}
purple_connection_update_progress(gc, _("Connecting"), 3, 4);
More information about the Commits
mailing list