--- a/libpurple/example/nullclient.c Mon Apr 22 23:54:33 2013 +0200
+++ b/libpurple/example/nullclient.c Sat Apr 27 14:39:33 2013 +0200
@@ -269,7 +269,7 @@
PurplePluginInfo *info = plugin->info;
if (info && info->name) {
printf("\t%d: %s\n", i++, info->name);
- names = g_list_append(names, info->id);
+ names = g_list_append(names, (gpointer)info->id); printf("Select the protocol [0-%d]: ", i-1);
--- a/libpurple/plugin.c Mon Apr 22 23:54:33 2013 +0200
+++ b/libpurple/plugin.c Sat Apr 27 14:39:33 2013 +0200
@@ -573,7 +573,7 @@
for (l = dep_list; l != NULL; l = l->next)
PurplePlugin *dep_plugin = (PurplePlugin *)l->data;
- dep_plugin->dependent_plugins = g_list_prepend(dep_plugin->dependent_plugins, plugin->info->id);
+ dep_plugin->dependent_plugins = g_list_prepend(dep_plugin->dependent_plugins, (gpointer)plugin->info->id); --- a/libpurple/plugin.h Mon Apr 22 23:54:33 2013 +0200
+++ b/libpurple/plugin.h Sat Apr 27 14:39:33 2013 +0200
@@ -86,13 +86,13 @@
PurplePluginPriority priority;
+ const char *description; * If a plugin defines a 'load' function, and it returns FALSE,
--- a/libpurple/plugins/perl/perl-common.h Mon Apr 22 23:54:33 2013 +0200
+++ b/libpurple/plugins/perl/perl-common.h Sat Apr 27 14:39:33 2013 +0200
@@ -35,9 +35,12 @@
#define PURPLE_PERL_BOOT(x) \
purple_perl_callXS(boot_Purple__##x, cv, mark)
+typedef struct _PurplePerlInfoStrings PurplePerlInfoStrings; + PurplePerlInfoStrings *info_strings; --- a/libpurple/plugins/perl/perl.c Mon Apr 22 23:54:33 2013 +0200
+++ b/libpurple/plugins/perl/perl.c Sat Apr 27 14:39:33 2013 +0200
@@ -103,6 +103,17 @@
PerlInterpreter *my_perl = NULL;
+struct _PurplePerlInfoStrings static PurplePluginUiInfo ui_info =
purple_perl_get_plugin_frame,
@@ -123,6 +134,21 @@
+static void perl_infostrings_free(PurplePerlInfoStrings *info_strings) + if (info_strings == NULL) + g_free(info_strings->name); + g_free(info_strings->id); + g_free(info_strings->homepage); + g_free(info_strings->author); + g_free(info_strings->summary); + g_free(info_strings->description); + g_free(info_strings->version); @@ -350,6 +376,7 @@
info = g_new0(PurplePluginInfo, 1);
gps = g_new0(PurplePerlScript, 1);
+ gps->info_strings = g_new0(PurplePerlInfoStrings, 1); info->magic = PURPLE_PLUGIN_MAGIC;
info->major_version = PURPLE_MAJOR_VERSION;
@@ -369,9 +396,9 @@
/* We know this one exists. */
key = hv_fetch(plugin_info, "name", strlen("name"), 0);
- info->name = g_strdup(SvPVutf8_nolen(*key));
+ info->name = gps->info_strings->name = g_strdup(SvPVutf8_nolen(*key)); /* Set id here in case we don't find one later. */
- info->id = g_strdup(info->name);
+ info->id = gps->info_strings->id = g_strdup(info->name); if ((key = hv_fetch(plugin_info, "GTK_UI",
@@ -381,23 +408,23 @@
if ((key = hv_fetch(plugin_info, "url",
- info->homepage = g_strdup(SvPVutf8_nolen(*key));
+ info->homepage = gps->info_strings->homepage = g_strdup(SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "author",
- info->author = g_strdup(SvPVutf8_nolen(*key));
+ info->author = gps->info_strings->author = g_strdup(SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "summary",
- info->summary = g_strdup(SvPVutf8_nolen(*key));
+ info->summary = gps->info_strings->summary = g_strdup(SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "description",
strlen("description"), 0)))
- info->description = g_strdup(SvPVutf8_nolen(*key));
+ info->description = gps->info_strings->description = g_strdup(SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "version",
- info->version = g_strdup(SvPVutf8_nolen(*key));
+ info->version = gps->info_strings->version = g_strdup(SvPVutf8_nolen(*key)); /* We know this one exists. */
key = hv_fetch(plugin_info, "load", strlen("load"), 0);
@@ -412,8 +439,8 @@
if ((key = hv_fetch(plugin_info, "id",
- info->id = g_strdup_printf("perl-%s",
+ g_free(gps->info_strings->id); + info->id = gps->info_strings->id = g_strdup_printf("perl-%s", @@ -600,16 +627,11 @@
if (plugin->info != NULL) {
- g_free(plugin->info->name);
- g_free(plugin->info->id);
- g_free(plugin->info->homepage);
- g_free(plugin->info->author);
- g_free(plugin->info->summary);
- g_free(plugin->info->description);
- g_free(plugin->info->version);
gps = (PurplePerlScript *)plugin->info->extra_info;
+ perl_infostrings_free(gps->info_strings); + gps->info_strings = NULL; --- a/libpurple/plugins/tcl/tcl.c Mon Apr 22 23:54:33 2013 +0200
+++ b/libpurple/plugins/tcl/tcl.c Sat Apr 27 14:39:33 2013 +0200
@@ -50,6 +50,16 @@
+} tcl_plugin_info_strings; PurpleStringref *PurpleTclRefAccount;
PurpleStringref *PurpleTclRefConnection;
PurpleStringref *PurpleTclRefConversation;
@@ -68,6 +78,21 @@
static gboolean tcl_loaded = FALSE;
+static void tcl_plugin_info_strings_free(tcl_plugin_info_strings *strings) + g_free(strings->version); + g_free(strings->summary); + g_free(strings->description); + g_free(strings->author); + g_free(strings->homepage); PurplePlugin *tcl_interp_get_plugin(Tcl_Interp *interp)
struct tcl_plugin_data *data;
@@ -219,7 +244,9 @@
result = Tcl_GetObjResult(interp);
if (Tcl_ListObjGetElements(interp, result, &nelems, &listitems) == TCL_OK) {
if ((nelems == 6) || (nelems == 7)) {
+ tcl_plugin_info_strings *strings = g_new0(tcl_plugin_info_strings, 1); info = g_new0(PurplePluginInfo, 1);
+ info->extra_info = strings; info->magic = PURPLE_PLUGIN_MAGIC;
info->major_version = PURPLE_MAJOR_VERSION;
@@ -227,17 +254,17 @@
info->type = PURPLE_PLUGIN_STANDARD;
info->dependencies = g_list_append(info->dependencies, "core-tcl");
- info->name = g_strdup(Tcl_GetString(listitems[0]));
- info->version = g_strdup(Tcl_GetString(listitems[1]));
- info->summary = g_strdup(Tcl_GetString(listitems[2]));
- info->description = g_strdup(Tcl_GetString(listitems[3]));
- info->author = g_strdup(Tcl_GetString(listitems[4]));
- info->homepage = g_strdup(Tcl_GetString(listitems[5]));
+ info->name = strings->name = g_strdup(Tcl_GetString(listitems[0])); + info->version = strings->version = g_strdup(Tcl_GetString(listitems[1])); + info->summary = strings->summary = g_strdup(Tcl_GetString(listitems[2])); + info->description = strings->description = g_strdup(Tcl_GetString(listitems[3])); + info->author = strings->author = g_strdup(Tcl_GetString(listitems[4])); + info->homepage = strings->homepage = g_strdup(Tcl_GetString(listitems[5])); - info->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[0]));
+ info->id = strings->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[0])); - info->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[6]));
+ info->id = strings->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[6])); @@ -314,12 +341,9 @@
static void tcl_destroy_plugin(PurplePlugin *plugin)
if (plugin->info != NULL) {
- g_free(plugin->info->id);
- g_free(plugin->info->name);
- g_free(plugin->info->version);
- g_free(plugin->info->description);
- g_free(plugin->info->author);
- g_free(plugin->info->homepage);
+ tcl_plugin_info_strings *info_strings = plugin->info->extra_info; + tcl_plugin_info_strings_free(info_strings); + plugin->info->extra_info = NULL;