# HG changeset patch # User Mark Doliner # Date 1229053596 0 # Node ID 1af3baa61c9f4e32b1d228adee9f023a3cf2ae9a # Parent 8f757b2139d211a67fa73c5fc657bf598efa4b76 Don't create a temporary PurpleBuddy when getting info for someone not on your buddy list. This breaks two things: * No more "View web profile" link when viewing info for people not in your buddy list. * No song or band info when viewing info for people not in your buddy list But I think it's for the best. We could always implement those features slightly differently and add the functionality back. diff -r 8f757b2139d2 -r 1af3baa61c9f libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Thu Dec 11 07:17:32 2008 +0000 +++ b/libpurple/protocols/myspace/myspace.c Fri Dec 12 03:46:36 2008 +0000 @@ -980,15 +980,8 @@ if (!user) { /* User isn't on blist, create a temporary user to store info. */ - /* TODO: is this legit, or is it somehow responsible for #3444? */ - PurpleBuddy *buddy; - user = g_new0(MsimUser, 1); 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 */ @@ -1005,7 +998,6 @@ purple_notify_user_info_destroy(user_info); if (user->temporary_user) { - purple_blist_remove_buddy(user->buddy); g_free(user->client_info); g_free(user->gender); g_free(user->location); diff -r 8f757b2139d2 -r 1af3baa61c9f libpurple/protocols/myspace/user.c --- a/libpurple/protocols/myspace/user.c Thu Dec 11 07:17:32 2008 +0000 +++ b/libpurple/protocols/myspace/user.c Fri Dec 12 03:46:36 2008 +0000 @@ -105,8 +105,6 @@ purple_notify_user_info_add_pair(user_info, _("User"), user->username); } - uid = purple_blist_node_get_int(&user->buddy->node, "UserID"); - /* a/s/l...the vitals */ if (user->age) { char age[16]; @@ -127,21 +125,23 @@ purple_notify_user_info_add_pair(user_info, _("Headline"), user->headline); } - presence = purple_buddy_get_presence(user->buddy); + if (user->buddy != NULL) { + presence = purple_buddy_get_presence(user->buddy); + + if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { + PurpleStatus *status; + const char *artist, *title; - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *status; - const char *artist, *title; - - status = purple_presence_get_status(presence, "tune"); - title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); + status = purple_presence_get_status(presence, "tune"); + title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); + artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - str = msim_format_now_playing(artist, title); - if (str && *str) { - purple_notify_user_info_add_pair(user_info, _("Song"), str); + str = msim_format_now_playing(artist, title); + if (str && *str) { + purple_notify_user_info_add_pair(user_info, _("Song"), str); + } + g_free(str); } - g_free(str); } /* Note: total friends only available if looked up by uid, not username. */ @@ -170,6 +170,7 @@ g_free(client); } + uid = user->buddy ? purple_blist_node_get_int(&user->buddy->node, "UserID") : 0; if (full && uid) { /* TODO: link to username, if available */ char *profile; @@ -199,12 +200,16 @@ PurplePresence *presence; const char *prev_artist, *prev_title; + if (user->buddy == NULL) + /* User not on buddy list so nothing to do */ + return; + prev_artist = NULL; prev_title = NULL; - if (new_artist && !strlen(new_artist)) + if (new_artist && !*new_artist) new_artist = NULL; - if (new_title && !strlen(new_title)) + if (new_title && !*new_title) new_title = NULL; if (!new_artist && !new_title) {