mirror of
https://github.com/pissnet/pissircd.git
synced 2025-07-30 23:12:25 +01:00
Module API: New function is_module_loaded("name"): return 1 / 0
This commit is contained in:
parent
92afdb56b5
commit
d63bc7e187
2 changed files with 21 additions and 0 deletions
|
@ -800,3 +800,4 @@ extern void send_cap_notify(int add, char *token);
|
|||
extern void sendbufto_one(aClient *to, char *msg, unsigned int quick);
|
||||
extern MODVAR int current_serial;
|
||||
extern char *spki_fingerprint(aClient *acptr);
|
||||
extern int is_module_loaded(char *name);
|
||||
|
|
|
@ -1715,3 +1715,23 @@ const char *our_dlerror(void)
|
|||
return errbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Check if a module is loaded.
|
||||
* @param name Name of the module (eg: 'floodprot')
|
||||
* @returns 1 if module is loaded, 0 if not.
|
||||
* @notes The name is checked against the module name,
|
||||
* this can be a problem if two modules have the same name.
|
||||
*/
|
||||
int is_module_loaded(char *name)
|
||||
{
|
||||
Module *mi;
|
||||
for (mi = Modules; mi; mi = mi->next)
|
||||
{
|
||||
if (mi->flags & MODFLAG_DELAYED)
|
||||
continue; /* unloading (delayed) */
|
||||
|
||||
if (!strcasecmp(mi->header->name, name))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue