--- a/libpurple/plugin.c Mon May 19 09:31:48 2014 +0200
+++ b/libpurple/plugin.c Mon May 19 10:01:26 2014 +0200
@@ -184,12 +184,32 @@
plugin->native_plugin = native;
plugin->path = g_strdup(path);
+ plugin->extra_data = g_hash_table_new_full(g_str_hash, g_str_equal, PURPLE_DBUS_REGISTER_POINTER(plugin, PurplePlugin);
+purple_plugin_set_data(PurplePlugin *plugin, const gchar *key, gpointer value) + g_return_if_fail(plugin != NULL); + g_return_if_fail(plugin->extra_data != NULL); + g_hash_table_insert(plugin->extra_data, g_strdup(key), value); +purple_plugin_get_data(PurplePlugin *plugin, const gchar *key) + g_return_val_if_fail(plugin != NULL, NULL); + g_return_val_if_fail(plugin->extra_data != NULL, NULL); + return g_hash_table_lookup(plugin->extra_data, key); purple_plugin_probe(const char *filename)
@@ -876,6 +896,7 @@
+ g_hash_table_destroy(plugin->extra_data); PURPLE_DBUS_UNREGISTER_POINTER(plugin);
--- a/libpurple/plugin.h Mon May 19 09:31:48 2014 +0200
+++ b/libpurple/plugin.h Mon May 19 10:01:26 2014 +0200
@@ -187,6 +187,7 @@
GList *dependent_plugins;
+ GHashTable *extra_data; void (*_purple_reserved1)(void);
@@ -297,6 +298,29 @@
PurplePlugin *purple_plugin_new(gboolean native, const char *path);
+ * purple_plugin_set_data: + * @value: The data to set. + * Sets extra data for particular plugin. +purple_plugin_set_data(PurplePlugin *plugin, const gchar *key, gpointer value); + * purple_plugin_get_data: + * Gets extra data for particular plugin. + * Returns: data set previously with #purple_plugin_set_data. +purple_plugin_get_data(PurplePlugin *plugin, const gchar *key); * @filename: The plugin's filename.
--- a/pidgin/plugins/Makefile.am Mon May 19 09:31:48 2014 +0200
+++ b/pidgin/plugins/Makefile.am Mon May 19 10:01:26 2014 +0200
@@ -43,6 +43,7 @@
gtkbuddynote_la_LDFLAGS = -module @PLUGIN_LDFLAGS@
history_la_LDFLAGS = -module @PLUGIN_LDFLAGS@
iconaway_la_LDFLAGS = -module @PLUGIN_LDFLAGS@
+imgupload_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ markerline_la_LDFLAGS = -module @PLUGIN_LDFLAGS@
notify_la_LDFLAGS = -module @PLUGIN_LDFLAGS@
relnot_la_LDFLAGS = -module @PLUGIN_LDFLAGS@
@@ -61,6 +62,7 @@
@@ -85,6 +87,7 @@
gtkbuddynote_la_SOURCES = gtkbuddynote.c
history_la_SOURCES = history.c
iconaway_la_SOURCES = iconaway.c
+imgupload_la_SOURCES = imgupload.c markerline_la_SOURCES = markerline.c
notify_la_SOURCES = notify.c
relnot_la_SOURCES = relnot.c
@@ -102,6 +105,7 @@
gtkbuddynote_la_LIBADD = @PIDGIN_LIBS@
history_la_LIBADD = @PIDGIN_LIBS@
iconaway_la_LIBADD = @PIDGIN_LIBS@
+imgupload_la_LIBADD = @PIDGIN_LIBS@ markerline_la_LIBADD = @PIDGIN_LIBS@ $(WEBKIT_LIBS)
notify_la_LIBADD = @PIDGIN_LIBS@
relnot_la_LIBADD = @PIDGIN_LIBS@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/plugins/imgupload.c Mon May 19 10:01:26 2014 +0200
@@ -0,0 +1,140 @@
+ * Image Upload - an inline images implementation for protocols without + * support for such feature. + * Copyright (C) 2014, Tomasz Wasilczyk <twasilczyk@pidgin.im> + * 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 "gtkwebviewtoolbar.h" +#include "pidginstock.h" +/****************************************************************************** + ******************************************************************************/ +/****************************************************************************** + ******************************************************************************/ +imgup_prpl_init(PurplePlugin *prpl) + PurplePluginProtocolInfo *prpl_info; + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + if (prpl_info->options & OPT_PROTO_IM_IMAGE) + purple_plugin_set_data(prpl, "imgupload-set", GINT_TO_POINTER(TRUE)); + prpl_info->options |= OPT_PROTO_IM_IMAGE; +imgup_prpl_uninit(PurplePlugin *prpl) + PurplePluginProtocolInfo *prpl_info; + if (!purple_plugin_get_data(prpl, "imgupload-set")) + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + prpl_info->options &= ~OPT_PROTO_IM_IMAGE; + purple_plugin_set_data(prpl, "imgupload-set", NULL); +imgup_plugin_load(PurplePlugin *plugin) + it = purple_plugins_get_protocols(); + for (; it; it = g_list_next(it)) { + PurplePlugin *prpl = it->data; +imgup_plugin_unload(PurplePlugin *plugin) + it = purple_plugins_get_protocols(); + for (; it; it = g_list_next(it)) { + PurplePlugin *prpl = it->data; + imgup_prpl_uninit(prpl); +static PurplePluginInfo imgup_info = + PURPLE_PLUGIN_STANDARD, + PURPLE_PRIORITY_DEFAULT, + N_("Inline images implementation for protocols without such feature."), + N_("Adds inline images support for protocols lacking this feature by " + "uploading them to the external service."), + "Tomasz Wasilczyk <twasilczyk@pidgin.im>", +imgup_init_plugin(PurplePlugin *plugin) + purple_prefs_add_none("/plugins"); + purple_prefs_add_none("/plugins/gtk"); + purple_prefs_add_none("/plugins/gtk/imgupload"); +PURPLE_INIT_PLUGIN(imgupload, imgup_init_plugin, imgup_info)