-
Notifications
You must be signed in to change notification settings - Fork 6
/
log_sasl_fail.c
37 lines (32 loc) · 1.03 KB
/
log_sasl_fail.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "fn-compat.h"
#include "atheme.h"
#ifdef NEED_OLD_COMPAT_INCLUDES
#include "pmodule.h"
#endif
void (*old_encap_handler)(sourceinfo_t *, int, char *[]) = 0;
static void encap_handler(sourceinfo_t *si, int parc, char *parv[])
{
if (!irccasecmp(parv[1], "SASLFAIL"))
{
if (parc < 6) return;
slog(LG_CMD_REQUEST, "SASL login failure by %s from %s(%s)", parv[2], parv[5], parv[6]);
}
if (old_encap_handler)
old_encap_handler(si, parc, parv);
}
static void mod_init(module_t *m)
{
pcommand_t *old_encap = pcommand_find("ENCAP");
if (old_encap) old_encap_handler = old_encap->handler;
pcommand_delete("ENCAP");
pcommand_add("ENCAP", encap_handler, 2, MSRC_USER | MSRC_SERVER);
}
static void mod_deinit(module_unload_intent_t intentvoid)
{
pcommand_delete("ENCAP");
if (old_encap_handler) pcommand_add("ENCAP", old_encap_handler, 2, MSRC_USER | MSRC_SERVER);
}
DECLARE_MODULE_V1 (
"freenode/log_sasl_fail", MODULE_UNLOAD_CAPABILITY_OK, mod_init, mod_deinit,
"", "freenode <http://www.freenode.net>"
);