changeset 7033:cf1126ba1834

[gaim-migrate @ 7596] Multiple copies of gaim installed at different locations no longer attempt to load the same, possibly incompatible plugins. It does this by saving the base filenames of the plugins, rather than the full names, and attempts to load them at the particular copy's plugin directory. Now a released gaim in the system default prefix and a development gaim in a home directory will no longer try to load each other's plugins. They'll each load their own versions of each. Thanks to Robot101 for the patch. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 29 Sep 2003 22:46:15 +0000
parents 0ffd540660df
children f7ff0dfa6b9f
files ChangeLog src/plugin.c src/plugin.h
diffstat 3 files changed, 62 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Sep 29 22:34:32 2003 +0000
+++ b/ChangeLog	Mon Sep 29 22:46:15 2003 +0000
@@ -1,10 +1,13 @@
 Gaim: The Pimpin' Penguin IM Clone that's good for the soul!
 
 version 0.71
-	* Display AIM away messages in the tooltip for buddies when 
+	* Display AIM away messages in the tooltip for buddies when
 	  they are away.
 	* Re-write of Jabber protocol plugin
 	* SSL support can now be provided by third party plugins.
+	* Multiple copies of gaim installed at different locations no
+	  longer attempt to load the same, possibly incompatible plugins
+	  (Robert McQueen)
 
 version 0.70 (09/28/2003):
 	* Implemented Yahoo's new authentication method (Cerulean Studios)
--- a/src/plugin.c	Mon Sep 29 22:34:32 2003 +0000
+++ b/src/plugin.c	Mon Sep 29 22:46:15 2003 +0000
@@ -765,8 +765,28 @@
 
 	files = gaim_prefs_get_string_list(key);
 
-	for (f = files; f; f = f->next) {
-		gaim_plugin_load(gaim_plugin_probe(f->data));
+	for (f = files; f; f = f->next)
+	{
+		char *filename = g_path_get_basename(f->data);
+		GaimPlugin *plugin = NULL;
+
+		if (filename != NULL)
+		{
+			if ((plugin = gaim_plugins_find_with_basename(filename)) != NULL)
+			{
+				gaim_debug_info("plugins", "Loading saved plugin %s\n",
+								filename);
+				gaim_plugin_load(plugin);
+			}
+			else
+			{
+				gaim_debug_error("plugins", "Unable to find saved plugin %s\n",
+								 filename);
+			}
+
+			g_free(filename);
+		}
+
 		g_free(f->data);
 	}
 
@@ -989,6 +1009,33 @@
 }
 
 GaimPlugin *
+gaim_plugins_find_with_basename(const char *basename)
+{
+	GaimPlugin *plugin;
+	GList *l;
+
+	g_return_val_if_fail(basename != NULL, NULL);
+
+	for (l = plugins; l != NULL; l = l->next)
+	{
+		char *tmp;
+
+		plugin = (GaimPlugin *)l->data;
+
+		if (plugin->path != NULL &&
+			(tmp = g_strrstr(plugin->path, basename)) != NULL)
+		{
+			tmp += strlen(basename);
+
+			if (*tmp == '\0')
+				return plugin;
+		}
+	}
+
+	return NULL;
+}
+
+GaimPlugin *
 gaim_plugins_find_with_id(const char *id)
 {
 	GaimPlugin *plugin;
--- a/src/plugin.h	Mon Sep 29 22:34:32 2003 +0000
+++ b/src/plugin.h	Mon Sep 29 22:46:15 2003 +0000
@@ -411,6 +411,15 @@
 GaimPlugin *gaim_plugins_find_with_filename(const char *filename);
 
 /**
+ * Finds a plugin with the specified base filename.
+ *
+ * @param basename The base plugin filename.
+ *
+ * @return The plugin if found, or @c NULL if not found.
+ */
+GaimPlugin *gaim_plugins_find_with_basename(const char *basename);
+
+/**
  * Finds a plugin with the specified plugin ID.
  *
  * @param id The plugin ID.