changeset 10045:ac98ece02b1f

[gaim-migrate @ 11005] also good for the gander committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 19 Sep 2004 04:17:23 +0000
parents 86a6d78b070b
children dcdda2857ca8
files src/protocols/jabber/chat.c
diffstat 1 files changed, 30 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c	Sun Sep 19 03:02:28 2004 +0000
+++ b/src/protocols/jabber/chat.c	Sun Sep 19 04:17:23 2004 +0000
@@ -710,17 +710,43 @@
 	js->roomlist = NULL;
 }
 
+static void roomlist_cancel_cb(JabberStream *js, const char *server) {
+	if(js->roomlist) {
+		gaim_roomlist_set_in_progress(js->roomlist, FALSE);
+		gaim_roomlist_unref(js->roomlist);
+		js->roomlist = NULL;
+	}
+}
+
 static void roomlist_ok_cb(JabberStream *js, const char *server)
 {
 	JabberIq *iq;
-	GList *fields = NULL;
-	GaimRoomlistField *f;
+
+	if(!js->roomlist)
+		return;
 
 	if(!server || !*server) {
 		gaim_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL);
 		return;
 	}
 
+	gaim_roomlist_set_in_progress(js->roomlist, TRUE);
+
+	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
+
+	xmlnode_set_attrib(iq->node, "to", server);
+
+	jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL);
+
+	jabber_iq_send(iq);
+}
+
+GaimRoomlist *jabber_roomlist_get_list(GaimConnection *gc)
+{
+	JabberStream *js = gc->proto_data;
+	GList *fields = NULL;
+	GaimRoomlistField *f;
+
 	if(js->roomlist)
 		gaim_roomlist_unref(js->roomlist);
 
@@ -737,26 +763,13 @@
 
 	gaim_roomlist_set_fields(js->roomlist, fields);
 
-	gaim_roomlist_set_in_progress(js->roomlist, TRUE);
-
-	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
-
-	xmlnode_set_attrib(iq->node, "to", server);
-
-	jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL);
-
-	jabber_iq_send(iq);
-}
-
-GaimRoomlist *jabber_roomlist_get_list(GaimConnection *gc)
-{
-	JabberStream *js = gc->proto_data;
 
 	gaim_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"),
 			_("Select a conference server to query"),
 			js->chat_servers ? js->chat_servers->data : "conference.jabber.org",
 			FALSE, FALSE, NULL,
-			_("Find Rooms"), G_CALLBACK(roomlist_ok_cb), _("Cancel"), NULL, js);
+			_("Find Rooms"), GAIM_CALLBACK(roomlist_ok_cb),
+			_("Cancel"), GAIM_CALLBACK(roomlist_cancel_cb), js);
 
 	return js->roomlist;
 }