Mercurial > pidgin
changeset 447:5db3734a1fe6
[gaim-migrate @ 457]
Attempting to reduce amount of messages sent when setting up buddy list.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 30 Jun 2000 03:45:03 +0000 |
parents | 6d78b988b479 |
children | 737dc468d778 |
files | src/server.c src/toc.c |
diffstat | 2 files changed, 28 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/server.c Fri Jun 30 02:35:56 2000 +0000 +++ b/src/server.c Fri Jun 30 03:45:03 2000 +0000 @@ -296,34 +296,35 @@ void serv_add_buddies(GList *buddies) { if (!USE_OSCAR) { - char buf[MSG_LEN]; - int n, num = 0; + char buf[MSG_LEN]; + int n, num = 0; - n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); - while(buddies) { - if (num == 20) { - sflap_send(buf, -1, TYPE_DATA); - n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); - num = 0; - } - ++num; - n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); - buddies = buddies->next; - } - sflap_send(buf, -1, TYPE_DATA); + n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); + while(buddies) { + /* i don't know why we choose 8, it just seems good */ + if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) { + sflap_send(buf, -1, TYPE_DATA); + n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); + num = 0; + } + ++num; + n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); + buddies = buddies->next; + } + sflap_send(buf, -1, TYPE_DATA); } else { - char buf[MSG_LEN]; - int n = 0; - while(buddies) { - if (n > MSG_LEN - 18) { - aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); - n = 0; + char buf[MSG_LEN]; + int n = 0; + while(buddies) { + if (n > MSG_LEN - 18) { + aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); + n = 0; + } + n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", + (char *)buddies->data); + buddies = buddies->next; } - n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", - (char *)buddies->data); - buddies = buddies->next; - } - aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); + aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); } }
--- a/src/toc.c Fri Jun 30 02:35:56 2000 +0000 +++ b/src/toc.c Fri Jun 30 03:45:03 2000 +0000 @@ -891,7 +891,7 @@ strncpy(current,c+2, sizeof(current)); add_group(current); how_many++; - } else if (*c == 'b') { + } else if (*c == 'b' && !find_buddy(c+2)) { add_buddy(current, c+2); how_many++; bud = g_list_append(bud, c+2); @@ -913,7 +913,7 @@ fprintf(stdout, "Sending message '%s'\n",buf); #endif - serv_add_buddies(bud); + if (bud != NULL) serv_add_buddies(bud); serv_set_permit_deny(); if (blist) { build_edit_tree();