soc.2008.xmpp: a3ef65d2: * looking for alternative connection met...
tfar at soc.pidgin.im
tfar at soc.pidgin.im
Sun Aug 3 14:10:49 EDT 2008
-----------------------------------------------------------------
Revision: a3ef65d2020abc61d9b341164c078f9ecb62605e
Ancestor: 30db35b1bd32ae530ca1552cce8c4cc264de9f1c
Author: tfar at soc.pidgin.im
Date: 2008-08-03T13:48:59
Branch: im.pidgin.soc.2008.xmpp
URL: http://d.pidgin.im/viewmtn/revision/info/a3ef65d2020abc61d9b341164c078f9ecb62605e
Added files:
libpurple/protocols/jabber/bosh.c
libpurple/protocols/jabber/bosh.h
Modified files:
libpurple/protocols/jabber/jabber.c
ChangeLog:
* looking for alternative connection methods if direct connection fails
* introducing bosh files
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/bosh.c 011efc14eb01eb45a435ae8a01cf74de70e18265
+++ libpurple/protocols/jabber/bosh.c 011efc14eb01eb45a435ae8a01cf74de70e18265
@@ -0,0 +1,39 @@
+/*
+ * purple - Jabber Protocol Plugin
+ *
+ * Copyright (C) 2008, Tobias Markmann <tmarkmann at googlemail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ *
+ */
+#include "internal.h"
+#include "cipher.h"
+#include "debug.h"
+#include "imgstore.h"
+#include "prpl.h"
+#include "notify.h"
+#include "request.h"
+#include "util.h"
+#include "xmlnode.h"
+
+#include "buddy.h"
+#include "chat.h"
+#include "jabber.h"
+#include "iq.h"
+#include "presence.h"
+#include "xdata.h"
+#include "pep.h"
+#include "adhoccommands.h"
+
============================================================
--- libpurple/protocols/jabber/bosh.h f852f17c88140b0db215acc746b013f8bde7c185
+++ libpurple/protocols/jabber/bosh.h f852f17c88140b0db215acc746b013f8bde7c185
@@ -0,0 +1,34 @@
+/**
+ * @file bosh.h Buddy handlers
+ *
+ * purple
+ *
+ * Copyright (C) 2008, Tobias Markmann <tmarkmann at googlemail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+#ifndef _PURPLE_JABBER_BOSH_H_
+#define _PURPLE_JABBER_BOSH_H_
+
+typedef struct {
+ char *url;
+ gboolean pipelining;
+} PurpleBOSHConnection;
+
+typedef struct {
+
+} PurpleHTTPRequest;
+
+#endif /* _PURPLE_JABBER_BOSH_H_ */
============================================================
--- libpurple/protocols/jabber/jabber.c 86c936d715c654d7c1c61889d4754111a7c3ed86
+++ libpurple/protocols/jabber/jabber.c 97f3de4f1cfb4aa4b705100ecfb3c6b825b54c36
@@ -521,6 +521,25 @@ jabber_login_callback_ssl(gpointer data,
jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION);
}
+static void
+txt_resolved_cb(PurpleTxtResponse *resp, int results, gpointer data)
+{
+ PurpleConnection *gc = data;
+ JabberStream *js = gc->proto_data;
+ int n;
+
+ if (results > 0) {
+ gchar *tmp;
+ tmp = g_strdup_printf(_("Could not find alternative XMPP connection methods after failing to connect directly.\n"));
+ purple_connection_error_reason (gc,
+ PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
+ g_free(tmp);
+ }
+
+ for (n = 0; n < results; n++) {
+ purple_debug_info("dnssrv","TXT RDATA: %s\n", resp[n].content);
+ }
+}
static void
jabber_login_callback(gpointer data, gint source, const gchar *error)
@@ -529,12 +548,8 @@ jabber_login_callback(gpointer data, gin
JabberStream *js = gc->proto_data;
if (source < 0) {
- gchar *tmp;
- tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"),
- error);
- purple_connection_error_reason (gc,
- PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
- g_free(tmp);
+ purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain);
+ purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, gc);
return;
}
More information about the Commits
mailing list