* CMDDESC: Adds a new channel to the bot.
* CMDFUNC: csc_doaddchan
* CMDPROTO: int csc_doaddchan(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: addchan <channel> [<owner> [<flags> [<type>]]]
+ * CMDHELP: Adds the given channel to the bot, where:
+ * CMDHELP: owner - can be either nickname on the network or #authname. If not supplied,
+ * CMDHELP: the channel will belong to the user issuing the ADDCHAN command.
+ * CMDHELP: flags - can be any valid chanflags (see CHANFLAGS). If not specified this
+ * CMDHELP: defaults to +j.
+ * CMDHELP: type - is a channel type as per old Q and is now obsolete.
*/
#include "../chanserv.h"
flags=0;
setflags(&flags, QCFLAG_ALL, cargv[2], rcflags, REJECT_NONE);
} else {
- flags = (QCFLAG_JOINED | QCFLAG_BITCH | QCFLAG_PROTECT | QCFLAG_ENFORCE);
+ flags = (QCFLAG_JOINED);
}
/* Pick up the chantype */
rcp->banstyle=0;
rcp->created=rcp->lastactive=rcp->statsreset=rcp->ostatsreset=time(NULL);
- rcp->banduration=1800;
+ rcp->banduration=0;
rcp->autoupdate=0;
rcp->lastbancheck=0;
* CMDDESC: Adds one or more users to a channel as +aot.
* CMDFUNC: csc_doadduser
* CMDPROTO: int csc_doadduser(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: ADDUSER <channel> <user1> [<user2> [<user3> [...]]]
+ * CMDHELP: Adds the named user(s) to the channel with +aot chanlev flags (see CHANLEV).
+ * CMDHELP: Where:
+ * CMDHELP: channel - the channel to use
+ * CMDHELP: user<n> - either a user's current nickname on the network or #accountname. Up to
+ * CMDHELP: 18 users can be specified.
+ * CMDHELP: ADDUSER requires master (+m) access on the named channel.
*/
#include "../chanserv.h"
* CMDDESC: Shows or changes the autolimit threshold on a channel.
* CMDFUNC: csc_doautolimit
* CMDPROTO: int csc_doautolimit(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: AUTOLIMIT <channel> [<threshold>]
+ * CMDHELP: This command shows or changes the number of free slots to keep on the channel
+ * CMDHELP: when autolimit (see CHANFLAGS) is enabled. Where:
+ * CMDHELP: channel - the channel to use.
+ * CMDHELP: threshold - specifies the new threshold. If not specified, the current threshold
+ * CMDHELP: is displayed.
+ * CMDHELP: Viewing the current threshold requires operator (+o) access on the named channel.
+ * CMDHELP: Updating the threshold requires master (+m) access on the named channel.
*/
#include "../chanserv.h"
* CMDDESC: Removes all bans from a channel including persistent bans.
* CMDFUNC: csc_dobanclear
* CMDPROTO: int csc_dobanclear(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: BANCLEAR <channel>
+ * CMDHELP: Removes all temporary and persistent bans from a channel, where:
+ * CMDHELP: channel - the channel to use
+ * CMDHELP: BANCLEAR requires master (+m) access on the named channel.
*/
#include "../chanserv.h"
* CMDDESC: Removes a single ban from a channel.
* CMDFUNC: csc_dobandel
* CMDPROTO: int csc_dobandel(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: BANDEL <channel> <ban>
+ * CMDHELP: Removes the specified persistent or channel ban, where:
+ * CMDHELP: channel - the channel to use
+ * CMDHELP: ban - either a ban mask (nick!user@host), or #number (see BANLIST)
+ * CMDHELP: Removing channel bans requires operator (+o) access on the named channel.
+ * CMDHELP: Removing persistent bans requires master (+m) access on the named channel.
*/
#include "../chanserv.h"
* CMDDESC: Displays all persistent bans on a channel.
* CMDFUNC: csc_dobanlist
* CMDPROTO: int csc_dobanlist(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: BANLIST <channel>
+ * CMDHELP: Displays a list of persistent and channel bans on the named channel. Each ban
+ * CMDHELP: is identified by a number which can be passed to a subsequent BANDEL command.
+ * CMDHELP: Note that the numbers can change if bans are added to or removed from the
+ * CMDHELP: chennel. Where:
+ * CMDHELP: channel - the channel to use
+ * CMDHELP: BANLIST requires operator (+o) access on the named channel.
*/
#include "../chanserv.h"
rup?rup->username:"<unknown>",
rbp->reason?rbp->reason->content:"");
}
- for (cbp=cip->channel->bans;cbp;cbp=cbp->next) {
- for (rbp=rcp->bans;rbp;rbp=rbp->next) {
- if (banequal(rbp->cbp, cbp))
- break;
- }
- if (!rbp) {
- if (rcp->banduration) {
- exp=(cbp->timeset + rcp->banduration) - time(NULL);
- } else {
- exp=0;
- }
- chanservsendmessage(sender, " #%-2d %-29s %-18s %-15s",++i,bantostring(cbp),
- exp ? longtoduration(exp,0) : "Permanent",
- "(channel ban)");
+ if (cip->channel) {
+ for (cbp=cip->channel->bans;cbp;cbp=cbp->next) {
+ for (rbp=rcp->bans;rbp;rbp=rbp->next) {
+ if (banequal(rbp->cbp, cbp))
+ break;
+ }
+ if (!rbp) {
+ if (rcp->banduration) {
+ exp=(cbp->timeset + rcp->banduration) - time(NULL);
+ } else {
+ exp=0;
+ }
+ chanservsendmessage(sender, " #%-2d %-29s %-18s %-15s",++i,bantostring(cbp),
+ exp ? longtoduration(exp,0) : "Permanent",
+ "(channel ban)");
+ }
}
}
chanservstdmessage(sender, QM_ENDOFLIST);
* CMDDESC: Shows or changes the time after which bans are removed.
* CMDFUNC: csc_dobantimer
* CMDPROTO: int csc_dobantimer(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: BANTIMER <channel> [<duration>]
+ * CMDHELP: To help keep channels clear of the clutter of too many bans, Q can automatically
+ * CMDHELP: remove channel bans after a specified time. This command is used to alter that
+ * CMDHELP: time period, disable the feature, or show the current setting, where:
+ * CMDHELP: channel - the channel to use
+ * CMDHELP: duration - how long to remove channel bans after. If duration is 0 then channel
+ * CMDHELP: bans will not be automatically removed. If duration is not specified,
+ * CMDHELP: the current setting will be displayed.
+ * CMDHELP: Viewing the current setting requires operator (+o) access on the named channel.
+ * CMDHELP: Changing the setting requires master (+m) access on the named channel.
*/
#include "../chanserv.h"
* CMDDESC: Shows or modifies user access on a channel.
* CMDFUNC: csc_dochanlev
* CMDPROTO: int csc_dochanlev(void *source, int cargc, char **cargv);
- * CMDHELP: Usage: chanlev <#channel> [<user> [<flag change>]]
- * CMDHELP: where <user> is either nickname on the network or #accountname.
- * CMDHELP: If only a channel name is supplied, list registered users on the channel.
- * CMDHELP: If a user is also specified, shows that user's access on the channel.
- * CMDHELP: If a change string is specified, the flags for that user are changed, provided
- * CMDHELP: you have sufficient access on the channel to do so. This can be used to add or
- * CMDHELP: remove users from the channel.
+ * CMDHELP: Usage: CHANLEV <channel> [<user> [<change>]]
+ * CMDHELP: Displays or alters the access of known users on a channel, where:
+ * CMDHELP: channel - the channel to use
+ * CMDHELP: user - the user to list or modify. user can be specified as either an active
+ * CMDHELP: nickname on the network or #accountname. If user is not specified then
+ * CMDHELP: all known users are listed.
+ * CMDHELP: change - lists the flags to add or remove, with + to add or - to remove. For
+ * CMDHELP: example, +ao to add a and o flags, or -gv to remove g and v flags. This
+ * CMDHELP: can be used to add or remove users from the channel. If change is not
+ * CMDHELP: specified then the current access of the named user is displayed.
+ * CMDHELP: Displaying known user information requires you to be known (+k) on the named channel.
+ * CMDHELP: Adjusting flags for other users requires master (+m) access on the named channel.
+ * CMDHELP: Adding or removing the +m flag for other users requires owner (+n) access on the
+ * CMDHELP: named channel.
+ * CMDHELP: You may always remove your own flags, except +qdb flags (which are not visible to you).
+ * CMDHELP: Adding or removing personal flags requires you to be known (+k) on the named channel.
+ * CMDHELP: Note that channel owners (+n) can grant +n to channel masters but they must use
+ * CMDHELP: the GIVEOWNER command for this.
* CMDHELP: Valid flags are:
* CMDHELP: Access level flags - these control your overall privilege level on the channel:
* CMDHELP: +n OWNER Can add or remove masters and all other flags (except personal flags)
* CMDHELP: that status, they will be reopped/voiced if deopped/voiced
* CMDHELP: +t TOPIC Can use SETTOPIC to alter the topic on the channel
* CMDHELP: Personal flags - these control user personal preferences and can only be changed
- * CMDHELP: by the user concerned. You need to be known on the channel (hold +k,
- * CMDHELP: +v, +o, +m or +n) in order to set personal flags.
+ * CMDHELP: by the user concerned. They are not visible to other users.
* CMDHELP: +w NOWELCOME Prevents the welcome message being sent when you join the channel.
* CMDHELP: +j AUTOINV Invites you to the channel automatically when you authenticate.
- * CMDHELP: Note that channel owners (+n) can grant +n to channel masters but they must use
- * CMDHELP: the the GIVEOWNER command for this.
- * CMDHELP: Non-sensible combinations of flags are not allowed.
+ * CMDHELP: Note that non-sensible combinations of flags are not allowed. After making a
+ * CMDHELP: change the current status of the named user on the channel will be confirmed.
*/
#include "../chanserv.h"
QCUFLAG_AUTOOP | QCUFLAG_TOPIC | QCUFLAG_PROTECT | QCUFLAG_KNOWN);
/* masters and above can see everything except personal flags */
- if (CUHasMasterPriv(rcup)) {
+ if (rcup && CUHasMasterPriv(rcup)) {
flagmask = QCUFLAG_ALL & ~QCUFLAGS_PERSONAL;
showtimes=1;
}
int csc_dowelcome(void *source, int cargc, char **cargv);
void _init() {
- chanservaddcommand("addchan", QCMD_OPER, 4, csc_doaddchan, "Adds a new channel to the bot.", "");
- chanservaddcommand("adduser", QCMD_AUTHED, 20, csc_doadduser, "Adds one or more users to a channel as +aot.", "");
- chanservaddcommand("autolimit", QCMD_AUTHED, 2, csc_doautolimit, "Shows or changes the autolimit threshold on a channel.", "");
- chanservaddcommand("banclear", QCMD_AUTHED, 1, csc_dobanclear, "Removes all bans from a channel including persistent bans.", "");
- chanservaddcommand("bandel", QCMD_AUTHED, 2, csc_dobandel, "Removes a single ban from a channel.", "");
- chanservaddcommand("banlist", QCMD_AUTHED, 1, csc_dobanlist, "Displays all persistent bans on a channel.", "");
- chanservaddcommand("bantimer", QCMD_AUTHED, 2, csc_dobantimer, "Shows or changes the time after which bans are removed.", "");
+ chanservaddcommand("addchan", QCMD_OPER, 4, csc_doaddchan, "Adds a new channel to the bot.", "Usage: addchan <channel> [<owner> [<flags> [<type>]]]\nAdds the given channel to the bot, where:\nowner - can be either nickname on the network or #authname. If not supplied,\n the channel will belong to the user issuing the ADDCHAN command.\nflags - can be any valid chanflags (see CHANFLAGS). If not specified this \n defaults to +j.\ntype - is a channel type as per old Q and is now obsolete.\n");
+ chanservaddcommand("adduser", QCMD_AUTHED, 20, csc_doadduser, "Adds one or more users to a channel as +aot.", "Usage: ADDUSER <channel> <user1> [<user2> [<user3> [...]]]\nAdds the named user(s) to the channel with +aot chanlev flags (see CHANLEV). \nWhere:\nchannel - the channel to use\nuser<n> - either a user's current nickname on the network or #accountname. Up to\n 18 users can be specified.\nADDUSER requires master (+m) access on the named channel.\n");
+ chanservaddcommand("autolimit", QCMD_AUTHED, 2, csc_doautolimit, "Shows or changes the autolimit threshold on a channel.", "Usage: AUTOLIMIT <channel> [<threshold>]\nThis command shows or changes the number of free slots to keep on the channel\nwhen autolimit (see CHANFLAGS) is enabled. Where:\nchannel - the channel to use.\nthreshold - specifies the new threshold. If not specified, the current threshold \n is displayed.\nViewing the current threshold requires operator (+o) access on the named channel.\nUpdating the threshold requires master (+m) access on the named channel.\n");
+ chanservaddcommand("banclear", QCMD_AUTHED, 1, csc_dobanclear, "Removes all bans from a channel including persistent bans.", "Usage: BANCLEAR <channel>\nRemoves all temporary and persistent bans from a channel, where:\nchannel - the channel to use\nBANCLEAR requires master (+m) access on the named channel.\n");
+ chanservaddcommand("bandel", QCMD_AUTHED, 2, csc_dobandel, "Removes a single ban from a channel.", "Usage: BANDEL <channel> <ban>\nRemoves the specified persistent or channel ban, where:\nchannel - the channel to use\nban - either a ban mask (nick!user@host), or #number (see BANLIST)\nRemoving channel bans requires operator (+o) access on the named channel.\nRemoving persistent bans requires master (+m) access on the named channel.\n");
+ chanservaddcommand("banlist", QCMD_AUTHED, 1, csc_dobanlist, "Displays all persistent bans on a channel.", "Usage: BANLIST <channel>\nDisplays a list of persistent and channel bans on the named channel. Each ban\nis identified by a number which can be passed to a subsequent BANDEL command.\nNote that the numbers can change if bans are added to or removed from the \nchennel. Where:\nchannel - the channel to use\nBANLIST requires operator (+o) access on the named channel.\n");
+ chanservaddcommand("bantimer", QCMD_AUTHED, 2, csc_dobantimer, "Shows or changes the time after which bans are removed.", "Usage: BANTIMER <channel> [<duration>]\nTo help keep channels clear of the clutter of too many bans, Q can automatically\nremove channel bans after a specified time. This command is used to alter that\ntime period, disable the feature, or show the current setting, where:\nchannel - the channel to use\nduration - how long to remove channel bans after. If duration is 0 then channel\n bans will not be automatically removed. If duration is not specified,\n the current setting will be displayed.\nViewing the current setting requires operator (+o) access on the named channel.\nChanging the setting requires master (+m) access on the named channel.\n");
chanservaddcommand("chanflags", QCMD_AUTHED, 2, csc_dochanflags, "Shows or changes the flags on a channel.", "");
- chanservaddcommand("chanlev", QCMD_AUTHED, 3, csc_dochanlev, "Shows or modifies user access on a channel.", "Usage: chanlev <#channel> [<user> [<flag change>]]\n where <user> is either nickname on the network or #accountname.\nIf only a channel name is supplied, list registered users on the channel.\nIf a user is also specified, shows that user's access on the channel.\nIf a change string is specified, the flags for that user are changed, provided\nyou have sufficient access on the channel to do so. This can be used to add or\nremove users from the channel.\nValid flags are:\nAccess level flags - these control your overall privilege level on the channel:\n +n OWNER Can add or remove masters and all other flags (except personal flags)\n +m MASTER Can add or remove all access except master or owner\n +o OP Can get ops on the channel\n +v VOICE Can get voice on the channel\n +k KNOWN Known on the channel - can get invites to the channel via INVITE\n +q DEVOICE Not allowed to be voiced on the channel\n +d DEOP Not allowed to be opped on the channel\n +b BANNED Banned from the channel\nExtra flags - these control specific behaviour on the channel:\n +a AUTOOP Ops the user automatically when they join the channel (the user \n must also hold +o in order to have this flag)\n +g AUTOVOICE Voices the user automatically when they join the channel (the \n user must also hold +v in order to have this flag)\n +p PROTECT If the user has +o or +v, this makes sure they will always have\n that status, they will be reopped/voiced if deopped/voiced\n +t TOPIC Can use SETTOPIC to alter the topic on the channel\nPersonal flags - these control user personal preferences and can only be changed\n by the user concerned. You need to be known on the channel (hold +k, \n +v, +o, +m or +n) in order to set personal flags.\n +w NOWELCOME Prevents the welcome message being sent when you join the channel.\n +j AUTOINV Invites you to the channel automatically when you authenticate.\nNote that channel owners (+n) can grant +n to channel masters but they must use \nthe the GIVEOWNER command for this.\nNon-sensible combinations of flags are not allowed.\n");
+ chanservaddcommand("chanlev", QCMD_AUTHED, 3, csc_dochanlev, "Shows or modifies user access on a channel.", "Usage: CHANLEV <channel> [<user> [<change>]]\nDisplays or alters the access of known users on a channel, where:\nchannel - the channel to use\nuser - the user to list or modify. user can be specified as either an active\n nickname on the network or #accountname. If user is not specified then\n all known users are listed.\nchange - lists the flags to add or remove, with + to add or - to remove. For\n example, +ao to add a and o flags, or -gv to remove g and v flags. This \n can be used to add or remove users from the channel. If change is not\n specified then the current access of the named user is displayed.\nDisplaying known user information requires you to be known (+k) on the named channel.\nAdjusting flags for other users requires master (+m) access on the named channel.\nAdding or removing the +m flag for other users requires owner (+n) access on the \n named channel.\nYou may always remove your own flags, except +qdb flags (which are not visible to you).\nAdding or removing personal flags requires you to be known (+k) on the named channel.\nNote that channel owners (+n) can grant +n to channel masters but they must use \nthe GIVEOWNER command for this.\nValid flags are:\nAccess level flags - these control your overall privilege level on the channel:\n +n OWNER Can add or remove masters and all other flags (except personal flags)\n +m MASTER Can add or remove all access except master or owner\n +o OP Can get ops on the channel\n +v VOICE Can get voice on the channel\n +k KNOWN Known on the channel - can get invites to the channel via INVITE\n +q DEVOICE Not allowed to be voiced on the channel\n +d DEOP Not allowed to be opped on the channel\n +b BANNED Banned from the channel\nExtra flags - these control specific behaviour on the channel:\n +a AUTOOP Ops the user automatically when they join the channel (the user \n must also hold +o in order to have this flag)\n +g AUTOVOICE Voices the user automatically when they join the channel (the \n user must also hold +v in order to have this flag)\n +p PROTECT If the user has +o or +v, this makes sure they will always have\n that status, they will be reopped/voiced if deopped/voiced\n +t TOPIC Can use SETTOPIC to alter the topic on the channel\nPersonal flags - these control user personal preferences and can only be changed\n by the user concerned. They are not visible to other users.\n +w NOWELCOME Prevents the welcome message being sent when you join the channel.\n +j AUTOINV Invites you to the channel automatically when you authenticate.\nNote that non-sensible combinations of flags are not allowed. After making a \nchange the current status of the named user on the channel will be confirmed.\n");
chanservaddcommand("chanlevhistory", QCMD_HELPER, 2, csc_dochanlevhistory, "View user access changes on a channel.", "");
chanservaddcommand("chanmode", QCMD_AUTHED, 4, csc_dochanmode, "Shows which modes are forced or denied on a channel.", "");
chanservaddcommand("channelcomment", QCMD_OPER, 2, csc_dochannelcomment, "Shows or changes the staff comment for a channel.", "");
unsigned long *lp;
int i;
modechanges changes;
+ int donotice=0;
+ char buf[512], bufpos=0;
if (!rup)
return CMD_ERROR;
}
/* You've got to be a master to 'silently' op other people */
- if (!cs_checkaccess(sender, NULL, CA_MASTERPRIV, cip, "op", 0, 0))
- return CMD_ERROR;
+ if (!cs_checkaccess(sender, NULL, CA_MASTERPRIV, cip, "op", 0, 1))
+ donotice=1;
/* Set up the modes */
localsetmodeinit(&changes, cip->channel, chanservnick);
continue;
}
+ bufpos += sprintf(buf+bufpos,"%s%s",bufpos?", ":"",np->nick);
localdosetmode_nick(&changes, np, MC_OP);
}
+ if (donotice && bufpos) {
+ sendopnoticetochannel(chanservnick, cip->channel, "%s opped %s", sender, buf);
+ }
+
localsetmodeflush(&changes, 1);
chanservstdmessage(sender, QM_DONE);
rcp=cip->exts[chanservext];
duration=durationtolong(cargv[2]);
+ if (duration > 400000000) {
+ chanservstdmessage(sender, QM_DURATIONTOOLONG, cargv[2]);
+ return CMD_ERROR;
+ }
rbp=getregban();
rbp->ID=++lastbanID;
#define QM_PWDONTMATCH 85
#define QM_PWTOSHORT 86
#define QM_PWCHANGED 87
-#define UNUSED_1 88
+#define QM_DURATIONTOOLONG 88
#define QM_EMAILCHANGED 89
#define QM_EMAILDONTMATCH 90
#define QM_INVALIDEMAIL 91
/* 85 */ "Sorry, but passwords do not match",
/* 86 */ "Sorry, but new password is to short",
/* 87 */ "Ok, password changed",
- /* 88 */ "UNUSED_1",
+ /* 88 */ "Duration too long or invalid: %s",
/* 89 */ "Ok, email changed to \"%s\"",
/* 90 */ "Sorry, but first and second email addresses don't match",
/* 91 */ "%s is not a valid email address",