changeset 15823:ed80ec6be33c

who knew that --disable-plugins still worked?! Also, some completely untested support for aim:buddyicon, which I'll look at more tomorrow
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 10:03:36 +0000
parents 32c366eeeb99
children 1342fa79d68c 90188f78beeb
files configure.ac libpurple/util.c pidgin/gtkstatusbox.c
diffstat 3 files changed, 46 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Mar 19 07:01:17 2007 +0000
+++ b/configure.ac	Mon Mar 19 10:03:36 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 07:01:17 2007 +0000
+++ b/libpurple/util.c	Mon Mar 19 10:03:36 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 07:01:17 2007 +0000
+++ b/pidgin/gtkstatusbox.c	Mon Mar 19 10:03:36 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