Mercurial > pidgin
comparison src/protocols/irc/irc.c @ 2648:4036f6d47737
[gaim-migrate @ 2661]
This is a little prettier...
committer: Tailor Script <tailor@pidgin.im>
| author | Rob Flynn <gaim@robflynn.com> |
|---|---|
| date | Thu, 01 Nov 2001 06:39:59 +0000 |
| parents | b740a33875c3 |
| children | f857ae4ddd84 |
comparison
equal
deleted
inserted
replaced
| 2647:6781ee2b9db0 | 2648:4036f6d47737 |
|---|---|
| 542 } | 542 } |
| 543 modes++; | 543 modes++; |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 | 546 |
| 547 /* Handle our whois stuff here. You know what, I have a sore throat. You know | |
| 548 * what I think about that? I'm not too pleased with it. Perhaps I should take | |
| 549 * some medicine, or perhaps I should go to bed? Blah!! */ | |
| 550 | |
| 551 static void handle_whois(struct gaim_connection *gc, char *word[], char *word_eol[], int num) | |
| 552 { | |
| 553 struct irc_data *id = gc->proto_data; | |
| 554 char tmp[1024]; | |
| 555 | |
| 556 if (!id->in_whois) { | |
| 557 id->in_whois = TRUE; | |
| 558 id->whois_str = g_string_new(""); | |
| 559 } else { | |
| 560 /* I can't decide if we should have one break or two */ | |
| 561 id->whois_str = g_string_append(id->whois_str, "<BR>"); | |
| 562 id->in_whois = TRUE; | |
| 563 } | |
| 564 | |
| 565 switch (num) { | |
| 566 case 311: | |
| 567 id->whois_str = g_string_append(id->whois_str, "<b>User: </b>"); | |
| 568 break; | |
| 569 case 312: | |
| 570 id->whois_str = g_string_append(id->whois_str, "<b>Server: </b>"); | |
| 571 break; | |
| 572 case 313: | |
| 573 g_snprintf(tmp, sizeof(tmp), "<b>IRC Operator:</b> %s ", word[4]); | |
| 574 id->whois_str = g_string_append(id->whois_str, tmp); | |
| 575 break; | |
| 576 | |
| 577 case 317: | |
| 578 id->whois_str = g_string_append(id->whois_str, "<b>Idle Time: </b>"); | |
| 579 break; | |
| 580 case 319: | |
| 581 id->whois_str = g_string_append(id->whois_str, "<b>Channels: </b>"); | |
| 582 break; | |
| 583 default: | |
| 584 break; | |
| 585 } | |
| 586 | |
| 587 if (word_eol[5][0] == ':') | |
| 588 id->whois_str = g_string_append(id->whois_str, word_eol[5] + 1); | |
| 589 else | |
| 590 id->whois_str = g_string_append(id->whois_str, word_eol[5]); | |
| 591 | |
| 592 } | |
| 593 | |
| 547 static void process_numeric(struct gaim_connection *gc, char *word[], char *word_eol[]) | 594 static void process_numeric(struct gaim_connection *gc, char *word[], char *word_eol[]) |
| 548 { | 595 { |
| 549 struct irc_data *id = gc->proto_data; | 596 struct irc_data *id = gc->proto_data; |
| 550 char *text = word_eol[3]; | 597 char *text = word_eol[3]; |
| 551 int n = atoi(word[2]); | 598 int n = atoi(word[2]); |
| 578 case 311: | 625 case 311: |
| 579 case 312: | 626 case 312: |
| 580 case 313: | 627 case 313: |
| 581 case 317: | 628 case 317: |
| 582 case 319: | 629 case 319: |
| 583 if (!id->in_whois) { | 630 handle_whois(gc, word, word_eol, n); |
| 584 id->in_whois = TRUE; | |
| 585 id->whois_str = g_string_new(""); | |
| 586 } else { | |
| 587 id->whois_str = g_string_append(id->whois_str, "<BR><BR>"); | |
| 588 id->in_whois = TRUE; | |
| 589 } | |
| 590 id->whois_str = g_string_append(id->whois_str, word_eol[4]); | |
| 591 break; | 631 break; |
| 592 case 318: | 632 case 318: |
| 633 /* | |
| 593 id->whois_str = g_string_append(id->whois_str, "<BR><BR>"); | 634 id->whois_str = g_string_append(id->whois_str, "<BR><BR>"); |
| 594 id->whois_str = g_string_append(id->whois_str, word_eol[4]); | 635 id->whois_str = g_string_append(id->whois_str, word_eol[4]); |
| 636 */ | |
| 637 | |
| 595 { | 638 { |
| 596 GString *str = decode_html(id->whois_str->str); | 639 GString *str = decode_html(id->whois_str->str); |
| 597 g_show_info_text(str->str, NULL); | 640 g_show_info_text(str->str, NULL); |
| 598 g_string_free(str, TRUE); | 641 g_string_free(str, TRUE); |
| 599 } | 642 } |
| 643 | |
| 600 g_string_free(id->whois_str, TRUE); | 644 g_string_free(id->whois_str, TRUE); |
| 601 id->whois_str = NULL; | 645 id->whois_str = NULL; |
| 602 id->in_whois = FALSE; | 646 id->in_whois = FALSE; |
| 603 break; | 647 break; |
| 604 case 324: | 648 case 324: |
