Mercurial > pidgin.yaz
diff libpurple/protocols/myspace/myspace.c @ 24120:16734635febf
Start hiding blist.h internals in prpls.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 27 Sep 2008 06:33:42 +0000 |
parents | 19ab21882b38 |
children | 8d562557ed6f |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/myspace/myspace.c Sat Sep 27 06:33:42 2008 +0000 @@ -1026,7 +1026,7 @@ user = msim_find_user(session, username); /* If is on buddy list, lookup by uid since it is faster. */ - if (user && (uid = purple_blist_node_get_int(&user->buddy->node, "UserID"))) { + if (user && (uid = purple_blist_node_get_int((PurpleBlistNode *)user->buddy, "UserID"))) { user_to_lookup = g_strdup_printf("%d", uid); } else { /* Looking up buddy not on blist. Lookup by whatever user entered. */ @@ -1252,7 +1252,7 @@ /* See finch/gnthistory.c */ buddy = cur->data; - uid = purple_blist_node_get_int(&buddy->node, "UserID"); + uid = purple_blist_node_get_int((PurpleBlistNode *)buddy, "UserID"); name = purple_buddy_get_name(buddy); if (uid == wanted_uid) @@ -1972,7 +1972,7 @@ user = msim_get_user_from_buddy(buddy); /* All buddies on list should have a UserID integer associated with them. */ - purple_blist_node_set_int(&buddy->node, "UserID", msim_msg_get_integer(msg, "f")); + purple_blist_node_set_int((PurpleBlistNode *)buddy, "UserID", msim_msg_get_integer(msg, "f")); msim_store_user_info(session, msg, NULL); } else { @@ -2065,10 +2065,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, @@ -2077,7 +2081,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; @@ -2089,7 +2093,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(""), @@ -2110,7 +2114,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); @@ -2286,7 +2290,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((PurpleBlistNode *)buddy, "UserID"); } else { uid = 0; } @@ -2328,8 +2332,10 @@ MsimMessage *persist_msg; MsimMessage *blocklist_msg; GList *blocklist_updates; + const char *name; session = (MsimSession *)gc->proto_data; + name = purple_buddy_get_name(buddy); delbuddy_msg = msim_msg_new( "delbuddy", MSIM_TYPE_BOOLEAN, TRUE, @@ -2337,7 +2343,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; @@ -2356,7 +2362,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; @@ -2378,7 +2384,7 @@ "idlist", MSIM_TYPE_LIST, blocklist_updates, NULL); - if (!msim_postprocess_outgoing(session, blocklist_msg, buddy->name, "idlist", NULL)) { + if (!msim_postprocess_outgoing(session, blocklist_msg, name, "idlist", NULL)) { purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("blocklist command failed")); msim_msg_free(blocklist_msg); return; @@ -2732,12 +2738,16 @@ 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; @@ -2785,8 +2795,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)); @@ -2867,7 +2879,7 @@ user = msim_get_user_from_buddy(buddy); /* All buddies on list should have 'uid' integer associated with them. */ - purple_blist_node_set_int(&buddy->node, "UserID", uid); + purple_blist_node_set_int((PurpleBlistNode *)buddy, "UserID", uid); /* Stores a few fields in the MsimUser, relevant to the buddy itself. * AvatarURL, Headline, ContactID. */