mlocktweaker: Applied mlock is now configurable via chanserv::mlocktweak
This commit is contained in:
parent
1f414ba7b1
commit
f7ae6ad9cc
|
@ -8,12 +8,13 @@
|
||||||
|
|
||||||
#include "atheme-compat.h"
|
#include "atheme-compat.h"
|
||||||
|
|
||||||
/*
|
/* Changed to allow for dynamic configuration, to configure this, set
|
||||||
* Set this to the string of mlock changes you want to make.
|
* chanserv::mlocktweak to the mode string you want set on channels as
|
||||||
* This is in addition to the default mlock, so -nt if you want to
|
* they are registered. Keep in mind that +nt will be applied as well,
|
||||||
* remove those mlocks, etcetera.
|
* so if you do not want +n or +t, negate them in the configuration.
|
||||||
|
* - Quora
|
||||||
*/
|
*/
|
||||||
#define MLOCK_CHANGE "-t+c"
|
char * mlocktweak;
|
||||||
|
|
||||||
DECLARE_MODULE_V1
|
DECLARE_MODULE_V1
|
||||||
(
|
(
|
||||||
|
@ -26,12 +27,14 @@ static void handle_channel_register(hook_channel_req_t *hdata);
|
||||||
|
|
||||||
void _modinit(module_t *m)
|
void _modinit(module_t *m)
|
||||||
{
|
{
|
||||||
|
add_dupstr_conf_item("MLOCKTWEAK", &chansvs.me->conf_table, 0, &mlocktweak, "-t+c");
|
||||||
hook_add_event("channel_register");
|
hook_add_event("channel_register");
|
||||||
hook_add_first_channel_register(handle_channel_register);
|
hook_add_first_channel_register(handle_channel_register);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _moddeinit(module_unload_intent_t intent)
|
void _moddeinit(module_unload_intent_t intent)
|
||||||
{
|
{
|
||||||
|
del_conf_item("MLOCKTWEAK", &chansvs.me->conf_table);
|
||||||
hook_del_channel_register(handle_channel_register);
|
hook_del_channel_register(handle_channel_register);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,13 +42,12 @@ static void handle_channel_register(hook_channel_req_t *hdata)
|
||||||
{
|
{
|
||||||
mychan_t *mc = hdata->mc;
|
mychan_t *mc = hdata->mc;
|
||||||
unsigned int *target;
|
unsigned int *target;
|
||||||
char *it, *str = MLOCK_CHANGE;
|
char *it = mlocktweak;
|
||||||
|
|
||||||
if (mc == NULL)
|
if (mc == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
target = &mc->mlock_on;
|
target = &mc->mlock_on;
|
||||||
it = str;
|
|
||||||
|
|
||||||
while (*it != '\0')
|
while (*it != '\0')
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue