Mercurial > pidgin.yaz
diff libpurple/protocols/myspace/myspace.c @ 25378:47540809ae91
explicit merge of '82e4edbe06cb0ef0fa59f70db44a289bb91e1343'
and '8edc2ac791e936a5d9eddd85e451d25e1afa5ba6'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 02 Jan 2009 22:23:19 +0000 |
parents | 759dbafdc74a a4a17fe80160 |
children | 4e8748f3374f |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Wed Dec 17 22:37:53 2008 +0000 +++ b/libpurple/protocols/myspace/myspace.c Fri Jan 02 22:23:19 2009 +0000 @@ -202,7 +202,7 @@ /* Next, see if on buddy list and know uid. */ buddy = purple_find_buddy(session->account, username); if (buddy) { - uid = purple_blist_node_get_int(&buddy->node, "UserID"); + uid = purple_blist_node_get_int(PURPLE_BLIST_NODE(buddy), "UserID"); } else { uid = 0; } @@ -312,7 +312,7 @@ /* See finch/gnthistory.c */ buddy = cur->data; - uid = purple_blist_node_get_int(&buddy->node, "UserID"); + uid = purple_blist_node_get_int(PURPLE_BLIST_NODE(buddy), "UserID"); name = purple_buddy_get_name(buddy); if (uid == wanted_uid) @@ -384,12 +384,17 @@ MsimSession *session; MsimUser *user; const gchar *display_name, *headline; + PurpleAccount *account; + PurpleConnection *gc; g_return_val_if_fail(buddy != NULL, NULL); user = msim_get_user_from_buddy(buddy); - session = (MsimSession *)buddy->account->gc->proto_data; + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); + session = (MsimSession *)gc->proto_data; + g_return_val_if_fail(MSIM_SESSION_VALID(session), NULL); display_name = headline = NULL; @@ -436,8 +441,10 @@ if (PURPLE_BUDDY_IS_ONLINE(buddy)) { MsimSession *session; - - session = (MsimSession *)buddy->account->gc->proto_data; + PurpleAccount *account = purple_buddy_get_account(buddy); + PurpleConnection *gc = purple_account_get_connection(account); + + session = (MsimSession *)gc->proto_data; g_return_if_fail(MSIM_SESSION_VALID(session)); @@ -1030,11 +1037,11 @@ * of numbers in the buddy list. */ if (display_name != NULL) { - purple_blist_node_set_string(&buddy->node, "DisplayName", display_name); + purple_blist_node_set_string(PURPLE_BLIST_NODE(buddy), "DisplayName", display_name); serv_got_alias(session->gc, username, display_name); } else { serv_got_alias(session->gc, username, - purple_blist_node_get_string(&buddy->node, "DisplayName")); + purple_blist_node_get_string(PURPLE_BLIST_NODE(buddy), "DisplayName")); } } g_free(display_name); @@ -1044,7 +1051,7 @@ user->id = uid; /* Keep track of the user ID across sessions */ - purple_blist_node_set_int(&buddy->node, "UserID", uid); + purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "UserID", uid); /* Stores a few fields in the MsimUser, relevant to the buddy itself. * AvatarURL, Headline, ContactID. */ @@ -1370,7 +1377,7 @@ user->id = msim_msg_get_integer(msg, "f"); /* Keep track of the user ID across sessions */ - purple_blist_node_set_int(&buddy->node, "UserID", user->id); + purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "UserID", user->id); msim_store_user_info(session, msg, NULL); } else { @@ -2628,10 +2635,14 @@ MsimMessage *msg; MsimMessage *msg_persist; MsimMessage *body; + const char *name, *gname; session = (MsimSession *)gc->proto_data; + name = purple_buddy_get_name(buddy); + gname = group ? purple_group_get_name(group) : NULL; + purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", - buddy->name, (group && group->name) ? group->name : "(no group)"); + name, gname ? gname : "(no group)"); msg = msim_msg_new( "addbuddy", MSIM_TYPE_BOOLEAN, TRUE, @@ -2640,7 +2651,7 @@ "reason", MSIM_TYPE_STRING, g_strdup(""), NULL); - if (!msim_postprocess_outgoing(session, msg, buddy->name, "newprofileid", "reason")) { + if (!msim_postprocess_outgoing(session, msg, name, "newprofileid", "reason")) { purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("'addbuddy' command failed.")); msim_msg_free(msg); return; @@ -2652,7 +2663,7 @@ body = msim_msg_new( "ContactID", MSIM_TYPE_STRING, g_strdup("<uid>"), - "GroupName", MSIM_TYPE_STRING, g_strdup(group->name), + "GroupName", MSIM_TYPE_STRING, g_strdup(gname), "Position", MSIM_TYPE_INTEGER, 1000, "Visibility", MSIM_TYPE_INTEGER, 1, "NickName", MSIM_TYPE_STRING, g_strdup(""), @@ -2673,7 +2684,7 @@ "body", MSIM_TYPE_DICTIONARY, body, NULL); - if (!msim_postprocess_outgoing(session, msg_persist, buddy->name, "body", NULL)) + if (!msim_postprocess_outgoing(session, msg_persist, name, "body", NULL)) { purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed")); msim_msg_free(msg_persist); @@ -2682,7 +2693,7 @@ msim_msg_free(msg_persist); /* Add to allow list, remove from block list */ - msim_update_blocklist_for_buddy(session, buddy->name, TRUE, FALSE); + msim_update_blocklist_for_buddy(session, name, TRUE, FALSE); } /** @@ -2694,8 +2705,10 @@ MsimSession *session; MsimMessage *delbuddy_msg; MsimMessage *persist_msg; + const char *name; session = (MsimSession *)gc->proto_data; + name = purple_buddy_get_name(buddy); delbuddy_msg = msim_msg_new( "delbuddy", MSIM_TYPE_BOOLEAN, TRUE, @@ -2703,7 +2716,7 @@ /* 'delprofileid' with uid will be inserted here. */ NULL); - if (!msim_postprocess_outgoing(session, delbuddy_msg, buddy->name, "delprofileid", NULL)) { + if (!msim_postprocess_outgoing(session, delbuddy_msg, name, "delprofileid", NULL)) { purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("'delbuddy' command failed")); msim_msg_free(delbuddy_msg); return; @@ -2722,7 +2735,7 @@ "body", MSIM_TYPE_STRING, g_strdup("ContactID=<uid>"), NULL); - if (!msim_postprocess_outgoing(session, persist_msg, buddy->name, "body", NULL)) { + if (!msim_postprocess_outgoing(session, persist_msg, name, "body", NULL)) { purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("persist command failed")); msim_msg_free(persist_msg); return; @@ -2734,7 +2747,7 @@ * doesn't seem like it would be necessary, but the official client * does it) */ - if (!msim_update_blocklist_for_buddy(session, buddy->name, FALSE, FALSE)) + if (!msim_update_blocklist_for_buddy(session, name, FALSE, FALSE)) purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("blocklist command failed")); } @@ -2756,6 +2769,7 @@ "sesskey", MSIM_TYPE_INTEGER, session->sesskey, /* 'delprofileid' with uid will be inserted here. */ NULL); + if (!msim_postprocess_outgoing(session, msg, name, "delprofileid", NULL)) purple_debug_error("myspace", "delbuddy command failed\n"); msim_msg_free(msg);