Mercurial > pidgin.yaz
diff src/protocols/toc/toc.c @ 9285:7a8aa87164ae
[gaim-migrate @ 10088]
Ok I'm done. This started out as shx's patch to make add/remove
buddy/buddies take GaimBuddy and GaimGroup's in various places.
I think his diff was like 2000 lines and mine is like 5000. I
tried to clean up blist.c a bit and make it more uniform. There
are some more g_return_if_fail() checks. Removed some code that
was deprecated--it's probably been long enough. Removed some
#include <multi.h>'s. Make blist.xml saving happen on a timer,
like prefs.xml and accounts.xml.
Sorry if this doesn't merge cleanly with whatever you're doing.
People should really test this a lot.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 15 Jun 2004 02:37:27 +0000 |
parents | 8b1af7cadeb8 |
children | b3bda982996b |
line wrap: on
line diff
--- a/src/protocols/toc/toc.c Tue Jun 15 01:17:16 2004 +0000 +++ b/src/protocols/toc/toc.c Tue Jun 15 02:37:27 2004 +0000 @@ -567,9 +567,9 @@ struct signon so; char buf[8 * 1024], *c; char snd[BUF_LEN * 2]; - const char *username = gaim_account_get_username(account); char *password; + GaimBuddy *buddy; /* there's data waiting to be read, so read it. */ if (wait_reply(gc, buf, 8 * 1024) <= 0) { @@ -647,7 +647,10 @@ * Add me to my buddy list so that we know the time when * the server thinks I signed on. */ - serv_add_buddy(gc, username, NULL); + buddy = gaim_buddy_new(account, username, NULL); + /* XXX - Pick a group to add to */ + /* gaim_blist_add(buddy, NULL, g, NULL); */ + serv_add_buddy(gc, buddy); /* Client sends TOC toc_init_done message */ gaim_debug(GAIM_DEBUG_INFO, "toc", @@ -1185,52 +1188,56 @@ } static void -toc_add_buddy(GaimConnection *gc, const char *name, GaimGroup *group) +toc_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { char buf[BUF_LEN * 2]; - g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", gaim_normalize(gc->account, name)); + g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", gaim_normalize(gc->account, buddy->name)); sflap_send(gc, buf, -1, TYPE_DATA); toc_set_config(gc); } -static void toc_add_buddies(GaimConnection *gc, GList *buddies) +static void toc_add_buddies(GaimConnection *gc, GList *buddies, GList *groups) { char buf[BUF_LEN * 2]; int n; + GList *cur; n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); - while (buddies) { - if (strlen(gaim_normalize(gc->account, buddies->data)) + n + 32 > MSG_LEN) { + for (cur = buddies; cur != NULL; cur = cur->next) { + GaimBuddy *buddy = cur->data; + + if (strlen(gaim_normalize(gc->account, buddy->name)) + n + 32 > MSG_LEN) { sflap_send(gc, buf, -1, TYPE_DATA); n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); } - n += g_snprintf(buf + n, sizeof(buf) - n, " %s", gaim_normalize(gc->account, buddies->data)); - buddies = buddies->next; + n += g_snprintf(buf + n, sizeof(buf) - n, " %s", gaim_normalize(gc->account, buddy->name)); } sflap_send(gc, buf, -1, TYPE_DATA); } -static void toc_remove_buddy(GaimConnection *gc, const char *name, const char *group) +static void toc_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { char buf[BUF_LEN * 2]; - g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", gaim_normalize(gc->account, name)); + g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", gaim_normalize(gc->account, buddy->name)); sflap_send(gc, buf, -1, TYPE_DATA); toc_set_config(gc); } -static void toc_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) +static void toc_remove_buddies(GaimConnection *gc, GList *buddies, GList *groups) { char buf[BUF_LEN * 2]; int n; + GList *cur; n = g_snprintf(buf, sizeof(buf), "toc_remove_buddy"); - while (buddies) { - if (strlen(gaim_normalize(gc->account, buddies->data)) + n + 32 > MSG_LEN) { + for (cur = buddies; cur != NULL; cur = cur->next) { + GaimBuddy *buddy = cur->data; + + if (strlen(gaim_normalize(gc->account, buddy->name)) + n + 32 > MSG_LEN) { sflap_send(gc, buf, -1, TYPE_DATA); n = g_snprintf(buf, sizeof(buf), "toc_remove_buddy"); } - n += g_snprintf(buf + n, sizeof(buf) - n, " %s", gaim_normalize(gc->account, buddies->data)); - buddies = buddies->next; + n += g_snprintf(buf + n, sizeof(buf) - n, " %s", gaim_normalize(gc->account, buddy->name)); } sflap_send(gc, buf, -1, TYPE_DATA); toc_set_config(gc);