Merge branch 'master' of github.com:atheme/atheme-contrib-modules
This commit is contained in:
commit
9efc2d9e6a
|
@ -1,6 +1,6 @@
|
|||
#include "atheme-compat.h"
|
||||
|
||||
#ifdef __Linux__
|
||||
#if defined( __linux__) || defined(__Linux__)
|
||||
#include <execinfo.h>
|
||||
|
||||
DECLARE_MODULE_V1
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
|
||||
#include "atheme-compat.h"
|
||||
|
||||
/*
|
||||
* Set this to the string of mlock changes you want to make.
|
||||
* This is in addition to the default mlock, so -nt if you want to
|
||||
* remove those mlocks, etcetera.
|
||||
/* Changed to allow for dynamic configuration, to configure this, set
|
||||
* chanserv::mlocktweak to the mode string you want set on channels as
|
||||
* they are registered. Keep in mind that +nt will be applied as well,
|
||||
* 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
|
||||
(
|
||||
|
@ -26,12 +27,14 @@ static void handle_channel_register(hook_channel_req_t *hdata);
|
|||
|
||||
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_first_channel_register(handle_channel_register);
|
||||
}
|
||||
|
||||
void _moddeinit(module_unload_intent_t intent)
|
||||
{
|
||||
del_conf_item("MLOCKTWEAK", &chansvs.me->conf_table);
|
||||
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;
|
||||
unsigned int *target;
|
||||
char *it, *str = MLOCK_CHANGE;
|
||||
char *it = mlocktweak;
|
||||
|
||||
if (mc == NULL)
|
||||
return;
|
||||
|
||||
target = &mc->mlock_on;
|
||||
it = str;
|
||||
|
||||
while (*it != '\0')
|
||||
{
|
||||
|
|
|
@ -49,6 +49,7 @@ static void klinechan_check_join(hook_channel_joinpart_t *hdata)
|
|||
chanuser_t *cu = hdata->cu;
|
||||
service_t *svs;
|
||||
char reason[256];
|
||||
const char *khost;
|
||||
|
||||
svs = service_find("operserv");
|
||||
if (svs == NULL)
|
||||
|
@ -62,6 +63,7 @@ static void klinechan_check_join(hook_channel_joinpart_t *hdata)
|
|||
|
||||
if (metadata_find(mc, "private:klinechan:closer"))
|
||||
{
|
||||
khost = cu->user->ip ? cu->user->ip : cu->user->host;
|
||||
if (has_priv_user(cu->user, PRIV_JOIN_STAFFONLY))
|
||||
notice(svs->me->nick, cu->user->nick,
|
||||
"Warning: %s klines normal users",
|
||||
|
@ -70,7 +72,7 @@ static void klinechan_check_join(hook_channel_joinpart_t *hdata)
|
|||
{
|
||||
char buf[BUFSIZE];
|
||||
snprintf(buf, sizeof(buf), "Not klining *@%s due to klinechan %s (user %s!%s@%s is exempt)",
|
||||
cu->user->host, cu->chan->name,
|
||||
khost, cu->chan->name,
|
||||
cu->user->nick, cu->user->user, cu->user->host);
|
||||
wallops_sts(buf);
|
||||
}
|
||||
|
@ -79,10 +81,10 @@ static void klinechan_check_join(hook_channel_joinpart_t *hdata)
|
|||
snprintf(reason, sizeof reason, "Joining %s",
|
||||
cu->chan->name);
|
||||
slog(LG_INFO, "klinechan_check_join(): klining \2*@%s\2 (user \2%s!%s@%s\2 joined \2%s\2)",
|
||||
cu->user->host, cu->user->nick,
|
||||
khost, cu->user->nick,
|
||||
cu->user->user, cu->user->host,
|
||||
cu->chan->name);
|
||||
kline_sts("*", "*", cu->user->host, 86400, reason);
|
||||
kline_sts("*", "*", khost, 86400, reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue