summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpurple/account.c21
-rw-r--r--libpurple/buddyicon.c4
-rw-r--r--libpurple/conversation.c4
-rw-r--r--libpurple/log.c16
-rw-r--r--libpurple/pounce.c22
-rw-r--r--libpurple/privacy.c6
-rw-r--r--libpurple/server.c17
-rw-r--r--libpurple/status.c24
8 files changed, 71 insertions, 43 deletions
diff --git a/libpurple/account.c b/libpurple/account.c
index 8196e266b6..640f29e7f3 100644
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -2249,7 +2249,9 @@ purple_account_add_buddies(PurpleAccount *account, GList *buddies)
/* Make a list of what group each buddy is in */
for (cur = buddies; cur != NULL; cur = cur->next) {
PurpleBlistNode *node = cur->data;
- groups = g_list_append(groups, node->parent->parent);
+ PurpleBlistNode *parent = purple_blist_node_get_parent(node);
+ PurpleBlistNode *gparent = purple_blist_node_get_parent(parent);
+ groups = g_list_append(groups, gparent);
}
if (prpl_info->add_buddies != NULL)
@@ -2499,23 +2501,26 @@ purple_accounts_delete(PurpleAccount *account)
purple_accounts_remove(account);
/* Remove this account's buddies */
- for (gnode = purple_get_blist()->root; gnode != NULL; gnode = gnode->next) {
+ for (gnode = purple_blist_get_root();
+ gnode != NULL;
+ gnode = purple_blist_node_get_sibling_next(gnode))
+ {
if (!PURPLE_BLIST_NODE_IS_GROUP(gnode))
continue;
- cnode = gnode->child;
+ cnode = purple_blist_node_get_first_child(gnode);
while (cnode) {
- PurpleBlistNode *cnode_next = cnode->next;
+ PurpleBlistNode *cnode_next = purple_blist_node_get_sibling_next(cnode);
if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
- bnode = cnode->child;
+ bnode = purple_blist_node_get_first_child(cnode);
while (bnode) {
- PurpleBlistNode *bnode_next = bnode->next;
+ PurpleBlistNode *bnode_next = purple_blist_node_get_sibling_next(bnode);
if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) {
PurpleBuddy *b = (PurpleBuddy *)bnode;
- if (b->account == account)
+ if (purple_buddy_get_account(b) == account)
purple_blist_remove_buddy(b);
}
bnode = bnode_next;
@@ -2523,7 +2528,7 @@ purple_accounts_delete(PurpleAccount *account)
} else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
PurpleChat *c = (PurpleChat *)cnode;
- if (c->account == account)
+ if (purple_chat_get_account(c) == account)
purple_blist_remove_chat(c);
}
cnode = cnode_next;
diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c
index f2567744a6..6745a4f030 100644
--- a/libpurple/buddyicon.c
+++ b/libpurple/buddyicon.c
@@ -889,7 +889,9 @@ purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node,
if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
PurpleBlistNode *child;
- for (child = node->child ; child ; child = child->next)
+ for (child = purple_blist_node_get_first_child(node);
+ child;
+ child = purple_blist_node_get_sibling_next(child))
{
PurpleBuddy *buddy;
PurpleConversation *conv;
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
index 34fbaa9c0a..b67557b938 100644
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -665,7 +665,7 @@ purple_conversation_autoset_title(PurpleConversation *conv)
text = purple_buddy_get_contact_alias(b);
} else if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
if(account && ((chat = purple_blist_find_chat(account, name)) != NULL))
- text = chat->alias;
+ text = purple_chat_get_name(chat);
}
@@ -912,7 +912,7 @@ purple_conversation_write(PurpleConversation *conv, const char *who,
if (purple_account_get_alias(account) != NULL)
alias = account->alias;
- else if (b != NULL && strcmp(b->name, purple_buddy_get_contact_alias(b)))
+ else if (b != NULL && strcmp(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b)))
alias = purple_buddy_get_contact_alias(b);
else if (purple_connection_get_display_name(gc) != NULL)
alias = purple_connection_get_display_name(gc);
diff --git a/libpurple/log.c b/libpurple/log.c
index 729da5b178..a287a28e07 100644
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -1952,22 +1952,28 @@ static void old_logger_get_log_sets(PurpleLogSetCallback cb, GHashTable *sets)
set->name = set->normalized_name = name;
/* Search the buddy list to find the account and to determine if this is a buddy. */
- for (gnode = purple_get_blist()->root; !found && gnode != NULL; gnode = gnode->next)
+ for (gnode = purple_blist_get_root();
+ !found && gnode != NULL;
+ gnode = purple_blist_node_get_sibling_next(gnode))
{
if (!PURPLE_BLIST_NODE_IS_GROUP(gnode))
continue;
- for (cnode = gnode->child; !found && cnode != NULL; cnode = cnode->next)
+ for (cnode = purple_blist_node_get_first_child(gnode);
+ !found && cnode != NULL;
+ cnode = purple_blist_node_get_sibling_next(cnode))
{
if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
continue;
- for (bnode = cnode->child; !found && bnode != NULL; bnode = bnode->next)
+ for (bnode = purple_blist_node_get_first_child(cnode);
+ !found && bnode != NULL;
+ bnode = purple_blist_node_get_sibling_next(bnode))
{
PurpleBuddy *buddy = (PurpleBuddy *)bnode;
- if (!strcmp(buddy->name, name)) {
- set->account = buddy->account;
+ if (!strcmp(purple_buddy_get_name(buddy), name)) {
+ set->account = purple_buddy_get_account(buddy);
set->buddy = TRUE;
found = TRUE;
}
diff --git a/libpurple/pounce.c b/libpurple/pounce.c
index 0f6e547abc..8a505a8cad 100644
--- a/libpurple/pounce.c
+++ b/libpurple/pounce.c
@@ -1042,35 +1042,39 @@ free_pounce_handler(gpointer user_data)
static void
buddy_state_cb(PurpleBuddy *buddy, PurplePounceEvent event)
{
- purple_pounce_execute(buddy->account, buddy->name, event);
+ PurpleAccount *account = purple_buddy_get_account(buddy);
+ const gchar *name = purple_buddy_get_name(buddy);
+
+ purple_pounce_execute(account, name, event);
}
static void
buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status,
PurpleStatus *status)
{
+ PurpleAccount *account = purple_buddy_get_account(buddy);
+ const gchar *name = purple_buddy_get_name(buddy);
gboolean old_available, available;
available = purple_status_is_available(status);
old_available = purple_status_is_available(old_status);
if (available && !old_available)
- purple_pounce_execute(buddy->account, buddy->name,
- PURPLE_POUNCE_AWAY_RETURN);
+ purple_pounce_execute(account, name, PURPLE_POUNCE_AWAY_RETURN);
else if (!available && old_available)
- purple_pounce_execute(buddy->account, buddy->name,
- PURPLE_POUNCE_AWAY);
+ purple_pounce_execute(account, name, PURPLE_POUNCE_AWAY);
}
static void
buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle)
{
+ PurpleAccount *account = purple_buddy_get_account(buddy);
+ const gchar *name = purple_buddy_get_name(buddy);
+
if (idle && !old_idle)
- purple_pounce_execute(buddy->account, buddy->name,
- PURPLE_POUNCE_IDLE);
+ purple_pounce_execute(account, name, PURPLE_POUNCE_IDLE);
else if (!idle && old_idle)
- purple_pounce_execute(buddy->account, buddy->name,
- PURPLE_POUNCE_IDLE_RETURN);
+ purple_pounce_execute(account, name, PURPLE_POUNCE_IDLE_RETURN);
}
static void
diff --git a/libpurple/privacy.c b/libpurple/privacy.c
index f92827cf21..d3665ce946 100644
--- a/libpurple/privacy.c
+++ b/libpurple/privacy.c
@@ -224,8 +224,10 @@ add_all_buddies_to_permit_list(PurpleAccount *account, gboolean local)
while (list != NULL)
{
PurpleBuddy *buddy = list->data;
- if (!g_slist_find_custom(account->permit, buddy->name, (GCompareFunc)g_utf8_collate))
- purple_privacy_permit_add(account, buddy->name, local);
+ const gchar *name = purple_buddy_get_name(buddy);
+
+ if (!g_slist_find_custom(account->permit, name, (GCompareFunc)g_utf8_collate))
+ purple_privacy_permit_add(account, name, local);
list = g_slist_delete_link(list, list);
}
}
diff --git a/libpurple/server.c b/libpurple/server.c
index a86c5d9a1f..d63bef265b 100644
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -230,7 +230,7 @@ void serv_alias_buddy(PurpleBuddy *b)
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
if(b && prpl_info && prpl_info->alias_buddy) {
- prpl_info->alias_buddy(gc, b->name, b->alias);
+ prpl_info->alias_buddy(gc, purple_buddy_get_name(b), purple_buddy_get_alias(b));
}
}
@@ -247,18 +247,20 @@ serv_got_alias(PurpleConnection *gc, const char *who, const char *alias)
while (buddies != NULL)
{
+ const gchar *server_alias = purple_buddy_get_server_alias(b);
+
b = buddies->data;
buddies = g_slist_delete_link(buddies, buddies);
- if((b->server_alias == NULL && alias == NULL) ||
- (b->server_alias && alias && !strcmp(b->server_alias, alias)))
+ if((server_alias == NULL && alias == NULL) ||
+ (server_alias && alias && !strcmp(server_alias, alias)))
{
continue;
}
purple_blist_server_alias_buddy(b, alias);
- conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, account);
+ conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(b), account);
if(conv != NULL && alias != NULL && strcmp(alias, who))
{
char *escaped = g_markup_escape_text(who, -1);
@@ -288,11 +290,12 @@ purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char
buddies = purple_find_buddies(account, who);
while(buddies != NULL) {
+ const gchar *balias = purple_buddy_get_alias(b);
b = buddies->data;
buddies = g_slist_delete_link(buddies, buddies);
- if((!b->alias && !alias) || (b->alias && alias && !strcmp(b->alias, alias)))
+ if((!balias && !alias) || (balias && alias && !strcmp(balias, alias)))
continue;
purple_blist_alias_buddy(b, alias);
@@ -366,7 +369,9 @@ void serv_move_buddy(PurpleBuddy *b, PurpleGroup *og, PurpleGroup *ng)
if(gc && og && ng) {
if (prpl_info && prpl_info->group_buddy) {
- prpl_info->group_buddy(gc, b->name, og->name, ng->name);
+ prpl_info->group_buddy(gc, purple_buddy_get_name(b),
+ purple_group_get_name(og),
+ purple_group_get_name(ng));
}
}
}
diff --git a/libpurple/status.c b/libpurple/status.c
index 9950644b36..49aff54e55 100644
--- a/libpurple/status.c
+++ b/libpurple/status.c
@@ -612,7 +612,8 @@ notify_buddy_status_update(PurpleBuddy *buddy, PurplePresence *presence,
if (old_status != NULL)
{
- tmp = g_strdup_printf(_("%s (%s) changed status from %s to %s"), buddy_alias, buddy->name,
+ tmp = g_strdup_printf(_("%s (%s) changed status from %s to %s"), buddy_alias,
+ purple_buddy_get_name(buddy),
purple_status_get_name(old_status),
purple_status_get_name(new_status));
logtmp = g_markup_escape_text(tmp, -1);
@@ -623,19 +624,21 @@ notify_buddy_status_update(PurpleBuddy *buddy, PurplePresence *presence,
if (purple_status_is_active(new_status))
{
- tmp = g_strdup_printf(_("%s (%s) is now %s"), buddy_alias, buddy->name,
+ tmp = g_strdup_printf(_("%s (%s) is now %s"), buddy_alias,
+ purple_buddy_get_name(buddy),
purple_status_get_name(new_status));
logtmp = g_markup_escape_text(tmp, -1);
}
else
{
- tmp = g_strdup_printf(_("%s (%s) is no longer %s"), buddy_alias, buddy->name,
+ tmp = g_strdup_printf(_("%s (%s) is no longer %s"), buddy_alias,
+ purple_buddy_get_name(buddy),
purple_status_get_name(new_status));
logtmp = g_markup_escape_text(tmp, -1);
}
}
- log = purple_account_get_log(buddy->account, FALSE);
+ log = purple_account_get_log(purple_buddy_get_account(buddy), FALSE);
if (log != NULL)
{
purple_log_write(log, PURPLE_MESSAGE_SYSTEM, buddy_alias,
@@ -1132,13 +1135,13 @@ purple_presence_new_for_buddy(PurpleBuddy *buddy)
PurpleAccount *account;
g_return_val_if_fail(buddy != NULL, NULL);
- account = buddy->account;
+ account = purple_buddy_get_account(buddy);
presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_BUDDY);
- presence->u.buddy.name = g_strdup(buddy->name);
- presence->u.buddy.account = buddy->account;
- presence->statuses = purple_prpl_get_statuses(buddy->account, presence);
+ presence->u.buddy.name = g_strdup(purple_buddy_get_name(buddy));
+ presence->u.buddy.account = account;
+ presence->statuses = purple_prpl_get_statuses(account, presence);
presence->u.buddy.buddy = buddy;
@@ -1234,12 +1237,13 @@ update_buddy_idle(PurpleBuddy *buddy, PurplePresence *presence,
time_t current_time, gboolean old_idle, gboolean idle)
{
PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
+ PurpleAccount *account = purple_buddy_get_account(buddy);
if (!old_idle && idle)
{
if (purple_prefs_get_bool("/purple/logging/log_system"))
{
- PurpleLog *log = purple_account_get_log(buddy->account, FALSE);
+ PurpleLog *log = purple_account_get_log(account, FALSE);
if (log != NULL)
{
@@ -1259,7 +1263,7 @@ update_buddy_idle(PurpleBuddy *buddy, PurplePresence *presence,
{
if (purple_prefs_get_bool("/purple/logging/log_system"))
{
- PurpleLog *log = purple_account_get_log(buddy->account, FALSE);
+ PurpleLog *log = purple_account_get_log(account, FALSE);
if (log != NULL)
{