comparison src/protocols/irc/irc.c @ 4349:0c68d402f59f

[gaim-migrate @ 4614] XML Blist Gaim stores all the buddy lists in one big happy file now. You can order the buddies however you want, and they'll stay ordered that way. We can also store some per-buddy information now, which will be cool. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 19 Jan 2003 22:16:52 +0000
parents 9c7fcb211886
children 5fb47ec9bfe4
comparison
equal deleted inserted replaced
4348:922b66840a51 4349:0c68d402f59f
608 id->bc--; 608 id->bc--;
609 if (id->bc) 609 if (id->bc)
610 return; 610 return;
611 611
612 g_strdown(id->str->str); 612 g_strdown(id->str->str);
613 gr = gc->groups; 613 gr = groups;
614 while (gr) { 614 while (gr) {
615 GSList *m = ((struct group *)gr->data)->members; 615 GSList *m = ((struct group *)gr->data)->members;
616 while (m) { 616 while (m) {
617 struct buddy *b = m->data; 617 struct buddy *b = m->data;
618 char *tmp = g_strdup(b->name); 618 if(b->user->gc == gc) {
619 char *x, *l; 619 char *tmp = g_strdup(b->name);
620 g_strdown(tmp); 620 char *x, *l;
621 x = strstr(id->str->str, tmp); 621 g_strdown(tmp);
622 l = x + strlen(b->name); 622 x = strstr(id->str->str, tmp);
623 if (x && (*l != ' ' && *l != 0)) 623 l = x + strlen(b->name);
624 x = 0; 624 if (x && (*l != ' ' && *l != 0))
625 if (!b->present && x) 625 x = 0;
626 serv_got_update(gc, b->name, 1, 0, 0, 0, 0, 0); 626 if (!b->present && x)
627 else if (b->present && !x) 627 serv_got_update(gc, b->name, 1, 0, 0, 0, 0, 0);
628 serv_got_update(gc, b->name, 0, 0, 0, 0, 0, 0); 628 else if (b->present && !x)
629 g_free(tmp); 629 serv_got_update(gc, b->name, 0, 0, 0, 0, 0, 0);
630 g_free(tmp);
631 }
630 m = m->next; 632 m = m->next;
631 } 633 }
632 gr = gr->next; 634 gr = gr->next;
633 } 635 }
634 g_string_free(id->str, TRUE); 636 g_string_free(id->str, TRUE);
641 struct gaim_connection *gc = data; 643 struct gaim_connection *gc = data;
642 struct irc_data *id = gc->proto_data; 644 struct irc_data *id = gc->proto_data;
643 char buf[500]; 645 char buf[500];
644 int n = g_snprintf(buf, sizeof(buf), "ISON"); 646 int n = g_snprintf(buf, sizeof(buf), "ISON");
645 647
646 GSList *gr = gc->groups; 648 GSList *gr = groups;
647 if (!gr || id->bc) 649 if (!gr || id->bc)
648 return TRUE; 650 return TRUE;
649 651
650 while (gr) { 652 while (gr) {
651 struct group *g = gr->data; 653 struct group *g = gr->data;
652 GSList *m = g->members; 654 GSList *m = g->members;
653 while (m) { 655 while (m) {
654 struct buddy *b = m->data; 656 struct buddy *b = m->data;
655 if (n + strlen(b->name) + 2 > sizeof(buf)) { 657 if(b->user->gc == gc) {
656 g_snprintf(buf + n, sizeof(buf) - n, "\r\n"); 658 if (n + strlen(b->name) + 2 > sizeof(buf)) {
657 irc_write(id->fd, buf, n); 659 g_snprintf(buf + n, sizeof(buf) - n, "\r\n");
658 id->bc++; 660 irc_write(id->fd, buf, n);
659 n = g_snprintf(buf, sizeof(buf), "ISON"); 661 id->bc++;
662 n = g_snprintf(buf, sizeof(buf), "ISON");
663 }
664 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", b->name);
660 } 665 }
661 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", b->name);
662 m = m->next; 666 m = m->next;
663 } 667 }
664 gr = gr->next; 668 gr = gr->next;
665 } 669 }
666 g_snprintf(buf + n, sizeof(buf) - n, "\r\n"); 670 g_snprintf(buf + n, sizeof(buf) - n, "\r\n");
1319 if (!idata->online) { 1323 if (!idata->online) {
1320 /* Now lets sign ourselves on */ 1324 /* Now lets sign ourselves on */
1321 account_online(gc); 1325 account_online(gc);
1322 serv_finish_login(gc); 1326 serv_finish_login(gc);
1323 1327
1324 if (bud_list_cache_exists(gc))
1325 do_import(gc, NULL);
1326
1327 /* we don't call this now because otherwise some IRC servers might not like us */ 1328 /* we don't call this now because otherwise some IRC servers might not like us */
1328 idata->timer = g_timeout_add(20000, irc_request_buddy_update, gc); 1329 idata->timer = g_timeout_add(20000, irc_request_buddy_update, gc);
1329 idata->online = TRUE; 1330 idata->online = TRUE;
1330 } 1331 }
1331 1332