#include "glines.h"
#include "../trusts/trusts.h"
+#define BLOCK_CHASE_MIN 5 /* seconds to chase nicknames in block without -c */
+#define BLOCK_CHASE_MAX 1800 /* seconds to chase nicknames in block with -c */
+
MODULE_VERSION("");
static void registercommands(int, void *);
target = getnickbynick(cargv[coff]);
if (!target) {
- ww = whowas_chase(cargv[coff], 1800);
+ ww = whowas_chase(cargv[coff], chase ? BLOCK_CHASE_MAX : BLOCK_CHASE_MIN);
if (!ww) {
- controlreply(sender, "Sorry, couldn't find that user.");
+ controlreply(sender, "Sorry, couldn't find that user.%s", chase ? "" : " Use -c to chase whowas entries.");
return CMD_ERROR;
}
ownww = 1;
}
+ wnp = &ww->nick;
+
+ if (sender != target && (IsService(wnp) || IsOper(wnp) || NickOnServiceServer(wnp))) {
+ controlreply(sender, "Target user '%s' is an oper or a service. Not setting G-Lines.", wnp->nick);
+ return CMD_ERROR;
+ }
+
rejoinline(cargv[coff + 2], cargc - coff - 2);
reason = cargv[coff + 2];
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "BLOCK", cargc + coff - 1, cargv);
glinebufcounthits(&gbuf, &hits, NULL);
id = glinebufcommit(&gbuf, 1);
- wnp = &ww->nick;
controlwall(NO_OPER, NL_GLINES, "%s BLOCK'ed user '%s!%s@%s' for %s with reason '%s' (%d hits)", controlid(sender),
wnp->nick, wnp->ident, wnp->host->name->content,
longtoduration(duration, 0), reason, hits);
}
#endif /* SNIRCD_VERSION */
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "GLINE", cargc + coff - 1, cargv);
return CMD_ERROR;
}
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "SMARTGLINE", cargc + coff - 1, cargv);
(((nick **)victims.content)[slot]) = np;
}
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "CLEARCHAN", cargc + coff - 1, cargv);
rejoinline(cargv[coff + 3], cargc - coff - 3);
reason = cargv[coff + 3];
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "TRUSTGLINE", cargc + coff - 1, cargv);
gline *searchgl = makegline(mask);
+ if (!searchgl) {
+ controlreply(sender, "Invalid G-line mask specified.");
+ return CMD_ERROR;
+ }
+
for (gl = glinelist; gl; gl = next) {
next = gl->next;