sadrul.struct.hiding: d0284514: Start hiding blist.h internals in prpls.
sadrul at pidgin.im
sadrul at pidgin.im
Fri Oct 31 04:51:44 EDT 2008
-----------------------------------------------------------------
Revision: d028451473728aac547fbc502b5453d27d035bc9
Ancestor: bf07db8e6300ffa5dc4613996800db83ad350afb
Author: sadrul at pidgin.im
Date: 2008-09-27T06:33:42
Branch: im.pidgin.sadrul.struct.hiding
URL: http://d.pidgin.im/viewmtn/revision/info/d028451473728aac547fbc502b5453d27d035bc9
Modified files:
libpurple/protocols/bonjour/bonjour.c
libpurple/protocols/bonjour/bonjour_ft.c
libpurple/protocols/bonjour/buddy.c
libpurple/protocols/bonjour/jabber.c
libpurple/protocols/gg/buddylist.c
libpurple/protocols/gg/gg.c libpurple/protocols/irc/irc.c
libpurple/protocols/irc/msgs.c
libpurple/protocols/jabber/adhoccommands.c
libpurple/protocols/jabber/buddy.c
libpurple/protocols/jabber/google.c
libpurple/protocols/jabber/jabber.c
libpurple/protocols/jabber/roster.c
libpurple/protocols/msn/contact.c
libpurple/protocols/msn/msn.c
libpurple/protocols/msn/session.c
libpurple/protocols/msn/user.c
libpurple/protocols/msn/userlist.c
libpurple/protocols/myspace/myspace.c
libpurple/protocols/myspace/user.c
libpurple/protocols/myspace/zap.c
libpurple/protocols/novell/novell.c
libpurple/protocols/oscar/oscar.c
libpurple/protocols/qq/buddy_opt.c
libpurple/protocols/qq/group.c
libpurple/protocols/qq/group_internal.c
libpurple/protocols/qq/qq.c
libpurple/protocols/sametime/sametime.c
libpurple/protocols/silc/buddy.c
libpurple/protocols/silc/chat.c
libpurple/protocols/silc/ops.c
libpurple/protocols/simple/simple.c
libpurple/protocols/yahoo/yahoo.c
libpurple/protocols/yahoo/yahoo_profile.c
libpurple/protocols/yahoo/yahoochat.c
libpurple/protocols/zephyr/zephyr.c
ChangeLog:
Start hiding blist.h internals in prpls.
-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/bonjour.c 1219251e75ffb9d3843eb0d9547ba21b71879d86
+++ libpurple/protocols/bonjour/bonjour.c ac4245404891f7af3ad39e3f0c670a86eba82f97
@@ -68,9 +68,9 @@ bonjour_removeallfromlocal(PurpleConnect
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);
}
============================================================
--- libpurple/protocols/bonjour/bonjour_ft.c 655f82b2b35b210d3fce3d3675088eaeb79e3a1f
+++ libpurple/protocols/bonjour/bonjour_ft.c f5e6c39d1036c52145f474c382f6b40b9da543aa
@@ -408,6 +408,7 @@ xep_si_parse(PurpleConnection *pc, xmlno
xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb)
{
const char *type, *id;
+ const char *name;
BonjourData *bd;
PurpleXfer *xfer;
@@ -421,6 +422,7 @@ xep_si_parse(PurpleConnection *pc, xmlno
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 @@ xep_si_parse(PurpleConnection *pc, xmlno
/* 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 @@ xep_bytestreams_parse(PurpleConnection *
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 @@ bonjour_bytestreams_connect(PurpleXfer *
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);
============================================================
--- libpurple/protocols/bonjour/buddy.c cb0821f5f2c7b024e39faafa42b29c2dcd144254
+++ libpurple/protocols/bonjour/buddy.c bc7a594f04e102b7b3d9386c74fb67fcbc385c9c
@@ -128,6 +128,7 @@ bonjour_buddy_add_to_purple(BonjourBuddy
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 @@ bonjour_buddy_add_to_purple(BonjourBuddy
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 @@ bonjour_buddy_add_to_purple(BonjourBuddy
(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 @@ bonjour_buddy_add_to_purple(BonjourBuddy
* 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);
}
/**
============================================================
--- libpurple/protocols/bonjour/jabber.c 43e9188ac1443114eac67594c10f2b535099a3a2
+++ libpurple/protocols/bonjour/jabber.c acc5e4cc4f78246cc00bdafd0f0bef078843d0db
@@ -142,7 +142,7 @@ _jabber_parse_and_write_message_to_ui(xm
_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 @@ _jabber_parse_and_write_message_to_ui(xm
}
/* 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 @@ _match_buddies_by_address(gpointer key,
* 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 @@ _send_data_write_cb(gpointer data, gint
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 @@ _send_data(PurpleBuddy *pb, char *messag
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 @@ _client_socket_handler(gpointer data, gi
}
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(Bonjour
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 @@ _connected_to_buddy(gpointer data, gint
{
PurpleBuddy *pb = data;
BonjourBuddy *bb = pb->proto_data;
+ PurpleAccount *account = purple_buddy_get_account(pb);
bb->conversation->connect_data = NULL;
@@ -757,7 +762,7 @@ _connected_to_buddy(gpointer data, gint
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 @@ _connected_to_buddy(gpointer data, gint
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 @@ bonjour_jabber_close_conversation(Bonjou
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 @@ check_if_blocked(PurpleBuddy *pb)
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 @@ xep_iq_parse(xmlnode *packet, PurpleConn
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))
============================================================
--- libpurple/protocols/gg/buddylist.c 353535de7d31ded3a69e0486d86d6d22604f31e6
+++ libpurple/protocols/gg/buddylist.c 72a6256e25c3bf06968be35841ed1b83b3a56772
@@ -41,17 +41,13 @@ void ggp_buddylist_send(PurpleConnection
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 @@ void ggp_buddylist_send(PurpleConnection
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(PurpleConnect
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 @@ void ggp_buddylist_offline(PurpleConnect
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 *
/* 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 *ggp_buddylist_dump(PurpleAccount *
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");
============================================================
--- libpurple/protocols/gg/gg.c 15da503be05fe6b49a46589f40361b9c6f4ffd93
+++ libpurple/protocols/gg/gg.c bb94394bf880a0158a4c53edeefe409f0704e13d
@@ -1907,11 +1907,12 @@ static void ggp_add_buddy(PurpleConnecti
{
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 @@ static void ggp_remove_buddy(PurpleConne
{
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)));
}
/* }}} */
============================================================
--- libpurple/protocols/irc/irc.c 72232dd16f455e0ce3b0e0e11f7ae31041a40a48
+++ libpurple/protocols/irc/irc.c e041172bccd44d5efe74b7f452bd5a5a008ec3b3
@@ -569,7 +569,7 @@ static void irc_add_buddy(PurpleConnecti
{
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(PurpleConne
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)
============================================================
--- libpurple/protocols/irc/msgs.c 2edff1a3e2eb8e7d3a2cce08a575165d5d4cbff1
+++ libpurple/protocols/irc/msgs.c b5ff630cb6e06f8762da6e08ae9a9d77344a4862
@@ -79,6 +79,7 @@ static void irc_connected(struct irc_con
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 @@ static void irc_connected(struct irc_con
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 @@ static void irc_connected(struct irc_con
}
/* 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 @@ static void irc_connected(struct irc_con
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);
}
}
============================================================
--- libpurple/protocols/jabber/adhoccommands.c c0cd56217d0f15123226823ea3521e117c3041c6
+++ libpurple/protocols/jabber/adhoccommands.c 24c5de8be74bcf216f6ba89decef071189b60727
@@ -211,8 +211,9 @@ void jabber_adhoc_execute_action(PurpleB
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);
}
}
============================================================
--- libpurple/protocols/jabber/buddy.c 69039f61c78b7d32d53c0cca4e92405ec580900b
+++ libpurple/protocols/jabber/buddy.c b01e3996f0c02445ef4b634007f684fb2d825894
@@ -1848,10 +1848,10 @@ static void jabber_buddy_make_invisible(
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 @@ static void jabber_buddy_make_visible(Pu
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 @@ static void jabber_buddy_cancel_presence
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 @@ static void jabber_buddy_rerequest_auth(
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 @@ static void jabber_buddy_unsubscribe(Pur
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 @@ static void jabber_buddy_login(PurpleBli
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 @@ static void jabber_buddy_logout(PurpleBl
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(PurpleBu
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 @@ static GList *jabber_buddy_menu(PurpleBu
* 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);
============================================================
--- libpurple/protocols/jabber/google.c f0624dcce3f7675f95224023738a5bc83d8f8fbb
+++ libpurple/protocols/jabber/google.c 68b75a7ab1598a7e70e63d1c1a29edd37cc8d58f
@@ -309,7 +309,7 @@ void jabber_google_roster_add_deny(Purpl
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 @@ void jabber_google_roster_rem_deny(Purpl
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;
}
============================================================
--- libpurple/protocols/jabber/jabber.c 825251d252c4ea07a3cfb8778cedad0ccde46026
+++ libpurple/protocols/jabber/jabber.c aca0c61713d5c6fe92a8fd536545095be0cc1a70
@@ -1476,13 +1476,14 @@ const char* jabber_list_emblem(PurpleBud
{
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,10 +1497,12 @@ char *jabber_status_text(PurpleBuddy *b)
{
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"));
} else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) {
@@ -1527,15 +1530,20 @@ void jabber_tooltip_text(PurpleBuddy *b,
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);
- jb = jabber_buddy_find(b->account->gc->proto_data, b->name,
- FALSE);
+ account = purple_buddy_get_account(b);
+ g_return_if_fail(account != NULL);
+ 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;
PurplePresence *presence = purple_buddy_get_presence(b);
@@ -1870,19 +1878,21 @@ PurpleChat *jabber_find_blist_chat(Purpl
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 &&
============================================================
--- libpurple/protocols/jabber/roster.c a384763565f91ecfa641f97f9ba59f697fa9169a
+++ libpurple/protocols/jabber/roster.c 735181ee13268d07c550edb05a3aa9a6058d21bb
@@ -80,7 +80,7 @@ static void add_purple_buddies_to_groups
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 @@ static void add_purple_buddies_to_groups
/* 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 @@ static void jabber_roster_update(JabberS
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 @@ void jabber_roster_add_buddy(PurpleConne
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 @@ void jabber_roster_group_change(PurpleCo
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 @@ void jabber_roster_group_change(PurpleCo
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 @@ void jabber_roster_group_rename(PurpleCo
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 @@ void jabber_roster_remove_buddy(PurpleCo
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 @@ void jabber_roster_remove_buddy(PurpleCo
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);
============================================================
--- libpurple/protocols/msn/contact.c 74dcd9e76be5e13e3846fade00d5230d33262151
+++ libpurple/protocols/msn/contact.c ce8c32f3da2f352ee0e8a434d804056f19054751
@@ -730,6 +730,7 @@ msn_parse_addressbook(MsnSession *sessio
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 @@ msn_parse_addressbook(MsnSession *sessio
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);
}
============================================================
--- libpurple/protocols/msn/msn.c 04fad6deed88391af6dba93608670cf94724bf97
+++ libpurple/protocols/msn/msn.c f8d16594d906bbd09fd83870e318fbf6ae252877
@@ -459,23 +459,27 @@ show_send_to_mobile_cb(PurpleBlistNode *
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 @@ initiate_chat_cb(PurpleBlistNode *node,
{
PurpleBuddy *buddy;
PurpleConnection *gc;
+ PurpleAccount *account;
MsnSession *session;
MsnSwitchBoard *swboard;
@@ -516,13 +521,14 @@ initiate_chat_cb(PurpleBlistNode *node,
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 @@ initiate_chat_cb(PurpleBlistNode *node,
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 @@ msn_buddy_menu(PurpleBuddy *buddy)
}
}
- 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 @@ msn_add_buddy(PurpleConnection *gc, Purp
{
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);
+ who = msn_normalize(purple_connection_get_account(gc), purple_buddy_get_name(buddy));
- purple_debug_info("msn", "Add user:%s to group:%s\n", who, (group && group->name) ? group->name : "(null)");
+ 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 @@ msn_add_buddy(PurpleConnection *gc, Purp
/* 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 @@ msn_rem_buddy(PurpleConnection *gc, Purp
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 @@ msn_rename_group(PurpleConnection *gc, c
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 @@ msn_remove_group(PurpleConnection *gc, P
{
MsnSession *session;
MsnCmdProc *cmdproc;
+ const char *gname;
session = gc->proto_data;
cmdproc = session->notification->cmdproc;
+ gname = purple_group_get_name(group);
- purple_debug_info("msn", "Remove group %s\n", group->name);
+ 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 @@ msn_tooltip_extract_info_text(PurpleNoti
if (b)
{
char *tmp;
+ const char *alias;
if (b->alias && b->alias[0])
{
@@ -1797,9 +1809,9 @@ msn_tooltip_extract_info_text(PurpleNoti
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);
============================================================
--- libpurple/protocols/msn/session.c 43e65308d6827f3ebad797cf2e9552b4bf78f6fb
+++ libpurple/protocols/msn/session.c 23126805de3512cb6583b1622886b2f36c9be753
@@ -274,12 +274,12 @@ msn_session_sync_users(MsnSession *sessi
* 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;
============================================================
--- libpurple/protocols/msn/user.c 6400e7b9b6da1e86d19f1884a1a0775dd5ba8315
+++ libpurple/protocols/msn/user.c 1cbb88b5580340c97a21aa798767b57daee1367b
@@ -273,7 +273,11 @@ msn_user_add_group_id(MsnUser *user, con
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*/
============================================================
--- libpurple/protocols/msn/userlist.c d5ac35b788b3219542de29549f1577ca62ada422
+++ libpurple/protocols/msn/userlist.c 9684f66a9f54dcb6eb240318830a6880d8758dc2
@@ -849,13 +849,14 @@ msn_userlist_load(MsnSession *session)
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 @@ msn_userlist_load(MsnSession *session)
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);
}
============================================================
--- libpurple/protocols/myspace/myspace.c 03f4a618f1c34ff94295a3978bf42fa5a9def896
+++ libpurple/protocols/myspace/myspace.c d36af442d0442f864bc5ada49733a6110ab6ce4e
@@ -1026,7 +1026,7 @@ msim_get_info(PurpleConnection *gc, cons
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 @@ msim_uid2username_from_blist(PurpleAccou
/* 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 @@ msim_incoming_status(MsimSession *sessio
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 @@ msim_add_buddy(PurpleConnection *gc, Pur
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 @@ msim_add_buddy(PurpleConnection *gc, Pur
"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 @@ msim_add_buddy(PurpleConnection *gc, Pur
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 @@ msim_add_buddy(PurpleConnection *gc, Pur
"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 @@ msim_postprocess_outgoing(MsimSession *s
/* 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 @@ msim_remove_buddy(PurpleConnection *gc,
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 @@ msim_remove_buddy(PurpleConnection *gc,
/* '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 @@ msim_remove_buddy(PurpleConnection *gc,
"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 @@ msim_remove_buddy(PurpleConnection *gc,
"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 @@ msim_status_text(PurpleBuddy *buddy)
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 @@ msim_tooltip_text(PurpleBuddy *buddy, Pu
if (PURPLE_BUDDY_IS_ONLINE(buddy)) {
MsimSession *session;
+ PurpleAccount *account = purple_buddy_get_account(buddy);
+ PurpleConnection *gc = purple_account_get_connection(account);
- session = (MsimSession *)buddy->account->gc->proto_data;
+ session = (MsimSession *)gc->proto_data;
g_return_if_fail(MSIM_SESSION_VALID(session));
@@ -2867,7 +2879,7 @@ msim_add_contact_from_server_cb(MsimSess
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. */
============================================================
--- libpurple/protocols/myspace/user.c 7d4e32a3eea84ba8adaf25b7df39ecd355a5aa12
+++ libpurple/protocols/myspace/user.c 2ccfcc4d56671a671b218410107b68b97268de59
@@ -105,7 +105,7 @@ msim_append_user_info(MsimSession *sessi
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(Msi
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 @@ static void msim_set_artist_or_title(Msi
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 @@ static void msim_set_artist_or_title(Msi
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 @@ msim_store_user_info_each(const gchar *k
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 @@ msim_store_user_info_each(const gchar *k
/* 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 @@ msim_downloaded_buddy_icon(PurpleUtilFet
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 @@ msim_downloaded_buddy_icon(PurpleUtilFet
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 */
}
============================================================
--- libpurple/protocols/myspace/zap.c 6053f3bd91bca7367cc461e72a8a51fb52a31572
+++ libpurple/protocols/myspace/zap.c 65fd991873488c39d9a1a0456276de61e83f6fe7
@@ -177,13 +177,13 @@ msim_send_zap_from_menu(PurpleBlistNode
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. */
============================================================
--- libpurple/protocols/novell/novell.c da346110e69c3d85d19e4f619edb0fd47035d321
+++ libpurple/protocols/novell/novell.c 67beb6ce4ed0ec603c26541a0dfa26bebf3f00a0
@@ -293,7 +293,7 @@ _get_details_resp_setup_buddy(NMUser * u
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 @@ _update_buddy_status(NMUser *user, Purpl
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 @@ _update_buddy_status(NMUser *user, Purpl
}
/* 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 @@ _update_buddy_status(NMUser *user, Purpl
}
}
- 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 @@ _remove_purple_buddies(NMUser *user)
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 @@ _initiate_conference_cb(PurpleBlistNode
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 @@ novell_add_buddy(PurpleConnection * gc,
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 @@ novell_add_buddy(PurpleConnection * gc,
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 @@ novell_remove_buddy(PurpleConnection *gc
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 @@ novell_remove_group(PurpleConnection * g
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 @@ novell_rename_group(PurpleConnection * g
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 @@ novell_rename_group(PurpleConnection * g
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 @@ novell_tooltip_text(PurpleBuddy * buddy,
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 @@ novell_status_text(PurpleBuddy * buddy)
{
const char *text = NULL;
const char *dn = NULL;
+ PurpleAccount *account;
- if (buddy && buddy->account) {
- PurpleConnection *gc = purple_account_get_connection(buddy->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);
============================================================
--- libpurple/protocols/oscar/oscar.c 0ba974ea1775d0dbe94f86c8e96e936b217acb6f
+++ libpurple/protocols/oscar/oscar.c 643b4372c9871860c4d0421ea1292ff70e048e9c
@@ -796,11 +796,13 @@ static void oscar_user_info_append_statu
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 @@ static void oscar_user_info_append_statu
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 @@ static void oscar_user_info_append_statu
} 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 @@ static void oscar_user_info_append_extra
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 @@ static void oscar_user_info_append_extra
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 @@ static void oscar_user_info_append_extra
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 @@ purple_auth_request(struct name_data *da
PurpleAccount *account;
PurpleBuddy *buddy;
PurpleGroup *group;
+ const char *bname, *gname;
gc = data->gc;
od = gc->proto_data;
@@ -2453,15 +2459,17 @@ purple_auth_request(struct name_data *da
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 @@ purple_auth_sendrequest_menu(PurpleBlist
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 @@ static int purple_icqinfo(OscarData *od,
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 @@ static int purple_icqinfo(OscarData *od,
}
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 @@ static int purple_icqinfo(OscarData *od,
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 @@ static int purple_icqinfo(OscarData *od,
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 @@ static int purple_icqinfo(OscarData *od,
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 @@ static int purple_icqalias(OscarData *od
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, Pu
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);
+ bname = purple_buddy_get_name(buddy);
+ gname = purple_group_get_name(group);
- if (!aim_snvalid(buddy->name)) {
+ 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 @@ oscar_add_buddy(PurpleConnection *gc, Pu
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 @@ void oscar_rename_group(PurpleConnection
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 @@ void oscar_rename_group(PurpleConnection
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 @@ static int purple_ssi_parselist(OscarDat
/* 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 @@ static int purple_ssi_parselist(OscarDat
} 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 @@ static int purple_ssi_parselist(OscarDat
}
/* 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_ssi_parseaddmod(OscarData *od, Fl
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(PurpleAc
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 @@ const char *oscar_list_icon_icq(PurpleAc
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 @@ const char *oscar_list_icon_aim(PurpleAc
return "aim";
}
- if (aim_snvalid_icq(b->name))
+ if (aim_snvalid_icq(name))
return "icq";
return "aim";
}
@@ -5733,14 +5749,16 @@ const char *oscar_list_emblem(PurpleBudd
PurpleStatus *status;
const char *status_id;
aim_userinfo_t *userinfo = NULL;
+ const char *name;
- account = b->account;
+ 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 @@ const char *oscar_list_emblem(PurpleBudd
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,
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 @@ char *oscar_status_text(PurpleBuddy *b)
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 @@ static void oscar_ssi_editcomment(struct
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 @@ static void oscar_buddycb_edit_comment(P
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 @@ static void oscar_buddycb_edit_comment(P
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 @@ oscar_ask_directim(gpointer object, gpoi
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 @@ oscar_get_aim_info_cb(PurpleBlistNode *n
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 @@ oscar_buddy_menu(PurpleBuddy *buddy) {
GList *menu;
PurpleMenuAction *act;
aim_userinfo_t *userinfo;
+ PurpleAccount *account;
+ const char *bname = purple_buddy_get_name(buddy);
- gc = purple_account_get_connection(buddy->account);
+ 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 @@ oscar_buddy_menu(PurpleBuddy *buddy) {
#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 @@ oscar_buddy_menu(PurpleBuddy *buddy) {
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 @@ static void oscar_show_awaitingauth(Purp
OscarData *od = gc->proto_data;
gchar *nombre, *text, *tmp;
PurpleBlistNode *gnode, *cnode, *bnode;
+ PurpleAccount *account;
int num=0;
text = g_strdup("");
+ account = purple_connection_get_account(gc);
- 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 *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;
============================================================
--- libpurple/protocols/qq/buddy_opt.c dd97c76aecca5f5faa6445642a21e74f4aeae891
+++ libpurple/protocols/qq/buddy_opt.c 66f8a858a8cee3f4329b590a99a3f389667059fe
@@ -240,6 +240,7 @@ void qq_block_buddy_with_gc_and_uid(gc_a
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 @@ void qq_add_buddy(PurpleConnection *gc,
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 @@ void qq_remove_buddy(PurpleConnection *g
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 @@ void qq_remove_buddy(PurpleConnection *g
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);
}
}
============================================================
--- libpurple/protocols/qq/group.c 4156644554b1da039cbb013b3ca1318d700fedd5
+++ libpurple/protocols/qq/group.c 2d5dec7fa1d8cee20c750e0cb896df715d219c4b
@@ -168,9 +168,9 @@ void qq_group_init(PurpleConnection *gc)
}
/* 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;
============================================================
--- libpurple/protocols/qq/group_internal.c 9c1c472072ff1a2fbe1ca02066b0ecb6b9ebf9b6
+++ libpurple/protocols/qq/group_internal.c 1d937f0e83167f1814c55f7ffc54dddfd02666ec
@@ -178,6 +178,7 @@ void qq_group_refresh(PurpleConnection *
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 @@ void qq_group_refresh(PurpleConnection *
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));
}
============================================================
--- libpurple/protocols/qq/qq.c e0cfd8ddb5718cead0b5a384dfc8aa2445c7a5d2
+++ libpurple/protocols/qq/qq.c 17ca552a3d1a20b082fe8d97ee62102cd2895dab
@@ -585,11 +585,14 @@ static void _qq_menu_unsubscribe_group(P
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);
}
============================================================
--- libpurple/protocols/sametime/sametime.c f57a2836e3579dc767727265d04760f695730200
+++ libpurple/protocols/sametime/sametime.c 263b10548f64abf685dafad9ff563992f782d8d3
@@ -658,7 +658,6 @@ static void blist_export(PurpleConnectio
*/
PurpleAccount *acct;
- PurpleBuddyList *blist;
PurpleBlistNode *gn, *cn, *bn;
PurpleGroup *grp;
PurpleBuddy *bdy;
@@ -669,10 +668,7 @@ static void blist_export(PurpleConnectio
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 @@ static void blist_export(PurpleConnectio
/* 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 @@ static void blist_export(PurpleConnectio
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(Purple
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 mwPurplePlu
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 @@ static void group_add(struct mwPurplePlu
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 @@ static PurpleGroup *group_ensure(PurpleC
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 @@ static void group_clear(PurpleGroup *gro
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 @@ static void group_clear(PurpleGroup *gro
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 @@ static void group_prune(PurpleConnection
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 @@ static void group_prune(PurpleConnection
/* 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 @@ static void blist_sync(PurpleConnection
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 @@ static void blist_sync(PurpleConnection
/* 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 @@ static void blist_menu_nab(PurpleBlistNo
GString *str;
char *tmp;
+ const char *gname;
g_return_if_fail(pd != NULL);
@@ -1290,11 +1287,12 @@ static void blist_menu_nab(PurpleBlistNo
str = g_string_new(NULL);
tmp = (char *) purple_blist_node_get_string(node, GROUP_KEY_NAME);
+ gname = purple_group_get_name(group);
- g_string_append_printf(str, _("<b>Group Title:</b> %s<br>"), group->name);
+ 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 @@ static void blist_init(PurpleAccount *ac
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 @@ static void blist_init(PurpleAccount *ac
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 @@ static void services_starting(struct mwP
PurpleConnection *gc;
PurpleAccount *acct;
struct mwStorageUnit *unit;
- PurpleBuddyList *blist;
PurpleBlistNode *l;
gc = pd->gc;
@@ -1394,8 +1391,7 @@ static void services_starting(struct mwP
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(PurpleB
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(PurpleB
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 @@ static void mw_prpl_tooltip_text(PurpleB
}
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 @@ static void conf_create_prompt_join(Purp
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 @@ static void conf_create_prompt_join(Purp
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 @@ static void blist_menu_conf_create(Purpl
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 @@ static void blist_menu_conf_create(Purpl
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 @@ static void conf_select_prompt_invite(Pu
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 @@ static void blist_menu_conf_list(PurpleB
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 @@ static void blist_menu_conf_list(PurpleB
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 @@ static void blist_menu_conf(PurpleBlistN
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 @@ static void mw_prpl_get_info(PurpleConne
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
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 @@ static void add_buddy_resolved(struct mw
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 @@ static void mw_prpl_add_buddy(PurpleConn
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 @@ static void mw_prpl_add_buddies(PurpleCo
/* 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 @@ static void mw_prpl_remove_buddy(PurpleC
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);
============================================================
--- libpurple/protocols/silc/buddy.c 7a08c648fb7c5adfe6f6569338d2fec65e1cc5de
+++ libpurple/protocols/silc/buddy.c 961da3f92b67f8a1bfab941b9eec39f52f60dab9
@@ -322,9 +322,12 @@ silcpurple_buddy_keyagr(PurpleBlistNode
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 @@ silcpurple_buddy_resetkey(PurpleBlistNod
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 @@ silcpurple_buddy_privkey_menu(PurpleBlis
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 @@ silcpurple_buddy_getkey_menu(PurpleBlist
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 @@ silcpurple_buddy_showkey(PurpleBlistNode
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 @@ silcpurple_buddy_showkey(PurpleBlistNode
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 @@ void silcpurple_get_info(PurpleConnectio
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 @@ silcpurple_add_buddy_pk_no(SilcPurpleBud
{
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 @@ silcpurple_add_buddy_ask_import(void *us
/* 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 @@ silcpurple_add_buddy_ask_pk(SilcPurpleBu
{
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 @@ silcpurple_add_buddy_resolved(SilcClient
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 @@ silcpurple_add_buddy_resolved(SilcClient
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 @@ silcpurple_add_buddy_i(PurpleConnection
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(PurpleCon
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
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
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 @@ silcpurple_buddy_kill(PurpleBlistNode *n
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
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;
============================================================
--- libpurple/protocols/silc/chat.c 749446bb892a607589f50093346156b207802e04
+++ libpurple/protocols/silc/chat.c fabe936dde280f66eef08d8aafd8021d0162ff79
@@ -182,7 +182,9 @@ silcpurple_chat_getinfo_menu(PurpleBlist
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 @@ silcpurple_chat_chauth(PurpleBlistNode *
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 @@ silcpurple_chat_prv_add(SilcPurpleCharPr
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 @@ silcpurple_chat_prv(PurpleBlistNode *nod
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 @@ silcpurple_chat_prv(PurpleBlistNode *nod
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 @@ silcpurple_chat_permanent_reset(PurpleBl
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 @@ silcpurple_chat_permanent(PurpleBlistNod
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 @@ silcpurple_chat_permanent(PurpleBlistNod
(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 @@ silcpurple_chat_ulimit(PurpleBlistNode *
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 @@ silcpurple_chat_resettopic(PurpleBlistNo
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 @@ silcpurple_chat_settopic(PurpleBlistNode
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 @@ silcpurple_chat_resetprivate(PurpleBlist
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 @@ silcpurple_chat_setprivate(PurpleBlistNo
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 @@ silcpurple_chat_resetsecret(PurpleBlistN
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 @@ silcpurple_chat_setsecret(PurpleBlistNod
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 *
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;
============================================================
--- libpurple/protocols/silc/ops.c 87a421e04a54cdb875b13f03ff5c53759e973308
+++ libpurple/protocols/silc/ops.c 279e98d2a236fc7dc4fb574d39b77338ed73438a
@@ -431,6 +431,7 @@ silc_notify(SilcClient client, SilcClien
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_notify(SilcClient client, SilcClien
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 @@ silc_notify(SilcClient client, SilcClien
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))
============================================================
--- libpurple/protocols/simple/simple.c 42fc9ca312f0f4aff9bde7d8be531fbc0e7d9b50
+++ libpurple/protocols/simple/simple.c 9f4cdebe325f0d988a40edde1ae8ab622ffc8154
@@ -196,33 +196,36 @@ static void simple_add_buddy(PurpleConne
{
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(PurpleCo
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 @@ static gboolean simple_add_lcs_contacts(
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);
============================================================
--- libpurple/protocols/yahoo/yahoo.c 7e5229419ad9251d0903c281223a7b90d319ec21
+++ libpurple/protocols/yahoo/yahoo.c aa3f072593d38396b674483920284eb8900952bb
@@ -385,7 +385,7 @@ static void yahoo_do_group_check(PurpleA
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 @@ static void yahoo_do_group_cleanup(gpoin
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 @@ static void ignore_buddy(PurpleBuddy *bu
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 @@ static const char *yahoo_list_emblem(Pur
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 @@ static void yahoo_initiate_conference(Pu
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 @@ static void yahoo_initiate_conference(Pu
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 @@ static void yahoo_presence_settings(Purp
int presence_val = GPOINTER_TO_INT(data);
buddy = (PurpleBuddy *) node;
- gc = purple_account_get_connection(buddy->account);
+ gc = purple_account_get_connection(purple_buddy_get_account(buddy));
- yahoo_friend_update_presence(gc, buddy->name, presence_val);
+ yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val);
}
static void yahoo_game(PurpleBlistNode *node, gpointer data) {
@@ -3226,10 +3230,10 @@ static void yahoo_game(PurpleBlistNode *
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 @@ static char *yahoo_status_text(PurpleBud
YahooFriend *f = NULL;
const char *msg;
char *msg2;
+ PurpleAccount *account;
- f = yahoo_friend_find(b->account->gc, b->name);
+ 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 @@ void yahoo_tooltip_text(PurpleBuddy *b,
char *escaped;
char *status = NULL;
const char *presence = NULL;
+ PurpleAccount *account;
- f = yahoo_friend_find(b->account->gc, b->name);
+ 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 @@ static void yahoo_addbuddyfrommenu_cb(Pu
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 @@ static void yahoo_chat_goto_menu(PurpleB
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_chat_goto(gc, buddy->name);
+ 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(Purp
static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data)
{
PurpleBuddy *b = (PurpleBuddy *)node;
- PurpleConnection *gc = b->account->gc;
+ PurpleAccount *account = purple_buddy_get_account(b);
+ PurpleConnection *gc = purple_account_get_connection(account);
- yahoo_doodle_initiate(gc, b->name);
+ yahoo_doodle_initiate(gc, purple_buddy_get_name(b));
}
static GList *yahoo_buddy_menu(PurpleBuddy *buddy)
@@ -3403,12 +3412,12 @@ static GList *yahoo_buddy_menu(PurpleBud
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 @@ static void yahoo_add_buddy(PurpleConnec
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 @@ static void yahoo_add_buddy(PurpleConnec
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(PurpleCon
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;
+ const char *bname, *gname;
- if (!(yahoo_friend_find(gc, buddy->name)))
+ 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 @@ static void yahoo_remove_buddy(PurpleCon
g_slist_free(buddies);
if (remove)
- g_hash_table_remove(yd->friends, buddy->name);
+ g_hash_table_remove(yd->friends, bname);
- cg = yahoo_string_encode(gc, group->name, NULL);
+ 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 @@ static void yahoo_rename_group(PurpleCon
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);
============================================================
--- libpurple/protocols/yahoo/yahoo_profile.c e97dfd619ed4abfce3dd8ecbf04c729a76d18342
+++ libpurple/protocols/yahoo/yahoo_profile.c 38456958cc93c616e704c21f677a034d747ee004
@@ -715,7 +715,7 @@ static void yahoo_extract_user_info_text
/* 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 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
* 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. "
============================================================
--- libpurple/protocols/yahoo/yahoochat.c 4196414d981c3f3ae81170143fb1a099a76c84f1
+++ libpurple/protocols/yahoo/yahoochat.c 102166db5a9d9cd82d35900ecdb4cf81819a9304
@@ -514,12 +514,12 @@ void yahoo_process_chat_join(PurpleConne
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;
============================================================
--- libpurple/protocols/zephyr/zephyr.c c6a3eb210389c26225c50bdd12fd16d47d4a4967
+++ libpurple/protocols/zephyr/zephyr.c 905f3c17c98834fe9521131fb638245c187a7f9d
@@ -732,7 +732,7 @@ static char *zephyr_to_html(const char *
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 @@ static void handle_message(PurpleConnect
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 @@ static void handle_message(PurpleConnect
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 @@ static void handle_message(PurpleConnect
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 @@ static gint check_notify_tzc(gpointer da
/* XXX fix */
char *user;
PurpleBuddy *b;
+ const char *bname;
int nlocs = 0;
parse_tree *locations;
gchar *locval;
@@ -1161,11 +1166,12 @@ static gint check_notify_tzc(gpointer da
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 @@ static gint check_notify_tzc(gpointer da
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)
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 @@ static gint check_loc(gpointer_data)
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 @@ static gint check_loc(gpointer data)
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 @@ static gint check_loc(gpointer data)
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 @@ static gint check_loc(gpointer data)
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 @@ static gint check_loc(gpointer data)
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 @@ static void write_anyone(PurpleConnectio
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 @@ static void write_anyone(PurpleConnectio
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 @@ static void write_anyone(PurpleConnectio
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 @@ static PurpleChat *zephyr_find_blist_cha
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)
+ if(purple_chat_get_account(chat) != account)
continue;
- if(!(zclass = g_hash_table_lookup(chat->components, "class")))
+ components = purple_chat_get_components(chat);
+ if(!(zclass = g_hash_table_lookup(components, "class")))
continue;
- if(!(inst = g_hash_table_lookup(chat->components, "instance")))
+ 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;
More information about the Commits
mailing list