aboutsummaryrefslogtreecommitdiff
path: root/src/plugin.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-10-16 08:51:24 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-10-16 08:51:24 +0000
commit1d0b765f618f4791d75a1226756d4568ca35be3c (patch)
tree4b6dc11d36b052a8ed529e744c47d2624aeb7372 /src/plugin.c
parent7633da4efcb1ce694f02759838bd10e6366c7846 (diff)
properly check plug-in version.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2285 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 16f9e0ef..087b56d8 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -174,12 +174,10 @@ gint syl_plugin_load(const gchar *name)
if (g_module_symbol(module, "plugin_load", (gpointer *)&load_func)) {
if (!syl_plugin_check_version(module)) {
-#if 0
g_warning("Version check failed. Skipping: %s", name);
g_module_close(module);
g_free(file);
return -1;
-#endif
}
debug_print("calling plugin_load() in %s\n",
@@ -286,6 +284,10 @@ gboolean syl_plugin_check_version(GModule *module)
{
gint (*version_func)(void);
gint ver;
+ gint a_major;
+ gint a_minor;
+ gint p_major;
+ gint p_minor;
g_return_val_if_fail(module != NULL, FALSE);
@@ -300,7 +302,11 @@ gboolean syl_plugin_check_version(GModule *module)
return FALSE;
}
- if (ver == SYL_PLUGIN_INTERFACE_VERSION) {
+ a_major = SYL_PLUGIN_INTERFACE_VERSION & 0xff00;
+ a_minor = SYL_PLUGIN_INTERFACE_VERSION & 0x00ff;
+ p_major = ver & 0xff00;
+ p_minor = ver & 0x00ff;
+ if (a_major == p_major && a_minor >= p_minor) {
debug_print("Version OK: plugin: %d, app: %d\n",
ver, SYL_PLUGIN_INTERFACE_VERSION);
return TRUE;