Mercurial > pidgin
diff libpurple/protocols/oscar/oscar.c @ 25877:1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
to branch 'im.pidgin.pidgin.next.minor' (head c165595260a2efa0ca23704ada46a303e0412e19)
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 12 Dec 2008 20:03:58 +0000 |
parents | 0331bc480515 e4b1ba7c351c |
children | 68265bcc8814 |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c Fri Dec 12 17:18:59 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.c Fri Dec 12 20:03:58 2008 +0000 @@ -807,11 +807,13 @@ PurpleStatus *status = NULL; gchar *message = NULL, *itmsurl = NULL, *tmp; gboolean is_away; + const char *bname; od = gc->proto_data; + bname = purple_buddy_get_name(b); if (userinfo == NULL) - userinfo = aim_locate_finduserinfo(od, b->name); + userinfo = aim_locate_finduserinfo(od, bname); if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL))) return; @@ -884,7 +886,7 @@ if (b) { if (purple_presence_is_online(presence)) { - if (aim_snvalid_icq(b->name) || is_away || !message || !(*message)) { + if (aim_snvalid_icq(bname) || is_away || !message || !(*message)) { /* Append the status name for online ICQ statuses, away AIM statuses, and for all buddies with no message. * If the status name and the message are the same, only show one. */ const char *status_name = purple_status_get_name(status); @@ -901,8 +903,8 @@ } else { if (aim_ssi_waitingforauth(od->ssi.local, - aim_ssi_itemlist_findparentname(od->ssi.local, b->name), - b->name)) { + aim_ssi_itemlist_findparentname(od->ssi.local, bname), + bname)) { /* Note if an offline buddy is not authorized */ tmp = g_strdup_printf("%s%s%s", _("Not Authorized"), @@ -931,6 +933,7 @@ PurpleGroup *g = NULL; struct buddyinfo *bi = NULL; char *tmp; + const char *bname, *gname = NULL; od = gc->proto_data; account = purple_connection_get_account(gc); @@ -938,14 +941,16 @@ if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL))) return; + bname = purple_buddy_get_name(b); if (userinfo == NULL) - userinfo = aim_locate_finduserinfo(od, b->name); + userinfo = aim_locate_finduserinfo(od, bname); if (b == NULL) b = purple_find_buddy(account, userinfo->sn); if (b != NULL) { g = purple_buddy_get_group(b); + gname = purple_group_get_name(g); presence = purple_buddy_get_presence(b); status = purple_presence_get_active_status(presence); } @@ -969,8 +974,8 @@ g_free(tmp); } - if ((b != NULL) && (b->name != NULL) && (g != NULL) && (g->name != NULL)) { - tmp = aim_ssi_getcomment(od->ssi.local, g->name, b->name); + if ((b != NULL) && (bname != NULL) && (g != NULL) && (gname != NULL)) { + tmp = aim_ssi_getcomment(od->ssi.local, gname, bname); if (tmp != NULL) { char *tmp2 = g_markup_escape_text(tmp, strlen(tmp)); g_free(tmp); @@ -2444,6 +2449,7 @@ PurpleAccount *account; PurpleBuddy *buddy; PurpleGroup *group; + const char *bname, *gname; gc = data->gc; od = gc->proto_data; @@ -2456,15 +2462,17 @@ if (group != NULL) { + bname = purple_buddy_get_name(buddy); + gname = purple_group_get_name(group); purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n", - buddy->name, group->name); + bname, gname); aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); - if (!aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) + if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) { - aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); + aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); /* Mobile users should always be online */ - if (buddy->name[0] == '+') { + if (bname[0] == '+') { purple_prpl_got_user_status(account, purple_buddy_get_name(buddy), OSCAR_STATUS_ID_AVAILABLE, NULL); @@ -2504,8 +2512,8 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - purple_auth_sendrequest(gc, buddy->name); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); + purple_auth_sendrequest(gc, purple_buddy_get_name(buddy)); } /* When other people ask you for authorization */ @@ -3896,9 +3904,9 @@ user_info = purple_notify_user_info_new(); g_snprintf(who, sizeof(who), "%u", info->uin); - buddy = purple_find_buddy(purple_connection_get_account(gc), who); + buddy = purple_find_buddy(account, who); if (buddy != NULL) - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(buddy->account, buddy->name)); + bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, purple_buddy_get_name(buddy))); else bi = NULL; @@ -3915,7 +3923,7 @@ } oscar_user_info_convert_and_add(account, user_info, _("First Name"), info->first); oscar_user_info_convert_and_add(account, user_info, _("Last Name"), info->last); - if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email))) { + if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(account, info->email))) { buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8); purple_notify_user_info_add_pair(user_info, _("Email Address"), buf); g_free(buf); @@ -3924,7 +3932,7 @@ if (info->numaddresses && info->email2) { int i; for (i = 0; i < info->numaddresses; i++) { - if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email2[i]))) { + if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(account, info->email2[i]))) { buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8); purple_notify_user_info_add_pair(user_info, _("Email Address"), buf); g_free(buf); @@ -3959,7 +3967,7 @@ snprintf(age, sizeof(age), "%hhd", info->age); purple_notify_user_info_add_pair(user_info, _("Age"), age); } - if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->personalwebpage))) { + if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(account, info->personalwebpage))) { buf = g_strdup_printf("<a href=\"%s\">%s</a>", utf8, utf8); purple_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf); g_free(buf); @@ -3995,7 +4003,7 @@ oscar_user_info_convert_and_add(account, user_info, _("Division"), info->workdivision); oscar_user_info_convert_and_add(account, user_info, _("Position"), info->workposition); - if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->workwebpage))) { + if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(account, info->workwebpage))) { char *webpage = g_strdup_printf("<a href=\"%s\">%s</a>", utf8, utf8); purple_notify_user_info_add_pair(user_info, _("Web Page"), webpage); g_free(webpage); @@ -4029,7 +4037,7 @@ if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, info->nick))) { g_snprintf(who, sizeof(who), "%u", info->uin); serv_got_alias(gc, who, utf8); - if ((b = purple_find_buddy(gc->account, who))) { + if ((b = purple_find_buddy(account, who))) { purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8); } g_free(utf8); @@ -4797,14 +4805,17 @@ oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { OscarData *od; PurpleAccount *account; + const char *bname, *gname; od = (OscarData *)gc->proto_data; account = purple_connection_get_account(gc); - - if (!aim_snvalid(buddy->name)) { + bname = purple_buddy_get_name(buddy); + gname = purple_group_get_name(group); + + if (!aim_snvalid(bname)) { gchar *buf; - buf = g_strdup_printf(_("Could not add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name); - if (!purple_conv_present_error(buddy->name, account, buf)) + buf = g_strdup_printf(_("Could not add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), bname); + if (!purple_conv_present_error(bname, account, buf)) purple_notify_error(gc, NULL, _("Unable to Add"), buf); g_free(buf); @@ -4814,34 +4825,34 @@ return; } - if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))) { + if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY))) { purple_debug_info("oscar", - "ssi: adding buddy %s to group %s\n", buddy->name, group->name); - aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); + "ssi: adding buddy %s to group %s\n", bname, gname); + aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); /* Mobile users should always be online */ - if (buddy->name[0] == '+') { + if (bname[0] == '+') { purple_prpl_got_user_status(account, - purple_buddy_get_name(buddy), - OSCAR_STATUS_ID_AVAILABLE, NULL); + bname, OSCAR_STATUS_ID_AVAILABLE, NULL); purple_prpl_got_user_status(account, - purple_buddy_get_name(buddy), - OSCAR_STATUS_ID_MOBILE, NULL); + bname, OSCAR_STATUS_ID_MOBILE, NULL); } } /* XXX - Should this be done from AIM accounts, as well? */ if (od->icq) - aim_icq_getalias(od, buddy->name); + aim_icq_getalias(od, bname); } void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { OscarData *od = (OscarData *)gc->proto_data; if (od->ssi.received_data) { + const char *gname = purple_group_get_name(group); + const char *bname = purple_buddy_get_name(buddy); purple_debug_info("oscar", - "ssi: deleting buddy %s from group %s\n", buddy->name, group->name); - aim_ssi_delbuddy(od, buddy->name, group->name); + "ssi: deleting buddy %s from group %s\n", bname, gname); + aim_ssi_delbuddy(od, bname, gname); } } @@ -4873,7 +4884,8 @@ OscarData *od = (OscarData *)gc->proto_data; if (od->ssi.received_data) { - if (aim_ssi_itemlist_finditem(od->ssi.local, group->name, NULL, AIM_SSI_TYPE_GROUP)) { + const char *gname = purple_group_get_name(group); + if (aim_ssi_itemlist_finditem(od->ssi.local, gname, NULL, AIM_SSI_TYPE_GROUP)) { GList *cur, *groups = NULL; PurpleAccount *account = purple_connection_get_account(gc); @@ -4883,25 +4895,25 @@ /* node is PurpleBuddy, parent is a PurpleContact. * We must go two levels up to get the Group */ groups = g_list_append(groups, - node->parent->parent); + purple_buddy_get_group((PurpleBuddy*)node)); } purple_account_remove_buddies(account, moved_buddies, groups); purple_account_add_buddies(account, moved_buddies); g_list_free(groups); purple_debug_info("oscar", - "ssi: moved all buddies from group %s to %s\n", old_name, group->name); + "ssi: moved all buddies from group %s to %s\n", old_name, gname); } else { - aim_ssi_rename_group(od, old_name, group->name); + aim_ssi_rename_group(od, old_name, gname); purple_debug_info("oscar", - "ssi: renamed group %s to %s\n", old_name, group->name); + "ssi: renamed group %s to %s\n", old_name, gname); } } } void oscar_remove_group(PurpleConnection *gc, PurpleGroup *group) { - aim_ssi_delgroup(gc->proto_data, group->name); + aim_ssi_delgroup(gc->proto_data, purple_group_get_name(group)); } static gboolean purple_ssi_rerequestdata(gpointer data) { @@ -5010,33 +5022,44 @@ /* Buddies */ cur = NULL; if ((blist = purple_get_blist()) != NULL) { - for (gnode = blist->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; + gnode = purple_blist_node_get_sibling_next(gnode)) { + const char *gname; if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; g = (PurpleGroup *)gnode; - for (cnode = gnode->child; cnode; cnode = cnode->next) { + gname = purple_group_get_name(g); + for (cnode = purple_blist_node_get_first_child(gnode); + cnode; + cnode = purple_blist_node_get_sibling_next(cnode)) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; - for (bnode = cnode->child; bnode; bnode = bnode->next) { + for (bnode = purple_blist_node_get_first_child(cnode); + bnode; + bnode = purple_blist_node_get_sibling_next(bnode)) { + const char *bname; if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; - if (b->account == gc->account) { - if (aim_ssi_itemlist_exists(od->ssi.local, b->name)) { + bname = purple_buddy_get_name(b); + if (purple_buddy_get_account(b) == account) { + if (aim_ssi_itemlist_exists(od->ssi.local, bname)) { /* If the buddy is an ICQ user then load his nickname */ const char *servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick"); char *alias; + const char *balias; if (servernick) - serv_got_alias(gc, b->name, servernick); + serv_got_alias(gc, bname, servernick); /* Store local alias on server */ - alias = aim_ssi_getalias(od->ssi.local, g->name, b->name); - if (!alias && b->alias && strlen(b->alias)) - aim_ssi_aliasbuddy(od, g->name, b->name, b->alias); + alias = aim_ssi_getalias(od->ssi.local, gname, bname); + balias = purple_buddy_get_local_buddy_alias(b); + if (!alias && balias && *balias) + aim_ssi_aliasbuddy(od, gname, bname, balias); g_free(alias); } else { purple_debug_info("oscar", - "ssi: removing buddy %s from local list\n", b->name); + "ssi: removing buddy %s from local list\n", bname); /* We can't actually remove now because it will screw up our looping */ cur = g_slist_prepend(cur, b); } @@ -5132,15 +5155,15 @@ } else alias_utf8 = NULL; - b = purple_find_buddy_in_group(gc->account, curitem->name, g); + b = purple_find_buddy_in_group(account, curitem->name, g); if (b) { /* Get server stored alias */ purple_blist_alias_buddy(b, alias_utf8); } else { - b = purple_buddy_new(gc->account, curitem->name, alias_utf8); + b = purple_buddy_new(account, curitem->name, alias_utf8); purple_debug_info("oscar", - "ssi: adding buddy %s to group %s to local list\n", curitem->name, g->name); + "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname); purple_blist_add_buddy(b, NULL, g, NULL); } if (!aim_sncmp(curitem->name, account->username)) { @@ -5153,7 +5176,7 @@ } /* Mobile users should always be online */ - if (b->name[0] == '+') { + if (curitem->name[0] == '+') { purple_prpl_got_user_status(account, purple_buddy_get_name(b), OSCAR_STATUS_ID_AVAILABLE, NULL); @@ -5367,13 +5390,11 @@ purple_blist_add_buddy(b, NULL, g, NULL); /* Mobile users should always be online */ - if (b->name[0] == '+') { + if (name[0] == '+') { purple_prpl_got_user_status(account, - purple_buddy_get_name(b), - OSCAR_STATUS_ID_AVAILABLE, NULL); + name, OSCAR_STATUS_ID_AVAILABLE, NULL); purple_prpl_got_user_status(account, - purple_buddy_get_name(b), - OSCAR_STATUS_ID_MOBILE, NULL); + name, OSCAR_STATUS_ID_MOBILE, NULL); } } @@ -5705,7 +5726,8 @@ const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b) { - if ((b == NULL) || (b->name == NULL) || aim_snvalid_sms(b->name)) + const char *name = b ? purple_buddy_get_name(b) : NULL; + if ((b == NULL) || (name == NULL) || aim_snvalid_sms(name)) { if (a == NULL || aim_snvalid_icq(purple_account_get_username(a))) return "icq"; @@ -5713,14 +5735,15 @@ return "aim"; } - if (aim_snvalid_icq(b->name)) + if (aim_snvalid_icq(name)) return "icq"; return "aim"; } const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b) { - if ((b == NULL) || (b->name == NULL) || aim_snvalid_sms(b->name)) + const char *name = b ? purple_buddy_get_name(b) : NULL; + if ((b == NULL) || (name == NULL) || aim_snvalid_sms(name)) { if (a != NULL && aim_snvalid_icq(purple_account_get_username(a))) return "icq"; @@ -5728,7 +5751,7 @@ return "aim"; } - if (aim_snvalid_icq(b->name)) + if (aim_snvalid_icq(name)) return "icq"; return "aim"; } @@ -5742,14 +5765,16 @@ PurpleStatus *status; const char *status_id; aim_userinfo_t *userinfo = NULL; - - account = b->account; + const char *name; + + account = purple_buddy_get_account(b); + name = purple_buddy_get_name(b); if (account != NULL) - gc = account->gc; + gc = purple_account_get_connection(account); if (gc != NULL) od = gc->proto_data; if (od != NULL) - userinfo = aim_locate_finduserinfo(od, b->name); + userinfo = aim_locate_finduserinfo(od, name); presence = purple_buddy_get_presence(b); status = purple_presence_get_active_status(presence); @@ -5757,9 +5782,9 @@ if (purple_presence_is_online(presence) == FALSE) { char *gname; - if ((b->name) && (od) && (od->ssi.received_data) && - (gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name)) && - (aim_ssi_waitingforauth(od->ssi.local, gname, b->name))) { + if ((name) && (od) && (od->ssi.received_data) && + (gname = aim_ssi_itemlist_findparentname(od->ssi.local, name)) && + (aim_ssi_waitingforauth(od->ssi.local, gname, name))) { return "not-authorized"; } } @@ -5782,15 +5807,17 @@ void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { PurpleConnection *gc; + PurpleAccount *account; OscarData *od; aim_userinfo_t *userinfo; if (!PURPLE_BUDDY_IS_ONLINE(b)) return; - gc = b->account->gc; + account = purple_buddy_get_account(b); + gc = purple_account_get_connection(account); od = gc->proto_data; - userinfo = aim_locate_finduserinfo(od, b->name); + userinfo = aim_locate_finduserinfo(od, purple_buddy_get_name(b)); oscar_user_info_append_status(gc, user_info, b, userinfo, /* strip_html_tags */ TRUE); @@ -5818,8 +5845,9 @@ if ((od != NULL) && !purple_presence_is_online(presence)) { - char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name); - if (aim_ssi_waitingforauth(od->ssi.local, gname, b->name)) + const char *name = purple_buddy_get_name(b); + char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); + if (aim_ssi_waitingforauth(od->ssi.local, gname, name)) ret = g_strdup(_("Not Authorized")); else ret = g_strdup(_("Offline")); @@ -6064,7 +6092,7 @@ return; } - aim_ssi_editcomment(od, g->name, data->name, text); + aim_ssi_editcomment(od, purple_group_get_name(g), data->name, text); if (!aim_sncmp(data->name, gc->account->username)) purple_check_comment(od, text); @@ -6082,11 +6110,15 @@ char *comment; gchar *comment_utf8; gchar *title; + PurpleAccount *account; + const char *name; g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + name = purple_buddy_get_name(buddy); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); od = gc->proto_data; if (!(g = purple_buddy_get_group(buddy))) @@ -6094,11 +6126,11 @@ data = g_new(struct name_data, 1); - comment = aim_ssi_getcomment(od->ssi.local, g->name, buddy->name); - comment_utf8 = comment ? oscar_utf8_try_convert(gc->account, comment) : NULL; + comment = aim_ssi_getcomment(od->ssi.local, purple_group_get_name(g), name); + comment_utf8 = comment ? oscar_utf8_try_convert(account, comment) : NULL; data->gc = gc; - data->name = g_strdup(purple_buddy_get_name(buddy)); + data->name = g_strdup(name); data->nick = g_strdup(purple_buddy_get_alias_only(buddy)); title = g_strdup_printf(_("Buddy Comment for %s"), data->name); @@ -6106,7 +6138,7 @@ comment_utf8, TRUE, FALSE, NULL, _("_OK"), G_CALLBACK(oscar_ssi_editcomment), _("_Cancel"), G_CALLBACK(oscar_free_name_data), - purple_connection_get_account(gc), data->name, NULL, + account, data->name, NULL, data); g_free(title); @@ -6138,26 +6170,28 @@ PurpleConnection *gc; gchar *buf; struct oscar_ask_directim_data *data; + PurpleAccount *account; node = object; g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(buddy->account); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); data = g_new0(struct oscar_ask_directim_data, 1); - data->who = g_strdup(buddy->name); + data->who = g_strdup(purple_buddy_get_name(buddy)); data->od = gc->proto_data; buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), - buddy->name); + data->who); purple_request_action(gc, NULL, buf, _("Because this reveals your IP address, it " "may be considered a security risk. Do you " "wish to continue?"), 0, /* Default action is "connect" */ - purple_connection_get_account(gc), data->who, NULL, + account, data->who, NULL, data, 2, _("C_onnect"), G_CALLBACK(oscar_ask_directim_yes_cb), _("_Cancel"), G_CALLBACK(oscar_ask_directim_no_cb)); @@ -6173,7 +6207,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); aim_locate_getinfoshort(gc->proto_data, purple_buddy_get_name(buddy), 0x00000003); } @@ -6186,13 +6220,16 @@ GList *menu; PurpleMenuAction *act; aim_userinfo_t *userinfo; - - gc = purple_account_get_connection(buddy->account); + PurpleAccount *account; + const char *bname = purple_buddy_get_name(buddy); + + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); od = gc->proto_data; - userinfo = aim_locate_finduserinfo(od, buddy->name); + userinfo = aim_locate_finduserinfo(od, bname); menu = NULL; - if (od->icq && aim_snvalid_icq(purple_buddy_get_name(buddy))) + if (od->icq && aim_snvalid_icq(bname)) { act = purple_menu_action_new(_("Get AIM Info"), PURPLE_CALLBACK(oscar_get_aim_info_cb), @@ -6216,7 +6253,7 @@ #endif if (userinfo && - aim_sncmp(purple_account_get_username(buddy->account), buddy->name) && + aim_sncmp(purple_account_get_username(account), bname) && PURPLE_BUDDY_IS_ONLINE(buddy)) { if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM) @@ -6240,8 +6277,8 @@ if (od->ssi.received_data) { char *gname; - gname = aim_ssi_itemlist_findparentname(od->ssi.local, buddy->name); - if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, buddy->name)) + gname = aim_ssi_itemlist_findparentname(od->ssi.local, bname); + if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, bname)) { act = purple_menu_action_new(_("Re-request Authorization"), PURPLE_CALLBACK(purple_auth_sendrequest_menu), @@ -6398,26 +6435,37 @@ OscarData *od = gc->proto_data; gchar *nombre, *text, *tmp; PurpleBlistNode *gnode, *cnode, *bnode; + PurpleAccount *account; int num=0; text = g_strdup(""); - - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + account = purple_connection_get_account(gc); + + for (gnode = purple_blist_get_root(); gnode; + gnode = purple_blist_node_get_sibling_next(gnode)) { PurpleGroup *group = (PurpleGroup *)gnode; + const char *gname; if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; - for (cnode = gnode->child; cnode; cnode = cnode->next) { + gname = purple_group_get_name(group); + for (cnode = purple_blist_node_get_first_child(gnode); + cnode; + cnode = purple_blist_node_get_sibling_next(cnode)) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; - for (bnode = cnode->child; bnode; bnode = bnode->next) { + for (bnode = purple_blist_node_get_first_child(cnode); + bnode; + bnode = purple_blist_node_get_sibling_next(bnode)) { PurpleBuddy *buddy = (PurpleBuddy *)bnode; + const char *bname; if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - if (buddy->account == gc->account && aim_ssi_waitingforauth(od->ssi.local, group->name, buddy->name)) { + bname = purple_buddy_get_name(buddy); + if (purple_buddy_get_account(buddy) == account && aim_ssi_waitingforauth(od->ssi.local, gname, bname)) { if (purple_buddy_get_alias_only(buddy)) - nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy)); + nombre = g_strdup_printf(" %s (%s)", bname, purple_buddy_get_alias_only(buddy)); else - nombre = g_strdup_printf(" %s", buddy->name); + nombre = g_strdup_printf(" %s", bname); tmp = g_strdup_printf("%s%s<br>", text, nombre); g_free(text); text = tmp;