Mercurial > pidgin
diff libpurple/protocols/myspace/myspace.c @ 20982:aee8d876fed1
When getting info on a myspace user not on the buddy list, a temporary
PurpleBuddy is needed so that the data can be associated properly. This
fixes a bug wherein the profile link went to http://myspace.com/0 for all
buddies not on the list. A check against that uid being 0 has also been added
to avoid displaying junk data.
Such temporary MsimUser objects (note that the temporariness of MsimUser
objects is unchanged; a temporary PurpleBuddy has just been added to go with
it) are destroyed before a delayed callback can be triggerred. This means that
we can not request a buddy icon on that object, because we will end up with
a pointer to freed data in the callback some time in the future. This fixes
a crash when getting info on a non-buddy list buddy (which for reasons I can't
pinpoint was most likely if the username contained capital letters).
A reference counting system for MsimUser objects would fix this but is a
significantly more complex solution.
| author | Evan Schoenberg <evan.s@dreskin.net> |
|---|---|
| date | Thu, 18 Oct 2007 12:01:41 +0000 |
| parents | 9c2ec10933b2 |
| children | ec3736fe2e4e |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Thu Oct 18 07:49:20 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Thu Oct 18 12:01:41 2007 +0000 @@ -935,7 +935,6 @@ gchar *username; PurpleNotifyUserInfo *user_info; MsimUser *user; - gboolean temporary_user; g_return_if_fail(MSIM_SESSION_VALID(session)); @@ -957,10 +956,14 @@ if (!user) { /* User isn't on blist, create a temporary user to store info. */ - temporary_user = TRUE; + PurpleBuddy *buddy; + user = g_new0(MsimUser, 1); - } else { - temporary_user = FALSE; + user->temporary_user = TRUE; + + buddy = purple_buddy_new(session->account, username, NULL); + user->buddy = buddy; + buddy->proto_data = (gpointer)user; } /* Update user structure with new information */ @@ -976,7 +979,8 @@ purple_notify_user_info_destroy(user_info); - if (temporary_user) { + if (user->temporary_user) { + purple_blist_remove_buddy(user->buddy); g_free(user->client_info); g_free(user->gender); g_free(user->location); @@ -1452,7 +1456,7 @@ purple_debug_info("msim", "data=%s\n", data->str ? data->str : "(NULL)"); - /* url_text is variable=data\n... */ + /* url_text is variable=data\n...†*/ /* Check FILEVER, 1.0.716.0. 716 is build, MSIM_CLIENT_VERSION */ /* New (english) version can be downloaded from SETUPURL+SETUPFILE */
