changeset 176:c99d0b82c8a8

[gaim-migrate @ 186] Fixed a bug where if you unload a plugin that had 3 callbacks, it would only unload 2 of them. Other touch-ups and additions. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 25 Apr 2000 18:55:56 +0000
parents 4b011ba81a9d
children 87160c1a39fc
files ChangeLog README.plugins plugins/Makefile.am src/aim.c src/plugins.c src/prefs.c
diffstat 6 files changed, 31 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Apr 25 17:38:35 2000 +0000
+++ b/ChangeLog	Tue Apr 25 18:55:56 2000 +0000
@@ -2,6 +2,7 @@
 
 version 0.9.15:
 	* Plugin support enabled by default (oops)
+	* Some plugins built/installed by default
 
 version 0.9.14:
 	* Numerous Fixes by G. Sumner Hayes (buffer over flow patches,
--- a/README.plugins	Tue Apr 25 17:38:35 2000 +0000
+++ b/README.plugins	Tue Apr 25 18:55:56 2000 +0000
@@ -9,10 +9,11 @@
 ./configure script with the --disable-plugins option and recompile your
 source code.  This will stop any plugins from loading.
 
-Currently, they are not compiled when you perform a make and make install.
 If you wish to make use of the gaim plugins, enter the directory where you
 untarred gaim/plugins and type: 'make'.  Copy the resulting .so files to
-a safe location ($HOME/.gaim/plugins) and load them from within gaim.
+a safe location ($HOME/.gaim/plugins) and load them from within gaim. Note
+that plugins do not have to have a .so extension, but that is what is built
+by default, and that is what gaim looks for by default.
 
 Enjoy and Happy Hacking!
 
--- a/plugins/Makefile.am	Tue Apr 25 17:38:35 2000 +0000
+++ b/plugins/Makefile.am	Tue Apr 25 18:55:56 2000 +0000
@@ -1,5 +1,9 @@
 SUFFIXES = .c .so
-CFLAGS += $(GTK_CFLAGS) -I../src $(GAIM_CFLAGS)
+if GNOMEAPPLET
+CFLAGS += $(GTK_CFLAGS) -I../src -DUSE_APPLET
+else
+CFLAGS += $(GTK_CFLAGS) -I../src
+endif
 LDFLAGS += -ggdb $(GTK_LIBS) -shared
 .c.so:
 	$(CC) $(CFLAGS) -Wl,-soname,$@ -o $@ $< $(LDFLAGS)
--- a/src/aim.c	Tue Apr 25 17:38:35 2000 +0000
+++ b/src/aim.c	Tue Apr 25 18:55:56 2000 +0000
@@ -446,7 +446,7 @@
 	}
 }
 
-
+extern show_debug(GtkObject *);
 int main(int argc, char *argv[])
 {
 #ifdef USE_APPLET
@@ -460,6 +460,8 @@
 
         set_defaults();
         load_prefs();
+	if (general_options & OPT_GEN_DEBUG)
+		show_debug(NULL);
 
 #ifdef USE_APPLET
 	applet_widget_register_callback(APPLET_WIDGET(applet),
--- a/src/plugins.c	Tue Apr 25 17:38:35 2000 +0000
+++ b/src/plugins.c	Tue Apr 25 18:55:56 2000 +0000
@@ -147,6 +147,8 @@
 		sprintf(plug->filename, "%s%s", buf, filename);
 	} else
 		plug->filename = g_strdup(filename);
+	sprintf(debug_buff, "Loading %s\n", filename);
+	debug_print(debug_buff);
 	/* do NOT OR with RTLD_GLOBAL, otherwise plugins may conflict
 	 * (it's really just a way to work around other people's bad
 	 * programming, by not using RTLD_GLOBAL :P ) */
@@ -343,22 +345,31 @@
 	if (i == NULL) return;
 
 	p = gtk_object_get_user_data(GTK_OBJECT(i->data));
+	sprintf(debug_buff, "Unloading %s\n", p->filename);
+	debug_print(debug_buff);
 
 	gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove");
 	if ((error = (char *)dlerror()) == NULL)
 		(*gaim_plugin_remove)();
+	sprintf(debug_buff, "%d callbacks to search\n", g_list_length(callbacks));
+	debug_print(debug_buff);
 	while (c) {
 		g = (struct gaim_callback *)c->data;
 		if (g->handle == p->handle) {
 			callbacks = g_list_remove(callbacks, c->data);
 			g_free(g);
+			sprintf(debug_buff, "Removing callback, %d remain\n",
+					g_list_length(callbacks));
+			debug_print(debug_buff);
 			c = callbacks;
-			if (c == NULL) break;
+			if (c == NULL) {
+				break;
+			}
+		} else {
+			c = c->next;
 		}
-		c = c->next;
 	}
-	/* don't ask me why this works */
-	if (callbacks != NULL) dlclose(p->handle);
+	dlclose(p->handle);
 
 	plugins = g_list_remove(plugins, p);
 	g_free(p->filename);
@@ -406,6 +417,8 @@
 	call->data = data;
 
 	callbacks = g_list_append(callbacks, call);
+	sprintf(debug_buff, "Adding callback %d\n", g_list_length(callbacks));
+	debug_print(debug_buff);
 }
 
 void gaim_signal_disconnect(void *handle, enum gaim_event which, void *func) {
--- a/src/prefs.c	Tue Apr 25 17:38:35 2000 +0000
+++ b/src/prefs.c	Tue Apr 25 18:55:56 2000 +0000
@@ -384,6 +384,8 @@
 	gaim_button("Show Lag-O-Meter", &general_options, OPT_GEN_SHOW_LAGMETER, genbox);
         gaim_button("Save some window size/positions", &general_options, OPT_GEN_SAVED_WINDOWS, genbox);
         gaim_button("Ignore new conversations when away", &general_options, OPT_GEN_DISCARD_WHEN_AWAY, genbox);
+	if (!dw && (general_options & OPT_GEN_DEBUG))
+		general_options = general_options ^ OPT_GEN_DEBUG;
         debugbutton = gaim_button("Enable debug mode", &general_options, OPT_GEN_DEBUG, genbox);