cpw.darkrain42.xmpp.disco: ded48352: Remove debugging, use user's server as d...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Mon May 25 22:50:35 EDT 2009
-----------------------------------------------------------------
Revision: ded483522069298e5562139fb48032231da598dc
Ancestor: 8a2d3d89b9dfc3024c007c23dcc8dc37e2f65eb6
Author: darkrain42 at pidgin.im
Date: 2009-05-26T02:46:14
Branch: im.pidgin.cpw.darkrain42.xmpp.disco
URL: http://d.pidgin.im/viewmtn/revision/info/ded483522069298e5562139fb48032231da598dc
Modified files:
pidgin/plugins/disco/gtkdisco.c
pidgin/plugins/disco/xmppdisco.c
ChangeLog:
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
-------------- next part --------------
============================================================
--- pidgin/plugins/disco/gtkdisco.c 0cd531547c32c0a80e0d453ca20bdda03f68898c
+++ pidgin/plugins/disco/gtkdisco.c e233f16f4e9183923405ffc45470ff8f9c40a724
@@ -156,6 +156,9 @@ static void browse_button_cb(GtkButton *
{
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 @@ static void browse_button_cb(GtkButton *
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 @@ static void browse_button_cb(GtkButton *
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)
============================================================
--- pidgin/plugins/disco/xmppdisco.c 8bf96dcd7b4686983a2190045f0617e3413e35f8
+++ pidgin/plugins/disco/xmppdisco.c d09d403af7a1dfb37750b340ffa0a21b05fd3aac
@@ -220,10 +220,9 @@ disco_service_type_from_identity(xmlnode
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;
}
More information about the Commits
mailing list