/pidgin/main: e6fb7d0dae03: Merge heads.

Elliott Sales de Andrade qulogic at pidgin.im
Mon Nov 5 18:16:03 EST 2012


Changeset: e6fb7d0dae031bd96d96b25a0a521014b5d2e193
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-11-05 18:15 -0500
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/e6fb7d0dae03

Description:

Merge heads.

diffstat:

 configure.ac                                |     7 +-
 finch/plugins/gnttinyurl.c                  |     1 +
 libpurple/Makefile.am                       |     3 +
 libpurple/connection.c                      |     2 +
 libpurple/core.c                            |     3 +
 libpurple/ft.c                              |     2 +-
 libpurple/ft.h                              |     2 +-
 libpurple/glibcompat.h                      |    29 +-
 libpurple/http.c                            |  2286 +++++++++++++++++++++++++++
 libpurple/http.h                            |   589 ++++++
 libpurple/obsolete.c                        |   773 +++++++++
 libpurple/obsolete.h                        |   110 +
 libpurple/plugins/perl/common/Util.xs       |    51 -
 libpurple/plugins/perl/common/module.h      |     1 -
 libpurple/protocols/gg/avatar.c             |     1 +
 libpurple/protocols/gg/oauth/oauth-purple.c |     1 +
 libpurple/protocols/gg/pubdir-prpl.c        |     1 +
 libpurple/protocols/jabber/google/relay.c   |     1 +
 libpurple/protocols/jabber/jabber.c         |     1 +
 libpurple/protocols/jabber/useravatar.c     |     1 +
 libpurple/protocols/msn/msn.c               |     1 +
 libpurple/protocols/msn/session.c           |     1 +
 libpurple/protocols/msn/slp.c               |     1 +
 libpurple/protocols/mxit/formcmds.c         |     1 +
 libpurple/protocols/mxit/login.c            |     1 +
 libpurple/protocols/mxit/markup.c           |     1 +
 libpurple/protocols/mxit/protocol.c         |     1 +
 libpurple/protocols/myspace/user.h          |     2 +
 libpurple/protocols/oscar/oscar.h           |     1 +
 libpurple/protocols/yahoo/libymsg.c         |     1 +
 libpurple/protocols/yahoo/yahoo_aliases.c   |     1 +
 libpurple/protocols/yahoo/yahoo_picture.c   |     1 +
 libpurple/protocols/yahoo/yahoo_profile.c   |     1 +
 libpurple/upnp.c                            |     1 +
 libpurple/util.c                            |   685 +--------
 libpurple/util.h                            |    70 -
 pidgin/gtkdialogs.c                         |     5 +-
 pidgin/gtkprefs.c                           |     1 +
 pidgin/gtksmiley.c                          |     1 +
 pidgin/gtkstatusbox.c                       |     1 +
 pidgin/plugins/relnot.c                     |    47 +-
 41 files changed, 3824 insertions(+), 866 deletions(-)

