changeset 12342:0692d20d9d81

[gaim-migrate @ 14646] sf patch #1361667, from Sadrul Habib Chowdhury "Gaim currently loads a plugin twice if it exists in user's home directory, and also in LIBDIR. This can create confusion in the plugins-dialog -- especially when someone modifies some plugin and installs in his home-directory. I think it'd be better to load only the plugin which is in user's home directory in such cases." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 05 Dec 2005 04:19:07 +0000
parents eea31c8cc9f7
children a02f877637a6
files src/gtkmain.c src/plugin.c
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkmain.c	Mon Dec 05 04:10:08 2005 +0000
+++ b/src/gtkmain.c	Mon Dec 05 04:19:07 2005 +0000
@@ -618,11 +618,14 @@
 	gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops());
 	gaim_eventloop_set_ui_ops(gaim_gtk_eventloop_get_ui_ops());
 
-	/* Set plugin search directories */
-	gaim_plugins_add_search_path(LIBDIR);
+	/*
+	 * Set plugin search directories. Give priority to the plugins
+	 * in user's home directory.
+	 */
 	search_path = g_build_filename(gaim_user_dir(), "plugins", NULL);
 	gaim_plugins_add_search_path(search_path);
 	g_free(search_path);
+	gaim_plugins_add_search_path(LIBDIR);
 
 	if (!gaim_core_init(GAIM_GTK_UI)) {
 		fprintf(stderr,
--- a/src/plugin.c	Mon Dec 05 04:10:08 2005 +0000
+++ b/src/plugin.c	Mon Dec 05 04:19:07 2005 +0000
@@ -200,6 +200,7 @@
 	GaimPlugin *plugin = NULL;
 	GaimPlugin *loader;
 	gpointer unpunned;
+	gchar *basename = NULL;
 	gboolean (*gaim_init_plugin)(GaimPlugin *);
 
 	gaim_debug_misc("plugins", "probing %s\n", filename);
@@ -209,9 +210,17 @@
 		return NULL;
 
 	/* If this plugin has already been probed then exit */
-	plugin = gaim_plugins_find_with_filename(filename);
+	basename = gaim_plugin_get_basename(filename);
+	plugin = gaim_plugins_find_with_basename(basename);
+	g_free(basename);
 	if (plugin != NULL)
+	{
+		if (strcmp(filename, plugin->path))
+			gaim_debug_info("plugins", "Not loading %s."
+							"Another plugin with the same name (%s) has already been loaded.\n",
+							filename, plugin->path);
 		return plugin;
+	}
 
 	plugin = gaim_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename);