| 1 |
/* |
| 2 |
* Copyright (c) 2005 Atheme Development Group |
| 3 |
* Rights to this code are documented in doc/LICENSE. |
| 4 |
* |
| 5 |
* This file contains routines to handle the GroupServ HELP command. |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "atheme.h" |
| 10 |
#include "groupserv.h" |
| 11 |
|
| 12 |
DECLARE_MODULE_V1 |
| 13 |
( |
| 14 |
"groupserv/acsnolimit", false, _modinit, _moddeinit, |
| 15 |
PACKAGE_STRING, |
| 16 |
VENDOR_STRING |
| 17 |
); |
| 18 |
|
| 19 |
static void gs_cmd_acsnolimit(sourceinfo_t *si, int parc, char *parv[]); |
| 20 |
|
| 21 |
command_t gs_acsnolimit = { "ACSNOLIMIT", N_("Allow a group to bypass access list limits."), PRIV_GROUP_ADMIN, 2, gs_cmd_acsnolimit, { .path = "groupserv/acsnolimit" } }; |
| 22 |
|
| 23 |
static void gs_cmd_acsnolimit(sourceinfo_t *si, int parc, char *parv[]) |
| 24 |
{ |
| 25 |
mygroup_t *mg; |
| 26 |
|
| 27 |
if (!parv[0] || !parv[1]) |
| 28 |
{ |
| 29 |
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "ACSNOLIMIT"); |
| 30 |
command_fail(si, fault_needmoreparams, _("Syntax: ACSNOLIMIT <!group> <ON|OFF>")); |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
if ((mg = mygroup_find(parv[0])) == NULL) |
| 35 |
{ |
| 36 |
command_fail(si, fault_nosuch_target, _("The group \2%s\2 does not exist."), parv[0]); |
| 37 |
return; |
| 38 |
} |
| 39 |
|
| 40 |
if (!strcasecmp(parv[1], "ON")) |
| 41 |
{ |
| 42 |
if (mg->flags & MG_ACSNOLIMIT) |
| 43 |
{ |
| 44 |
command_fail(si, fault_nochange, _("\2%s\2 can already bypass access list limits."), entity(mg)->name); |
| 45 |
return; |
| 46 |
} |
| 47 |
|
| 48 |
mg->flags |= MG_ACSNOLIMIT; |
| 49 |
|
| 50 |
wallops("%s set the ACSNOLIMIT option on the group \2%s\2.", get_oper_name(si), entity(mg)->name); |
| 51 |
logcommand(si, CMDLOG_ADMIN, "ACSNOLIMIT:ON: \2%s\2", entity(mg)->name); |
| 52 |
command_success_nodata(si, _("\2%s\2 can now bypass access list limits."), entity(mg)->name); |
| 53 |
} |
| 54 |
else if (!strcasecmp(parv[1], "OFF")) |
| 55 |
{ |
| 56 |
if (!(mg->flags & MG_ACSNOLIMIT)) |
| 57 |
{ |
| 58 |
command_fail(si, fault_nochange, _("\2%s\2 cannot bypass access list limits."), entity(mg)->name); |
| 59 |
return; |
| 60 |
} |
| 61 |
|
| 62 |
mg->flags &= ~MG_ACSNOLIMIT; |
| 63 |
|
| 64 |
wallops("%s removed the ACSNOLIMIT option from the group \2%s\2.", get_oper_name(si), entity(mg)->name); |
| 65 |
logcommand(si, CMDLOG_ADMIN, "ACSNOLIMIT:OFF: \2%s\2", entity(mg)->name); |
| 66 |
command_success_nodata(si, _("\2%s\2 cannot bypass access list limits anymore."), entity(mg)->name); |
| 67 |
} |
| 68 |
else |
| 69 |
{ |
| 70 |
command_fail(si, fault_badparams, STR_INVALID_PARAMS, "ACSNOLIMIT"); |
| 71 |
command_fail(si, fault_badparams, _("Syntax: ACSNOLIMIT <!group> <ON|OFF>")); |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
void _modinit(module_t *m) |
| 76 |
{ |
| 77 |
use_groupserv_main_symbols(m); |
| 78 |
|
| 79 |
service_named_bind_command("groupserv", &gs_acsnolimit); |
| 80 |
} |
| 81 |
|
| 82 |
void _moddeinit(module_unload_intent_t intent) |
| 83 |
{ |
| 84 |
service_named_unbind_command("groupserv", &gs_acsnolimit); |
| 85 |
} |
| 86 |
|