# HG changeset patch # User Paul Aurich # Date 1243305984 0 # Node ID 1c8d7165df6bf7ae9e9645e2c77025d4017a5ee1 # Parent 45e812208f055e54747a5887113785a569c39d7a# Parent 9639747bb98c923c94651418f211fe748ca0d099 merge of '17367f37cdcde61c1f7a9bc2df681c177a65ffbb' and 'ded483522069298e5562139fb48032231da598dc' diff -r 45e812208f05 -r 1c8d7165df6b pidgin/plugins/disco/gtkdisco.c --- 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) diff -r 45e812208f05 -r 1c8d7165df6b pidgin/plugins/disco/xmppdisco.c --- 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; }