Mercurial > pidgin
diff libpurple/protocols/myspace/user.c @ 24684:128a77f3b3c4
Keep track of the user ID in the MsimUser struct so that we have a copy
even for people who aren't in our buddy list. This fixes the "View web
profile" link when getting info for people not in our buddy list.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 12 Dec 2008 04:01:39 +0000 |
parents | 1af3baa61c9f |
children | 694591875bc9 1260a3fb60f4 |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/user.c Fri Dec 12 03:46:36 2008 +0000 +++ b/libpurple/protocols/myspace/user.c Fri Dec 12 04:01:39 2008 +0000 @@ -63,6 +63,7 @@ /* TODO: where is this freed? */ user = g_new0(MsimUser, 1); user->buddy = buddy; + user->id = purple_blist_node_get_int(&buddy->node, "UserID"); buddy->proto_data = (gpointer)user; } @@ -96,7 +97,6 @@ { PurplePresence *presence; gchar *str; - guint uid; guint cv; /* Useful to identify the account the tooltip refers to. @@ -170,13 +170,12 @@ g_free(client); } - uid = user->buddy ? purple_blist_node_get_int(&user->buddy->node, "UserID") : 0; - if (full && uid) { + if (full && user->id) { /* TODO: link to username, if available */ char *profile; purple_notify_user_info_add_section_break(user_info); profile = g_strdup_printf("<a href=\"http://myspace.com/%d\">%s</a>", - uid, _("View web profile")); + user->id, _("View web profile")); purple_notify_user_info_add_pair(user_info, NULL, profile); g_free(profile); } @@ -251,10 +250,11 @@ { if (g_str_equal(key_str, "UserID") || g_str_equal(key_str, "ContactID")) { /* Save to buddy list, if it exists, for quick cached uid lookup with msim_uid2username_from_blist(). */ + user->id = atol(value_str); if (user->buddy) { purple_debug_info("msim", "associating uid %s with username %s\n", key_str, user->buddy->name); - purple_blist_node_set_int(&user->buddy->node, "UserID", atol(value_str)); + purple_blist_node_set_int(&user->buddy->node, "UserID", user->id); } /* Need to store in MsimUser, too? What if not on blist? */ } else if (g_str_equal(key_str, "Age")) {