changeset 15836:1342fa79d68c

merge of '4f3716fabe4921140f734b988e908d44142507e0' and '9d39bda320a4f35bdab8e3a3ec39c79d34ddedc8'
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 19 Mar 2007 17:35:41 +0000
parents 9e6dd4e924a5 (current diff) ed80ec6be33c (diff)
children cf140d8c878c
files libpurple/plugins/perl/common/Gaim.pm libpurple/plugins/perl/common/Gaim.xs libpurple/win32/wgaimerror.h
diffstat 3 files changed, 46 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Mar 19 17:03:02 2007 +0000
+++ b/configure.ac	Mon Mar 19 17:35:41 2007 +0000
@@ -1717,7 +1717,7 @@
 AC_SUBST(LIBS)
 
 if test "x$enable_plugins" = "xyes" ; then
-	AC_DEFINE(GAIM_PLUGINS, 1, [Define if plugins are enabled.])
+	AC_DEFINE(PURPLE_PLUGINS, 1, [Define if plugins are enabled.])
 	AM_CONDITIONAL(PLUGINS, true)
 else
 	AM_CONDITIONAL(PLUGINS, false)
--- a/libpurple/util.c	Mon Mar 19 17:03:02 2007 +0000
+++ b/libpurple/util.c	Mon Mar 19 17:35:41 2007 +0000
@@ -3004,7 +3004,7 @@
 	char *cmd;
 	GHashTable *params = NULL;
 	int len;
-
+printf("got handler uri \n");
 	if (!(tmp = strchr(uri, ':')) || tmp == uri) {
 		purple_debug_error("util", "Malformed protocol handler message - missing protocol.\n");
 		return;
--- a/pidgin/gtkstatusbox.c	Mon Mar 19 17:03:02 2007 +0000
+++ b/pidgin/gtkstatusbox.c	Mon Mar 19 17:35:41 2007 +0000
@@ -42,6 +42,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #include "account.h"
+#include "core.h"
 #include "internal.h"
 #include "network.h"
 #include "savedstatuses.h"
@@ -295,6 +296,46 @@
 	gtk_drag_finish(dc, FALSE, FALSE, t);
 }
 
+static void
+statusbox_got_url(PurpleUtilFetchUrlData *url_data, gpointer user_data,
+                const gchar *themedata, size_t len, const gchar *error_message, 
+		PidginStatusBox *status_box)
+{
+        FILE *f;
+        gchar *path;
+
+        if ((error_message != NULL) || (len == 0))
+                return;
+
+        f = purple_mkstemp(&path, TRUE);
+        fwrite(themedata, len, 1, f);
+        fclose(f);
+
+	icon_choose_cb(path, status_box);
+
+        g_unlink(path);
+        g_free(path);
+}
+
+
+static gboolean
+statusbox_uri_handler(const char *proto, const char *cmd, GHashTable *params, void *data)
+{
+	const char *src;
+printf("%s %s\n", proto, cmd);
+	if (g_ascii_strcasecmp(proto, "aim"))
+		return FALSE;
+
+	if (g_ascii_strcasecmp(cmd, "buddyicon"))
+		return FALSE;
+
+	src = g_hash_table_lookup(params, "account");
+	if (src == NULL)
+		return FALSE;
+
+	purple_util_fetch_url(src, TRUE, NULL, FALSE, statusbox_got_url, data);
+	return TRUE;
+}
 
 static gboolean
 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box)
@@ -1735,6 +1776,9 @@
 								spellcheck_prefs_cb, status_box);
 	purple_prefs_connect_callback(status_box, "/purple/gtk/accounts/buddyicon",
 	                            update_buddyicon_cb, status_box);
+	purple_signal_connect(purple_get_core(), "uri-handler", status_box,
+					PURPLE_CALLBACK(statusbox_uri_handler), status_box);
+
 }
 
 static void