diff src/module.c @ 2494:2c1950c5544a

[gaim-migrate @ 2507] don't ask committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 12 Oct 2001 22:31:12 +0000
parents 7f36b34f8676
children a83b4a5ffcd6
line wrap: on
line diff
--- a/src/module.c	Fri Oct 12 21:12:56 2001 +0000
+++ b/src/module.c	Fri Oct 12 22:31:12 2001 +0000
@@ -174,6 +174,29 @@
 
 void gaim_plugin_unload(GModule *handle)
 {
+	GList *pl = plugins;
+	struct gaim_plugin *p;
+	void (*gaim_plugin_remove)();
+
+	while (pl) {
+		p = pl->data;
+		if (p->handle == handle)
+			break;
+		pl = pl->next;
+	}
+	if (!pl)
+		return;
+
+	debug_printf("Unloading %s\n", g_module_name(p->handle));
+
+	if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove))
+		(*gaim_plugin_remove)();
+	plugin_remove_callbacks(p->handle);
+	plugins = g_list_remove(plugins, p);
+	g_free(p);
+	/* XXX CUI need to tell UI what happened, but not like this */
+	update_show_plugins();
+
 	g_timeout_add(5000, unload_timeout, handle);
 }