# HG changeset patch # User Rob Flynn # Date 1004596799 0 # Node ID 4036f6d47737b160a1bd6cfaeaf6b0d73ca8aa09 # Parent 6781ee2b9db072b8b0d88518b10d89de0b134cc7 [gaim-migrate @ 2661] This is a little prettier... committer: Tailor Script diff -r 6781ee2b9db0 -r 4036f6d47737 src/protocols/irc/irc.c --- a/src/protocols/irc/irc.c Thu Nov 01 02:25:13 2001 +0000 +++ b/src/protocols/irc/irc.c Thu Nov 01 06:39:59 2001 +0000 @@ -544,6 +544,53 @@ } } +/* Handle our whois stuff here. You know what, I have a sore throat. You know + * what I think about that? I'm not too pleased with it. Perhaps I should take + * some medicine, or perhaps I should go to bed? Blah!! */ + +static void handle_whois(struct gaim_connection *gc, char *word[], char *word_eol[], int num) +{ + struct irc_data *id = gc->proto_data; + char tmp[1024]; + + if (!id->in_whois) { + id->in_whois = TRUE; + id->whois_str = g_string_new(""); + } else { + /* I can't decide if we should have one break or two */ + id->whois_str = g_string_append(id->whois_str, "
"); + id->in_whois = TRUE; + } + + switch (num) { + case 311: + id->whois_str = g_string_append(id->whois_str, "User: "); + break; + case 312: + id->whois_str = g_string_append(id->whois_str, "Server: "); + break; + case 313: + g_snprintf(tmp, sizeof(tmp), "IRC Operator: %s ", word[4]); + id->whois_str = g_string_append(id->whois_str, tmp); + break; + + case 317: + id->whois_str = g_string_append(id->whois_str, "Idle Time: "); + break; + case 319: + id->whois_str = g_string_append(id->whois_str, "Channels: "); + break; + default: + break; + } + + if (word_eol[5][0] == ':') + id->whois_str = g_string_append(id->whois_str, word_eol[5] + 1); + else + id->whois_str = g_string_append(id->whois_str, word_eol[5]); + +} + static void process_numeric(struct gaim_connection *gc, char *word[], char *word_eol[]) { struct irc_data *id = gc->proto_data; @@ -580,23 +627,20 @@ case 313: case 317: case 319: - if (!id->in_whois) { - id->in_whois = TRUE; - id->whois_str = g_string_new(""); - } else { - id->whois_str = g_string_append(id->whois_str, "

"); - id->in_whois = TRUE; - } - id->whois_str = g_string_append(id->whois_str, word_eol[4]); + handle_whois(gc, word, word_eol, n); break; case 318: + /* id->whois_str = g_string_append(id->whois_str, "

"); id->whois_str = g_string_append(id->whois_str, word_eol[4]); + */ + { GString *str = decode_html(id->whois_str->str); g_show_info_text(str->str, NULL); g_string_free(str, TRUE); } + g_string_free(id->whois_str, TRUE); id->whois_str = NULL; id->in_whois = FALSE;