changeset 1236:dcf9242241ee

[gaim-migrate @ 1246] fixing some plugin stuff committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 12 Dec 2000 11:31:58 +0000
parents a9cf2f61a7b1
children 72692c70317e
files src/gaimrc.c src/plugins.c
diffstat 2 files changed, 16 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaimrc.c	Tue Dec 12 09:09:24 2000 +0000
+++ b/src/gaimrc.c	Tue Dec 12 11:31:58 2000 +0000
@@ -423,23 +423,32 @@
 {
 	struct parse *p;
 	char buf[4096];
+	GSList *load = NULL;
 
 	buf[0] = 0;
 	
 	while (buf[0] != '}')
 	{
 		if (!fgets(buf, sizeof(buf), f))
-			return;
+			break;
 		
 		if (buf[0] == '}')
-			return;
+			break;
 
 		p = parse_line(buf);
 		if (!strcmp(p->option, "plugin"))
 		{
-			load_plugin(p->value[0]);
+			load = g_slist_append(load, g_strdup(p->value[0]));
 		}
 	}
+	/* this is such a fucked up hack. the reason we do this is because after
+	 * we load a plugin the gaimrc file gets rewrit. so we have to remember
+	 * which ones to load before loading them. */
+	while (load) {
+		load_plugin(load->data);
+		g_free(load->data);
+		load = g_slist_remove(load, load->data);
+	}
 }
 #endif /* GAIM_PLUGINS */
 
--- a/src/plugins.c	Tue Dec 12 09:09:24 2000 +0000
+++ b/src/plugins.c	Tue Dec 12 11:31:58 2000 +0000
@@ -150,10 +150,10 @@
 	char *(*cfunc)();
 	char *error;
 	char *retval;
-	char *tmp_filename;
 
 	if (!g_module_supported()) return;
 	if (filename == NULL) return;
+	if (strlen(filename) == 0) return;
 
 	while (c) {
 		plug = (struct gaim_plugin *)c->data;
@@ -168,19 +168,13 @@
 			c = g_list_next(c);
 	}
 	plug = g_malloc(sizeof *plug);
-	if (!g_path_is_absolute(filename))
-		tmp_filename = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S,
-			PLUGIN_DIR, filename, NULL);
-	else
-		tmp_filename = g_strdup(filename);
 
 	if (last_dir)
 		g_free(last_dir);
-	last_dir = g_dirname(tmp_filename);
+	last_dir = g_dirname(filename);
 
-	debug_printf("Loading %s\n", tmp_filename);
-	plug->handle = g_module_open(tmp_filename, 0);
-	g_free(tmp_filename);
+	debug_printf("Loading %s\n", filename);
+	plug->handle = g_module_open(filename, 0);
 	if (!plug->handle) {
 		error = (char *)g_module_error();
 		do_error_dialog(error, _("Plugin Error"));