Mercurial > pidgin
comparison src/module.c @ 3572:bdd0bebd2d04
[gaim-migrate @ 3670]
Phase II. No longer do you have to worry about protocol plugins. When
Gaim probes plugins on load, it will detect protocol plugins and add them
to the list of available protocols. When you try to log an account on with
one of them, Gaim will automatically load the plugin--when no more accounts
need the protocol--Gaim will automatically unload it. Protocol plugins are
no longer available in the plugins ui, and no protocols are compiled statically
by default.
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Mon, 30 Sep 2002 01:05:18 +0000 |
| parents | 154c4a9d9b6d |
| children | 9682c0e022c6 |
comparison
equal
deleted
inserted
replaced
| 3571:a88c62c5b7da | 3572:bdd0bebd2d04 |
|---|---|
| 33 #ifdef HAVE_CONFIG_H | 33 #ifdef HAVE_CONFIG_H |
| 34 #include <config.h> | 34 #include <config.h> |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 #include "gaim.h" | 37 #include "gaim.h" |
| 38 #include "prpl.h" | |
| 38 | 39 |
| 39 #include <string.h> | 40 #include <string.h> |
| 40 #include <sys/time.h> | 41 #include <sys/time.h> |
| 41 | 42 |
| 42 #include <sys/types.h> | 43 #include <sys/types.h> |
| 90 char userspace[128]; | 91 char userspace[128]; |
| 91 char *probedirs[] = {LIBDIR, &userspace, 0}; | 92 char *probedirs[] = {LIBDIR, &userspace, 0}; |
| 92 int l; | 93 int l; |
| 93 #if GAIM_PLUGINS | 94 #if GAIM_PLUGINS |
| 94 char *(*gaim_plugin_init)(GModule *); | 95 char *(*gaim_plugin_init)(GModule *); |
| 96 char *(*gaim_prpl_init)(struct prpl *); | |
| 95 char *(*cfunc)(); | 97 char *(*cfunc)(); |
| 98 struct prpl * new_prpl; | |
| 96 struct gaim_plugin_description *(*desc)(); | 99 struct gaim_plugin_description *(*desc)(); |
| 97 GModule *handle; | 100 GModule *handle; |
| 98 #endif | 101 #endif |
| 99 | 102 |
| 100 g_snprintf(userspace, sizeof(userspace), "%s" G_DIR_SEPARATOR_S ".gaim", g_get_home_dir()); | 103 g_snprintf(userspace, sizeof(userspace), "%s" G_DIR_SEPARATOR_S ".gaim", g_get_home_dir()); |
| 109 handle = g_module_open(path, 0); | 112 handle = g_module_open(path, 0); |
| 110 if (!handle) { | 113 if (!handle) { |
| 111 debug_printf("%s is unloadable: %s\n", file, g_module_error()); | 114 debug_printf("%s is unloadable: %s\n", file, g_module_error()); |
| 112 continue; | 115 continue; |
| 113 } | 116 } |
| 117 if (g_module_symbol(handle, "gaim_prpl_init", (gpointer *)&gaim_prpl_init)) { | |
| 118 plug = g_new0(struct gaim_plugin, 1); | |
| 119 g_snprintf(plug->path, sizeof(plug->path), path); | |
| 120 plug->type = plugin; | |
| 121 | |
| 122 new_prpl = g_new0(struct prpl, 1); | |
| 123 new_prpl->plug = plug; | |
| 124 gaim_prpl_init(new_prpl); | |
| 125 if (new_prpl->protocol == PROTO_ICQ || | |
| 126 find_prpl(new_prpl->protocol)) { | |
| 127 /* Nothing to see here--move along, move along */ | |
| 128 unload_protocol(new_prpl); | |
| 129 continue; | |
| 130 } | |
| 131 protocols = g_slist_insert_sorted(protocols, new_prpl, (GCompareFunc)proto_compare); | |
| 132 g_module_close(handle); | |
| 133 continue; | |
| 134 } | |
| 135 | |
| 114 if (!g_module_symbol(handle, "gaim_plugin_init", (gpointer *)&gaim_plugin_init)) { | 136 if (!g_module_symbol(handle, "gaim_plugin_init", (gpointer *)&gaim_plugin_init)) { |
| 115 debug_printf("%s is unloadable %s\n", file, g_module_error()); | 137 debug_printf("%s is unloadable %s\n", file, g_module_error()); |
| 116 g_module_close(handle); | 138 g_module_close(handle); |
| 117 continue; | 139 continue; |
| 118 } | 140 } |
