Mercurial > pidgin
diff src/protocols/gg/gg.c @ 10869:3e43c132f151
[gaim-migrate @ 12556]
We no longer call "serv_add_buddies" at log in. Any PRPL that relied on
that should look through the buddy list itself and do whatever it needs
to after calling gaim_connection_set_state(gc, GAIM_CONNECTED);
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 25 Apr 2005 03:55:11 +0000 |
parents | 4a56b48dbaa6 |
children | 50224ac8184d |
line wrap: on
line diff
--- a/src/protocols/gg/gg.c Mon Apr 25 03:41:16 2005 +0000 +++ b/src/protocols/gg/gg.c Mon Apr 25 03:55:11 2005 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 12555 2005-04-25 03:41:16Z datallah $ + * $Id: gg.c 12556 2005-04-25 03:55:11Z thekingant $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * @@ -758,6 +758,49 @@ gg_free_event(e); } +static void agg_send_buddylist(GaimConnection *gc) +{ + GaimBuddyList *blist; + GaimBlistNode *gnode, *cnode, *bnode; + GaimBuddy *buddy; + struct agg_data *gd = (struct agg_data *)gc->proto_data; + uin_t *userlist = NULL; + int userlist_size = 0; + + if ((blist = gaim_get_blist()) != NULL) + { + for (gnode = blist->root; gnode != NULL; gnode = gnode->next) + { + if (!GAIM_BLIST_NODE_IS_GROUP(gnode)) + continue; + for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) + { + if (!GAIM_BLIST_NODE_IS_CONTACT(cnode)) + continue; + for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) + { + if (!GAIM_BLIST_NODE_IS_BUDDY(bnode)) + continue; + buddy = (GaimBuddy *)bnode; + if (invalid_uin(buddy->name)) + continue; + userlist_size++; + userlist = g_renew(uin_t, userlist, userlist_size); + userlist[userlist_size - 1] = + (uin_t) strtol(buddy->name, (char **)NULL, 10); + } + } + } + } + + if (userlist) { + gg_notify(gd->sess, userlist, userlist_size); + g_free(userlist); + } + + agg_save_buddy_list(gc, NULL); +} + void login_callback(gpointer data, gint source, GaimInputCondition cond) { GaimConnection *gc = data; @@ -855,6 +898,9 @@ /* Our signon is complete */ gaim_connection_set_state(gc, GAIM_CONNECTED); + /* Send the server our buddy list */ + agg_send_buddylist(gc); + break; case GG_EVENT_CONN_FAILED: gaim_input_remove(gc->inpa); @@ -975,31 +1021,6 @@ agg_save_buddy_list(gc, NULL); } -static void agg_add_buddies(GaimConnection *gc, GList *buddies, GList *groups) -{ - struct agg_data *gd = (struct agg_data *)gc->proto_data; - uin_t *userlist = NULL; - int userlist_size = 0; - - while (buddies) { - GaimBuddy *buddy = buddies->data; - if (!invalid_uin(buddy->name)) { - userlist_size++; - userlist = g_renew(uin_t, userlist, userlist_size); - userlist[userlist_size - 1] = - (uin_t) strtol(buddy->name, (char **)NULL, 10); - } - buddies = g_list_next(buddies); - } - - if (userlist) { - gg_notify(gd->sess, userlist, userlist_size); - g_free(userlist); - } - - agg_save_buddy_list(gc, NULL); -} - static void agg_buddy_free (GaimBuddy *buddy) { if (buddy->proto_data) { @@ -1735,10 +1756,10 @@ agg_get_info, /* get_info */ agg_set_status, /* set_away */ NULL, /* set_idle */ - agg_change_passwd, /* change_passwd */ - agg_add_buddy, /* add_buddy */ - agg_add_buddies, /* add_buddies */ - agg_rem_buddy, /* remove_buddy */ + agg_change_passwd, /* change_passwd */ + agg_add_buddy, /* add_buddy */ + NULL, /* add_buddies */ + agg_rem_buddy, /* remove_buddy */ NULL, /* remove_buddies */ agg_permit_deny_dummy, /* add_permit */ agg_permit_deny_dummy, /* add_deny */