From ff8ccaf08b60d88a67ddf810f8229f910f016cf7 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 24 Nov 2015 00:08:20 +0100 Subject: module check irssi version Add explicit checks into every module to match the ABI version defined in common.h --- src/fe-common/core/fe-modules.c | 4 ++++ src/fe-common/core/module-formats.c | 1 + src/fe-common/core/module-formats.h | 1 + 3 files changed, 6 insertions(+) (limited to 'src/fe-common') diff --git a/src/fe-common/core/fe-modules.c b/src/fe-common/core/fe-modules.c index df97ceb1..27b6b4c1 100644 --- a/src/fe-common/core/fe-modules.c +++ b/src/fe-common/core/fe-modules.c @@ -43,6 +43,10 @@ static void sig_module_error(void *number, const char *data, printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_MODULE_LOAD_ERROR, rootmodule, submodule, data); break; + case MODULE_ERROR_VERSION_MISMATCH: + printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, + TXT_MODULE_VERSION_MISMATCH, rootmodule, submodule, data); + break; case MODULE_ERROR_INVALID: printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_MODULE_INVALID, rootmodule, submodule); diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c index 4ae26950..e6d32b6d 100644 --- a/src/fe-common/core/module-formats.c +++ b/src/fe-common/core/module-formats.c @@ -196,6 +196,7 @@ FORMAT_REC fecommon_core_formats[] = { { "module_already_loaded", "Module {hilight $0/$1} already loaded", 2, { 0, 0 } }, { "module_not_loaded", "Module {hilight $0/$1} is not loaded", 2, { 0, 0 } }, { "module_load_error", "Error loading module {hilight $0/$1}: $2", 3, { 0, 0, 0 } }, + { "module_version_mismatch", "{hilight $0/$1} is ABI version $2 but Irssi is version $abiversion, cannot load", 3, { 0, 0, 0 } }, { "module_invalid", "{hilight $0/$1} isn't Irssi module", 2, { 0, 0 } }, { "module_loaded", "Loaded module {hilight $0/$1}", 2, { 0, 0 } }, { "module_unloaded", "Unloaded module {hilight $0/$1}", 2, { 0, 0 } }, diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h index 18bf91f5..3f06bb97 100644 --- a/src/fe-common/core/module-formats.h +++ b/src/fe-common/core/module-formats.h @@ -166,6 +166,7 @@ enum { TXT_MODULE_ALREADY_LOADED, TXT_MODULE_NOT_LOADED, TXT_MODULE_LOAD_ERROR, + TXT_MODULE_VERSION_MISMATCH, TXT_MODULE_INVALID, TXT_MODULE_LOADED, TXT_MODULE_UNLOADED, -- cgit v1.2.3