/cpw/tomkiewicz/masterpassword: 16c7de07a9cf: Merge with trunk

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Wed May 1 08:18:27 EDT 2013


Changeset: 16c7de07a9cf0f645001739abe2a3513591e1e6e
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-05-01 11:52 +0200
Branch:	 soc.2008.masterpassword
URL: https://hg.pidgin.im/cpw/tomkiewicz/masterpassword/rev/16c7de07a9cf

Description:

Merge with trunk

diffstat:

 libpurple/ciphers/ciphers.h          |  76 ++++++++++++++++++------------------
 libpurple/example/nullclient.c       |   2 +-
 libpurple/plugin.c                   |   2 +-
 libpurple/plugin.h                   |  14 +++---
 libpurple/plugins/perl/perl-common.h |   3 +
 libpurple/plugins/perl/perl.c        |  56 ++++++++++++++++++--------
 libpurple/plugins/tcl/tcl.c          |  52 ++++++++++++++++++------
 7 files changed, 127 insertions(+), 78 deletions(-)

diffs (truncated from 361 to 300 lines):

diff --git a/libpurple/ciphers/ciphers.h b/libpurple/ciphers/ciphers.h
--- a/libpurple/ciphers/ciphers.h
+++ b/libpurple/ciphers/ciphers.h
@@ -1,38 +1,38 @@
-/* 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
- */
-
-/* des.c */
-PurpleCipherOps * purple_des_cipher_get_ops(void);
-PurpleCipherOps * purple_des3_cipher_get_ops(void);
-
-/* gchecksum.c */
-PurpleCipherOps * purple_md5_cipher_get_ops(void);
-PurpleCipherOps * purple_sha1_cipher_get_ops(void);
-PurpleCipherOps * purple_sha256_cipher_get_ops(void);
-
-/* hmac.c */
-PurpleCipherOps * purple_hmac_cipher_get_ops(void);
-
-/* md4.c */
-PurpleCipherOps * purple_md4_cipher_get_ops(void);
-
-/* rc4.c */
-PurpleCipherOps * purple_rc4_cipher_get_ops(void);
+/* 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
+ */
+
+/* des.c */
+PurpleCipherOps * purple_des_cipher_get_ops(void);
+PurpleCipherOps * purple_des3_cipher_get_ops(void);
+
+/* gchecksum.c */
+PurpleCipherOps * purple_md5_cipher_get_ops(void);
+PurpleCipherOps * purple_sha1_cipher_get_ops(void);
+PurpleCipherOps * purple_sha256_cipher_get_ops(void);
+
+/* hmac.c */
+PurpleCipherOps * purple_hmac_cipher_get_ops(void);
+
+/* md4.c */
+PurpleCipherOps * purple_md4_cipher_get_ops(void);
+
+/* rc4.c */
+PurpleCipherOps * purple_rc4_cipher_get_ops(void);
diff --git a/libpurple/example/nullclient.c b/libpurple/example/nullclient.c
--- a/libpurple/example/nullclient.c
+++ b/libpurple/example/nullclient.c
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
 		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);
diff --git a/libpurple/plugin.c b/libpurple/plugin.c
--- a/libpurple/plugin.c
+++ b/libpurple/plugin.c
@@ -573,7 +573,7 @@ purple_plugin_load(PurplePlugin *plugin)
 	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);
 	}
 
 	g_list_free(dep_list);
diff --git a/libpurple/plugin.h b/libpurple/plugin.h
--- a/libpurple/plugin.h
+++ b/libpurple/plugin.h
@@ -86,13 +86,13 @@ struct _PurplePluginInfo
 	GList *dependencies;
 	PurplePluginPriority priority;
 