diffs (truncated from 5204 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -821,11 +821,8 @@ dnl ####################################
 
 PKG_CHECK_MODULES([JSON], [json-glib-1.0], [enable_json="yes"], [enable_json="no"])
 
-dnl #######################################################################
-dnl # Check for libcurl (required)
-dnl #######################################################################
-
-PKG_CHECK_MODULES([LIBCURL], [libcurl])
+AC_SUBST(JSON_CFLAGS)
+AC_SUBST(JSON_LIBS)
 
 dnl #######################################################################
 dnl # Check for zlib (required)
diff --git a/finch/plugins/gnttinyurl.c b/finch/plugins/gnttinyurl.c
--- a/finch/plugins/gnttinyurl.c
+++ b/finch/plugins/gnttinyurl.c
@@ -21,6 +21,7 @@
 
 #include "internal.h"
 #include <glib.h>
+#include "obsolete.h"
 
 #define PLUGIN_STATIC_NAME	TinyURL
 #define PREFS_BASE          "/plugins/gnt/tinyurl"
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -50,6 +50,7 @@ purple_coresources = \
 	desktopitem.c \
 	eventloop.c \
 	ft.c \
+	http.c \
 	idle.c \
 	imgstore.c \
 	log.c \
@@ -65,6 +66,7 @@ purple_coresources = \
 	network.c \
 	ntlm.c \
 	notify.c \
+	obsolete.c \
 	plugin.c \
 	pluginpref.c \
 	pounce.c \
@@ -283,6 +285,7 @@ libpurple_la_SOURCES = \
 
 noinst_HEADERS= \
 	internal.h \
+	obsolete.h \
 	media/backend-fs2.h \
 	valgrind.h
 
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -31,6 +31,7 @@
 #include "connection.h"
 #include "dbus-maybe.h"
 #include "debug.h"
+#include "http.h"
 #include "log.h"
 #include "notify.h"
 #include "prefs.h"
@@ -251,6 +252,7 @@ void
 
 	update_keepalive(gc, FALSE);
 
+	purple_http_conn_cancel_all(gc);
 	purple_proxy_connect_cancel_with_handle(gc);
 
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -33,6 +33,7 @@
 #include "debug.h"
 #include "dnsquery.h"
 #include "ft.h"
+#include "http.h"
 #include "idle.h"
 #include "imgstore.h"
 #include "network.h"
@@ -174,6 +175,7 @@ purple_core_init(const char *ui)
 	purple_stun_init();
 	purple_xfers_init();
 	purple_idle_init();
+	purple_http_init();
 	purple_smileys_init();
 	/*
 	 * Call this early on to try to auto-detect our IP address and
@@ -222,6 +224,7 @@ purple_core_quit(void)
 
 	/* Save .xml files, remove signals, etc. */
 	purple_smileys_uninit();
+	purple_http_uninit();
 	purple_idle_uninit();
 	purple_pounces_uninit();
 	purple_blist_uninit();
diff --git a/libpurple/ft.c b/libpurple/ft.c
--- a/libpurple/ft.c
+++ b/libpurple/ft.c
@@ -319,7 +319,7 @@ purple_xfer_conversation_write_internal(
 }
 
 void
-purple_xfer_conversation_write(PurpleXfer *xfer, gchar *message,
+purple_xfer_conversation_write(PurpleXfer *xfer, const gchar *message,
 	gboolean is_error)
 {
 	purple_xfer_conversation_write_internal(xfer, message, is_error, FALSE);
diff --git a/libpurple/ft.h b/libpurple/ft.h
--- a/libpurple/ft.h
+++ b/libpurple/ft.h
@@ -705,7 +705,7 @@ void purple_xfer_update_progress(PurpleX
  * @param message The message to display.
  * @param is_error Is this an error message?.
  */
-void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is_error);
+void purple_xfer_conversation_write(PurpleXfer *xfer, const gchar *message, gboolean is_error);
 
 /**
  * Allows the UI to signal it's ready to send/receive data (depending on
diff --git a/libpurple/glibcompat.h b/libpurple/glibcompat.h
--- a/libpurple/glibcompat.h
+++ b/libpurple/glibcompat.h
@@ -25,31 +25,34 @@
  * Also, any public API should not depend on this file.
  */
 
+#if !GLIB_CHECK_VERSION(2, 20, 0)
+
+#define G_OFFSET_FORMAT G_GINT64_FORMAT
+
 #if !GLIB_CHECK_VERSION(2, 28, 0)
 
+static inline gint64 g_get_monotonic_time(void)
+{
+	GTimeVal time_s;
+
+	g_get_current_time(&time_s);
+
+	return ((gint64)time_s.tv_sec << 32) | time_s.tv_usec;
+}
+
 static inline void g_list_free_full(GList *list, GDestroyNotify free_func)
 {
-	GList *it;
-	it = g_list_first(list);
-	while (it)
-	{
-		free_func(it->data);
-		it = g_list_next(it);
-	}
+	g_list_foreach(list, (GFunc)free_func, NULL);
 	g_list_free(list);
 }
 
 static inline void g_slist_free_full(GSList *list, GDestroyNotify free_func)
 {
-	GSList *it = list;
-	while (it)
-	{
-		free_func(it->data);
-		it = g_slist_next(it);
-	}
+	g_slist_foreach(list, (GFunc)free_func, NULL);
 	g_slist_free(list);
 }
 
 #endif /* 2.28.0 */
+#endif /* 2.20.0 */
 
 #endif /* _PIDGINGLIBCOMPAT_H_ */
diff --git a/libpurple/http.c b/libpurple/http.c
new file mode 100644
--- /dev/null
+++ b/libpurple/http.c
@@ -0,0 +1,2286 @@
+/**
+ * @file http.c HTTP API
+ * @ingroup core
+ */
+
+/* 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 "http.h"
+
+#include "internal.h"
+
+#include "debug.h"
+#include "ntlm.h"
+
+#define PURPLE_HTTP_URL_CREDENTIALS_CHARS "a-z0-9.,~_/*!&%?=+\\^-"
+#define PURPLE_HTTP_MAX_RECV_BUFFER_LEN 10240
+#define PURPLE_HTTP_MAX_READ_BUFFER_LEN 10240
+
+#define PURPLE_HTTP_REQUEST_DEFAULT_MAX_REDIRECTS 20
+#define PURPLE_HTTP_REQUEST_DEFAULT_TIMEOUT 30
+
+typedef struct _PurpleHttpURL PurpleHttpURL;
+
+typedef struct _PurpleHttpSocket PurpleHttpSocket;
+
+typedef struct _PurpleHttpHeaders PurpleHttpHeaders;
+
+struct _PurpleHttpSocket
+{
+	gboolean is_ssl;
+	PurpleSslConnection *ssl_connection;
+	PurpleProxyConnectData *raw_connection;
+	int fd;
+	guint inpa;
+};
+
+struct _PurpleHttpRequest
+{
+	int ref_count;
+
+	gchar *url;
+	gchar *method;
+	PurpleHttpHeaders *headers;
+	PurpleHttpCookieJar *cookie_jar;
+
+	gchar *contents;
+	int contents_length;
+	PurpleHttpContentReader contents_reader;
+	gpointer contents_reader_data;
+
+	int timeout;
+	int max_redirects;
+	gboolean http11;
+	int max_length;
+};
+
+struct _PurpleHttpConnection
+{
+	PurpleConnection *gc;
+	PurpleHttpCallback callback;
+	gpointer user_data;
+	gboolean is_reading;
+
+	PurpleHttpURL *url;
+	PurpleHttpRequest *request;
+	PurpleHttpResponse *response;
+
+	PurpleHttpSocket socket;
+	GString *request_header;
+	int request_header_written, request_contents_written;
+	gboolean main_header_got, headers_got;
+	GString *response_buffer;
+
+	GString *contents_reader_buffer;
+	gboolean contents_reader_requested;
+
+	int redirects_count;
+	int data_length_got;
+
+	int length_expected, length_got;
+
+	gboolean is_chunked, in_chunk, chunks_done;
+	int chunk_length, chunk_got;
+
+	GList *link_global, *link_gc;
+
+	guint timeout_handle;
+
+	PurpleHttpProgressWatcher watcher;
+	gpointer watcher_user_data;
+	guint watcher_interval_threshold;
+	gint64 watcher_last_call;
+};
+
+struct _PurpleHttpResponse
+{
+	int code;
+	gchar *error;
+
+	GString *contents;



More information about the Commits mailing list