comparison src/protocols/irc/irc.c @ 4785:1e28e7d802a1

[gaim-migrate @ 5105] fix a few things, get rid of a few stale functions, and get rid of the compatibility functions. wee! committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 15 Mar 2003 03:23:30 +0000
parents c4c28874ecd3
children 677d3cb193a1
comparison
equal deleted inserted replaced
4784:b1365291f002 4785:1e28e7d802a1
567 567
568 static void 568 static void
569 handle_list(struct gaim_connection *gc, char *list) 569 handle_list(struct gaim_connection *gc, char *list)
570 { 570 {
571 struct irc_data *id = gc->proto_data; 571 struct irc_data *id = gc->proto_data;
572 GSList *gr, *gr1; 572 GaimBlistNode *gnode, *bnode;
573 573
574 id->str = g_string_append_c(id->str, ' '); 574 id->str = g_string_append_c(id->str, ' ');
575 id->str = g_string_append(id->str, list); 575 id->str = g_string_append(id->str, list);
576 id->bc--; 576 id->bc--;
577 if (id->bc) 577 if (id->bc)
578 return; 578 return;
579 579
580 g_strdown(id->str->str); 580 g_strdown(id->str->str);
581 gr = gaim_blist_groups(); 581
582 gr1 = gr; 582 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
583 while (gr1) { 583 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
584 GSList *m = gaim_blist_members((struct group *)gr1->data); 584 continue;
585 GSList *m1 = m; 585 for(bnode = gnode->child; bnode; bnode = bnode->next) {
586 while (m1) { 586 struct buddy *b = (struct buddy *)bnode;
587 struct buddy *b = m->data; 587 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
588 continue;
588 if(b->account->gc == gc) { 589 if(b->account->gc == gc) {
589 char *tmp = g_strdup(b->name); 590 char *tmp = g_strdup(b->name);
590 char *x, *l; 591 char *x, *l;
591 g_strdown(tmp); 592 g_strdown(tmp);
592 x = strstr(id->str->str, tmp); 593 x = strstr(id->str->str, tmp);
597 serv_got_update(gc, b->name, 1, 0, 0, 0, 0); 598 serv_got_update(gc, b->name, 1, 0, 0, 0, 0);
598 else if (b->present && !x) 599 else if (b->present && !x)
599 serv_got_update(gc, b->name, 0, 0, 0, 0, 0); 600 serv_got_update(gc, b->name, 0, 0, 0, 0, 0);
600 g_free(tmp); 601 g_free(tmp);
601 } 602 }
602 m1 = m1->next; 603 }
603 } 604 }
604 g_slist_free(m);
605 gr1 = gr1->next;
606 }
607 g_slist_free(gr);
608 g_string_free(id->str, TRUE); 605 g_string_free(id->str, TRUE);
609 id->str = g_string_new(""); 606 id->str = g_string_new("");
610 } 607 }
611 608
612 static gboolean 609 static gboolean
616 struct irc_data *id = gc->proto_data; 613 struct irc_data *id = gc->proto_data;
617 char buf[500]; 614 char buf[500];
618 int n = g_snprintf(buf, sizeof(buf), "ISON"); 615 int n = g_snprintf(buf, sizeof(buf), "ISON");
619 gboolean found = FALSE; 616 gboolean found = FALSE;
620 617
621 GSList *gr = gaim_blist_groups(); 618 GaimBlistNode *gnode, *bnode;
622 GSList *gr1 = gr; 619
623 if (!gr || id->bc) 620 if (id->bc)
624 return TRUE; 621 return TRUE;
625 622
626 while (gr1) { 623 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
627 struct group *g = gr->data; 624 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
628 GSList *m = gaim_blist_members(g); 625 continue;
629 GSList *m1 = m; 626 for(bnode = gnode->child; bnode; bnode = bnode->next) {
630 while (m1) { 627 struct buddy *b = (struct buddy *)bnode;
631 struct buddy *b = m->data; 628 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
629 continue;
632 if(b->account->gc == gc) { 630 if(b->account->gc == gc) {
633 if (n + strlen(b->name) + 2 > sizeof(buf)) { 631 if (n + strlen(b->name) + 2 > sizeof(buf)) {
634 g_snprintf(buf + n, sizeof(buf) - n, "\r\n"); 632 g_snprintf(buf + n, sizeof(buf) - n, "\r\n");
635 irc_write(id->fd, buf, n); 633 irc_write(id->fd, buf, n);
636 id->bc++; 634 id->bc++;
638 } 636 }
639 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", b->name); 637 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", b->name);
640 638
641 found = TRUE; 639 found = TRUE;
642 } 640 }
643 m1 = m1->next; 641 }
644 } 642 }
645 g_slist_free(m);
646 gr1 = gr1->next;
647 }
648 g_slist_free(gr);
649 643
650 if (found) { 644 if (found) {
651 g_snprintf(buf + n, sizeof(buf) - n, "\r\n"); 645 g_snprintf(buf + n, sizeof(buf) - n, "\r\n");
652 irc_write(id->fd, buf, strlen(buf)); 646 irc_write(id->fd, buf, strlen(buf));
653 id->bc++; 647 id->bc++;