/soc/2013/ankitkv/gobjectification: caf380128870: Merged default...

Ankit Vani a at nevitus.org
Fri Jul 5 14:01:56 EDT 2013


Changeset: caf38012887028bce789aacad36fc3aa767ddd2e
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-05 23:31 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/caf380128870

Description:

Merged default branch

diffstat:

 libpurple/Makefile.am                      |    2 -
 libpurple/http.c                           |   18 +-
 libpurple/media/backend-fs2.c              |    1 +
 libpurple/obsolete.c                       |  909 -----------------------------
 libpurple/obsolete.h                       |  111 ---
 libpurple/protocols/jabber/google/relay.c  |   73 +-
 libpurple/protocols/jabber/jabber.c        |   13 -
 libpurple/protocols/jabber/jabber.h        |    2 -
 libpurple/protocols/jabber/jingle/jingle.c |    1 +
 libpurple/protocols/mxit/login.c           |  164 ++--
 libpurple/protocols/mxit/markup.c          |    1 -
 libpurple/protocols/mxit/mxit.h            |    1 -
 libpurple/protocols/mxit/protocol.c        |   97 +-
 libpurple/protocols/oscar/clientlogin.c    |   83 +-
 libpurple/protocols/oscar/oscar.h          |    4 +-
 libpurple/protocols/oscar/oscar_data.c     |    3 +-
 libpurple/protocols/yahoo/libyahoo.c       |    2 +-
 libpurple/protocols/yahoo/libyahoojp.c     |    2 +-
 libpurple/protocols/yahoo/libymsg.c        |  505 +++++++--------
 libpurple/protocols/yahoo/libymsg.h        |    3 -
 libpurple/protocols/yahoo/util.c           |    2 +-
 libpurple/protocols/yahoo/yahoo_aliases.c  |  193 ++---
 libpurple/protocols/yahoo/yahoo_picture.c  |    1 -
 libpurple/proxy.c                          |    1 -
 libpurple/upnp.c                           |  165 ++---
 pidgin/gtkprefs.c                          |    1 +
 26 files changed, 592 insertions(+), 1766 deletions(-)

diffs (truncated from 3352 to 300 lines):

diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -73,7 +73,6 @@ purple_coresources = \
 	network.c \
 	ntlm.c \
 	notify.c \
-	obsolete.c \
 	plugin.c \
 	pluginpref.c \
 	pounce.c \
@@ -324,7 +323,6 @@ libpurple_la_SOURCES = \
 
 noinst_HEADERS= \
 	internal.h \
-	obsolete.h \
 	media/backend-fs2.h \
 	valgrind.h
 
diff --git a/libpurple/http.c b/libpurple/http.c
--- a/libpurple/http.c
+++ b/libpurple/http.c
@@ -2058,7 +2058,23 @@ const gchar * purple_http_response_get_e
 {
 	g_return_val_if_fail(response != NULL, NULL);
 
-	return response->error;
+	if (response->error != NULL)
+		return response->error;
+
+	if (!purple_http_response_is_successfull(response)) {
+		static gchar errmsg[200];
+		if (response->code <= 0) {
+			g_snprintf(errmsg, sizeof(errmsg),
+				_("Unknown HTTP error"));
+		} else {
+			g_snprintf(errmsg, sizeof(errmsg),
+				_("Invalid HTTP response code (%d)"),
+				response->code);
+		}
+		return errmsg;
+	}
+
+	return NULL;
 }
 
 gsize purple_http_response_get_data_len(PurpleHttpResponse *response)
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -25,6 +25,7 @@
  */
 
 #include "internal.h"
+#include "glibcompat.h"
 
 #include "backend-fs2.h"
 