-	char *id;
-	char *name;
-	char *version;
-	char *summary;
-	char *description;
-	char *author;
-	char *homepage;
+	const char *id;
+	const char *name;
+	const char *version;
+	const char *summary;
+	const char *description;
+	const char *author;
+	const char *homepage;
 
 	/**
 	 * If a plugin defines a 'load' function, and it returns FALSE,
diff --git a/libpurple/plugins/perl/perl-common.h b/libpurple/plugins/perl/perl-common.h
--- a/libpurple/plugins/perl/perl-common.h
+++ b/libpurple/plugins/perl/perl-common.h
@@ -35,9 +35,12 @@
 #define PURPLE_PERL_BOOT(x) \
 	purple_perl_callXS(boot_Purple__##x, cv, mark)
 
+typedef struct _PurplePerlInfoStrings PurplePerlInfoStrings;
+
 typedef struct
 {
 	PurplePlugin *plugin;
+	PurplePerlInfoStrings *info_strings;
 	char *package;
 	char *load_sub;
 	char *unload_sub;
diff --git a/libpurple/plugins/perl/perl.c b/libpurple/plugins/perl/perl.c
--- a/libpurple/plugins/perl/perl.c
+++ b/libpurple/plugins/perl/perl.c
@@ -103,6 +103,17 @@ extern void boot_DynaLoader _((pTHX_ CV 
 
 PerlInterpreter *my_perl = NULL;
 
+struct _PurplePerlInfoStrings
+{
+	char *name;
+	char *id;
+	char *homepage;
+	char *author;
+	char *summary;
+	char *description;
+	char *version;
+};
+
 static PurplePluginUiInfo ui_info =
 {
 	purple_perl_get_plugin_frame,
@@ -123,6 +134,21 @@ static PurpleGtkPluginUiInfo gtk_ui_info
 };
 #endif
 
+static void perl_infostrings_free(PurplePerlInfoStrings *info_strings)
+{
+	if (info_strings == NULL)
+		return;
+
+	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);
+	g_free(info_strings);
+}
+
 static void
 #ifdef OLD_PERL
 xs_init()
@@ -350,6 +376,7 @@ probe_perl_plugin(PurplePlugin *plugin)
 
 			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 @@ probe_perl_plugin(PurplePlugin *plugin)
 
 			/* 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);
 
 #ifdef PURPLE_GTKPERL
 			if ((key = hv_fetch(plugin_info, "GTK_UI",
@@ -381,23 +408,23 @@ probe_perl_plugin(PurplePlugin *plugin)
 
 			if ((key = hv_fetch(plugin_info, "url",
 			                    strlen("url"), 0)))
-				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",
 			                    strlen("author"), 0)))
-				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",
 			                    strlen("summary"), 0)))
-				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",
 			                    strlen("version"), 0)))
-				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 @@ probe_perl_plugin(PurplePlugin *plugin)
 
 			if ((key = hv_fetch(plugin_info, "id",
 			                    strlen("id"), 0))) {
-				g_free(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",
 				                           SvPVutf8_nolen(*key));
 			}
 
@@ -600,16 +627,11 @@ destroy_perl_plugin(PurplePlugin *plugin
 	if (plugin->info != NULL) {
 		PurplePerlScript *gps;
 
-		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;
 		if (gps != NULL) {
+			perl_infostrings_free(gps->info_strings);
+			gps->info_strings = NULL;
+
 			g_free(gps->package);
 			g_free(gps->load_sub);
 			g_free(gps->unload_sub);
diff --git a/libpurple/plugins/tcl/tcl.c b/libpurple/plugins/tcl/tcl.c
--- a/libpurple/plugins/tcl/tcl.c
+++ b/libpurple/plugins/tcl/tcl.c
@@ -50,6 +50,16 @@ struct tcl_plugin_data {
 	Tcl_Interp *interp;
 };
 
+typedef struct {
+	char *id;
+	char *name;
+	char *version;
+	char *summary;
+	char *description;
+	char *author;
+	char *homepage;
+} tcl_plugin_info_strings;
+
 PurpleStringref *PurpleTclRefAccount;
 PurpleStringref *PurpleTclRefConnection;
 PurpleStringref *PurpleTclRefConversation;
@@ -68,6 +78,21 @@ PurplePlugin *_tcl_plugin;
 
 static gboolean tcl_loaded = FALSE;
 
+static void tcl_plugin_info_strings_free(tcl_plugin_info_strings *strings)
+{
+	if (strings == NULL)
+		return;
+
+	g_free(strings->id);
+	g_free(strings->name);
+	g_free(strings->version);
+	g_free(strings->summary);



More information about the Commits mailing list