changeset 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 6781ee2b9db0
children f857ae4ddd84
files src/protocols/irc/irc.c
diffstat 1 files changed, 52 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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, "<BR>");
+		id->in_whois = TRUE;
+	}
+
+	switch (num) {
+		case 311:
+			id->whois_str = g_string_append(id->whois_str, "<b>User: </b>");
+			break;
+		case 312:
+			id->whois_str = g_string_append(id->whois_str, "<b>Server: </b>");
+			break;
+		case 313:
+			g_snprintf(tmp, sizeof(tmp), "<b>IRC Operator:</b> %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, "<b>Idle Time: </b>");
+			break;
+		case 319:
+			id->whois_str = g_string_append(id->whois_str, "<b>Channels: </b>");
+			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, "<BR><BR>");
-			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, "<BR><BR>");
 		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;