merge of '9adbd0dd8d9efef0733a64466d86f4608de5c23f'

Tue, 26 May 2009 02:46:24 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Tue, 26 May 2009 02:46:24 +0000
changeset 27220
744de7bd69fc
parent 27219
9adbd0dd8d9e (current diff)
parent 27218
36968b1cde87 (diff)
child 27221
665d80eca401

merge of '9adbd0dd8d9efef0733a64466d86f4608de5c23f'
and '36968b1cde877a687db6427770b829e5550a382a'

--- a/pidgin/plugins/disco/gtkdisco.c	Tue May 26 02:28:34 2009 +0000
+++ b/pidgin/plugins/disco/gtkdisco.c	Tue May 26 02:46:24 2009 +0000
@@ -156,6 +156,9 @@
 {
 	PurpleConnection *pc;
 	PidginDiscoList *pdl;
+	const char *username;
+	const char *at, *slash;
+	char *server = NULL;
 
 	pc = purple_account_get_connection(dialog->account);
 	if (!pc)
@@ -166,7 +169,10 @@
 	gtk_widget_set_sensitive(dialog->register_button, FALSE);
 
 	if (dialog->discolist != NULL) {
-		gtk_widget_destroy(dialog->discolist->tree);
+		if (dialog->discolist->tree) {
+			gtk_widget_destroy(dialog->discolist->tree);
+			dialog->discolist->tree = NULL;
+		}
 		pidgin_disco_list_unref(dialog->discolist);
 	}
 
@@ -183,12 +189,27 @@
 	if (dialog->account_widget)
 		gtk_widget_set_sensitive(dialog->account_widget, FALSE);
 
+	username = purple_account_get_username(dialog->account);
+	at = g_utf8_strchr(username, -1, '@');
+	slash = g_utf8_strchr(username, -1, '/');
+	if (at && !slash) {
+		server = g_strdup_printf("%s", at + 1);
+	} else if (at && slash && at + 1 < slash) {
+		server = g_strdup_printf("%.*s", (int)(slash - (at + 1)), at + 1);
+	}
+
+	if (server == NULL)
+		/* This shouldn't ever happen since the account is connected */
+		server = g_strdup("jabber.org");
+
 	purple_request_input(my_plugin, _("Server name request"), _("Enter an XMPP Server"),
 			_("Select an XMPP server to query"),
-			"jabber.org" /* FIXME */, FALSE, FALSE, NULL,
+			server, FALSE, FALSE, NULL,
 			_("Find Services"), PURPLE_CALLBACK(discolist_ok_cb),
 			_("Cancel"), PURPLE_CALLBACK(discolist_cancel_cb),
 			purple_connection_get_account(pc), NULL, NULL, pdl);
+
+	g_free(server);
 }
 
 static void add_room_to_blist_cb(GtkButton *button, PidginDiscoDialog *dialog)
--- a/pidgin/plugins/disco/xmppdisco.c	Tue May 26 02:28:34 2009 +0000
+++ b/pidgin/plugins/disco/xmppdisco.c	Tue May 26 02:46:24 2009 +0000
@@ -220,10 +220,9 @@
 			return XMPP_DISCO_SERVICE_TYPE_PUBSUB_COLLECTION;
 		else if (g_str_equal(type, "leaf"))
 			return XMPP_DISCO_SERVICE_TYPE_PUBSUB_LEAF;
-		else if (g_str_equal(type, "service")) {
-			purple_debug_error("xmppdisco", "here\n");
+		else if (g_str_equal(type, "service"))
 			return XMPP_DISCO_SERVICE_TYPE_OTHER;
-		} else {
+		else {
 			purple_debug_warning("xmppdisco", "Unknown pubsub type '%s'\n", type);
 			return XMPP_DISCO_SERVICE_TYPE_OTHER;
 		}

mercurial