Mercurial > pidgin
changeset 25130:16734635febf
Start hiding blist.h internals in prpls.
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/bonjour/bonjour.c Sat Sep 27 06:33:42 2008 +0000 @@ -68,9 +68,9 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; buddy = (PurpleBuddy *) bnode; - if (buddy->account != account) + if (purple_buddy_get_account(buddy) != account) continue; - purple_prpl_got_user_status(account, buddy->name, "offline", NULL); + purple_prpl_got_user_status(account, purple_buddy_get_name(buddy), "offline", NULL); purple_account_remove_buddy(account, buddy, NULL); purple_blist_remove_buddy(buddy); }
--- a/libpurple/protocols/bonjour/bonjour_ft.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/bonjour/bonjour_ft.c Sat Sep 27 06:33:42 2008 +0000 @@ -408,6 +408,7 @@ xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) { const char *type, *id; + const char *name; BonjourData *bd; PurpleXfer *xfer; @@ -421,6 +422,7 @@ type = xmlnode_get_attrib(packet, "type"); id = xmlnode_get_attrib(packet, "id"); + name = purple_buddy_get_name(pb); if(type) { if(!strcmp(type, "set")) { const char *profile; @@ -446,31 +448,31 @@ /* TODO: Make sure that it is advertising a bytestreams transfer */ - bonjour_xfer_receive(pc, id, sid, pb->name, filesize, filename, XEP_BYTESTREAMS); + bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS); parsed_receive = TRUE; } if (!parsed_receive) { purple_debug_info("bonjour", "rejecting unrecognized si SET offer.\n"); - xep_ft_si_reject((BonjourData *)pc->proto_data, id, pb->name, "403", "cancel"); + xep_ft_si_reject((BonjourData *)pc->proto_data, id, name, "403", "cancel"); /*TODO: Send Cancel (501) */ } } else if(!strcmp(type, "result")) { purple_debug_info("bonjour", "si offer Message type - RESULT.\n"); - xfer = bonjour_si_xfer_find(bd, id, pb->name); + xfer = bonjour_si_xfer_find(bd, id, name); if(xfer == NULL) { purple_debug_info("bonjour", "xfer find fail.\n"); - xep_ft_si_reject((BonjourData *)pc->proto_data, id, pb->name, "403", "cancel"); + xep_ft_si_reject((BonjourData *)pc->proto_data, id, name, "403", "cancel"); } else bonjour_bytestreams_init(xfer); } else if(!strcmp(type, "error")) { purple_debug_info("bonjour", "si offer Message type - ERROR.\n"); - xfer = bonjour_si_xfer_find(bd, id, pb->name); + xfer = bonjour_si_xfer_find(bd, id, name); if(xfer == NULL) purple_debug_info("bonjour", "xfer find fail.\n"); @@ -498,7 +500,7 @@ purple_debug_info("bonjour", "xep-bytestreams-parse.\n"); type = xmlnode_get_attrib(packet, "type"); - from = pb->name; + from = purple_buddy_get_name(pb); query = xmlnode_get_child(packet,"query"); if(type) { if(!strcmp(type, "set")) { @@ -853,7 +855,8 @@ if(!xf) return; - p = g_strdup_printf("%s%s%s", xf->sid, pb->name, purple_account_get_username(pb->account)); + p = g_strdup_printf("%s%s%s", xf->sid, purple_buddy_get_name(pb), + purple_account_get_username(purple_buddy_get_account(pb))); purple_cipher_digest_region("sha1", (guchar *)p, strlen(p), sizeof(hashval), hashval, NULL); g_free(p);
--- a/libpurple/protocols/bonjour/buddy.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/bonjour/buddy.c Sat Sep 27 06:33:42 2008 +0000 @@ -128,6 +128,7 @@ PurpleGroup *group; PurpleAccount *account = bonjour_buddy->account; const char *status_id, *old_hash, *new_hash; + const char *name; /* Translate between the Bonjour status and the Purple status */ if (bonjour_buddy->status != NULL && g_ascii_strcasecmp("dnd", bonjour_buddy->status) == 0) @@ -157,11 +158,12 @@ purple_blist_add_buddy(buddy, NULL, group, NULL); } + name = purple_buddy_get_name(buddy); buddy->proto_data = bonjour_buddy; /* Create the alias for the buddy using the first and the last name */ if (bonjour_buddy->nick) - serv_got_alias(purple_account_get_connection(account), buddy->name, bonjour_buddy->nick); + serv_got_alias(purple_account_get_connection(account), name, bonjour_buddy->nick); else { gchar *alias = NULL; const char *first, *last; @@ -172,18 +174,18 @@ (first && *first ? first : ""), (first && *first && last && *last ? " " : ""), (last && *last ? last : "")); - serv_got_alias(purple_account_get_connection(account), buddy->name, alias); + serv_got_alias(purple_account_get_connection(account), name, alias); g_free(alias); } /* Set the user's status */ if (bonjour_buddy->msg != NULL) - purple_prpl_got_user_status(account, buddy->name, status_id, + purple_prpl_got_user_status(account, name, status_id, "message", bonjour_buddy->msg, NULL); else - purple_prpl_got_user_status(account, buddy->name, status_id, NULL); + purple_prpl_got_user_status(account, name, status_id, NULL); - purple_prpl_got_user_idle(account, buddy->name, FALSE, 0); + purple_prpl_got_user_idle(account, name, FALSE, 0); /* TODO: Because we don't save Bonjour buddies in blist.xml, * we will always have to look up the buddy icon at login time. @@ -198,7 +200,7 @@ * as what we looked up. */ bonjour_dns_sd_retrieve_buddy_icon(bonjour_buddy); } else if (!new_hash) - purple_buddy_icons_set_for_user(account, buddy->name, NULL, 0, NULL); + purple_buddy_icons_set_for_user(account, name, NULL, 0, NULL); } /**
--- a/libpurple/protocols/bonjour/jabber.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Sat Sep 27 06:33:42 2008 +0000 @@ -142,7 +142,7 @@ _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) { xmlnode *body_node, *html_node, *events_node; - PurpleConnection *gc = pb->account->gc; + PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(pb)); gchar *body = NULL; gboolean composing_event = FALSE; @@ -225,7 +225,7 @@ } /* Send the message to the UI */ - serv_got_im(gc, pb->name, body, 0, time(NULL)); + serv_got_im(gc, purple_buddy_get_name(pb), body, 0, time(NULL)); g_free(body); } @@ -247,7 +247,7 @@ * is the same as the account requesting the check then continue to determine * whether one of the buddies IPs matches the target IP. */ - if (mbba->jdata->account == pb->account && pb->proto_data != NULL) + if (mbba->jdata->account == purple_buddy_get_account(pb) && pb->proto_data != NULL) { const char *ip; BonjourBuddy *bb = pb->proto_data; @@ -291,7 +291,8 @@ purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n", purple_buddy_get_name(pb), error ? error : "(null)"); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, pb->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, + purple_buddy_get_account(pb)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send message."), @@ -334,7 +335,8 @@ purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n", purple_buddy_get_name(pb), error ? error : "(null)"); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, pb->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, + purple_buddy_get_account(pb)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send message."), @@ -396,7 +398,8 @@ } return; } else if (len == 0) { /* The other end has closed the socket */ - purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", (bconv->pb && bconv->pb->name) ? bconv->pb->name : "(unknown)"); + const char *name = bconv->pb ? purple_buddy_get_name(bconv->pb) : NULL; + purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", name ? name : "(unknown)"); bonjour_jabber_stream_ended(bconv); return; } else { @@ -416,7 +419,8 @@ void bonjour_jabber_stream_ended(BonjourJabberConversation *bconv) { - purple_debug_info("bonjour", "Recieved conversation close notification from %s.\n", bconv->pb ? bconv->pb->name : "(unknown)"); + purple_debug_info("bonjour", "Recieved conversation close notification from %s.\n", + bconv->pb ? purple_buddy_get_name(bconv->pb) : "(unknown)"); /* Inform the user that the conversation has been closed */ if (bconv != NULL) { @@ -748,6 +752,7 @@ { PurpleBuddy *pb = data; BonjourBuddy *bb = pb->proto_data; + PurpleAccount *account = purple_buddy_get_account(pb); bb->conversation->connect_data = NULL; @@ -757,7 +762,7 @@ purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d error: %s\n", purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error ? error : "(null)"); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, pb->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send the message, the conversation couldn't be started."), @@ -775,7 +780,7 @@ purple_debug_error("bonjour", "Error starting stream with buddy %s at %s:%d error: %s\n", purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, err ? err : "(null)"); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, pb->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send the message, the conversation couldn't be started."), @@ -1040,7 +1045,7 @@ tmp_next = xfers->next; /* We only need to cancel this if it hasn't actually started transferring. */ /* This will change if we ever support IBB transfers. */ - if (strcmp(xfer->who, bconv->pb->name) == 0 + if (strcmp(xfer->who, purple_buddy_get_name(bconv->pb)) == 0 && (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_NOT_STARTED || purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_UNKNOWN)) { purple_xfer_cancel_remote(xfer); @@ -1164,15 +1169,18 @@ gboolean blocked = FALSE; GSList *l = NULL; PurpleAccount *acc = NULL; + const char *username, *bname; if(pb == NULL) return FALSE; - acc = pb->account; + acc = purple_buddy_get_account(pb); + username = purple_account_get_username(acc); + bname = purple_buddy_get_name(pb); for(l = acc->deny; l != NULL; l = l->next) { - if(!purple_utf8_strcasecmp(pb->name, (char *)l->data)) { - purple_debug_info("bonjour", "%s has been blocked by %s.\n", pb->name, acc->username); + if(!purple_utf8_strcasecmp(bname, (char *)l->data)) { + purple_debug_info("bonjour", "%s has been blocked by %s.\n", bname, username); blocked = TRUE; break; } @@ -1189,8 +1197,9 @@ return; if(connection == NULL) { - if(pb->account != NULL) - connection = (pb->account)->gc; + PurpleAccount *account = purple_buddy_get_account(pb); + if(account != NULL) + connection = purple_account_get_connection(account); } if(check_if_blocked(pb))
--- a/libpurple/protocols/gg/buddylist.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/gg/buddylist.c Sat Sep 27 06:33:42 2008 +0000 @@ -41,17 +41,13 @@ GGPInfo *info = gc->proto_data; PurpleAccount *account = purple_connection_get_account(gc); - PurpleBuddyList *blist; PurpleBlistNode *gnode, *cnode, *bnode; PurpleBuddy *buddy; uin_t *userlist = NULL; gchar *types = NULL; int size = 0; - if ((blist = purple_get_blist()) == NULL) - return; - - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode != NULL; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -65,13 +61,13 @@ buddy = (PurpleBuddy *)bnode; - if (buddy->account != account) + if (purple_buddy_get_account(buddy) != account) continue; size++; userlist = (uin_t *) g_renew(uin_t, userlist, size); types = (gchar *) g_renew(gchar, types, size); - userlist[size - 1] = ggp_str_to_uin(buddy->name); + userlist[size - 1] = ggp_str_to_uin(purple_buddy_get_name(buddy)); types[size - 1] = GG_USER_NORMAL; purple_debug_info("gg", "ggp_buddylist_send: adding %d\n", userlist[size - 1]); @@ -173,14 +169,10 @@ void ggp_buddylist_offline(PurpleConnection *gc) { PurpleAccount *account = purple_connection_get_account(gc); - PurpleBuddyList *blist; PurpleBlistNode *gnode, *cnode, *bnode; PurpleBuddy *buddy; - if ((blist = purple_get_blist()) == NULL) - return; - - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode != NULL; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -194,15 +186,15 @@ buddy = (PurpleBuddy *)bnode; - if (buddy->account != account) + if (purple_buddy_get_account(buddy) != account) continue; - purple_prpl_got_user_status( - account, buddy->name, "offline", NULL); + purple_prpl_got_user_status(account, + purple_buddy_get_name(buddy), "offline", NULL); purple_debug_info("gg", "ggp_buddylist_offline: gone: %s\n", - buddy->name); + purple_buddy_get_name(buddy)); } } } @@ -212,7 +204,6 @@ /* char *ggp_buddylist_dump(PurpleAccount *account) {{{ */ char *ggp_buddylist_dump(PurpleAccount *account) { - PurpleBuddyList *blist; PurpleBlistNode *gnode, *cnode, *bnode; PurpleGroup *group; PurpleBuddy *buddy; @@ -220,33 +211,31 @@ char *buddylist = g_strdup(""); char *ptr; - if ((blist = purple_get_blist()) == NULL) - return NULL; - - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode != NULL; gnode = gnode->next) { + const gchar *gname; if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; group = (PurpleGroup *)gnode; + gname = purple_group_get_name(group); for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) { if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) { - gchar *newdata, *name, *alias, *gname; - gchar *cp_alias, *cp_gname; + gchar *newdata, *cp_gname, *cp_alias; + const gchar *alias, *name; if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; buddy = (PurpleBuddy *)bnode; - if (buddy->account != account) + if (purple_buddy_get_account(buddy) != account) continue; - name = buddy->name; - alias = buddy->alias ? buddy->alias : buddy->name; - gname = group->name; + name = purple_buddy_get_name(buddy); + alias = buddy->alias ? buddy->alias : name; cp_gname = charset_convert(gname, "UTF-8", "CP1250"); cp_alias = charset_convert(alias, "UTF-8", "CP1250");
--- a/libpurple/protocols/gg/gg.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/gg/gg.c Sat Sep 27 06:33:42 2008 +0000 @@ -1907,11 +1907,12 @@ { PurpleAccount *account; GGPInfo *info = gc->proto_data; + const char *name = purple_buddy_get_name(buddy); - gg_add_notify(info->session, ggp_str_to_uin(buddy->name)); + gg_add_notify(info->session, ggp_str_to_uin(name)); account = purple_connection_get_account(gc); - if (strcmp(purple_account_get_username(account), buddy->name) == 0) { + if (strcmp(purple_account_get_username(account), name) == 0) { ggp_status_fake_to_self(account); } } @@ -1923,7 +1924,7 @@ { GGPInfo *info = gc->proto_data; - gg_remove_notify(info->session, ggp_str_to_uin(buddy->name)); + gg_remove_notify(info->session, ggp_str_to_uin(purple_buddy_get_name(buddy))); } /* }}} */
--- a/libpurple/protocols/irc/irc.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/irc/irc.c Sat Sep 27 06:33:42 2008 +0000 @@ -569,7 +569,7 @@ { struct irc_conn *irc = (struct irc_conn *)gc->proto_data; struct irc_buddy *ib = g_new0(struct irc_buddy, 1); - ib->name = g_strdup(buddy->name); + ib->name = g_strdup(purple_buddy_get_name(buddy)); g_hash_table_insert(irc->buddies, ib->name, ib); /* if the timer isn't set, this is during signon, so we don't want to flood @@ -582,7 +582,7 @@ static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { struct irc_conn *irc = (struct irc_conn *)gc->proto_data; - g_hash_table_remove(irc->buddies, buddy->name); + g_hash_table_remove(irc->buddies, purple_buddy_get_name(buddy)); } static void read_input(struct irc_conn *irc, int len)
--- a/libpurple/protocols/irc/msgs.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/irc/msgs.c Sat Sep 27 06:33:42 2008 +0000 @@ -79,6 +79,7 @@ PurpleConnection *gc; PurpleStatus *status; PurpleBlistNode *gnode, *cnode, *bnode; + PurpleAccount *account; if ((gc = purple_account_get_connection(irc->account)) == NULL || PURPLE_CONNECTION_IS_CONNECTED(gc)) @@ -87,6 +88,8 @@ purple_connection_set_display_name(gc, nick); purple_connection_set_state(gc, PURPLE_CONNECTED); + account = purple_connection_get_account(gc); + /* If we're away then set our away message */ status = purple_account_get_active_status(irc->account); if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { @@ -95,7 +98,7 @@ } /* this used to be in the core, but it's not now */ - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for(cnode = gnode->child; cnode; cnode = cnode->next) { @@ -106,9 +109,9 @@ if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; - if(b->account == gc->account) { + if(purple_buddy_get_account(b) == account) { struct irc_buddy *ib = g_new0(struct irc_buddy, 1); - ib->name = g_strdup(b->name); + ib->name = g_strdup(purple_buddy_get_name(b)); g_hash_table_insert(irc->buddies, ib->name, ib); } }
--- a/libpurple/protocols/jabber/adhoccommands.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/jabber/adhoccommands.c Sat Sep 27 06:33:42 2008 +0000 @@ -211,8 +211,9 @@ if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { JabberAdHocCommands *cmd = data; PurpleBuddy *buddy = (PurpleBuddy *) node; - JabberStream *js = purple_account_get_connection(buddy->account)->proto_data; - + PurpleAccount *account = purple_buddy_get_account(buddy); + JabberStream *js = purple_account_get_connection(account)->proto_data; + jabber_adhoc_execute(js, cmd); } }
--- a/libpurple/protocols/jabber/buddy.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sat Sep 27 06:33:42 2008 +0000 @@ -1848,10 +1848,10 @@ 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)); js = gc->proto_data; - jabber_buddy_set_invisibility(js, buddy->name, TRUE); + jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); } static void jabber_buddy_make_visible(PurpleBlistNode *node, gpointer data) @@ -1863,10 +1863,10 @@ 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)); js = gc->proto_data; - jabber_buddy_set_invisibility(js, buddy->name, FALSE); + jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); } static void jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, @@ -1879,11 +1879,11 @@ 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)); js = gc->proto_data; /* I wonder if we should prompt the user before doing this */ - jabber_presence_subscription_set(js, buddy->name, "unsubscribed"); + jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed"); } static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data) @@ -1895,10 +1895,10 @@ 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)); js = gc->proto_data; - jabber_presence_subscription_set(js, buddy->name, "subscribe"); + jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); } @@ -1911,19 +1911,19 @@ 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)); js = gc->proto_data; - jabber_presence_subscription_set(js, buddy->name, "unsubscribe"); + jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribe"); } static void jabber_buddy_login(PurpleBlistNode *node, gpointer data) { if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { /* simply create a directed presence of the current status */ PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleConnection *gc = purple_account_get_connection(buddy->account); + PurpleAccount *account = purple_buddy_get_account(buddy); + PurpleConnection *gc = purple_account_get_connection(account); JabberStream *js = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); PurplePresence *gpresence = purple_account_get_presence(account); PurpleStatus *status = purple_presence_get_active_status(gpresence); xmlnode *presence; @@ -1936,7 +1936,7 @@ g_free(msg); - xmlnode_set_attrib(presence, "to", buddy->name); + xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); jabber_send(js, presence); xmlnode_free(presence); @@ -1947,12 +1947,13 @@ if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { /* simply create a directed unavailable presence */ PurpleBuddy *buddy = (PurpleBuddy *) node; - JabberStream *js = purple_account_get_connection(buddy->account)->proto_data; + PurpleAccount *account = purple_buddy_get_account(buddy); + JabberStream *js = purple_account_get_connection(account)->proto_data; xmlnode *presence; presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); - xmlnode_set_attrib(presence, "to", buddy->name); + xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); jabber_send(js, presence); xmlnode_free(presence); @@ -1961,9 +1962,11 @@ static GList *jabber_buddy_menu(PurpleBuddy *buddy) { - PurpleConnection *gc = purple_account_get_connection(buddy->account); + const char *name = purple_buddy_get_name(buddy); + PurpleAccount *account = purple_buddy_get_account(buddy); + PurpleConnection *gc = purple_account_get_connection(account); JabberStream *js = gc->proto_data; - JabberBuddy *jb = jabber_buddy_find(js, buddy->name, TRUE); + JabberBuddy *jb = jabber_buddy_find(js, name, TRUE); GList *jbrs; GList *m = NULL; @@ -2018,7 +2021,7 @@ * that gateways on the roster can be identified by having no '@' in their jid. This is a faily safe assumption, since * people don't tend to have a server or other service there. */ - if (g_utf8_strchr(buddy->name, -1, '@') == NULL) { + if (g_utf8_strchr(name, -1, '@') == NULL) { act = purple_menu_action_new(_("Log In"), PURPLE_CALLBACK(jabber_buddy_login), NULL, NULL);
--- a/libpurple/protocols/jabber/google.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/jabber/google.c Sat Sep 27 06:33:42 2008 +0000 @@ -309,7 +309,7 @@ g = purple_buddy_get_group(b); group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, g->name, -1); + xmlnode_insert_data(group, purple_group_get_name(g), -1); buddies = buddies->next; } @@ -375,7 +375,7 @@ g = purple_buddy_get_group(b); group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, g->name, -1); + xmlnode_insert_data(group, purple_group_get_name(g), -1); buddies = buddies->next; }
--- a/libpurple/protocols/jabber/jabber.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sat Sep 27 06:33:42 2008 +0000 @@ -1476,13 +1476,14 @@ { JabberStream *js; JabberBuddy *jb = NULL; + PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); - if(!b->account->gc) + if(!gc) return NULL; - js = b->account->gc->proto_data; + js = gc->proto_data; if(js) - jb = jabber_buddy_find(js, b->name, FALSE); + jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); if(!PURPLE_BUDDY_IS_ONLINE(b)) { if(jb && (jb->subscription & JABBER_SUB_PENDING || @@ -1496,9 +1497,11 @@ { char *ret = NULL; JabberBuddy *jb = NULL; - - if (b->account->gc && b->account->gc->proto_data) - jb = jabber_buddy_find(b->account->gc->proto_data, b->name, FALSE); + PurpleAccount *account = purple_buddy_get_account(b); + PurpleConnection *gc = purple_account_get_connection(account); + + if (gc && gc->proto_data) + jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { ret = g_strdup(_("Not Authorized")); @@ -1527,14 +1530,19 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { JabberBuddy *jb; + PurpleAccount *account; + PurpleConnection *gc; g_return_if_fail(b != NULL); - g_return_if_fail(b->account != NULL); - g_return_if_fail(b->account->gc != NULL); - g_return_if_fail(b->account->gc->proto_data != NULL); + + account = purple_buddy_get_account(b); + g_return_if_fail(account != NULL); - jb = jabber_buddy_find(b->account->gc->proto_data, b->name, - FALSE); + gc = purple_account_get_connection(account); + g_return_if_fail(gc != NULL); + g_return_if_fail(gc->proto_data != NULL); + + jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); if(jb) { JabberBuddyResource *jbr = NULL; @@ -1870,19 +1878,21 @@ if(!(jid = jabber_id_new(name))) return NULL; - for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for(gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { for(cnode = gnode->child; cnode; cnode = cnode->next) { PurpleChat *chat = (PurpleChat*)cnode; const char *room, *server; + GHashTable *components; if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) continue; - if(chat->account != account) + if (purple_chat_get_account(chat) != account) continue; - if(!(room = g_hash_table_lookup(chat->components, "room"))) + components = purple_chat_get_components(chat); + if(!(room = g_hash_table_lookup(components, "room"))) continue; - if(!(server = g_hash_table_lookup(chat->components, "server"))) + if(!(server = g_hash_table_lookup(components, "server"))) continue; if(jid->node && jid->domain &&
--- a/libpurple/protocols/jabber/roster.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/jabber/roster.c Sat Sep 27 06:33:42 2008 +0000 @@ -80,7 +80,7 @@ buddies = g_slist_remove(buddies, b); - if((l = g_slist_find_custom(g2, g->name, (GCompareFunc)strcmp))) { + if((l = g_slist_find_custom(g2, purple_group_get_name(g), (GCompareFunc)strcmp))) { const char *servernick; /* Previously stored serverside / buddy-supplied alias */ @@ -119,11 +119,13 @@ /* If we just learned about ourself, then fake our status, * because we won't be receiving a normal presence message * about ourself. */ - if(!strcmp(b->name, my_bare_jid)) { + if(!strcmp(purple_buddy_get_name(b), my_bare_jid)) { PurplePresence *gpresence; PurpleStatus *status; + PurpleAccount *account; - gpresence = purple_account_get_presence(js->gc->account); + account = purple_connection_get_account(js->gc); + gpresence = purple_account_get_presence(account); status = purple_presence_get_active_status(gpresence); jabber_presence_fake_to_self(js, status); } @@ -289,7 +291,7 @@ while(buddies) { b = buddies->data; g = purple_buddy_get_group(b); - groups = g_slist_append(groups, g->name); + groups = g_slist_append(groups, (char *)purple_group_get_name(g)); buddies = g_slist_remove(buddies, b); } } @@ -327,14 +329,16 @@ JabberBuddy *jb; JabberBuddyResource *jbr; char *my_bare_jid; + const char *name; if(!js->roster_parsed) return; - if(!(who = jabber_get_bare_jid(buddy->name))) + name = purple_buddy_get_name(buddy); + if(!(who = jabber_get_bare_jid(name))) return; - jb = jabber_buddy_find(js, buddy->name, FALSE); + jb = jabber_buddy_find(js, name, FALSE); jabber_roster_update(js, who, NULL); @@ -375,6 +379,7 @@ GSList *buddies, *groups = NULL; PurpleBuddy *b; PurpleGroup *g; + const char *gname; if(!old_group || !new_group || !strcmp(old_group, new_group)) return; @@ -383,10 +388,11 @@ while(buddies) { b = buddies->data; g = purple_buddy_get_group(b); - if(!strcmp(g->name, old_group)) + gname = purple_group_get_name(g); + if(!strcmp(gname, old_group)) groups = g_slist_append(groups, (char*)new_group); /* ick */ else - groups = g_slist_append(groups, g->name); + groups = g_slist_append(groups, (char*)gname); buddies = g_slist_remove(buddies, b); } jabber_roster_update(gc->proto_data, name, groups); @@ -397,15 +403,17 @@ PurpleGroup *group, GList *moved_buddies) { GList *l; + const char *gname = purple_group_get_name(group); for(l = moved_buddies; l; l = l->next) { PurpleBuddy *buddy = l->data; - jabber_roster_group_change(gc, buddy->name, old_name, group->name); + jabber_roster_group_change(gc, purple_buddy_get_name(buddy), old_name, gname); } } void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - GSList *buddies = purple_find_buddies(gc->account, buddy->name); + const char *name = purple_buddy_get_name(buddy); + GSList *buddies = purple_find_buddies(purple_connection_get_account(gc), name); buddies = g_slist_remove(buddies, buddy); if(buddies != NULL) { @@ -416,11 +424,11 @@ while(buddies) { tmpbuddy = buddies->data; tmpgroup = purple_buddy_get_group(tmpbuddy); - groups = g_slist_append(groups, tmpgroup->name); + groups = g_slist_append(groups, (char *)purple_group_get_name(tmpgroup)); buddies = g_slist_remove(buddies, tmpbuddy); } - jabber_roster_update(gc->proto_data, buddy->name, groups); + jabber_roster_update(gc->proto_data, name, groups); g_slist_free(groups); } else { JabberIq *iq = jabber_iq_new_query(gc->proto_data, JABBER_IQ_SET, @@ -428,7 +436,7 @@ xmlnode *query = xmlnode_get_child(iq->node, "query"); xmlnode *item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", buddy->name); + xmlnode_set_attrib(item, "jid", name); xmlnode_set_attrib(item, "subscription", "remove"); jabber_iq_send(iq);
--- a/libpurple/protocols/msn/contact.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/msn/contact.c Sat Sep 27 06:33:42 2008 +0000 @@ -730,6 +730,7 @@ MSN_INDIVIDUALS_GROUP_ID, MSN_INDIVIDUALS_GROUP_NAME); if ((purple_find_group(MSN_INDIVIDUALS_GROUP_NAME)) == NULL){ PurpleGroup *g = purple_group_new(MSN_INDIVIDUALS_GROUP_NAME); + purple_group_set_is_pseudo(g, TRUE); purple_blist_add_group(g, NULL); } @@ -738,6 +739,7 @@ purple_debug_misc("msn", "AB group_id:%s name:%s\n", MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME); if ((purple_find_group(MSN_NON_IM_GROUP_NAME)) == NULL) { PurpleGroup *g = purple_group_new(MSN_NON_IM_GROUP_NAME); + purple_group_set_is_pseudo(g, TRUE); purple_blist_add_group(g, NULL); }
--- a/libpurple/protocols/msn/msn.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Sat Sep 27 06:33:42 2008 +0000 @@ -459,23 +459,27 @@ PurpleConnection *gc; MsnSession *session; MsnMobileData *data; + 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); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); + name = purple_buddy_get_name(buddy); session = gc->proto_data; data = g_new0(MsnMobileData, 1); data->gc = gc; - data->passport = buddy->name; + data->passport = name; purple_request_input(gc, NULL, _("Send a mobile message."), NULL, NULL, TRUE, FALSE, NULL, _("Page"), G_CALLBACK(send_to_mobile_cb), _("Close"), G_CALLBACK(close_mobile_page_cb), - purple_connection_get_account(gc), purple_buddy_get_name(buddy), NULL, + account, name, NULL, data); } @@ -507,6 +511,7 @@ { PurpleBuddy *buddy; PurpleConnection *gc; + PurpleAccount *account; MsnSession *session; MsnSwitchBoard *swboard; @@ -516,13 +521,14 @@ 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); session = gc->proto_data; swboard = msn_switchboard_new(session); msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, buddy->name); + msn_switchboard_request_add_user(swboard, purple_buddy_get_name(buddy)); /* TODO: This might move somewhere else, after USR might be */ swboard->chat_id = msn_switchboard_get_chat_id(); @@ -530,9 +536,9 @@ swboard->flag = MSN_SB_FLAG_IM; /* Local alias > Display name > Username */ - if ((alias = purple_account_get_alias(buddy->account)) == NULL) + if ((alias = purple_account_get_alias(account)) == NULL) if ((alias = purple_connection_get_display_name(gc)) == NULL) - alias = purple_account_get_username(buddy->account); + alias = purple_account_get_username(account); purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), alias, NULL, PURPLE_CBFLAGS_NONE, TRUE); @@ -925,8 +931,8 @@ } } - if (g_ascii_strcasecmp(buddy->name, - purple_account_get_username(buddy->account))) + if (g_ascii_strcasecmp(purple_buddy_get_name(buddy), + purple_account_get_username(purple_buddy_get_account(buddy)))) { act = purple_menu_action_new(_("Initiate _Chat"), PURPLE_CALLBACK(initiate_chat_cb), @@ -1377,13 +1383,14 @@ { MsnSession *session; MsnUserList *userlist; - const char *who; + const char *who, *gname; session = gc->proto_data; userlist = session->userlist; - who = msn_normalize(gc->account, buddy->name); - - purple_debug_info("msn", "Add user:%s to group:%s\n", who, (group && group->name) ? group->name : "(null)"); + who = msn_normalize(purple_connection_get_account(gc), purple_buddy_get_name(buddy)); + + gname = group ? purple_group_get_name(group) : NULL; + purple_debug_info("msn", "Add user:%s to group:%s\n", who, gname ? gname : "(null)"); if (!session->logged_in) { #if 0 @@ -1417,7 +1424,7 @@ /* XXX - Would group ever be NULL here? I don't think so... * shx: Yes it should; MSN handles non-grouped buddies, and this is only * internal. */ - msn_userlist_add_buddy(userlist, who, group ? group->name : NULL); + msn_userlist_add_buddy(userlist, who, gname); } static void @@ -1433,7 +1440,7 @@ return; /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ - msn_userlist_rem_buddy(userlist, buddy->name); + msn_userlist_rem_buddy(userlist, purple_buddy_get_name(buddy)); } static void @@ -1686,20 +1693,22 @@ PurpleGroup *group, GList *moved_buddies) { MsnSession *session; + const char *gname; session = gc->proto_data; g_return_if_fail(session != NULL); g_return_if_fail(session->userlist != NULL); + gname = purple_group_get_name(group); if (msn_userlist_find_group_with_name(session->userlist, old_name) != NULL) { - msn_contact_rename_group(session, old_name, group->name); + msn_contact_rename_group(session, old_name, gname); } else { /* not found */ - msn_add_group(session, NULL, group->name); + msn_add_group(session, NULL, gname); } } @@ -1759,20 +1768,22 @@ { MsnSession *session; MsnCmdProc *cmdproc; + const char *gname; session = gc->proto_data; cmdproc = session->notification->cmdproc; - - purple_debug_info("msn", "Remove group %s\n", group->name); + gname = purple_group_get_name(group); + + purple_debug_info("msn", "Remove group %s\n", gname); /*we can't delete the default group*/ - if(!strcmp(group->name, MSN_INDIVIDUALS_GROUP_NAME)|| - !strcmp(group->name, MSN_NON_IM_GROUP_NAME)) + if(!strcmp(gname, MSN_INDIVIDUALS_GROUP_NAME)|| + !strcmp(gname, MSN_NON_IM_GROUP_NAME)) { purple_debug_info("msn", "This group can't be removed, returning.\n"); return ; } - msn_del_group(session, group->name); + msn_del_group(session, gname); } /** @@ -1789,6 +1800,7 @@ if (b) { char *tmp; + const char *alias; if (b->alias && b->alias[0]) { @@ -1797,9 +1809,9 @@ g_free(aliastext); } - if (b->server_alias) + if ((alias = purple_buddy_get_server_alias(b)) != NULL) { - char *nicktext = g_markup_escape_text(b->server_alias, -1); + char *nicktext = g_markup_escape_text(alias, -1); tmp = g_strdup_printf("<font sml=\"msn\">%s</font><br>", nicktext); purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); g_free(tmp);
--- a/libpurple/protocols/msn/session.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/msn/session.c Sat Sep 27 06:33:42 2008 +0000 @@ -274,12 +274,12 @@ * being logged in. This no longer happens, so we manually iterate * over the whole buddy list to identify sync issues. */ - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { PurpleGroup *group = (PurpleGroup *)gnode; const char *group_name; if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; - group_name = group->name; + group_name = purple_group_get_name(group); for(cnode = gnode->child; cnode; cnode = cnode->next) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue;
--- a/libpurple/protocols/msn/user.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/msn/user.c Sat Sep 27 06:33:42 2008 +0000 @@ -273,7 +273,11 @@ if (b == NULL) { b = purple_buddy_new(account, passport, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); + if (group_id && (!strcmp(group_id, MSN_INDIVIDUALS_GROUP_ID) || + !strcmp(group_id, MSN_NON_IM_GROUP_ID))) + purple_blist_add_buddy_pseudo_group(b, NULL, g, NULL); + else + purple_blist_add_buddy(b, NULL, g, NULL); } b->proto_data = user; /*Update the blist Node info*/
--- a/libpurple/protocols/msn/userlist.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/msn/userlist.c Sat Sep 27 06:33:42 2008 +0000 @@ -849,13 +849,14 @@ msn_userlist_load(MsnSession *session) { PurpleBlistNode *gnode, *cnode, *bnode; - PurpleConnection *gc = purple_account_get_connection(session->account); + PurpleAccount *account = session->account; + PurpleConnection *gc = purple_account_get_connection(account); GSList *l; MsnUser * user; g_return_if_fail(gc != NULL); - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -869,10 +870,10 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; - if (b->account == gc->account) + if (purple_buddy_get_account(b) == account) { user = msn_userlist_find_add_user(session->userlist, - b->name,NULL); + purple_buddy_get_name(b), NULL); b->proto_data = user; msn_user_set_op(user, MSN_LIST_FL_OP); }
--- 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. */
--- a/libpurple/protocols/myspace/user.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/myspace/user.c Sat Sep 27 06:33:42 2008 +0000 @@ -105,7 +105,7 @@ purple_notify_user_info_add_pair(user_info, _("User"), user->username); } - uid = purple_blist_node_get_int(&user->buddy->node, "UserID"); + uid = purple_blist_node_get_int((PurpleBlistNode *)user->buddy, "UserID"); if (full) { /* TODO: link to username, if available */ @@ -198,7 +198,9 @@ static void msim_set_artist_or_title(MsimUser *user, const char *new_artist, const char *new_title) { PurplePresence *presence; + PurpleAccount *account; const char *prev_artist, *prev_title; + const char *name; prev_artist = NULL; prev_title = NULL; @@ -208,8 +210,11 @@ if (new_title && !strlen(new_title)) new_title = NULL; + account = purple_buddy_get_account(user->buddy); + name = purple_buddy_get_name(user->buddy); + if (!new_artist && !new_title) { - purple_prpl_got_user_status_deactive(user->buddy->account, user->buddy->name, "tune"); + purple_prpl_got_user_status_deactive(account, name, "tune"); return; } @@ -229,7 +234,7 @@ if (!new_title) new_title = prev_title; - purple_prpl_got_user_status(user->buddy->account, user->buddy->name, "tune", + purple_prpl_got_user_status(account, name, "tune", PURPLE_TUNE_TITLE, new_title, PURPLE_TUNE_ARTIST, new_artist, NULL); @@ -245,12 +250,13 @@ void msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user) { + const char *name = user->buddy ? purple_buddy_get_name(user->buddy) : NULL; if (g_str_equal(key_str, "UserID") || g_str_equal(key_str, "ContactID")) { /* Save to buddy list, if it exists, for quick cached uid lookup with msim_uid2username_from_blist(). */ if (user->buddy) { - purple_debug_info("msim", "associating uid %s with username %s\n", key_str, user->buddy->name); - purple_blist_node_set_int(&user->buddy->node, "UserID", atol(value_str)); + purple_debug_info("msim", "associating uid %s with username %s\n", key_str, name); + purple_blist_node_set_int((PurpleBlistNode *)user->buddy, "UserID", atol(value_str)); } /* Need to store in MsimUser, too? What if not on blist? */ } else if (g_str_equal(key_str, "Age")) { @@ -300,9 +306,8 @@ /* Instead of showing 'no photo' picture, show nothing. */ if (g_str_equal(user->image_url, "http://x.myspace.com/images/no_pic.gif")) { - purple_buddy_icons_set_for_user(user->buddy->account, - user->buddy->name, - NULL, 0, NULL); + purple_buddy_icons_set_for_user(purple_buddy_get_account(user->buddy), + name, NULL, 0, NULL); return; } @@ -539,8 +544,10 @@ const gchar *error_message) { MsimUser *user; + const char *name; user = (MsimUser *)user_data; + name = purple_buddy_get_name(user->buddy); purple_debug_info("msim_downloaded_buddy_icon", "Downloaded %" G_GSIZE_FORMAT " bytes\n", len); @@ -548,13 +555,12 @@ if (!url_text) { purple_debug_info("msim_downloaded_buddy_icon", "failed to download icon for %s", - user->buddy->name); + name); return; } - purple_buddy_icons_set_for_user(user->buddy->account, - user->buddy->name, - g_memdup((gchar *)url_text, len), len, + purple_buddy_icons_set_for_user(purple_buddy_get_account(user->buddy), + name, g_memdup((gchar *)url_text, len), len, /* Use URL itself as buddy icon "checksum" (TODO: ETag) */ user->image_url); /* checksum */ }
--- a/libpurple/protocols/myspace/zap.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/myspace/zap.c Sat Sep 27 06:33:42 2008 +0000 @@ -177,13 +177,13 @@ buddy = (PurpleBuddy *)node; /* Find the session */ - account = buddy->account; + account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); session = (MsimSession *)gc->proto_data; zap = GPOINTER_TO_INT(zap_num_ptr); - purple_prpl_send_attention(session->gc, buddy->name, zap); + purple_prpl_send_attention(session->gc, purple_buddy_get_name(buddy), zap); } /** Return menu, if any, for a buddy list node. */
--- a/libpurple/protocols/novell/novell.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/novell/novell.c Sat Sep 27 06:33:42 2008 +0000 @@ -293,7 +293,7 @@ nm_user_record_get_display_id(user_record)); alias = purple_buddy_get_alias(buddy); - if (alias == NULL || *alias == '\0' || (strcmp(alias, buddy->name) == 0)) { + if (alias == NULL || *alias == '\0' || (strcmp(alias, purple_buddy_get_name(buddy)) == 0)) { purple_blist_alias_buddy(buddy, nm_user_record_get_full_name(user_record)); @@ -1175,10 +1175,12 @@ const char *status_id; const char *text = NULL; const char *dn; + const char *name; int idle = 0; gboolean loggedin = TRUE; - account = buddy->account; + account = purple_buddy_get_account(buddy); + name = purple_buddy_get_name(buddy); switch (novellstatus) { case NM_STATUS_AVAILABLE: @@ -1205,7 +1207,7 @@ } /* Get status text for the user */ - dn = nm_lookup_dn(user, buddy->name); + dn = nm_lookup_dn(user, name); if (dn) { NMUserRecord *user_record = nm_find_user_record(user, dn); if (user_record) { @@ -1213,9 +1215,9 @@ } } - purple_prpl_got_user_status(account, buddy->name, status_id, + purple_prpl_got_user_status(account, name, status_id, "message", text, NULL); - purple_prpl_got_user_idle(account, buddy->name, + purple_prpl_got_user_idle(account, name, (novellstatus == NM_STATUS_AWAY_IDLE), idle); } @@ -1230,44 +1232,41 @@ PurpleBlistNode *bnode; PurpleGroup *group; PurpleBuddy *buddy; - PurpleBuddyList *blist; GSList *rem_list = NULL; GSList *l; NMFolder *folder = NULL; const char *gname = NULL; - if ((blist = purple_get_blist())) { - for (gnode = blist->root; gnode; gnode = gnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { + if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + continue; + group = (PurpleGroup *) gnode; + gname = purple_group_get_name(group); + for (cnode = gnode->child; cnode; cnode = cnode->next) { + if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; - group = (PurpleGroup *) gnode; - for (cnode = gnode->child; cnode; cnode = cnode->next) { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) + for (bnode = cnode->child; bnode; bnode = bnode->next) { + if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - for (bnode = cnode->child; bnode; bnode = bnode->next) { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *) bnode; - if (buddy->account == user->client_data) { - gname = group->name; - if (strcmp(group->name, NM_ROOT_FOLDER_NAME) == 0) - gname = ""; - folder = nm_find_folder(user, gname); - if (folder == NULL || - !nm_folder_find_contact_by_display_id(folder, buddy->name)) { - rem_list = g_slist_append(rem_list, buddy); - } + buddy = (PurpleBuddy *) bnode; + if (purple_buddy_get_account(buddy) == user->client_data) { + if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) + gname = ""; + folder = nm_find_folder(user, gname); + if (folder == NULL || + !nm_folder_find_contact_by_display_id(folder, purple_buddy_get_name(buddy))) { + rem_list = g_slist_append(rem_list, buddy); } } } } - - if (rem_list) { - for (l = rem_list; l; l = l->next) { - purple_blist_remove_buddy(l->data); - } - g_slist_free(rem_list); + } + + if (rem_list) { + for (l = rem_list; l; l = l->next) { + purple_blist_remove_buddy(l->data); } + g_slist_free(rem_list); } } @@ -1613,14 +1612,14 @@ 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)); user = gc->proto_data; if (user == NULL) return; /* We should already have a userrecord for the buddy */ - user_record = nm_find_user_record(user, buddy->name); + user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); if (user_record == NULL) return; @@ -2538,7 +2537,7 @@ NMContact *contact; NMUser *user; NMERR_T rc = NM_OK; - const char *alias, *gname; + const char *alias, *gname, *bname; if (gc == NULL || buddy == NULL || group == NULL) return; @@ -2554,22 +2553,22 @@ return; contact = nm_create_contact(); - nm_contact_set_dn(contact, buddy->name); + nm_contact_set_dn(contact, purple_buddy_get_name(buddy)); /* Remove the PurpleBuddy (we will add it back after adding it * to the server side list). Save the alias if there is one. */ alias = purple_buddy_get_alias(buddy); - if (alias && strcmp(alias, buddy->name)) + bname = purple_buddy_get_name(buddy); + if (alias && strcmp(alias, bname)) nm_contact_set_display_name(contact, alias); purple_blist_remove_buddy(buddy); buddy = NULL; - if (strcmp(group->name, NM_ROOT_FOLDER_NAME) == 0) { + gname = purple_group_get_name(group); + if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { gname = ""; - } else { - gname = group->name; } folder = nm_find_folder(user, gname); @@ -2603,11 +2602,10 @@ return; user = (NMUser *) gc->proto_data; - if (user && (dn = nm_lookup_dn(user, buddy->name))) { - if (strcmp(group->name, NM_ROOT_FOLDER_NAME) == 0) { + if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { + gname = purple_group_get_name(group); + if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { gname = ""; - } else { - gname = group->name; } folder = nm_find_folder(user, gname); if (folder) { @@ -2637,7 +2635,7 @@ user = (NMUser *) gc->proto_data; if (user) { - NMFolder *folder = nm_find_folder(user, group->name); + NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); if (folder) { rc = nm_send_remove_folder(user, folder, @@ -2777,8 +2775,9 @@ user = gc->proto_data; if (user) { + const char *gname = purple_group_get_name(group); /* Does new folder exist already? */ - if (nm_find_folder(user, group->name)) { + if (nm_find_folder(user, gname)) { /* purple_blist_rename_group() adds the buddies * to the new group and removes the old group... * so there is nothing more to do here. @@ -2793,7 +2792,7 @@ folder = nm_find_folder(user, old_name); if (folder) { - rc = nm_send_rename_folder(user, folder, group->name, + rc = nm_send_rename_folder(user, folder, gname, _rename_folder_resp_cb, NULL); _check_for_disconnect(user, rc); } @@ -2819,12 +2818,12 @@ if (buddy == NULL) return; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); if (gc == NULL || (user = gc->proto_data) == NULL) return; if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - user_record = nm_find_user_record(user, buddy->name); + user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); if (user_record) { status = nm_user_record_get_status(user_record); text = nm_user_record_get_status_text(user_record); @@ -2923,14 +2922,16 @@ { const char *text = NULL; const char *dn = NULL; - - if (buddy && buddy->account) { - PurpleConnection *gc = purple_account_get_connection(buddy->account); + PurpleAccount *account; + + account = buddy ? purple_buddy_get_account(buddy) : NULL; + if (buddy && account) { + PurpleConnection *gc = purple_account_get_connection(account); if (gc && gc->proto_data) { NMUser *user = gc->proto_data; - dn = nm_lookup_dn(user, buddy->name); + dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); if (dn) { NMUserRecord *user_record = nm_find_user_record(user, dn);
--- a/libpurple/protocols/oscar/oscar.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sat Sep 27 06:33:42 2008 +0000 @@ -796,11 +796,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; @@ -873,7 +875,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); @@ -890,8 +892,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"), @@ -920,6 +922,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); @@ -927,14 +930,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); } @@ -958,8 +963,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); @@ -2441,6 +2446,7 @@ PurpleAccount *account; PurpleBuddy *buddy; PurpleGroup *group; + const char *bname, *gname; gc = data->gc; od = gc->proto_data; @@ -2453,15 +2459,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); @@ -2501,8 +2509,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 */ @@ -3887,9 +3895,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; @@ -3906,7 +3914,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); @@ -3915,7 +3923,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); @@ -3950,7 +3958,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); @@ -3986,7 +3994,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); @@ -4020,7 +4028,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); @@ -4788,14 +4796,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); @@ -4805,34 +4816,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); } } @@ -4864,7 +4875,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); @@ -4881,18 +4893,18 @@ 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) { @@ -5001,33 +5013,37 @@ /* 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 = gnode->next) { + const char *gname; if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; g = (PurpleGroup *)gnode; + gname = purple_group_get_name(g); for (cnode = gnode->child; cnode; cnode = cnode->next) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; for (bnode = cnode->child; bnode; bnode = bnode->next) { + 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; 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); + alias = aim_ssi_getalias(od->ssi.local, gname, bname); if (!alias && b->alias && strlen(b->alias)) - aim_ssi_aliasbuddy(od, g->name, b->name, b->alias); + aim_ssi_aliasbuddy(od, gname, bname, b->alias); 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); } @@ -5123,15 +5139,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)) { @@ -5144,7 +5160,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); @@ -5358,13 +5374,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); } } @@ -5696,7 +5710,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"; @@ -5704,14 +5719,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"; @@ -5719,7 +5735,7 @@ return "aim"; } - if (aim_snvalid_icq(b->name)) + if (aim_snvalid_icq(name)) return "icq"; return "aim"; } @@ -5733,14 +5749,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); @@ -5748,9 +5766,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"; } } @@ -5773,15 +5791,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); @@ -5809,8 +5829,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")); @@ -6055,7 +6076,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); @@ -6073,22 +6094,26 @@ 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; data = g_new(struct name_data, 1); if (!(g = purple_buddy_get_group(buddy))) return; - 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); @@ -6096,7 +6121,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); @@ -6128,26 +6153,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)); @@ -6163,7 +6190,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); } @@ -6176,13 +6203,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), @@ -6206,7 +6236,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) @@ -6230,8 +6260,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), @@ -6388,26 +6418,32 @@ 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 = gnode->next) { PurpleGroup *group = (PurpleGroup *)gnode; + const char *gname; if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; + gname = purple_group_get_name(group); for (cnode = gnode->child; cnode; cnode = cnode->next) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; for (bnode = cnode->child; bnode; bnode = bnode->next) { 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;
--- a/libpurple/protocols/qq/buddy_opt.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/qq/buddy_opt.c Sat Sep 27 06:33:42 2008 +0000 @@ -240,6 +240,7 @@ uid = g->uid; g_return_if_fail(uid > 0); + /* XXX: This looks very wrong */ buddy.name = uid_to_purple_name(uid); group.name = PURPLE_GROUP_QQ_BLOCKED; @@ -460,16 +461,18 @@ qq_data *qd; guint32 uid; PurpleBuddy *b; + const char *bname; qd = (qq_data *) gc->proto_data; if (!qd->is_login) return; /* IMPORTANT ! */ - uid = purple_name_to_uid(buddy->name); + bname = purple_buddy_get_name(buddy); + uid = purple_name_to_uid(bname); if (uid > 0) _qq_send_packet_add_buddy(gc, uid); else { - b = purple_find_buddy(gc->account, buddy->name); + b = purple_find_buddy(gc->account, bname); if (b != NULL) purple_blist_remove_buddy(b); purple_notify_error(gc, NULL, @@ -485,9 +488,11 @@ PurpleBuddy *b; qq_buddy *q_bud; guint32 uid; + const char *bname; qd = (qq_data *) gc->proto_data; - uid = purple_name_to_uid(buddy->name); + bname = purple_buddy_get_name(buddy); + uid = purple_name_to_uid(bname); if (!qd->is_login) return; @@ -495,17 +500,17 @@ if (uid > 0) _qq_send_packet_remove_buddy(gc, uid); - b = purple_find_buddy(gc->account, buddy->name); + b = purple_find_buddy(gc->account, bname); if (b != NULL) { q_bud = (qq_buddy *) b->proto_data; if (q_bud != NULL) qd->buddies = g_list_remove(qd->buddies, q_bud); else - purple_debug_warning("QQ", "We have no qq_buddy record for %s\n", buddy->name); + purple_debug_warning("QQ", "We have no qq_buddy record for %s\n", bname); /* remove buddy on blist, this does not trigger qq_remove_buddy again * do this only if the request comes from block request, * otherwise purple segmentation fault */ - if (g_ascii_strcasecmp(group->name, PURPLE_GROUP_QQ_BLOCKED) == 0) + if (g_ascii_strcasecmp(purple_group_get_name(group), PURPLE_GROUP_QQ_BLOCKED) == 0) purple_blist_remove_buddy(b); } }
--- a/libpurple/protocols/qq/group.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/qq/group.c Sat Sep 27 06:33:42 2008 +0000 @@ -168,9 +168,9 @@ } /* got one */ chat = (PurpleChat *) node; - if (account != chat->account) /* not qq account*/ + if (account != purple_chat_get_account(chat)) /* not qq account*/ continue; - group = qq_room_create_by_hashtable(gc, chat->components); + group = qq_room_create_by_hashtable(gc, purple_chat_get_components(chat)); if (group == NULL) continue;
--- a/libpurple/protocols/qq/group_internal.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/qq/group_internal.c Sat Sep 27 06:33:42 2008 +0000 @@ -178,6 +178,7 @@ void qq_group_refresh(PurpleConnection *gc, qq_group *group) { PurpleChat *chat; + GHashTable *components; gchar *ext_id; g_return_if_fail(group != NULL); @@ -193,33 +194,35 @@ return; } + components = purple_chat_get_components(chat); + /* we have a local record, update its info */ /* if there is title_utf8, we update the group name */ if (group->title_utf8 != NULL && strlen(group->title_utf8) > 0) purple_blist_alias_chat(chat, group->title_utf8); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_ROLE), g_strdup_printf("%d", group->my_role)); group->my_role_desc = get_role_desc(group); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_ROLE_DESC), g_strdup(group->my_role_desc)); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_INTERNAL_ID), g_strdup_printf("%d", group->id)); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_EXTERNAL_ID), g_strdup_printf("%d", group->ext_id)); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_TYPE), g_strdup_printf("%d", group->type8)); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_CREATOR_UID), g_strdup_printf("%d", group->creator_uid)); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_CATEGORY), g_strdup_printf("%d", group->category)); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_AUTH_TYPE), g_strdup_printf("%d", group->auth_type)); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_TITLE_UTF8), g_strdup(group->title_utf8)); - g_hash_table_replace(chat->components, + g_hash_table_replace(components, g_strdup(QQ_ROOM_KEY_DESC_UTF8), g_strdup(group->desc_utf8)); }
--- a/libpurple/protocols/qq/qq.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/qq/qq.c Sat Sep 27 06:33:42 2008 +0000 @@ -585,11 +585,14 @@ static void _qq_menu_unsubscribe_group(PurpleBlistNode * node) { PurpleChat *chat = (PurpleChat *)node; - PurpleConnection *gc = purple_account_get_connection(chat->account); - GHashTable *components = chat -> components; + PurpleConnection *gc; + GHashTable *components; g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); + gc = purple_account_get_connection(purple_chat_get_account(chat)); + components = purple_chat_get_components(chat); + g_return_if_fail(components != NULL); qq_group_exit(gc, components); }
--- a/libpurple/protocols/sametime/sametime.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/sametime/sametime.c Sat Sep 27 06:33:42 2008 +0000 @@ -658,7 +658,6 @@ */ PurpleAccount *acct; - PurpleBuddyList *blist; PurpleBlistNode *gn, *cn, *bn; PurpleGroup *grp; PurpleBuddy *bdy; @@ -669,10 +668,7 @@ acct = purple_connection_get_account(gc); g_return_if_fail(acct != NULL); - blist = purple_get_blist(); - g_return_if_fail(blist != NULL); - - for(gn = blist->root; gn; gn = gn->next) { + for(gn = purple_blist_get_root(); gn; gn = gn->next) { const char *owner; const char *gname; enum mwSametimeGroupType gtype; @@ -697,13 +693,13 @@ /* the group's actual name may be different from the purple group's name. Find whichever is there */ gname = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - if(! gname) gname = grp->name; + if(! gname) gname = purple_group_get_name(grp); /* we save this, but never actually honor it */ gopen = ! purple_blist_node_get_bool(gn, GROUP_KEY_COLLAPSED); stg = mwSametimeGroup_new(stlist, gtype, gname); - mwSametimeGroup_setAlias(stg, grp->name); + mwSametimeGroup_setAlias(stg, purple_group_get_name(grp)); mwSametimeGroup_setOpen(stg, gopen); /* don't attempt to put buddies in a dynamic group, it breaks @@ -720,17 +716,17 @@ bdy = (PurpleBuddy *) bn; - if(bdy->account == acct) { + if(purple_buddy_get_account(bdy) == acct) { struct mwSametimeUser *stu; enum mwSametimeUserType utype; - idb.user = bdy->name; + idb.user = (char *)purple_buddy_get_name(bdy); utype = purple_blist_node_get_int(bn, BUDDY_KEY_TYPE); if(! utype) utype = mwSametimeUser_NORMAL; stu = mwSametimeUser_new(stg, utype, &idb); - mwSametimeUser_setShortName(stu, bdy->server_alias); + mwSametimeUser_setShortName(stu, purple_buddy_get_server_alias(bdy)); mwSametimeUser_setAlias(stu, bdy->alias); } } @@ -811,7 +807,7 @@ static gboolean buddy_is_external(PurpleBuddy *b) { g_return_val_if_fail(b != NULL, FALSE); - return purple_str_has_prefix(b->name, "@E "); + return purple_str_has_prefix(purple_buddy_get_name(b), "@E "); } @@ -820,7 +816,7 @@ static void buddy_add(struct mwPurplePluginData *pd, PurpleBuddy *buddy) { - struct mwAwareIdBlock idb = { mwAware_USER, (char *) buddy->name, NULL }; + struct mwAwareIdBlock idb = { mwAware_USER, (char *) purple_buddy_get_name(buddy), NULL }; struct mwAwareList *list; PurpleGroup *group; @@ -885,7 +881,7 @@ GList *add; n = purple_blist_node_get_string((PurpleBlistNode *) group, GROUP_KEY_NAME); - if(! n) n = group->name; + if(! n) n = purple_group_get_name(group); idb.user = (char *) n; add = g_list_prepend(NULL, &idb); @@ -921,7 +917,7 @@ NSTR(name), NSTR(alias)); /* first attempt at finding the group, by the name key */ - for(gn = blist->root; gn; gn = gn->next) { + for(gn = purple_blist_get_root(); gn; gn = gn->next) { const char *n, *o; if(! PURPLE_BLIST_NODE_IS_GROUP(gn)) continue; n = purple_blist_node_get_string(gn, GROUP_KEY_NAME); @@ -1001,7 +997,7 @@ g_return_if_fail(group != NULL); - DEBUG_INFO("clearing members from pruned group %s\n", NSTR(group->name)); + DEBUG_INFO("clearing members from pruned group %s\n", NSTR(purple_group_get_name(group))); gc = purple_account_get_connection(acct); g_return_if_fail(gc != NULL); @@ -1016,8 +1012,8 @@ if(! PURPLE_BLIST_NODE_IS_BUDDY(bn)) continue; - if(gb->account == acct) { - DEBUG_INFO("clearing %s from group\n", NSTR(gb->name)); + if(purple_buddy_get_account(gb) == acct) { + DEBUG_INFO("clearing %s from group\n", NSTR(purple_buddy_get_name(gb))); prune = g_list_prepend(prune, gb); } } @@ -1054,7 +1050,7 @@ g_return_if_fail(group != NULL); - DEBUG_INFO("pruning membership of group %s\n", NSTR(group->name)); + DEBUG_INFO("pruning membership of group %s\n", NSTR(purple_group_get_name(group))); acct = purple_connection_get_account(gc); g_return_if_fail(acct != NULL); @@ -1083,8 +1079,8 @@ /* if the account is correct and they're not in our table, mark them for pruning */ - if(gb->account == acct && !g_hash_table_lookup(stusers, gb->name)) { - DEBUG_INFO("marking %s for pruning\n", NSTR(gb->name)); + if(purple_buddy_get_account(gb) == acct && !g_hash_table_lookup(stusers, purple_buddy_get_name(gb))) { + DEBUG_INFO("marking %s for pruning\n", NSTR(purple_buddy_get_name(gb))); prune = g_list_prepend(prune, gb); } } @@ -1140,7 +1136,7 @@ g_list_free(gtl); /* find all groups which should be pruned from the local list */ - for(gn = blist->root; gn; gn = gn->next) { + for(gn = purple_blist_get_root(); gn; gn = gn->next) { PurpleGroup *grp = (PurpleGroup *) gn; const char *gname, *owner; struct mwSametimeGroup *stgrp; @@ -1159,12 +1155,12 @@ /* we actually are synching by this key as opposed to the group title, which can be different things in the st list */ gname = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - if(! gname) gname = grp->name; + if(! gname) gname = purple_group_get_name(grp); stgrp = g_hash_table_lookup(stgroups, gname); if(! stgrp) { /* remove the whole group */ - DEBUG_INFO("marking group %s for pruning\n", grp->name); + DEBUG_INFO("marking group %s for pruning\n", purple_group_get_name(grp)); g_prune = g_list_prepend(g_prune, grp); } else { @@ -1279,6 +1275,7 @@ GString *str; char *tmp; + const char *gname; g_return_if_fail(pd != NULL); @@ -1290,11 +1287,12 @@ str = g_string_new(NULL); tmp = (char *) purple_blist_node_get_string(node, GROUP_KEY_NAME); - - g_string_append_printf(str, _("<b>Group Title:</b> %s<br>"), group->name); + gname = purple_group_get_name(group); + + g_string_append_printf(str, _("<b>Group Title:</b> %s<br>"), gname); g_string_append_printf(str, _("<b>Notes Group ID:</b> %s<br>"), tmp); - tmp = g_strdup_printf(_("Info for Group %s"), group->name); + tmp = g_strdup_printf(_("Info for Group %s"), gname); purple_notify_formatted(gc, tmp, _("Notes Address Book Information"), NULL, str->str, NULL, NULL); @@ -1351,7 +1349,7 @@ PurpleBlistNode *gnode, *cnode, *bnode; GList *add_buds = NULL; - for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for(gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if(! PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for(cnode = gnode->child; cnode; cnode = cnode->next) { @@ -1363,7 +1361,7 @@ continue; b = (PurpleBuddy *)bnode; - if(b->account == acct) { + if(purple_buddy_get_account(b) == acct) { add_buds = g_list_append(add_buds, b); } } @@ -1383,7 +1381,6 @@ PurpleConnection *gc; PurpleAccount *acct; struct mwStorageUnit *unit; - PurpleBuddyList *blist; PurpleBlistNode *l; gc = pd->gc; @@ -1394,8 +1391,7 @@ mwServiceStorage_load(pd->srvc_store, unit, fetch_blist_cb, pd, NULL); /* find all the NAB groups and subscribe to them */ - blist = purple_get_blist(); - for(l = blist->root; l; l = l->next) { + for(l = purple_blist_get_root(); l; l = l->next) { PurpleGroup *group = (PurpleGroup *) l; enum mwSametimeGroupType gt; const char *owner; @@ -3234,10 +3230,10 @@ static char *mw_prpl_status_text(PurpleBuddy *b) { PurpleConnection *gc; struct mwPurplePluginData *pd; - struct mwAwareIdBlock t = { mwAware_USER, b->name, NULL }; + struct mwAwareIdBlock t = { mwAware_USER, (char *)purple_buddy_get_name(b), NULL }; const char *ret = NULL; - if ((gc = purple_account_get_connection(b->account)) + if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) && (pd = gc->proto_data)) ret = mwServiceAware_getText(pd->srvc_aware, &t); @@ -3294,13 +3290,13 @@ static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { PurpleConnection *gc; struct mwPurplePluginData *pd = NULL; - struct mwAwareIdBlock idb = { mwAware_USER, b->name, NULL }; + struct mwAwareIdBlock idb = { mwAware_USER, (char *)purple_buddy_get_name(b), NULL }; const char *message = NULL; const char *status; char *tmp; - if ((gc = purple_account_get_connection(b->account)) + if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) && (pd = gc->proto_data)) message = mwServiceAware_getText(pd->srvc_aware, &idb); @@ -3316,7 +3312,7 @@ } if(full && pd != NULL) { - tmp = user_supports_text(pd->srvc_aware, b->name); + tmp = user_supports_text(pd->srvc_aware, purple_buddy_get_name(b)); if(tmp) { purple_notify_user_info_add_pair(user_info, _("Supports"), tmp); g_free(tmp); @@ -3378,7 +3374,7 @@ struct mwConference *conf; struct mwIdBlock idb = { NULL, NULL }; - acct = buddy->account; + acct = purple_buddy_get_account(buddy); gc = purple_account_get_connection(acct); pd = gc->proto_data; srvc = pd->srvc_conf; @@ -3392,7 +3388,7 @@ conf = mwConference_new(srvc, topic); mwConference_open(conf); - idb.user = buddy->name; + idb.user = (char *)purple_buddy_get_name(buddy); mwConference_invite(conf, &idb, invite); } @@ -3412,7 +3408,7 @@ g_return_if_fail(buddy != NULL); - acct = buddy->account; + acct = purple_buddy_get_account(buddy); g_return_if_fail(acct != NULL); gc = purple_account_get_connection(acct); @@ -3432,7 +3428,7 @@ msgA = _("Create conference with user"); msgB = _("Please enter a topic for the new conference, and an invitation" " message to be sent to %s"); - msg1 = g_strdup_printf(msgB, buddy->name); + msg1 = g_strdup_printf(msgB, purple_buddy_get_name(buddy)); purple_request_fields(gc, _("New Conference"), msgA, msg1, fields, @@ -3469,7 +3465,7 @@ blist_menu_conf_create(buddy, msg); } else { - struct mwIdBlock idb = { buddy->name, NULL }; + struct mwIdBlock idb = { (char *)purple_buddy_get_name(buddy), NULL }; mwConference_invite(d, &idb, msg); } } @@ -3490,7 +3486,7 @@ const char *msgB; char *msg; - acct = buddy->account; + acct = purple_buddy_get_account(buddy); g_return_if_fail(acct != NULL); gc = purple_account_get_connection(acct); @@ -3518,7 +3514,7 @@ msgB = _("Select a conference from the list below to send an invite to" " user %s. Select \"Create New Conference\" if you'd like to" " create a new conference to invite this user to."); - msg = g_strdup_printf(msgB, buddy->name); + msg = g_strdup_printf(msgB, purple_buddy_get_name(buddy)); purple_request_fields(gc, _("Invite to Conference"), msgA, msg, fields, @@ -3540,7 +3536,7 @@ g_return_if_fail(node != NULL); g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - acct = buddy->account; + acct = purple_buddy_get_account(buddy); g_return_if_fail(acct != NULL); gc = purple_account_get_connection(acct); @@ -4180,8 +4176,8 @@ if(b) { guint32 type; - if(b->server_alias) { - purple_notify_user_info_add_pair(user_info, _("Full Name"), b->server_alias); + if(purple_buddy_get_server_alias(b)) { + purple_notify_user_info_add_pair(user_info, _("Full Name"), purple_buddy_get_server_alias(b)); } type = purple_blist_node_get_int((PurpleBlistNode *) b, BUDDY_KEY_CLIENT); @@ -4323,10 +4319,10 @@ static void notify_add(PurpleConnection *gc, GList *row, void *user_data) { BuddyAddData *data = user_data; - char *group_name = NULL; + const char *group_name = NULL; if (data && data->group) { - group_name = data->group->name; + group_name = purple_group_get_name(data->group); } purple_blist_request_add_buddy(purple_connection_get_account(gc), @@ -4408,14 +4404,14 @@ buddy = data->buddy; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); pd = gc->proto_data; if(results) res = results->data; if(!code && res && res->matches) { - if(g_list_length(res->matches) == 1) { + if(res->matches->next == NULL) { struct mwResolveMatch *match = res->matches->data; /* only one? that might be the right one! */ @@ -4511,7 +4507,7 @@ return; } - query = g_list_prepend(NULL, buddy->name); + query = g_list_prepend(NULL, (char *)purple_buddy_get_name(buddy)); flags = mwResolveFlag_FIRST | mwResolveFlag_USERS; req = mwServiceResolve_resolve(srvc, query, flags, add_buddy_resolved, @@ -4564,7 +4560,7 @@ /* convert PurpleBuddy into a mwAwareIdBlock */ idb->type = mwAware_USER; - idb->user = (char *) b->name; + idb->user = (char *) purple_buddy_get_name(b); idb->community = NULL; /* put idb into the list associated with the buddy's group */ @@ -4589,7 +4585,7 @@ PurpleBuddy *buddy, PurpleGroup *group) { struct mwPurplePluginData *pd; - struct mwAwareIdBlock idb = { mwAware_USER, buddy->name, NULL }; + struct mwAwareIdBlock idb = { mwAware_USER, (char *)purple_buddy_get_name(buddy), NULL }; struct mwAwareList *list; GList *rem = g_list_prepend(NULL, &idb);
--- a/libpurple/protocols/silc/buddy.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/silc/buddy.c Sat Sep 27 06:33:42 2008 +0000 @@ -322,9 +322,12 @@ silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data) { PurpleBuddy *buddy; + PurpleAccount *account; buddy = (PurpleBuddy *)node; - silcpurple_buddy_keyagr_do(buddy->account->gc, buddy->name, FALSE); + account = purple_buddy_get_account(buddy); + silcpurple_buddy_keyagr_do(purple_account_get_connection(account), + purple_buddy_get_name(buddy), FALSE); } @@ -341,12 +344,12 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); + gc = purple_account_get_connection(purple_buddy_get_account(b)); sg = gc->proto_data; /* Find client entry */ clients = silc_client_get_clients_local(sg->client, sg->conn, - b->name, FALSE); + purple_buddy_get_name(b), FALSE); if (!clients) return; @@ -467,9 +470,9 @@ 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)); - silcpurple_buddy_privkey(gc, buddy->name); + silcpurple_buddy_privkey(gc, purple_buddy_get_name(buddy)); } @@ -596,9 +599,9 @@ 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)); - silcpurple_buddy_getkey(gc, buddy->name); + silcpurple_buddy_getkey(gc, purple_buddy_get_name(buddy)); } static void @@ -613,7 +616,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); + gc = purple_account_get_connection(purple_buddy_get_account(b)); sg = gc->proto_data; pkfile = purple_blist_node_get_string(node, "public-key"); @@ -624,7 +627,7 @@ return; } - silcpurple_show_public_key(sg, b->name, public_key, NULL, NULL); + silcpurple_show_public_key(sg, purple_buddy_get_name(b), public_key, NULL, NULL); silc_pkcs_public_key_free(public_key); } @@ -697,7 +700,7 @@ if (!b->proto_data) { g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), b->name); + _("User %s is not present in the network"), purple_buddy_get_name(b)); purple_notify_error(gc, _("User Information"), _("Cannot get user information"), tmp); return; @@ -721,7 +724,7 @@ { char tmp[512]; g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not trusted"), - r->b->name); + purple_buddy_get_name(r->b)); purple_notify_error(r->client->application, _("Add Buddy"), tmp, _("You cannot receive buddy notifications until you " "import his/her public key. You can use the Get Public Key " @@ -1033,7 +1036,7 @@ /* Now verify the public key */ r->offline_pk = silc_pkcs_public_key_encode(r->public_key, &r->offline_pk_len); - silcpurple_verify_public_key(r->client, r->conn, r->b->name, + silcpurple_verify_public_key(r->client, r->conn, purple_buddy_get_name(r->b), SILC_CONN_CLIENT, r->public_key, silcpurple_add_buddy_save, r); } @@ -1071,7 +1074,7 @@ { char tmp[512]; g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not present in the network"), - r->b->name); + purple_buddy_get_name(r->b)); purple_request_action(r->client->application, _("Add Buddy"), tmp, _("To add the buddy you must import his/her public key. " "Press Import to import a public key."), 0, @@ -1209,6 +1212,7 @@ const char *filename; SilcClientEntry client_entry = NULL; SilcUInt16 cmd_ident; + const char *name; filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); @@ -1246,17 +1250,19 @@ silc_dlist_start(clients); client_entry = silc_dlist_get(clients); + name = purple_buddy_get_name(b); + /* If we searched using public keys and more than one entry was found the same person is logged on multiple times. */ - if (silc_dlist_count(clients) > 1 && r->pubkey_search && b->name) { + if (silc_dlist_count(clients) > 1 && r->pubkey_search && name) { if (r->init) { /* Find the entry that closest matches to the buddy nickname. */ SilcClientEntry entry; silc_dlist_start(clients); while ((entry = silc_dlist_get(clients))) { - if (!g_ascii_strncasecmp(b->name, entry->nickname, - strlen(b->name))) { + if (!g_ascii_strncasecmp(name, entry->nickname, + strlen(name))) { client_entry = entry; break; } @@ -1335,7 +1341,7 @@ SilcClientConnection conn = sg->conn; SilcPurpleBuddyRes r; SilcBuffer attrs; - const char *filename, *name = b->name; + const char *filename, *name = purple_buddy_get_name(b); r = silc_calloc(1, sizeof(*r)); if (!r) @@ -1395,31 +1401,27 @@ void silcpurple_send_buddylist(PurpleConnection *gc) { - PurpleBuddyList *blist; PurpleBlistNode *gnode, *cnode, *bnode; PurpleBuddy *buddy; PurpleAccount *account; account = purple_connection_get_account(gc); - if ((blist = purple_get_blist()) != NULL) + for (gnode = purple_blist_get_root(); gnode != NULL; gnode = gnode->next) { - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) + if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + continue; + for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; - for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) + for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) + if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) - { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *)bnode; - if (purple_buddy_get_account(buddy) == account) - silcpurple_add_buddy_i(gc, buddy, TRUE); - } + buddy = (PurpleBuddy *)bnode; + if (purple_buddy_get_account(buddy) == account) + silcpurple_add_buddy_i(gc, buddy, TRUE); } } } @@ -1469,7 +1471,9 @@ char *silcpurple_status_text(PurpleBuddy *b) { - SilcPurple sg = b->account->gc->proto_data; + PurpleAccount *account = purple_buddy_get_account(b); + PurpleConnection *gc = purple_account_get_connection(account); + SilcPurple sg = gc->proto_data; SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientID *client_id = b->proto_data; @@ -1533,7 +1537,9 @@ void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { - SilcPurple sg = b->account->gc->proto_data; + PurpleAccount *account = purple_buddy_get_account(b); + PurpleConnection *gc = purple_account_get_connection(account); + SilcPurple sg = gc->proto_data; SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientID *client_id = b->proto_data; @@ -1610,12 +1616,12 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); + gc = purple_account_get_connection(purple_buddy_get_account(b)); sg = gc->proto_data; /* Call KILL */ silc_client_command_call(sg->client, sg->conn, NULL, "KILL", - b->name, "Killed by operator", NULL); + purple_buddy_get_name(b), "Killed by operator", NULL); } typedef struct { @@ -1633,7 +1639,8 @@ GList *silcpurple_buddy_menu(PurpleBuddy *buddy) { - PurpleConnection *gc = purple_account_get_connection(buddy->account); + PurpleAccount *account = purple_buddy_get_account(buddy); + PurpleConnection *gc = purple_account_get_connection(account); SilcPurple sg = gc->proto_data; SilcClientConnection conn = sg->conn; const char *pkfile = NULL;
--- a/libpurple/protocols/silc/chat.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/silc/chat.c Sat Sep 27 06:33:42 2008 +0000 @@ -182,7 +182,9 @@ silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) { PurpleChat *chat = (PurpleChat *)node; - silcpurple_chat_getinfo(chat->account->gc, chat->components); + PurpleAccount *account = purple_chat_get_account(chat); + silcpurple_chat_getinfo(purple_account_get_connection(account), + purple_chat_get_components(chat)); } @@ -496,11 +498,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "+C", NULL); } @@ -549,7 +551,7 @@ g_hash_table_replace(comp, "passphrase", g_strdup(passphrase)); cn = purple_chat_new(sg->account, alias, comp); - g = (PurpleGroup *)p->c->node.parent; + g = purple_chat_get_group(p->c); purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); /* Associate to a real channel */ @@ -583,7 +585,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; p = silc_calloc(1, sizeof(*p)); @@ -591,7 +593,7 @@ return; p->sg = sg; - p->channel = g_hash_table_lookup(chat->components, "channel"); + p->channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); p->c = purple_blist_find_chat(sg->account, p->channel); fields = purple_request_fields_new(); @@ -633,11 +635,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "-f", NULL); } @@ -652,7 +654,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; if (!sg->conn) @@ -663,7 +665,7 @@ (default key). */ /* Call CMODE */ - channel = g_hash_table_lookup(chat->components, "channel"); + channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, "+f", NULL); } @@ -729,13 +731,13 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; if (!sg->conn) return; - ch = g_strdup(g_hash_table_lookup(chat->components, "channel")); + ch = g_strdup(g_hash_table_lookup(purple_chat_get_components(chat), "channel")); channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch); if (!channel) return; @@ -764,11 +766,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "-t", NULL); } @@ -782,11 +784,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "+t", NULL); } @@ -800,11 +802,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "-p", NULL); } @@ -818,11 +820,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "+p", NULL); } @@ -836,11 +838,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "-s", NULL); } @@ -854,11 +856,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "+s", NULL); } @@ -877,8 +879,8 @@ GList *silcpurple_chat_menu(PurpleChat *chat) { - GHashTable *components = chat->components; - PurpleConnection *gc = purple_account_get_connection(chat->account); + GHashTable *components = purple_chat_get_components(chat); + PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); SilcPurple sg = gc->proto_data; SilcClientConnection conn = sg->conn; const char *chname = NULL;
--- a/libpurple/protocols/silc/ops.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/silc/ops.c Sat Sep 27 06:33:42 2008 +0000 @@ -431,6 +431,7 @@ va_list va; PurpleConnection *gc = client->application; SilcPurple sg = gc->proto_data; + PurpleAccount *account = purple_connection_get_account(gc); PurpleConversation *convo; SilcClientEntry client_entry, client_entry2; SilcChannelEntry channel; @@ -856,7 +857,7 @@ silc_free(pk); /* Find buddy by associated public key */ - for (gnode = purple_get_blist()->root; gnode; + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -868,7 +869,7 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; - if (b->account != gc->account) + if (purple_buddy_get_account(b) != account) continue; f = purple_blist_node_get_string(bnode, "public-key"); if (f && !strcmp(f, buf))
--- a/libpurple/protocols/simple/simple.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/simple/simple.c Sat Sep 27 06:33:42 2008 +0000 @@ -196,33 +196,36 @@ { struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; struct simple_buddy *b; - if(strncmp("sip:", buddy->name, 4)) { - gchar *buf = g_strdup_printf("sip:%s", buddy->name); + const char *name = purple_buddy_get_name(buddy); + if(strncmp("sip:", name, 4)) { + gchar *buf = g_strdup_printf("sip:%s", name); purple_blist_rename_buddy(buddy, buf); g_free(buf); } - if(!g_hash_table_lookup(sip->buddies, buddy->name)) { + if(!g_hash_table_lookup(sip->buddies, name)) { b = g_new0(struct simple_buddy, 1); - purple_debug_info("simple", "simple_add_buddy %s\n", buddy->name); - b->name = g_strdup(buddy->name); + purple_debug_info("simple", "simple_add_buddy %s\n", name); + b->name = g_strdup(name); g_hash_table_insert(sip->buddies, b->name, b); } else { - purple_debug_info("simple", "buddy %s already in internal list\n", buddy->name); + purple_debug_info("simple", "buddy %s already in internal list\n", name); } } static void simple_get_buddies(PurpleConnection *gc) { PurpleBlistNode *gnode, *cnode, *bnode; + PurpleAccount *account; purple_debug_info("simple", "simple_get_buddies\n"); - for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + account = purple_connection_get_account(gc); + for(gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for(cnode = gnode->child; cnode; cnode = cnode->next) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; for(bnode = cnode->child; bnode; bnode = bnode->next) { if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - if(((PurpleBuddy*)bnode)->account == gc->account) + if(purple_buddy_get_account((PurpleBuddy*)bnode) == account) simple_add_buddy(gc, (PurpleBuddy*)bnode, (PurpleGroup *)gnode); } } @@ -231,9 +234,10 @@ static void simple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { + const char *name = purple_buddy_get_name(buddy); struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; - struct simple_buddy *b = g_hash_table_lookup(sip->buddies, buddy->name); - g_hash_table_remove(sip->buddies, buddy->name); + struct simple_buddy *b = g_hash_table_lookup(sip->buddies, name); + g_hash_table_remove(sip->buddies, name); g_free(b->name); g_free(b); } @@ -922,7 +926,7 @@ purple_blist_add_buddy(b, NULL, g, NULL); purple_blist_alias_buddy(b, uri); bs = g_new0(struct simple_buddy, 1); - bs->name = g_strdup(b->name); + bs->name = g_strdup(purple_buddy_get_name(b)); g_hash_table_insert(sip->buddies, bs->name, bs); } xmlnode_free(isc);
--- a/libpurple/protocols/yahoo/yahoo.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Sat Sep 27 06:33:42 2008 +0000 @@ -385,7 +385,7 @@ for (i = list; i; i = i->next) { b = i->data; g = purple_buddy_get_group(b); - if (!purple_utf8_strcasecmp(group, g->name)) { + if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) { purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Oh good, %s is in the right group (%s).\n", name, group); list = g_slist_delete_link(list, i); @@ -423,7 +423,8 @@ for (i = list; i; i = i->next) { b = i->data; g = purple_buddy_get_group(b); - purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name, g->name); + purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name, + purple_group_get_name(g)); purple_blist_remove_buddy(b); } } @@ -2027,21 +2028,23 @@ return; group = purple_buddy_get_group(buddy); - name = g_strdup(buddy->name); - account = buddy->account; + name = g_strdup(purple_buddy_get_name(buddy)); + account = purple_buddy_get_account(buddy); purple_debug(PURPLE_DEBUG_INFO, "blist", - "Removing '%s' from buddy list.\n", buddy->name); + "Removing '%s' from buddy list.\n", name); purple_account_remove_buddy(account, buddy, group); purple_blist_remove_buddy(buddy); - serv_add_deny(account->gc, name); + serv_add_deny(purple_account_get_connection(account), name); g_free(name); } -static void keep_buddy(PurpleBuddy *b) { - purple_privacy_deny_remove(b->account, b->name, 1); +static void keep_buddy(PurpleBuddy *b) +{ + purple_privacy_deny_remove(purple_buddy_get_account(b), + purple_buddy_get_name(b), 1); } static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) { @@ -3121,11 +3124,12 @@ YahooFriend *f; PurplePresence *presence; - if (!b || !(account = b->account) || !(gc = purple_account_get_connection(account)) || - !(yd = gc->proto_data)) + if (!b || !(account = purple_buddy_get_account(b)) || + !(gc = purple_account_get_connection(account)) || + !(yd = gc->proto_data)) return NULL; - f = yahoo_friend_find(gc, b->name); + f = yahoo_friend_find(gc, purple_buddy_get_name(b)); if (!f) { return "not-authorized"; } @@ -3185,7 +3189,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)); yd = gc->proto_data; id = yd->conf_id; @@ -3197,7 +3201,7 @@ yahoo_c_join(gc, components); g_hash_table_destroy(components); - yahoo_c_invite(gc, id, "Join my conference...", buddy->name); + yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy)); } static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) { @@ -3206,9 +3210,9 @@ int presence_val = GPOINTER_TO_INT(data); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - yahoo_friend_update_presence(gc, buddy->name, presence_val); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); + + yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val); } static void yahoo_game(PurpleBlistNode *node, gpointer data) { @@ -3226,10 +3230,10 @@ 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)); yd = (struct yahoo_data *) gc->proto_data; - f = yahoo_friend_find(gc, buddy->name); + f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); if (!f) return; @@ -3251,8 +3255,10 @@ YahooFriend *f = NULL; const char *msg; char *msg2; - - f = yahoo_friend_find(b->account->gc, b->name); + PurpleAccount *account; + + account = purple_buddy_get_account(b); + f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b)); if (!f) return g_strdup(_("Not on server list")); @@ -3281,8 +3287,10 @@ char *escaped; char *status = NULL; const char *presence = NULL; - - f = yahoo_friend_find(b->account->gc, b->name); + PurpleAccount *account; + + account = purple_buddy_get_account(b); + f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b)); if (!f) status = g_strdup_printf("\n%s", _("Not on server list")); else { @@ -3333,7 +3341,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)); yahoo_add_buddy(gc, buddy, NULL); } @@ -3347,9 +3355,9 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - yahoo_chat_goto(gc, buddy->name); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); + + yahoo_chat_goto(gc, purple_buddy_get_name(buddy)); } static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { @@ -3393,9 +3401,10 @@ static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data) { PurpleBuddy *b = (PurpleBuddy *)node; - PurpleConnection *gc = b->account->gc; - - yahoo_doodle_initiate(gc, b->name); + PurpleAccount *account = purple_buddy_get_account(b); + PurpleConnection *gc = purple_account_get_connection(account); + + yahoo_doodle_initiate(gc, purple_buddy_get_name(b)); } static GList *yahoo_buddy_menu(PurpleBuddy *buddy) @@ -3403,12 +3412,12 @@ GList *m = NULL; PurpleMenuAction *act; - PurpleConnection *gc = purple_account_get_connection(buddy->account); + PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); struct yahoo_data *yd = gc->proto_data; static char buf2[1024]; YahooFriend *f; - f = yahoo_friend_find(gc, buddy->name); + f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); if (!f && !yd->wm) { act = purple_menu_action_new(_("Add Buddy"), @@ -3917,19 +3926,20 @@ const char *group = NULL; char *group2; YahooFriend *f; + const char *bname; if (!yd->logged_in) return; - if (!purple_privacy_check(purple_connection_get_account(gc), - purple_buddy_get_name(buddy))) + bname = purple_buddy_get_name(buddy); + if (!purple_privacy_check(purple_connection_get_account(gc), bname)) return; - f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); + f = yahoo_friend_find(gc, bname); g = purple_buddy_get_group(buddy); if (g) - group = g->name; + group = purple_group_get_name(g); else group = "Buddies"; @@ -3942,7 +3952,7 @@ 1, purple_connection_get_display_name(gc), 302, "319", 300, "319", - 7, buddy->name, + 7, bname, 334, "0", 301, "319", 303, "319" @@ -3956,19 +3966,22 @@ static void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; - struct yahoo_packet *pkt; + struct yahoo_packet *pkt; GSList *buddies, *l; PurpleGroup *g; gboolean remove = TRUE; char *cg; - - if (!(yahoo_friend_find(gc, buddy->name))) + const char *bname, *gname; + + bname = purple_buddy_get_name(buddy); + if (!(yahoo_friend_find(gc, bname))) return; - buddies = purple_find_buddies(purple_connection_get_account(gc), buddy->name); + gname = purple_group_get_name(group); + buddies = purple_find_buddies(purple_connection_get_account(gc), bname); for (l = buddies; l; l = l->next) { g = purple_buddy_get_group(l->data); - if (purple_utf8_strcasecmp(group->name, g->name)) { + if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) { remove = FALSE; break; } @@ -3977,12 +3990,12 @@ g_slist_free(buddies); if (remove) - g_hash_table_remove(yd->friends, buddy->name); - - cg = yahoo_string_encode(gc, group->name, NULL); + g_hash_table_remove(yd->friends, bname); + + cg = yahoo_string_encode(gc, gname, NULL); pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), - 7, buddy->name, 65, cg); + 7, bname, 65, cg); yahoo_packet_send_and_free(pkt, yd); g_free(cg); } @@ -4091,7 +4104,7 @@ struct yahoo_packet *pkt; char *gpn, *gpo; - gpn = yahoo_string_encode(gc, group->name, NULL); + gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL); gpo = yahoo_string_encode(gc, old_name, NULL); if (!strcmp(gpn, gpo)) { g_free(gpn);
--- a/libpurple/protocols/yahoo/yahoo_profile.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo_profile.c Sat Sep 27 06:33:42 2008 +0000 @@ -715,7 +715,7 @@ /* Add the normal tooltip pairs */ yahoo_tooltip_text(b, user_info, TRUE); - if ((f = yahoo_friend_find(info_data->gc, b->name))) { + if ((f = yahoo_friend_find(info_data->gc, purple_buddy_get_name(b)))) { const char *ip; if ((ip = yahoo_friend_get_ip(f))) purple_notify_user_info_add_pair(user_info, _("IP Address"), ip); @@ -1215,7 +1215,9 @@ * in which case the user may or may not actually exist. * Hence this extra step. */ - f = yahoo_friend_find(b->account->gc, b->name); + PurpleAccount *account = purple_buddy_get_account(b); + f = yahoo_friend_find(purple_account_get_connection(account), + purple_buddy_get_name(b)); } g_string_append_printf(str, "%s<br><br>", f? _("Could not retrieve the user's profile. "
--- a/libpurple/protocols/yahoo/yahoochat.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoochat.c Sat Sep 27 06:33:42 2008 +0000 @@ -514,12 +514,12 @@ c = purple_find_chat(gc, YAHOO_CHAT_ID); if (room && (!c || purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) && members && - ((g_list_length(members) > 1) || + ((members->next != NULL) || !g_ascii_strcasecmp(members->data, purple_connection_get_display_name(gc)))) { int i; GList *flags = NULL; for (i = 0; i < g_list_length(members); i++) - flags = g_list_append(flags, GINT_TO_POINTER(PURPLE_CBFLAGS_NONE)); + flags = g_list_prepend(flags, GINT_TO_POINTER(PURPLE_CBFLAGS_NONE)); if (c && purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) { /* this might be a hack, but oh well, it should nicely */ char *tmpmsg;
--- a/libpurple/protocols/zephyr/zephyr.c Thu Sep 25 07:19:38 2008 +0000 +++ b/libpurple/protocols/zephyr/zephyr.c Sat Sep 27 06:33:42 2008 +0000 @@ -732,7 +732,7 @@ return ret; } -static gboolean pending_zloc(zephyr_account *zephyr,char *who) +static gboolean pending_zloc(zephyr_account *zephyr, const char *who) { GList *curr; @@ -771,6 +771,8 @@ int nlocs; char *user; PurpleBuddy *b; + const char *bname; + /* XXX add real error reporting */ if (ZParseLocations(¬ice, NULL, &nlocs, &user) != ZERR_NONE) return; @@ -780,13 +782,15 @@ b = purple_find_buddy(gc->account,stripped_user); g_free(stripped_user); } - if ((b && pending_zloc(zephyr,b->name)) || pending_zloc(zephyr,user)) { + + bname = b ? purple_buddy_get_name(b) : NULL; + if ((b && pending_zloc(zephyr,bname)) || pending_zloc(zephyr,user)) { ZLocations_t locs; int one = 1; PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); char *tmp; - purple_notify_user_info_add_pair(user_info, _("User"), (b ? b->name : user)); + purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); if (b && b->alias) purple_notify_user_info_add_pair(user_info, _("Alias"), b->alias); @@ -801,14 +805,14 @@ purple_notify_user_info_add_pair(user_info, _("Location"), tmp); g_free(tmp); } - purple_notify_userinfo(gc, (b ? b->name : user), + purple_notify_userinfo(gc, (b ? bname : user), user_info, NULL, NULL); purple_notify_user_info_destroy(user_info); } else { if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? b->name : user, "available", NULL); + purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); else - purple_prpl_got_user_status(gc->account, b ? b->name : user, "offline", NULL); + purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); } g_free(user); @@ -1142,6 +1146,7 @@ /* XXX fix */ char *user; PurpleBuddy *b; + const char *bname; int nlocs = 0; parse_tree *locations; gchar *locval; @@ -1161,11 +1166,12 @@ nlocs = 1; } - if ((b && pending_zloc(zephyr,b->name)) || pending_zloc(zephyr,user) || pending_zloc(zephyr,local_zephyr_normalize(zephyr,user))){ + bname = b ? purple_buddy_get_name(b) : NULL; + if ((b && pending_zloc(zephyr,bname)) || pending_zloc(zephyr,user) || pending_zloc(zephyr,local_zephyr_normalize(zephyr,user))){ PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); char *tmp; - purple_notify_user_info_add_pair(user_info, _("User"), (b ? b->name : user)); + purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); if (b && b->alias) purple_notify_user_info_add_pair(user_info, _("Alias"), b->alias); @@ -1180,14 +1186,14 @@ g_free(tmp); } - purple_notify_userinfo(gc, b ? b->name : user, + purple_notify_userinfo(gc, b ? bname : user, user_info, NULL, NULL); purple_notify_user_info_destroy(user_info); } else { if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? b->name : user, "available", NULL); + purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); else - purple_prpl_got_user_status(gc->account, b ? b->name : user, "offline", NULL); + purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); } } else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) { @@ -1247,12 +1253,12 @@ static gint check_loc(gpointer_data) { - PurpleBlistNode *gnode, *cnode, *bnode; - ZLocations_t locations; - int numlocs; - int one = 1; + PurpleBlistNode *gnode, *cnode, *bnode; + ZLocations_t locations; + int numlocs; + int one = 1; - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for (cnode = gnode->child; cnode; cnode = cnode->next) { @@ -1263,22 +1269,23 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - if (b->account->gc == zgc) { + if (purple_buddy_get_account(b)->gc == zgc) { char *chk; - chk = local_zephyr_normalize(b->name); - ZLocateUser(chk,&numlocs, ZAUTH); - if (numlocs) { - int i; - for(i=0;i<numlocs;i++) { - ZGetLocations(&locations,&one); - serv_got_update(zgc,b->name,1,0,0,0,0); - } - } - } - } - } - } - return TRUE; + const char *bname = purple_buddy_get_name(b); + chk = local_zephyr_normalize(bname); + ZLocateUser(chk,&numlocs, ZAUTH); + if (numlocs) { + int i; + for(i=0;i<numlocs;i++) { + ZGetLocations(&locations,&one); + serv_got_update(zgc,bname,1,0,0,0,0); + } + } + } + } + } + } + return TRUE; } #else @@ -1289,6 +1296,7 @@ ZAsyncLocateData_t ald; PurpleConnection *gc = (PurpleConnection *)data; zephyr_account *zephyr = gc->proto_data; + PurpleAccount *account = purple_connection_get_account(gc); if (use_zeph02(zephyr)) { ald.user = NULL; @@ -1296,7 +1304,7 @@ ald.version = NULL; } - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for (cnode = gnode->child; cnode; cnode = cnode->next) { @@ -1307,11 +1315,12 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - if (b->account->gc == gc) { + if (purple_buddy_get_account(b) == account) { const char *chk; + const char *name = purple_buddy_get_name(b); - chk = local_zephyr_normalize(zephyr,b->name); - purple_debug_info("zephyr","chk: %s b->name %s\n",chk,b->name); + chk = local_zephyr_normalize(zephyr,name); + purple_debug_info("zephyr","chk: %s b->name %s\n",chk,name); /* XXX add real error reporting */ /* doesn't matter if this fails or not; we'll just move on to the next one */ if (use_zeph02(zephyr)) { @@ -1324,9 +1333,9 @@ for(i=0;i<numlocs;i++) { ZGetLocations(&locations,&one); if (nlocs>0) - purple_prpl_got_user_status(gc->account,b->name,"available",NULL); + purple_prpl_got_user_status(account,name,"available",NULL); else - purple_prpl_got_user_status(gc->account,b->name,"offline",NULL); + purple_prpl_got_user_status(account,name,"offline",NULL); } } #else @@ -1934,6 +1943,7 @@ PurpleBuddy *b; char *fname; FILE *fd; + PurpleAccount *account; zephyr_account* zephyr = gc->proto_data; fname = g_strdup_printf("%s/.anyone", purple_home_dir()); fd = g_fopen(fname, "w"); @@ -1942,7 +1952,8 @@ return; } - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + account = purple_connection_get_account(gc); + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for (cnode = gnode->child; cnode; cnode = cnode->next) { @@ -1952,8 +1963,8 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *) bnode; - if (b->account == gc->account) { - gchar *stripped_user = zephyr_strip_local_realm(zephyr,b->name); + if (purple_buddy_get_account(b) == account) { + gchar *stripped_user = zephyr_strip_local_realm(zephyr, purple_buddy_get_name(b)); fprintf(fd, "%s\n", stripped_user); g_free(stripped_user); } @@ -2496,26 +2507,28 @@ PurpleBlistNode *gnode, *cnode; /* XXX needs to be %host%,%canon%, and %me% clean */ - for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for(gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { for(cnode = gnode->child; cnode; cnode = cnode->next) { PurpleChat *chat = (PurpleChat*)cnode; char *zclass, *inst, *recip; char** triple; + GHashTable *components; if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) continue; - if(chat->account !=account) - continue; - if(!(zclass = g_hash_table_lookup(chat->components, "class"))) + if(purple_chat_get_account(chat) != account) continue; - if(!(inst = g_hash_table_lookup(chat->components, "instance"))) + components = purple_chat_get_components(chat); + if(!(zclass = g_hash_table_lookup(components, "class"))) + continue; + if(!(inst = g_hash_table_lookup(components, "instance"))) inst = g_strdup(""); - if(!(recip = g_hash_table_lookup(chat->components, "recipient"))) + if(!(recip = g_hash_table_lookup(components, "recipient"))) recip = g_strdup(""); /* purple_debug_info("zephyr","in zephyr_find_blist_chat name: %s\n",name?name:""); */ triple = g_strsplit(name,",",3); if (!g_ascii_strcasecmp(triple[0],zclass) && !g_ascii_strcasecmp(triple[1],inst) && !g_ascii_strcasecmp(triple[2],recip)) return chat; - + } } return NULL;