]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/autolimit.c
1 /* Automatically generated by refactor.pl.
5 * CMDLEVEL: QCMD_AUTHED
7 * CMDDESC: Shows or changes the autolimit threshold on a channel.
8 * CMDFUNC: csc_doautolimit
9 * CMDPROTO: int csc_doautolimit(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: AUTOLIMIT <channel> [<threshold>]
11 * CMDHELP: The autolimit feature maintains a user limit (+l) on the channel which is
12 * CMDHELP: regularly updated to keep a fixed number of spaces free on the channel for
13 * CMDHELP: people to join. This is useful since it prevents a large number of \"clones\"
14 * CMDHELP: joining at the same time. However, if the number of free spaces is too small
15 * CMDHELP: it's possible that legitimate users won't be able to join. This command allows
16 * CMDHELP: you to adjust the number of free spaces to maintain when autolimit is enabled.
17 * CMDHELP: To actually turn the autolimit feature on or off, see CHANFLAGS. Where:
18 * CMDHELP: channel - the channel to use.
19 * CMDHELP: threshold - specifies the new threshold. If not specified, the current threshold
20 * CMDHELP: is displayed.
21 * CMDHELP: Viewing the current threshold requires operator (+o) access on the named channel.
22 * CMDHELP: Updating the threshold requires master (+m) access on the named channel.
25 #include "../chanserv.h"
26 #include "../../nick/nick.h"
27 #include "../../lib/flags.h"
28 #include "../../lib/irc_string.h"
29 #include "../../channel/channel.h"
30 #include "../../parser/parser.h"
31 #include "../../irc/irc.h"
32 #include "../../localuser/localuserchannel.h"
36 int csc_doautolimit(void *source
, int cargc
, char **cargv
) {
43 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "autolimit");
47 if (!(cip
=cs_checkaccess(sender
, cargv
[0], CA_OPPRIV
,
48 NULL
, "autolimit", QPRIV_VIEWAUTOLIMIT
, 0)))
51 rcp
=cip
->exts
[chanservext
];
54 if (!cs_checkaccess(sender
, NULL
, CA_MASTERPRIV
,
55 cip
, "autolimit", QPRIV_CHANGEAUTOLIMIT
, 0))
58 oldlimit
=rcp
->autolimit
;
59 rcp
->autolimit
=strtol(cargv
[1],NULL
,10);
60 if (rcp
->autolimit
<1) {
61 rcp
->autolimit
=oldlimit
;
62 chanservstdmessage(sender
, QM_INVALIDLIMIT
, cargv
[1]);
66 csdb_updatechannel(rcp
);
68 cs_log(sender
,"AUTOLIMIT %s %s (%d -> %d)",cip
->name
->content
,cargv
[1],oldlimit
,rcp
->autolimit
);
69 chanservstdmessage(sender
, QM_DONE
);
74 chanservstdmessage(sender
, QM_CHANAUTOLIMIT
, cargv
[0], rcp
->autolimit
);