Add ircd serials to AV2.
This commit is contained in:
parent
4ea068e826
commit
81204be809
2 changed files with 28 additions and 3 deletions
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#ifndef INCLUDED_modules_h
|
#ifndef INCLUDED_modules_h
|
||||||
#define INCLUDED_modules_h
|
#define INCLUDED_modules_h
|
||||||
|
#include "serno.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
@ -107,13 +108,14 @@ struct mapi_mheader_av2
|
||||||
mapi_cap_list_av2 *mapi_cap_list; /* List of CAPs to add */
|
mapi_cap_list_av2 *mapi_cap_list; /* List of CAPs to add */
|
||||||
const char *mapi_module_version; /* Module's version (freeform), replaced with ircd version if NULL */
|
const char *mapi_module_version; /* Module's version (freeform), replaced with ircd version if NULL */
|
||||||
const char *mapi_module_description; /* Module's description (freeform) */
|
const char *mapi_module_description; /* Module's description (freeform) */
|
||||||
|
unsigned long int mapi_datecode; /* Unix timestamp of module's build */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DECLARE_MODULE_AV1(name, reg, unreg, cl, hl, hfnlist, v) \
|
#define DECLARE_MODULE_AV1(name, reg, unreg, cl, hl, hfnlist, v) \
|
||||||
struct mapi_mheader_av1 _mheader = { MAPI_V1, reg, unreg, cl, hl, hfnlist, v}
|
struct mapi_mheader_av1 _mheader = { MAPI_V1, reg, unreg, cl, hl, hfnlist, v}
|
||||||
|
|
||||||
#define DECLARE_MODULE_AV2(name, reg, unreg, cl, hl, hfnlist, caplist, v, desc) \
|
#define DECLARE_MODULE_AV2(name, reg, unreg, cl, hl, hfnlist, caplist, v, desc) \
|
||||||
struct mapi_mheader_av2 _mheader = { MAPI_V2, reg, unreg, cl, hl, hfnlist, caplist, v, desc}
|
struct mapi_mheader_av2 _mheader = { MAPI_V2, reg, unreg, cl, hl, hfnlist, caplist, v, desc, DATECODE}
|
||||||
|
|
||||||
/* add a path */
|
/* add a path */
|
||||||
void mod_add_path(const char *path);
|
void mod_add_path(const char *path);
|
||||||
|
|
|
@ -58,6 +58,8 @@ static const char *core_module_table[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MOD_WARN_DELTA (90 * 86400) /* time in seconds, 86400 seconds in a day */
|
||||||
|
|
||||||
#define MODS_INCREMENT 10
|
#define MODS_INCREMENT 10
|
||||||
int num_mods = 0;
|
int num_mods = 0;
|
||||||
int max_mods = MODS_INCREMENT;
|
int max_mods = MODS_INCREMENT;
|
||||||
|
@ -796,7 +798,6 @@ unload_one_module(const char *name, int warn)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* load_a_module()
|
* load_a_module()
|
||||||
*
|
*
|
||||||
|
@ -897,7 +898,7 @@ load_a_module(const char *path, int warn, int origin, int core)
|
||||||
if(mheader->mapi_register && (mheader->mapi_register() == -1))
|
if(mheader->mapi_register && (mheader->mapi_register() == -1))
|
||||||
{
|
{
|
||||||
ilog(L_MAIN, "Module %s indicated failure during load.",
|
ilog(L_MAIN, "Module %s indicated failure during load.",
|
||||||
mod_basename);
|
mod_basename);
|
||||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||||
"Module %s indicated failure during load.",
|
"Module %s indicated failure during load.",
|
||||||
mod_basename);
|
mod_basename);
|
||||||
|
@ -905,6 +906,28 @@ load_a_module(const char *path, int warn, int origin, int core)
|
||||||
rb_free(mod_basename);
|
rb_free(mod_basename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Basic date code checks
|
||||||
|
*
|
||||||
|
* Don't make them fatal, but do complain about differences within a certain time frame.
|
||||||
|
* Later on if there are major API changes we can add fatal checks.
|
||||||
|
* -- Elizafox
|
||||||
|
*/
|
||||||
|
if(mheader->mapi_datecode != datecode && mheader->mapi_datecode > 0)
|
||||||
|
{
|
||||||
|
long int delta = labs(datecode - mheader->mapi_datecode);
|
||||||
|
if (delta > MOD_WARN_DELTA)
|
||||||
|
{
|
||||||
|
delta /= 86400;
|
||||||
|
iwarn(L_MAIN,
|
||||||
|
"Module %s build date is out of sync with ircd build date by %ld days, expect problems",
|
||||||
|
mod_basename, delta);
|
||||||
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||||
|
"Module %s build date is out of sync with ircd build date by %ld days, expect problems",
|
||||||
|
mod_basename, delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(mheader->mapi_command_list)
|
if(mheader->mapi_command_list)
|
||||||
{
|
{
|
||||||
struct Message **m;
|
struct Message **m;
|
||||||
|
|
Loading…
Reference in a new issue