diff --git a/libpurple/obsolete.c b/libpurple/obsolete.c
deleted file mode 100644
--- a/libpurple/obsolete.c
+++ /dev/null
@@ -1,909 +0,0 @@
-/* purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * 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 "obsolete.h"
-
-#include "internal.h"
-#include "debug.h"
-#include "ntlm.h"
-
-#if 0
-#include "http.h"
-#endif
-
-struct _PurpleUtilFetchUrlData
-{
-	PurpleUtilFetchUrlCallback callback;
-	void *user_data;
-
-	struct
-	{
-		char *user;
-		char *passwd;
-		char *address;
-		int port;
-		char *page;
-
-	} website;
-
-	char *url;
-	int num_times_redirected;
-	gboolean full;
-	char *user_agent;
-	gboolean http11;
-	char *request;
-	gsize request_written;
-	gboolean include_headers;
-
-	gboolean is_ssl;
-	PurpleSslConnection *ssl_connection;
-	PurpleProxyConnectData *connect_data;
-	int fd;
-	guint inpa;
-
-	gboolean got_headers;
-	gboolean has_explicit_data_len;
-	char *webdata;
-	gsize len;
-	unsigned long data_len;
-	gssize max_len;
-	gboolean chunked;
-	PurpleAccount *account;
-
-#if 0
-	PurpleHttpConnection *wrapped_request;
-#endif
-	gboolean cancelled;
-};
-
-/**
- * Parses a URL, returning its host, port, file path, username and password.
- *
- * The returned data must be freed.
- *
- * @param url      The URL to parse.
- * @param ret_host The returned host.
- * @param ret_port The returned port.
- * @param ret_path The returned path.
- * @param ret_user The returned username.
- * @param ret_passwd The returned password.
- */
-static gboolean purple_url_parse(const char *url, char **ret_host, int *ret_port,
-	char **ret_path, char **ret_user, char **ret_passwd);
-
-#if 0
-
-typedef struct
-{
-	PurpleUtilFetchUrlData *url_data;
-	PurpleUtilFetchUrlCallback cb;
-	gpointer user_data;
-} PurpleUtilLegacyWrapData;
-
-static void purple_util_fetch_url_cb(PurpleHttpConnection *http_conn,
-	PurpleHttpResponse *response, gpointer _wrap_data)
-{
-	PurpleUtilLegacyWrapData *wrap_data = _wrap_data;
-	const char *data = NULL;
-	size_t len;
-
-	if (wrap_data->cb && !wrap_data->url_data->cancelled) {
-		data = purple_http_response_get_data(response, &len);
-
-		wrap_data->cb(wrap_data->url_data, wrap_data->user_data, data, len,
-			purple_http_response_get_error(response));
-	}
-
-	g_free(wrap_data->url_data);
-	g_free(wrap_data);
-}
-
-PurpleUtilFetchUrlData * purple_util_fetch_url(const gchar *url, gboolean full,
-	const gchar *user_agent, gboolean http11, gssize max_len,
-	PurpleUtilFetchUrlCallback cb, gpointer data)
-{
-	PurpleHttpRequest *request;
-	PurpleUtilFetchUrlData *url_data;
-	PurpleUtilLegacyWrapData *wrap_data;
-
-	if (FALSE)
-		return purple_util_fetch_url_request(NULL, url, full,
-			user_agent, http11, NULL, FALSE, max_len, cb, data);
-
-	wrap_data = g_new0(PurpleUtilLegacyWrapData, 1);
-	url_data = g_new0(PurpleUtilFetchUrlData, 1);
-	request = purple_http_request_new(url);
-
-	wrap_data->url_data = url_data;
-	wrap_data->cb = cb;
-	wrap_data->user_data = data;
-
-	if (user_agent)
-		purple_http_request_header_set(request,
-			"User-Agent", user_agent);
-	purple_http_request_set_http11(request, http11);
-	purple_http_request_set_max_len(request, max_len);
-
-	url_data->wrapped_request = purple_http_request(NULL, request,
-		purple_util_fetch_url_cb, wrap_data);
-
-	purple_http_request_unref(request);
-
-	return url_data;
-}
-
-#endif
-
-/**
- * The arguments to this function are similar to printf.
- */
-static void
-purple_util_fetch_url_error(PurpleUtilFetchUrlData *gfud, const char *format, ...)
-{
-	gchar *error_message;
-	va_list args;
-
-	va_start(args, format);
-	error_message = g_strdup_vprintf(format, args);
-	va_end(args);
-
-	gfud->callback(gfud, gfud->user_data, NULL, 0, error_message);
-	g_free(error_message);
-	purple_util_fetch_url_cancel(gfud);
-}
-
-static void url_fetch_connect_cb(gpointer url_data, gint source, const gchar *error_message);
-static void ssl_url_fetch_connect_cb(gpointer data, PurpleSslConnection *ssl_connection, PurpleInputCondition cond);
-static void ssl_url_fetch_error_cb(PurpleSslConnection *ssl_connection, PurpleSslErrorType error, gpointer data);
-
-static gboolean
-parse_redirect(const char *data, size_t data_len,
-			   PurpleUtilFetchUrlData *gfud)
-{
-	gchar *s;
-	gchar *new_url, *temp_url, *end;
-	gboolean full;
-	int len;
-
-	if ((s = g_strstr_len(data, data_len, "\nLocation: ")) == NULL)
-		/* We're not being redirected */
-		return FALSE;
-
-	s += strlen("Location: ");
-	end = strchr(s, '\r');
-
-	/* Just in case :) */
-	if (end == NULL)
-		end = strchr(s, '\n');
-
-	if (end == NULL)
-		return FALSE;
-
-	len = end - s;
-
-	new_url = g_malloc(len + 1);
-	strncpy(new_url, s, len);
-	new_url[len] = '\0';
-
-	full = gfud->full;
-
-	if (*new_url == '/' || g_strstr_len(new_url, len, "://") == NULL)
-	{
-		temp_url = new_url;
-
-		new_url = g_strdup_printf("%s:%d%s", gfud->website.address,
-								  gfud->website.port, temp_url);
-
-		g_free(temp_url);
-
-		full = FALSE;
-	}
-
-	purple_debug_info("util", "Redirecting to %s\n", new_url);
-
-	gfud->num_times_redirected++;
-	if (gfud->num_times_redirected >= 5)
-	{
-		purple_util_fetch_url_error(gfud,
-				_("Could not open %s: Redirected too many times"),
-				gfud->url);
-		return TRUE;
-	}
-
-	/*
-	 * Try again, with this new location.  This code is somewhat
-	 * ugly, but we need to reuse the gfud because whoever called
-	 * us is holding a reference to it.
-	 */
-	g_free(gfud->url);
-	gfud->url = new_url;



More information about the Commits mailing list