Mercurial > pidgin
diff src/module.c @ 3563:e120097bbd72
[gaim-migrate @ 3658]
I made my perl script unloading not suck (as much). Now you may port your
perl scripts--use gaim.pl and PERL-HOWTO as references.
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Sat, 28 Sep 2002 08:08:14 +0000 |
| parents | cd938f18f3f8 |
| children | 154c4a9d9b6d |
line wrap: on
line diff
--- a/src/module.c Sat Sep 28 03:48:28 2002 +0000 +++ b/src/module.c Sat Sep 28 08:08:14 2002 +0000 @@ -136,7 +136,7 @@ #endif #ifdef USE_PERL if (is_so_file(file, ".pl")) { - path = g_build_filename(LIBDIR, file, NULL); + path = g_build_filename(probedirs[l], file, NULL); plug = probe_perl(path); if (plug) probed_plugins = g_list_append(probed_plugins, plug); @@ -159,7 +159,7 @@ GList *c = plugins; GList *p = probed_plugins; char *(*gaim_plugin_init)(GModule *); - char *error, *retval, *tmp; + char *error, *retval; gboolean newplug = FALSE; if (!g_module_supported()) @@ -167,6 +167,10 @@ if (!filename || !strlen(filename)) return NULL; + if (is_so_file(filename, ".pl")) { + return perl_load_file(filename); + } + while (filename && p) { plug = (struct gaim_plugin *)p->data; if (!strcmp(filename, plug->path)) @@ -190,21 +194,18 @@ if (!plug->handle) { error = (char *)g_module_error(); plug->handle = NULL; - tmp = plug->desc.description; - plug->desc.description = g_strdup_printf("<span weight=\"bold\" foreground=\"red\">%s</span>\n\n%s", error, tmp); - g_free(tmp); + g_snprintf(plug->error, sizeof(plug->error), error); return NULL; } if (!g_module_symbol(plug->handle, "gaim_plugin_init", (gpointer *)&gaim_plugin_init)) { g_module_close(plug->handle); plug->handle = NULL; - tmp = plug->desc.description; - plug->desc.description = g_strdup_printf("<span foreground=\"red\">%s</span>\n\n%s", g_module_error(), tmp); - g_free(tmp); + g_snprintf(plug->error, sizeof(plug->error), error); return NULL; } + plug->error[0] = '\0'; retval = gaim_plugin_init(plug->handle); debug_printf("loaded plugin returned %s\n", retval ? retval : "NULL"); if (retval) { @@ -632,8 +633,10 @@ while (c) { p = (struct gaim_plugin *)c->data; - if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) - gaim_plugin_remove(); + if (p->type == plugin) { + if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) + gaim_plugin_remove(); + } g_free(p); c = c->next; }
