Mercurial > pidgin
comparison src/plugin.c @ 9943:f8e395a054e2
[gaim-migrate @ 10835]
this all seemed to work last night...hopefully no stray cosmic rays did anything to break it since then
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 03 Sep 2004 21:21:25 +0000 |
parents | f568b6655331 |
children | 9fdbfe832fac |
comparison
equal
deleted
inserted
replaced
9942:3941c39ccff5 | 9943:f8e395a054e2 |
---|---|
26 #include "notify.h" | 26 #include "notify.h" |
27 #include "prefs.h" | 27 #include "prefs.h" |
28 #include "prpl.h" | 28 #include "prpl.h" |
29 #include "request.h" | 29 #include "request.h" |
30 #include "signals.h" | 30 #include "signals.h" |
31 #include "version.h" | |
31 | 32 |
32 #ifdef _WIN32 | 33 #ifdef _WIN32 |
33 # define PLUGIN_EXT ".dll" | 34 # define PLUGIN_EXT ".dll" |
34 #else | 35 #else |
35 #ifdef __hpux | 36 #ifdef __hpux |
237 gaim_plugin_destroy(plugin); | 238 gaim_plugin_destroy(plugin); |
238 | 239 |
239 return NULL; | 240 return NULL; |
240 } | 241 } |
241 | 242 |
242 if (plugin->info->api_version != GAIM_PLUGIN_API_VERSION) | 243 if (plugin->info->magic != GAIM_PLUGIN_MAGIC || |
243 { | 244 plugin->info->major_version != GAIM_MAJOR_VERSION || |
244 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable: API version mismatch %d (need %d)\n", | 245 plugin->info->minor_version > GAIM_MINOR_VERSION) |
245 plugin->path, plugin->info->api_version, GAIM_PLUGIN_API_VERSION); | 246 { |
247 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable: API version mismatch %d.%d.x (need %d.%d.x)\n", | |
248 plugin->path, plugin->info->major_version, plugin->info->minor_version, GAIM_MAJOR_VERSION, GAIM_MINOR_VERSION); | |
246 gaim_plugin_destroy(plugin); | 249 gaim_plugin_destroy(plugin); |
247 return NULL; | 250 return NULL; |
248 } | 251 } |
249 | 252 |
250 return plugin; | 253 return plugin; |
477 plugins = g_list_remove(plugins, plugin); | 480 plugins = g_list_remove(plugins, plugin); |
478 | 481 |
479 if (load_queue != NULL) | 482 if (load_queue != NULL) |
480 load_queue = g_list_remove(load_queue, plugin); | 483 load_queue = g_list_remove(load_queue, plugin); |
481 | 484 |
485 /* true, this may leak a little memory if there is a major version | |
486 * mismatch, but it's a lot better than trying to free something | |
487 * we shouldn't, and crashing while trying to load an old plugin */ | |
488 if(plugin->info == NULL || plugin->info->magic != GAIM_PLUGIN_MAGIC || | |
489 plugin->info->major_version != GAIM_MAJOR_VERSION) { | |
490 if(plugin->handle) | |
491 g_module_close(plugin->handle); | |
492 g_free(plugin); | |
493 return; | |
494 } | |
495 | |
482 if (plugin->info != NULL && plugin->info->dependencies != NULL) | 496 if (plugin->info != NULL && plugin->info->dependencies != NULL) |
483 g_list_free(plugin->info->dependencies); | 497 g_list_free(plugin->info->dependencies); |
484 | 498 |
485 if (plugin->native_plugin) | 499 if (plugin->native_plugin) |
486 { | 500 { |
490 GList *exts, *l, *next_l; | 504 GList *exts, *l, *next_l; |
491 GaimPlugin *p2; | 505 GaimPlugin *p2; |
492 | 506 |
493 loader_info = GAIM_PLUGIN_LOADER_INFO(plugin); | 507 loader_info = GAIM_PLUGIN_LOADER_INFO(plugin); |
494 | 508 |
495 if (loader_info != NULL && plugin->info->api_version >= 3 && | 509 if (loader_info != NULL && loader_info->exts != NULL) |
496 loader_info->exts != NULL) | |
497 { | 510 { |
498 for (exts = GAIM_PLUGIN_LOADER_INFO(plugin)->exts; | 511 for (exts = GAIM_PLUGIN_LOADER_INFO(plugin)->exts; |
499 exts != NULL; | 512 exts != NULL; |
500 exts = exts->next) { | 513 exts = exts->next) { |
501 | 514 |
969 { | 982 { |
970 GaimPluginLoaderInfo *loader_info; | 983 GaimPluginLoaderInfo *loader_info; |
971 | 984 |
972 loader_info = GAIM_PLUGIN_LOADER_INFO(plugin); | 985 loader_info = GAIM_PLUGIN_LOADER_INFO(plugin); |
973 | 986 |
974 if (loader_info == NULL || | 987 if (loader_info == NULL) |
975 loader_info->api_version != GAIM_LOADER_API_VERSION) | |
976 { | 988 { |
977 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable: API version mismatch %d (need %d)\n", | 989 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable\n", |
978 plugin->path, loader_info->api_version, GAIM_LOADER_API_VERSION); | 990 plugin->path); |
979 return FALSE; | 991 return FALSE; |
980 } | 992 } |
981 | 993 |
982 load_queue = g_list_append(load_queue, plugin); | 994 load_queue = g_list_append(load_queue, plugin); |
983 } | 995 } |
985 { | 997 { |
986 GaimPluginProtocolInfo *prpl_info; | 998 GaimPluginProtocolInfo *prpl_info; |
987 | 999 |
988 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); | 1000 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
989 | 1001 |
990 if (prpl_info == NULL || | 1002 if (prpl_info == NULL) |
991 prpl_info->api_version != GAIM_PRPL_API_VERSION) | |
992 { | 1003 { |
993 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable: API version mismatch %d (need %d)\n", | 1004 gaim_debug(GAIM_DEBUG_ERROR, "plugins", "%s is unloadable\n", |
994 plugin->path, prpl_info->api_version, GAIM_PRPL_API_VERSION); | 1005 plugin->path); |
995 return FALSE; | 1006 return FALSE; |
996 } | 1007 } |
997 | 1008 |
998 load_queue = g_list_append(load_queue, plugin); | 1009 load_queue = g_list_append(load_queue, plugin); |
999 } | 1010 } |