Mercurial > pidgin.yaz
comparison libpurple/protocols/myspace/user.c @ 24631:1af3baa61c9f
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.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 12 Dec 2008 03:46:36 +0000 |
parents | 9fc3f5bf4455 |
children | 128a77f3b3c4 |
comparison
equal
deleted
inserted
replaced
24630:8f757b2139d2 | 24631:1af3baa61c9f |
---|---|
103 * Other prpls show this. */ | 103 * Other prpls show this. */ |
104 if (user->username) { | 104 if (user->username) { |
105 purple_notify_user_info_add_pair(user_info, _("User"), user->username); | 105 purple_notify_user_info_add_pair(user_info, _("User"), user->username); |
106 } | 106 } |
107 | 107 |
108 uid = purple_blist_node_get_int(&user->buddy->node, "UserID"); | |
109 | |
110 /* a/s/l...the vitals */ | 108 /* a/s/l...the vitals */ |
111 if (user->age) { | 109 if (user->age) { |
112 char age[16]; | 110 char age[16]; |
113 g_snprintf(age, sizeof(age), "%d", user->age); | 111 g_snprintf(age, sizeof(age), "%d", user->age); |
114 purple_notify_user_info_add_pair(user_info, _("Age"), age); | 112 purple_notify_user_info_add_pair(user_info, _("Age"), age); |
125 /* Other information */ | 123 /* Other information */ |
126 if (user->headline && *user->headline) { | 124 if (user->headline && *user->headline) { |
127 purple_notify_user_info_add_pair(user_info, _("Headline"), user->headline); | 125 purple_notify_user_info_add_pair(user_info, _("Headline"), user->headline); |
128 } | 126 } |
129 | 127 |
130 presence = purple_buddy_get_presence(user->buddy); | 128 if (user->buddy != NULL) { |
131 | 129 presence = purple_buddy_get_presence(user->buddy); |
132 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { | 130 |
133 PurpleStatus *status; | 131 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { |
134 const char *artist, *title; | 132 PurpleStatus *status; |
135 | 133 const char *artist, *title; |
136 status = purple_presence_get_status(presence, "tune"); | 134 |
137 title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); | 135 status = purple_presence_get_status(presence, "tune"); |
138 artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); | 136 title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); |
139 | 137 artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); |
140 str = msim_format_now_playing(artist, title); | 138 |
141 if (str && *str) { | 139 str = msim_format_now_playing(artist, title); |
142 purple_notify_user_info_add_pair(user_info, _("Song"), str); | 140 if (str && *str) { |
143 } | 141 purple_notify_user_info_add_pair(user_info, _("Song"), str); |
144 g_free(str); | 142 } |
143 g_free(str); | |
144 } | |
145 } | 145 } |
146 | 146 |
147 /* Note: total friends only available if looked up by uid, not username. */ | 147 /* Note: total friends only available if looked up by uid, not username. */ |
148 if (user->total_friends) { | 148 if (user->total_friends) { |
149 char friends[16]; | 149 char friends[16]; |
168 if (client && *client) | 168 if (client && *client) |
169 purple_notify_user_info_add_pair(user_info, _("Client Version"), client); | 169 purple_notify_user_info_add_pair(user_info, _("Client Version"), client); |
170 g_free(client); | 170 g_free(client); |
171 } | 171 } |
172 | 172 |
173 uid = user->buddy ? purple_blist_node_get_int(&user->buddy->node, "UserID") : 0; | |
173 if (full && uid) { | 174 if (full && uid) { |
174 /* TODO: link to username, if available */ | 175 /* TODO: link to username, if available */ |
175 char *profile; | 176 char *profile; |
176 purple_notify_user_info_add_section_break(user_info); | 177 purple_notify_user_info_add_section_break(user_info); |
177 profile = g_strdup_printf("<a href=\"http://myspace.com/%d\">%s</a>", | 178 profile = g_strdup_printf("<a href=\"http://myspace.com/%d\">%s</a>", |
197 static void msim_set_artist_or_title(MsimUser *user, const char *new_artist, const char *new_title) | 198 static void msim_set_artist_or_title(MsimUser *user, const char *new_artist, const char *new_title) |
198 { | 199 { |
199 PurplePresence *presence; | 200 PurplePresence *presence; |
200 const char *prev_artist, *prev_title; | 201 const char *prev_artist, *prev_title; |
201 | 202 |
203 if (user->buddy == NULL) | |
204 /* User not on buddy list so nothing to do */ | |
205 return; | |
206 | |
202 prev_artist = NULL; | 207 prev_artist = NULL; |
203 prev_title = NULL; | 208 prev_title = NULL; |
204 | 209 |
205 if (new_artist && !strlen(new_artist)) | 210 if (new_artist && !*new_artist) |
206 new_artist = NULL; | 211 new_artist = NULL; |
207 if (new_title && !strlen(new_title)) | 212 if (new_title && !*new_title) |
208 new_title = NULL; | 213 new_title = NULL; |
209 | 214 |
210 if (!new_artist && !new_title) { | 215 if (!new_artist && !new_title) { |
211 purple_prpl_got_user_status_deactive(user->buddy->account, user->buddy->name, "tune"); | 216 purple_prpl_got_user_status_deactive(user->buddy->account, user->buddy->name, "tune"); |
212 return; | 217 return; |