pidgin.next.minor: 7cee5c06: moved gg to use the api rather than stru...
grim at pidgin.im
grim at pidgin.im
Thu Oct 30 23:45:37 EDT 2008
-----------------------------------------------------------------
Revision: 7cee5c064d15a9555be5e272a513dbbc1a637a14
Ancestor: 8490194de528b3aa4c7fb94ddc2c204f54b0f4d5
Author: grim at pidgin.im
Date: 2008-10-31T03:38:24
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/7cee5c064d15a9555be5e272a513dbbc1a637a14
Modified files:
libpurple/protocols/gg/buddylist.c
libpurple/protocols/gg/gg.c
ChangeLog:
moved gg to use the api rather than structs directly
-------------- next part --------------
============================================================
--- libpurple/protocols/gg/buddylist.c 353535de7d31ded3a69e0486d86d6d22604f31e6
+++ libpurple/protocols/gg/buddylist.c a7ee0115cea310b82a36bf62b1f0fcd6f92cb8c4
@@ -41,37 +41,47 @@ 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 = purple_blist_node_get_sibling_next(gnode))
+ {
if (!PURPLE_BLIST_NODE_IS_GROUP(gnode))
continue;
- for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) {
+ for (cnode = purple_blist_node_get_first_child(gnode);
+ cnode != NULL;
+ cnode = purple_blist_node_get_sibling_next(cnode))
+ {
if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
continue;
- for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) {
+ for (bnode = purple_blist_node_get_first_child(cnode);
+ bnode != NULL;
+ bnode = purple_blist_node_get_sibling_next(bnode))
+ {
+ PurpleAccount *ba = NULL;
+ const gchar *name = NULL;
+
if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
continue;
buddy = (PurpleBuddy *)bnode;
- if (buddy->account != account)
+ if ((ba = purple_buddy_get_account(buddy)) != account)
continue;
+ name = purple_buddy_get_name(buddy);
+
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(name);
types[size - 1] = GG_USER_NORMAL;
purple_debug_info("gg", "ggp_buddylist_send: adding %d\n",
userlist[size - 1]);
@@ -173,36 +183,45 @@ 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 = purple_blist_node_get_sibling_next(gnode))
+ {
if (!PURPLE_BLIST_NODE_IS_GROUP(gnode))
continue;
- for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) {
+ for (cnode = purple_blist_node_get_first_child(gnode);
+ cnode != NULL;
+ cnode = purple_blist_node_get_sibling_next(cnode))
+ {
if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
continue;
- for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) {
+ for (bnode = purple_blist_node_get_first_child(cnode);
+ bnode != NULL;
+ bnode = purple_blist_node_get_sibling_next(bnode))
+ {
+ const gchar *name = NULL;
+
if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
continue;
buddy = (PurpleBuddy *)bnode;
+
+ name = purple_buddy_get_name(buddy);
- if (buddy->account != account)
+ if (purple_buddy_get_account(buddy) != account)
continue;
purple_prpl_got_user_status(
- account, buddy->name, "offline", NULL);
+ account, name, "offline", NULL);
purple_debug_info("gg",
"ggp_buddylist_offline: gone: %s\n",
- buddy->name);
+ name);
}
}
}
@@ -212,7 +231,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 +238,42 @@ 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 = purple_blist_node_get_sibling_next(gnode))
+ {
if (!PURPLE_BLIST_NODE_IS_GROUP(gnode))
continue;
group = (PurpleGroup *)gnode;
- for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) {
+ for (cnode = purple_blist_node_get_first_child(gnode);
+ cnode != NULL;
+ cnode = purple_blist_node_get_sibling_next(cnode))
+ {
if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
continue;
- for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) {
- gchar *newdata, *name, *alias, *gname;
+ for (bnode = purple_blist_node_get_first_child(cnode);
+ bnode != NULL;
+ bnode = purple_blist_node_get_sibling_next(bnode))
+ {
+ gchar *newdata;
+ const gchar *name, *alias, *gname;
gchar *cp_alias, *cp_gname;
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 = purple_buddy_get_alias(buddy);
+ if(alias == NULL)
+ alias = name;
+ gname = purple_group_get_name(group);
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 4ff2484b4b4c18c041f87c49f15b6dc2ac2af6f1
@@ -1907,11 +1907,12 @@ static void ggp_add_buddy(PurpleConnecti
{
PurpleAccount *account;
GGPInfo *info = gc->proto_data;
+ const gchar *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)));
}
/* }}} */
More information about the Commits
mailing list