[Commits] plugin.c 1.13.2.48 1.13.2.49

colin at claws-mail.org colin at claws-mail.org
Wed Feb 20 16:21:48 CET 2013


Update of /home/claws-mail/claws/src/common
In directory srv:/tmp/cvs-serv21021/src/common

Modified Files:
      Tag: gtk2
	plugin.c 
Log Message:
2013-02-20 [colin]	3.9.0cvs93

	* src/common/plugin.c
		Auto fix plugin names ending in	"_plugin"

Index: plugin.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/plugin.c,v
retrieving revision 1.13.2.48
retrieving revision 1.13.2.49
diff -u -d -r1.13.2.48 -r1.13.2.49
--- plugin.c	30 Nov 2012 18:57:21 -0000	1.13.2.48
+++ plugin.c	20 Feb 2013 15:21:46 -0000	1.13.2.49
@@ -562,6 +562,28 @@
 
 }
 
+static void replace_old_plugin_name(gchar *plugin_name)
+{
+	gchar *old_name_end = g_strconcat("_plugin.", G_MODULE_SUFFIX, NULL);
+	gchar *matches = strstr(plugin_name, old_name_end);
+
+	if (!matches) {
+		g_free(old_name_end);
+		return;
+	} else if (plugin_name + strlen(plugin_name) != matches + strlen(matches)) {
+		g_free(old_name_end);
+		return;
+	} else {
+		gchar *new_name_end = g_strconcat(".", G_MODULE_SUFFIX, NULL);
+		int offset = strlen(plugin_name) - strlen(old_name_end);
+
+		debug_print("Replacing old plugin name %s\n", plugin_name);
+		
+		strncpy(plugin_name + offset, new_name_end, strlen(old_name_end) - 1);
+		debug_print(" to %s\n", plugin_name);
+	}
+}
+
 void plugin_load_all(const gchar *type)
 {
 	gchar *rcpath;
@@ -591,6 +613,8 @@
 			break;
 
 		g_strstrip(buf);
+		replace_old_plugin_name(buf);
+
 		if ((buf[0] != '\0') && (plugin_load(buf, &error) == NULL)) {
 			g_warning("plugin loading error: %s\n", error);
 			g_free(error);



More information about the Commits mailing list