| 59 |
59 |
| 60 static struct prpl *my_protocol = NULL; |
60 static struct prpl *my_protocol = NULL; |
| 61 |
61 |
| 62 /* for win32 compatability */ |
62 /* for win32 compatability */ |
| 63 G_MODULE_IMPORT GSList *connections; |
63 G_MODULE_IMPORT GSList *connections; |
| 64 G_MODULE_IMPORT GSList *groups; |
|
| 65 |
64 |
| 66 #ifndef INET6_ADDRSTRLEN |
65 #ifndef INET6_ADDRSTRLEN |
| 67 #define INET6_ADDRSTRLEN 46 |
66 #define INET6_ADDRSTRLEN 46 |
| 68 #endif |
67 #endif |
| 69 |
68 |
| 568 |
567 |
| 569 static void |
568 static void |
| 570 handle_list(struct gaim_connection *gc, char *list) |
569 handle_list(struct gaim_connection *gc, char *list) |
| 571 { |
570 { |
| 572 struct irc_data *id = gc->proto_data; |
571 struct irc_data *id = gc->proto_data; |
| 573 GSList *gr; |
572 GSList *gr, *gr1; |
| 574 |
573 |
| 575 id->str = g_string_append_c(id->str, ' '); |
574 id->str = g_string_append_c(id->str, ' '); |
| 576 id->str = g_string_append(id->str, list); |
575 id->str = g_string_append(id->str, list); |
| 577 id->bc--; |
576 id->bc--; |
| 578 if (id->bc) |
577 if (id->bc) |
| 579 return; |
578 return; |
| 580 |
579 |
| 581 g_strdown(id->str->str); |
580 g_strdown(id->str->str); |
| 582 gr = groups; |
581 gr = gaim_blist_groups(); |
| 583 while (gr) { |
582 gr1 = gr; |
| 584 GSList *m = ((struct group *)gr->data)->members; |
583 while (gr1) { |
| 585 while (m) { |
584 GSList *m = gaim_blist_members((struct group *)gr1->data); |
| |
585 GSList *m1 = m; |
| |
586 while (m1) { |
| 586 struct buddy *b = m->data; |
587 struct buddy *b = m->data; |
| 587 if(b->account->gc == gc) { |
588 if(b->account->gc == gc) { |
| 588 char *tmp = g_strdup(b->name); |
589 char *tmp = g_strdup(b->name); |
| 589 char *x, *l; |
590 char *x, *l; |
| 590 g_strdown(tmp); |
591 g_strdown(tmp); |
| 596 serv_got_update(gc, b->name, 1, 0, 0, 0, 0); |
597 serv_got_update(gc, b->name, 1, 0, 0, 0, 0); |
| 597 else if (b->present && !x) |
598 else if (b->present && !x) |
| 598 serv_got_update(gc, b->name, 0, 0, 0, 0, 0); |
599 serv_got_update(gc, b->name, 0, 0, 0, 0, 0); |
| 599 g_free(tmp); |
600 g_free(tmp); |
| 600 } |
601 } |
| 601 m = m->next; |
602 m1 = m1->next; |
| 602 } |
603 } |
| 603 gr = gr->next; |
604 g_slist_free(m); |
| 604 } |
605 gr1 = gr1->next; |
| |
606 } |
| |
607 g_slist_free(gr); |
| 605 g_string_free(id->str, TRUE); |
608 g_string_free(id->str, TRUE); |
| 606 id->str = g_string_new(""); |
609 id->str = g_string_new(""); |
| 607 } |
610 } |
| 608 |
611 |
| 609 static gboolean |
612 static gboolean |
| 613 struct irc_data *id = gc->proto_data; |
616 struct irc_data *id = gc->proto_data; |
| 614 char buf[500]; |
617 char buf[500]; |
| 615 int n = g_snprintf(buf, sizeof(buf), "ISON"); |
618 int n = g_snprintf(buf, sizeof(buf), "ISON"); |
| 616 gboolean found = FALSE; |
619 gboolean found = FALSE; |
| 617 |
620 |
| 618 GSList *gr = groups; |
621 GSList *gr = gaim_blist_groups(); |
| |
622 GSList *gr1 = gr; |
| 619 if (!gr || id->bc) |
623 if (!gr || id->bc) |
| 620 return TRUE; |
624 return TRUE; |
| 621 |
625 |
| 622 while (gr) { |
626 while (gr1) { |
| 623 struct group *g = gr->data; |
627 struct group *g = gr->data; |
| 624 GSList *m = g->members; |
628 GSList *m = gaim_blist_members(g); |
| 625 while (m) { |
629 GSList *m1 = m; |
| |
630 while (m1) { |
| 626 struct buddy *b = m->data; |
631 struct buddy *b = m->data; |
| 627 if(b->account->gc == gc) { |
632 if(b->account->gc == gc) { |
| 628 if (n + strlen(b->name) + 2 > sizeof(buf)) { |
633 if (n + strlen(b->name) + 2 > sizeof(buf)) { |
| 629 g_snprintf(buf + n, sizeof(buf) - n, "\r\n"); |
634 g_snprintf(buf + n, sizeof(buf) - n, "\r\n"); |
| 630 irc_write(id->fd, buf, n); |
635 irc_write(id->fd, buf, n); |
| 633 } |
638 } |
| 634 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", b->name); |
639 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", b->name); |
| 635 |
640 |
| 636 found = TRUE; |
641 found = TRUE; |
| 637 } |
642 } |
| 638 m = m->next; |
643 m1 = m1->next; |
| 639 } |
644 } |
| 640 gr = gr->next; |
645 g_slist_free(m); |
| 641 } |
646 gr1 = gr1->next; |
| |
647 } |
| |
648 g_slist_free(gr); |
| 642 |
649 |
| 643 if (found) { |
650 if (found) { |
| 644 g_snprintf(buf + n, sizeof(buf) - n, "\r\n"); |
651 g_snprintf(buf + n, sizeof(buf) - n, "\r\n"); |
| 645 irc_write(id->fd, buf, strlen(buf)); |
652 irc_write(id->fd, buf, strlen(buf)); |
| 646 id->bc++; |
653 id->bc++; |