diff src/protocols/jabber/chat.c @ 7926:68900f9cb540

[gaim-migrate @ 8597] tweak tweaky tweak committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 24 Dec 2003 01:48:25 +0000
parents e87e7d9d0132
children 119a22025818
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c	Tue Dec 23 23:41:51 2003 +0000
+++ b/src/protocols/jabber/chat.c	Wed Dec 24 01:48:25 2003 +0000
@@ -290,6 +290,7 @@
 	xmlnode *query, *x;
 	const char *type = xmlnode_get_attrib(packet, "type");
 	const char *from = xmlnode_get_attrib(packet, "from");
+	char *msg;
 	JabberChat *chat;
 	JabberID *jid;
 
@@ -297,6 +298,7 @@
 		return;
 
 
+
 	if(!strcmp(type, "result")) {
 		jid = jabber_id_new(from);
 
@@ -325,10 +327,35 @@
 				return;
 			}
 		}
-	} else {
-		/* XXX: handle errors */
+	} else if(!strcmp(type, "error")) {
+		xmlnode *errnode = xmlnode_get_child(packet, "error");
+		const char *code = NULL;
+		char *code_txt = NULL;
+		char *msg;
+		char *text = NULL;
+
+		if(errnode) {
+			code = xmlnode_get_attrib(errnode, "code");
+			text = xmlnode_get_data(errnode);
+		}
+
+		if(code)
+			code_txt = g_strdup_printf(_(" (Code %s)"), code);
+
+		msg = g_strdup_printf("%s%s", text ? text : "", code_txt ? code_txt : "");
+		gaim_notify_error(js->gc, _("Configuration error"), _("Configuration error"), msg);
+
+		g_free(msg);
+		if(code_txt)
+			g_free(code_txt);
+
+		return;
 	}
 
+	msg = g_strdup_printf("Unable to configure room %s", from);
+
+	gaim_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg);
+	g_free(msg);
 
 }