1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 06:36:39 +02:00

Compare commits

..

27 Commits

Author SHA1 Message Date
Adam 9ed5db9920 Anope 1.9.4-p1 Release 2011-09-09 23:31:27 -04:00
Adam 9c3b967a87 Update version.log 2011-09-09 23:30:47 -04:00
Adam 3f3657a9eb Fixed windows build 2011-08-27 21:11:01 -04:00
Adam 49b81a5e78 Update changes.conf, bump version to 1.9.4-p1-git 2011-08-27 21:05:48 -04:00
Adam 99e4eae4e9 Fixed /ns logout on other users 2011-08-27 15:35:09 -04:00
Adam 232af7fa7a Moved the ERROR log message out of debug
(cherry picked from commit a68d17c17e)
2011-08-21 14:56:53 -04:00
Adam 9c8a789aa0 Fixed ns alist min level 2011-08-18 00:46:17 -04:00
Adam 389341b862 Fixed number list position when requesting custom lists from akill and sqline 2011-08-13 21:59:12 -04:00
Adam 949f86908a Use case insensitive matching for server names 2011-08-10 17:36:24 -04:00
Adam 8d551f26d5 Fixed crash in /ns set 2011-08-09 18:37:33 -04:00
Adam 962002b5f5 Fixed JOIN on plexus & fixed UMODE_NETADMIN 2011-08-09 18:36:23 -04:00
Adam 1ce0199af2 Fixed build 2011-08-09 17:50:15 -04:00
Adam 5d6f4cfea4 Added a few sanity checks which never really should happen to db-convert
(cherry picked from commit b7542fd6f2)
2011-08-09 17:39:25 -04:00
Adam 2b03500a61 Updated TODO 2011-08-09 17:38:32 -04:00
Adam 4d6b824551 Made /os stats work like the help describes 2011-08-09 17:37:12 -04:00
Adam 389dde04ab Bug #1291 - fixed parsing JOIN on ratbox
(cherry picked from commit e2b47e001f)
2011-08-09 17:29:38 -04:00
Adam 59fad58ab0 Fixed nickserv help output 2011-08-09 17:29:14 -04:00
Adam d5d2a31042 Fixed appending diff@* to some access list entries that are valid hosts 2011-08-09 17:27:39 -04:00
Adam 7f4eb85205 Bug #1285 - Fixed setting -P on channels with only a service bot in it
(cherry picked from commit b5ec57a3f9)
2011-08-09 17:25:40 -04:00
Adam e9ce53fe88 Use getrlimit instead of ulimit, fixes freebsd build of poll() 2011-08-09 17:25:22 -04:00
Adam 7c06078cf1 Do not send news when a server is syncing 2011-08-09 17:24:02 -04:00
Adam 205eb1ce22 Fixed chanserv/access/modify permission on non-xop channels
(cherry picked from commit ffd5c045e4)
2011-08-09 17:22:50 -04:00
Adam 11fdf16c84 Send account data once an account is confirmed
(cherry picked from commit cc3c2b6999)
2011-08-09 17:22:31 -04:00
Adam 0c47383f8b Fixed mail delay time
(cherry picked from commit 3e9888092a)
2011-08-09 17:21:58 -04:00
Adam fa9f6a34ce Fixed sending account data for unconfirmed accounts 2011-08-09 17:21:28 -04:00
Adam 6574bca404 Fixed destructing bots with commands and fixed quitting services enforcers 2011-08-09 17:14:23 -04:00
Adam ae72c25e1d Bugs #1271 and #1272 2011-08-09 17:12:56 -04:00
388 changed files with 136701 additions and 138316 deletions
+1
View File
@@ -1,3 +1,4 @@
config.cache
include/version.h
include/sysconf.h
build/
+4 -3
View File
@@ -222,7 +222,7 @@ option(USE_RUN_CC_PL "Use run-cc.pl for building" OFF)
# Use the following directories as includes
# Note that it is important the binary include directory comes before the
# source include directory so the precompiled headers work correctly.
include_directories(${Anope_BINARY_DIR}/include ${Anope_SOURCE_DIR}/include ${Anope_BINARY_DIR}/language ${Anope_SOURCE_DIR}/modules/pseudoclients)
include_directories(${Anope_BINARY_DIR}/include ${Anope_SOURCE_DIR}/include ${Anope_BINARY_DIR}/language)
# If using Windows, always add the _WIN32 define
if(WIN32)
@@ -337,10 +337,11 @@ check_include_file(sys/eventfd.h HAVE_SYS_EVENTFD_H)
check_function_exists(setgrent HAVE_SETGRENT)
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(stricmp HAVE_STRICMP)
check_function_exists(strlcat HAVE_STRLCAT)
check_function_exists(strlcpy HAVE_STRLCPY)
check_function_exists(umask HAVE_UMASK)
check_function_exists(backtrace HAVE_BACKTRACE)
check_function_exists(eventfd HAVE_EVENTFD)
check_function_exists(epoll_wait HAVE_EPOLL)
check_function_exists(poll HAVE_POLL)
# Check for the existance of the following types
check_type_size(uint8_t UINT8_T)
+2 -8
View File
@@ -178,17 +178,11 @@ if [ ! "$NO_INTRO" ] ; then
if [ -d .git ] ; then
VERSION=`git describe --tags`
VERSION_BUILD=`echo "$VERSION" | cut -d'-' -f2`
if [ "$SOURCE_DIR" = "." ] ; then
test -d build || mkdir -p build/include
BUILD_DIR="build"
else
BUILD_DIR="."
fi
VERSION_EXTRA=`echo "$VERSION" | cut -d'-' -f3`
# Only do this if we are not on a tag, src/version.sh will be all we need then.
if [ "$VERSION_BUILD" != "$VERSION_EXTRA" ] ; then
echo "#define VERSION_BUILD $VERSION_BUILD" > $BUILD_DIR/include/version.h
echo "#define VERSION_EXTRA \"-$VERSION_EXTRA\"" >> $BUILD_DIR/include/version.h
echo "#define VERSION_BUILD $VERSION_BUILD" > include/version.h
echo "#define VERSION_EXTRA \"-$VERSION_EXTRA\"" >> include/version.h
fi
fi
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
+1 -1
View File
@@ -1,6 +1,6 @@
# Only install example.chk and example.conf from this directory
# NOTE: I would've had this just find all files in the directory, but that would include files not needed (like this file)
set(DATA example.chk tables.sql botserv.example.conf example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf)
set(DATA example.chk example.conf mysql/tables.sql)
install(FILES ${DATA}
DESTINATION data
)
-240
View File
@@ -1,240 +0,0 @@
/*
* Example configuration file for BotServ.
*/
/*
* First, create the service.
*/
service
{
/*
* The name of the BotServ client
*/
nick = "BotServ"
/*
* The username of the BotServ client.
*/
user = "services"
/*
* The hostname of the BotServ client.
*/
host = "services.host"
/*
* The realname of the BotServ client.
*/
gecos = "Bot Service"
/*
* The modes this client should use.
* Do not modify this unless you know what you are doing.
*
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
}
/*
* Core BotServ module.
*
* Provides essential functionality for BotServ.
*/
module { name = "bs_main" }
/*
* Configuration for BotServ provided by bs_main.
*/
botserv
{
/*
* The name of the client that should be BotServ.
*/
name = "BotServ"
/*
* The default bot options for newly registered channels. Note that changing these options
* will have no effect on channels which are already registered. The list must be separated
* by spaces.
*
* The options are:
* - dontkickops: Channel operators will be protected against BotServ kicks
* - dontkickvoices: Voiced users will be protected against BotServ kicks
* - greet: The channel's BotServ bot will greet incoming users that have set a greet
* in their NickServ settings
* - fantasy: Enables the use of BotServ fantasy commands in the channel
*
* This directive is optional, if left blank, there will be no defaults.
*/
defaults="greet fantasy"
/*
* The minimum number of users there must be in a channel before the bot joins it. The best
* value for this setting is 1 or 2. This can be 0, the service bots will not part unless
* specifically unassigned, and will keep the channel open.
*/
minusers = 1
/*
* The maximum number of entries a single bad words list can have. Setting it too high can
* reduce performance slightly.
*/
badwordsmax = 32
/*
* The amount of time that data for a user is valid in BotServ. If the data exceeds this time,
* it is reset or deleted depending on the case. Do not set it too high, otherwise your
* resources will be slightly affected.
*/
keepdata = 10m
/*
* The bots are currently not affected by any modes or bans when they try to join a channel.
* But some people may want to make it act like a real bot, that is, for example, remove all
* the bans affecting the bot before joining the channel, remove a ban that affects the bot
* set by a user when it is in the channel, and so on. Since it consumes a bit more CPU
* time, you should not enable this on larger networks.
*
* This directive is optional.
*/
#smartjoin = yes
/*
* If set, the bots will use a kick reason that does not state the word when it is kicking.
* This is especially useful if you have young people on your network.
*
* This directive is optional.
*/
gentlebadwordreason = yes
/*
* If set, BotServ will use case sensitive checking for badwords.
*
* This directive is optional.
*/
#casesensitive = yes
/*
* Defines the prefix for fantasy commands in channels. This character will have to be prepended
* to all fantasy commands. If you choose "!", for example, fantasy commands will be "!kick",
* "!op", etc. This directive is optional, if left out, the default fantasy character is "!".
*/
#fantasycharacter = "!"
}
/*
* Core BotServ commands.
*
* In Anope modules can provide (multiple) commands, each of which has a unique command name. Once these modules
* are loaded you can then configure the commands to be added to any client you like with any name you like.
*
* Additionally, you may provide a permission name that must be in the opertype of users executing the command.
*
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
command { service = "BotServ"; name = "HELP"; command = "generic/help"; }
/*
* bs_assign
*
* Provides the commands botserv/assign and botserv/unassign.
*
* Used for assigning and unassigning bots to channels.
*/
module { name = "bs_assign" }
command { service = "BotServ"; name = "ASSIGN"; command = "botserv/assign"; }
command { service = "BotServ"; name = "UNASSIGN"; command = "botserv/unassign"; }
/*
* bs_autoassign
*
* Allows service bots to be automatically assigned to channels upon registration.
*/
#module { name = "bs_autoassign" }
bs_autoassign
{
/*
* Automatically assign ChanServ to channels upon registration.
*/
bot = "ChanServ"
}
/*
* bs_badwords
*
* Provides the command botserv/badwords.
*
* Used for controlling the channel badword list.
*/
module { name = "bs_badwords" }
command { service = "BotServ"; name = "BADWORDS"; command = "botserv/badwords"; }
/*
* bs_bot
*
* Provides the command botserv/bot.
*
* Used for administrating BotServ bots.
*/
module { name = "bs_bot" }
command { service = "BotServ"; name = "BOT"; command = "botserv/bot"; }
/*
* bs_botlist
*
* Provides the command botserv/botlist.
*
* Used for listing all available bots.
*/
module { name = "bs_botlist" }
command { service = "BotServ"; name = "BOTLIST"; command = "botserv/botlist"; }
/*
* bs_control
*
* Provides the commands botserv/act and botserv/say.
*
* Used for making the bot message a channel.
*/
module { name = "bs_control" }
command { service = "BotServ"; name = "ACT"; command = "botserv/act"; }
command { service = "BotServ"; name = "SAY"; command = "botserv/say"; }
/*
* bs_info
*
* Provides the command botserv/info.
*
* Used for getting information on bots or channels.
*/
module { name = "bs_info" }
command { service = "BotServ"; name = "INFO"; command = "botserv/info"; }
/*
* bs_kick
*
* Provides the command botserv/kick.
*
* Used for configuring what bots should kick for.
*/
module { name = "bs_kick" }
command { service = "BotServ"; name = "KICK"; command = "botserv/kick"; }
/*
* bs_set
*
* Provides the command botserv/set.
*
* Used for setting options such as kickers and fantasy replies.
*/
module { name = "bs_set" }
command { service = "BotServ"; name = "SET"; command = "botserv/set"; }
-752
View File
@@ -1,752 +0,0 @@
/*
* Example configuration file for ChanServ.
*/
/*
* First, create the service.
*/
service
{
/*
* The name of the ChanServ client
*/
nick = "ChanServ"
/*
* The username of the ChanServ client.
*/
user = "services"
/*
* The hostname of the ChanServ client.
*/
host = "services.host"
/*
* The realname of the ChanServ client.
*/
gecos = "Channel Registration Service"
/*
* The modes this client should use.
* Do not modify this unless you know what you are doing.
*
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
}
/*
* Core ChanServ module.
*
* Provides essential functionality for ChanServ.
*/
module { name = "cs_main" }
/*
* Configuration for ChanServ provided by cs_main.
*/
chanserv
{
/*
* The name of the client that should be ChanServ.
*/
name = "ChanServ"
/*
* The default options for newly registered channels. Note that changing these options
* will have no effect on channels which are already registered. The list must be separated
* by spaces.
*
* The options are:
* - keeptopic: Retain topic when the channel is not in use
* - opnotice: Send a notice when OP/DEOP commands are used
* - peace: Disallow users from kicking or removing modes from others who are of the same
* access level or superior
* - private: Hide the channel from ChanServ's LIST command
* - restricted: Kick/ban users who are restricted from the channel
* - secure: Enable channel security, requiring the user to be identified with NickServ in
* order to be considered for being on the access list of the channel
* - secureops: Only allow operator status to be given if the user is on the access list
* - securefounder: Only allow the real founder of the channel to drop the channel, change it's
* password, or change the founder or successor
* - signkick: Use of ChanServ's KICK command will cause the user's nick to be signed to the kick.
* - signkicklevel: Same as above, but the kick will not be signed if the user is at the same access
* level or superior to the target
* - topiclock: Disallow the topic to be changed except with ChanServ's TOPIC command
* - persist: Keep the channel open at all times
* - none: No defaults
*
* This directive is optional, if left blank, the options will default to keeptopic, secure, securefounder,
* and signkick. If you really want no defaults, use "none" by itself as the option.
*/
defaults="keeptopic peace secure securefounder signkick"
/*
* The maximum number of channels which may be registered to a single nickname.
*
* This directive is optional, but recommended.
* If not set, there will be no restriction on the numbers of channels a single nickname can have registered.
*/
maxregistered = 20
/*
* The length of time before a channel registration expires.
*
* This directive is optional, but recommended.
* If not set, the default is 14 days.
*/
expire = 14d
/*
* The length of time before a suspended channel becomes unsuspended.
*
* This directive is optional.
* If not set, the default is to never.
*/
#suspendexpire = 90d
/*
* The lenth of time before a forbidden channel drops.
*
* This directive is optional.
* If not set, the default is to never.
*/
#forbidexpire = 90d
/*
* The default ban type for newly registered channels (and when importing old databases).
*
* defbantype can be:
*
* 0: ban in the form of *!user@host
* 1: ban in the form of *!*user@host
* 2: ban in the form of *!*@host
* 3: ban in the form of *!*user@*.domain
*/
defbantype = 2
/*
* The maximum number of entries on a channel's access list.
*/
accessmax = 1024
/*
* The maximum number of entries on a channel's autokick list.
*/
autokickmax = 32
/*
* The default reason for an autokick if none is given.
*/
autokickreason = "User has been banned from the channel"
/*
* The length of time ChanServ stays in a channel after kicking a user from a channel they are not
* permitted to be in. This only occurs when the user is the only one in the channel.
*/
inhabit = 15s
/*
* The maximum number of channels to be returned for a ChanServ LIST command.
*/
listmax = 50
/*
* Allow only IRC Operators to use ChanServ.
*
* This directive is optional.
*/
#opersonly = yes
/*
* ChanServ levels configuration, for use with cs_access.
*
* These levels are used by the chanserv/access access system.
* The levels configured below will be used as a default by newly registered channels.
*
* The level "founder" is a special level that means anyone with the level_founder permission
* can use (which of course defaults to "founder"). Anyone with the founder level permission in
* a channel can do anything in the channel.
*
* The level "disabled" is a special level that means the level is disabled, even from people
* with founder level access.
*/
level_change = 10
level_list = 1
level_akick = 10
level_assign = "founder"
level_autohalfop = 4
level_autoop = 5
level_autoowner = 9999
level_autoprotect = 10
level_autovoice = 3
level_badwords = 10
level_ban = 4
level_fantasia = 3
level_founder = "founder"
level_getkey = 5
level_greet = 5
level_halfop = 5
level_halfopme = 4
level_info = 9999
level_invite = 5
level_kick = 4
level_memo = 10
level_mode = 5
level_nokick = 1
level_opdeop = 5
level_opdeopme = 5
level_owner = "founder"
level_ownerme = 9999
level_protect = 9999
level_protectme = 10
level_say = 5
level_signkick = 9999
level_set = 9999
level_topic = 5
level_unban = 4
level_voice = 4
level_voiceme = 3
/*
* ChanServ flags configuration, for use with cs_flags.
*
* These flags are used by the chanserv/flags access system.
*/
flag_change = "f"
flag_list = "l"
flag_akick = "K"
flag_assign = "s"
flag_autohalfop = "H"
flag_autoop = "O"
flag_autoowner = "Q"
flag_autoprotect = "A"
flag_autovoice = "V"
flag_badwords = "k"
flag_ban = "b"
flag_fantasia = "c"
flag_founder = "F"
flag_getkey = "G"
flag_greet = "g"
flag_halfop = "h"
flag_halfopme = "h"
flag_info = "I"
flag_invite = "i"
flag_kick = "k"
flag_memo = "m"
flag_mode = "s"
flag_nokick = "N"
flag_opdeop = "o"
flag_opdeopme = "o"
flag_owner = "q"
flag_ownerme = "q"
flag_protect = "a"
flag_protectme = "a"
flag_say = "B"
flag_set = "s"
flag_signkick = "K"
flag_topic = "t"
flag_unban = "u"
flag_voice = "v"
flag_voiceme = "v"
}
/*
* Core ChanServ commands.
*
* In Anope modules can provide (multiple) commands, each of which has a unique command name. Once these modules
* are loaded you can then configure the commands to be added to any client you like with any name you like.
*
* Additionally, you may provide a permission name that must be in the opertype of users executing the command.
*
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
command { service = "ChanServ"; name = "HELP"; command = "generic/help"; }
/*
* cs_access
*
* Provides commands chanserv/access and chanserv/levels.
* Provides the access system "levels".
*
* Used for giving users access in channels.
*/
module { name = "cs_access" }
command { service = "ChanServ"; name = "ACCESS"; command = "chanserv/access"; }
command { service = "ChanServ"; name = "LEVELS"; command = "chanserv/levels"; }
/*
* cs_akick
*
* Provides the command chanserv/akick.
*
* Used for preventing users from joining channels.
*/
module { name = "cs_akick" }
command { service = "ChanServ"; name = "AKICK"; command = "chanserv/akick"; }
/*
* cs_appendtopic
*
* Provides the chanserv/appendtopic command.
*
* Used to append text to existing channel topics.
*/
module { name = "cs_appendtopic" }
command { service = "ChanServ"; name = "APPENDTOPIC"; command = "chanserv/appendtopic"; }
/*
* cs_ban
*
* Provides the command chanserv/ban.
*
* Used for banning users from channels.
*/
module { name = "cs_ban" }
command { service = "ChanServ"; name = "BAN"; command = "chanserv/ban"; }
command { service = "ChanServ"; name = "KB"; command = "chanserv/ban"; }
/*
* cs_clearusers
*
* Provides the command chanserv/clearusers.
*
* Used for kicking all users from channels.
*/
module { name = "cs_clearusers" }
command { service = "ChanServ"; name = "CLEARUSERS"; command = "chanserv/clearusers"; }
/*
* cs_clone
*
* Provides the command chanserv/clone.
*
* Used for copying channel settings from one channel to another.
*/
module { name = "cs_clone" }
command { service = "ChanServ"; name = "CLONE"; command = "chanserv/clone"; }
/*
* cs_drop
*
* Provides the command chanserv/drop.
*
* Used for unregistering channels.
*/
module { name = "cs_drop" }
command { service = "ChanServ"; name = "DROP"; command = "chanserv/drop"; }
/*
* cs_enforce
*
* Provides the command chanserv/enforce.
*
* Used to enforce various channel settings such as secureops and restricted.
*/
module { name = "cs_enforce" }
command { service = "ChanServ"; name = "ENFORCE"; command = "chanserv/enforce"; }
/*
* cs_entrymsg
*
* Provides the command chanserv/entrymsg.
*
* Used to configure entry messages sent to users when they join a channel.
*/
module { name = "cs_entrymsg" }
command { service = "ChanServ"; name = "ENTRYMSG"; command = "chanserv/entrymsg"; }
cs_entrymsg
{
/* The maximum number of entrymsgs allowed per channel. If not set, defaults to 5. */
maxentries = 5
}
/*
* cs_flags
*
* Provides the command chanserv/flags.
* Provides the access system "flags".
*
* Used for giving users access in channels.
*/
module { name = "cs_flags" }
command { service = "ChanServ"; name = "FLAGS"; command = "chanserv/flags"; }
/*
* cs_getkey
*
* Provides the command chanserv/getkey.
*
* Used for getting the key for channels.
*/
module { name = "cs_getkey" }
command { service = "ChanServ"; name = "GETKEY"; command = "chanserv/getkey"; }
/*
* cs_info
*
* Provides the command chanserv/info.
*
* Used for getting information about channels.
*/
module { name = "cs_info" }
command { service = "ChanServ"; name = "INFO"; command = "chanserv/info"; }
/*
* cs_invite
*
* Provides the command chanserv/invite.
*
* Used for inviting yourself in to channels.
*/
module { name = "cs_invite" }
command { service = "ChanServ"; name = "INVITE"; command = "chanserv/invite"; }
/*
* cs_kick
*
* Provides the command chanserv/kick.
*
* Used for kicking users from channels.
*/
module { name = "cs_kick" }
command { service = "ChanServ"; name = "KICK"; command = "chanserv/kick"; }
command { service = "ChanServ"; name = "K"; command = "chanserv/kick"; }
/*
* cs_list
*
* Provides the command chanserv/list.
*
* Used for retrieving and searching the registered channel list.
*/
module { name = "cs_list" }
command { service = "ChanServ"; name = "LIST"; command = "chanserv/list"; permission = "chanserv/list"; }
/*
* cs_mode
*
* Provides the command chanserv/mode.
*
* Used for changing mode locks and changing modes.
*/
module { name = "cs_mode" }
command { service = "ChanServ"; name = "MODE"; command = "chanserv/mode"; }
/*
* cs_mode
*
* Provides the commands chanserv/op, chanserv/deop, chanserv/halfop, chanserv/dehalfop
* chanserv/voice, chanserv/devoice, chanserv/protect, chanserv/deprotect,
* chanserv/owner, and chanserv/deowner.
*
* Used for setting and removing modes on users.
*/
module { name = "cs_modes" }
command { service = "ChanServ"; name = "OP"; command = "chanserv/op"; }
command { service = "ChanServ"; name = "DEOP"; command = "chanserv/deop"; }
command { service = "ChanServ"; name = "HALFOP"; command = "chanserv/halfop"; }
command { service = "ChanServ"; name = "DEHALFOP"; command = "chanserv/dehalfop"; }
command { service = "ChanServ"; name = "VOICE"; command = "chanserv/voice"; }
command { service = "ChanServ"; name = "DEVOICE"; command = "chanserv/devoice"; }
command { service = "ChanServ"; name = "PROTECT"; command = "chanserv/protect"; }
command { service = "ChanServ"; name = "DEPROTECT"; command = "chanserv/deprotect"; }
command { service = "ChanServ"; name = "OWNER"; command = "chanserv/owner"; }
command { service = "ChanServ"; name = "DEOWNER"; command = "chanserv/deowner"; }
/*
* cs_register
*
* Provides the commands chanserv/register.
*
* Used for registering channels.
*/
module { name = "cs_register" }
command { service = "ChanServ"; name = "REGISTER"; command = "chanserv/register"; }
/*
* cs_seen
*
* Provides the commands chanserv/seen and operserv/seen.
*
* Records the last time a user was seen and what they were doing and allows users to request this data.
* Also allows administrators to view stats about seen data and purge the database.
*/
module { name = "cs_seen" }
command { service = "ChanServ"; name = "SEEN"; command = "chanserv/seen"; }
#command { service = "OperServ"; name = "SEEN"; command = "operserv/seen"; }
/*
* cs_set
*
* Provides the command chanserv/set.
*
* Is a dummy command to provide a help wrapper for the various SET commands.
*/
module { name = "cs_set" }
command { service = "ChanServ"; name = "SET"; command = "chanserv/set"; }
/*
* cs_saset
*
* Provides the command chanserv/saset.
*
* Is a dummy command to provide a help wrapper for the various SASET commands.
*/
module { name = "cs_saset" }
command { service = "ChanServ"; name = "SASET"; command = "chanserv/saset"; permission = "chanserv/saset"; }
/*
* cs_set_bantype
*
* Provides the commands chanserv/set/bantype and chanserv/saset/bantype.
*
* Used for controlling what format bans are placed on channels.
*/
module { name = "cs_set_bantype" }
command { service = "ChanServ"; name = "SET BANTYPE"; command = "chanserv/set/bantype"; }
command { service = "ChanServ"; name = "SASET BANTYPE"; command = "chanserv/saset/bantype"; permission = "chanserv/saset/bantype"; }
/*
* cs_set_description
*
* Provides the commands chanserv/set/description and chanserv/saset/description.
*
* Used for changing channels descriptions.
*/
module { name = "cs_set_description" }
command { service = "ChanServ"; name = "SET DESCRIPTION"; command = "chanserv/set/description"; }
command { service = "ChanServ"; name = "SET DESC"; command = "chanserv/set/description"; }
command { service = "ChanServ"; name = "SASET DESCRIPTION"; command = "chanserv/saset/description"; permission = "chanserv/saset/description"; }
command { service = "ChanServ"; name = "SASET DESC"; command = "chanserv/saset/description"; permission = "chanserv/saset/description"; }
/*
* cs_set_founder
*
* Provides the commands chanserv/set/founder and chanserv/saset/founder.
*
* Used for changing channel founders.
*/
module { name = "cs_set_founder" }
command { service = "ChanServ"; name = "SET FOUNDER"; command = "chanserv/set/founder"; }
command { service = "ChanServ"; name = "SASET FOUNDER"; command = "chanserv/saset/founder"; permission = "chanserv/saset/founder"; }
/*
* cs_set_keeptopic
*
* Provides the commands chanserv/set/keeptopic and chanserv/saset/keeptopic.
*
* Used for enabling keeptopic on channels, which causes ChanServ to restore the channel topic
* when a channel is created.
*/
module { name = "cs_set_keeptopic" }
command { service = "ChanServ"; name = "SET KEEPTOPIC"; command = "chanserv/set/keeptopic"; }
command { service = "ChanServ"; name = "SASET KEEPTOPIC"; command = "chanserv/saset/keeptopic"; permission = "chanserv/saset/keeptopic"; }
/*
* cs_set_misc
*
* Provides the command chanserv/set/misc.
*
* Allows you to create arbitrary commands to set data, and have that data show up in chanserv/info.
*/
module { name = "cs_set_misc" }
command { service = "ChanServ"; name = "SET URL"; command = "chanserv/set/misc"; }
command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc"; }
/*
* cs_set_opnotice
*
* Provides the commands chanserv/set/opnotice and chanserv/saset/opnotice.
*
* Used for setting whether channel ops should be notified of mode changes made through ChanServ.
*/
module { name = "cs_set_opnotice" }
command { service = "ChanServ"; name = "SET OPNOTICE"; command = "chanserv/set/opnotice"; }
command { service = "ChanServ"; name = "SASET OPNOTICE"; command = "chanserv/saset/opnotice"; permission = "chanserv/saset/opnotice"; }
/*
* cs_set_peace
*
* Provides the commands chanserv/set/peace and chanserv/saset/peace.
*
* Used for setting the peace option, which prevents users from kicking other users with
* higher level access than them.
*/
module { name = "cs_set_peace" }
command { service = "ChanServ"; name = "SET PEACE"; command = "chanserv/set/peace"; }
command { service = "ChanServ"; name = "SASET PEACE"; command = "chanserv/saset/peace"; permission = "chanserv/saset/peace"; }
/*
* cs_set_persist
*
* Provides the commands chanserv/set/persist and chanserv/saset/persist.
*
* Used for setting whether ChanServ should stay in channels after the last user leaves.
*/
module { name = "cs_set_persist" }
command { service = "ChanServ"; name = "SET PERSIST"; command = "chanserv/set/persist"; }
command { service = "ChanServ"; name = "SASET PERSIST"; command = "chanserv/saset/persist"; permission = "chanserv/saset/persist"; }
/*
* cs_set_private
*
* Provides the commands chanserv/set/private and chanserv/saset/private.
*
* Used for setting whether channels should show up in chanserv/list.
*/
module { name = "cs_set_private" }
command { service = "ChanServ"; name = "SET PRIVATE"; command = "chanserv/set/private"; }
command { service = "ChanServ"; name = "SASET PRIVATE"; command = "chanserv/saset/private"; permission = "chanserv/saset/private"; }
/*
* cs_set_restricted
*
* Provides the commands chanserv/set/restricted and chanserv/saset/restricted.
*
* Used for setting whether users not on a channel's access list can join.
*/
module { name = "cs_set_restricted" }
command { service = "ChanServ"; name = "SET RESTRICTED"; command = "chanserv/set/restricted"; }
command { service = "ChanServ"; name = "SASET RESTRICTED"; command = "chanserv/saset/restricted"; permission = "chanserv/saset/restricted"; }
/*
* cs_set_secure
*
* Provides the commands chanserv/set/secure and chanserv/saset/secure.
*
* Used for setting whether users who are recognized for accounts should have their access in channels.
*/
module { name = "cs_set_secure" }
command { service = "ChanServ"; name = "SET SECURE"; command = "chanserv/set/secure"; }
command { service = "ChanServ"; name = "SASET SECURE"; command = "chanserv/saset/secure"; permission = "chanserv/saset/secure"; }
/*
* cs_set_securefounder
*
* Provides the commands chanserv/set/securefounder and chanserv/saset/securefounder.
*
* Used for setting whether users with founder level access in channels have true founder or not.
*/
module { name = "cs_set_securefounder" }
command { service = "ChanServ"; name = "SET SECUREFOUNDER"; command = "chanserv/set/securefounder"; }
command { service = "ChanServ"; name = "SASET SECUREFOUNDER"; command = "chanserv/saset/securefounder"; permission = "chanserv/saset/securefounder"; }
/*
* cs_set_secureops
*
* Provides the commands chanserv/set/secureops and chanserv/saset/secureops.
*
* Used for restricting who can have channel op privilege in a channel to those whom have access in the channel.
*/
module { name = "cs_set_secureops" }
command { service = "ChanServ"; name = "SET SECUREOPS"; command = "chanserv/set/secureops"; }
command { service = "ChanServ"; name = "SASET SECUREOPS"; command = "chanserv/saset/secureops"; permission = "chanserv/saset/secureops"; }
/*
* cs_set_signkick
*
* Provides the commands chanserv/set/signkick and chanserv/saset/signkick.
*
* Used for setting signkick, which appends the kicker's name to kicks sent through ChanServ.
*/
module { name = "cs_set_signkick" }
command { service = "ChanServ"; name = "SET SIGNKICK"; command = "chanserv/set/signkick"; }
command { service = "ChanServ"; name = "SASET SIGNKICK"; command = "chanserv/saset/signkick"; permission = "chanserv/saset/signkick"; }
/*
* cs_set_successor
*
* Provides the commands chanserv/set/successor and chanserv/saset/successor.
*
* Used for setting channel successors, which become channel founders if the founders account expires.
*/
module { name = "cs_set_successor" }
command { service = "ChanServ"; name = "SET SUCCESSOR"; command = "chanserv/set/successor"; }
command { service = "ChanServ"; name = "SASET SUCCESSOR"; command = "chanserv/saset/successor"; permission = "chanserv/saset/successor"; }
/*
* cs_set_topiclock
*
* Provides the commands chanserv/set/topiclock and chanserv/saset/topiclock.
*
* Used for setting topiclock, which prevents channel topics from being modified.
*/
module { name = "cs_set_topiclock" }
command { service = "ChanServ"; name = "SET TOPICLOCK"; command = "chanserv/set/topiclock"; }
command { service = "ChanServ"; name = "SASET TOPICLOCK"; command = "chanserv/saset/topiclock"; permission = "chanserv/saset/topiclock"; }
/*
* cs_set_noexpire
*
* Provides the command chanserv/saset/noexpire.
*
* Used for setting noexpire, which prevents channels from expiring.
*/
module { name = "cs_saset_noexpire" }
command { service = "ChanServ"; name = "SASET NOEXPIRE"; command = "chanserv/saset/noexpire"; permission = "chanserv/saset/noexpire"; }
/*
* cs_suspend
*
* Provides the commands chanserv/suspend and chanserv/unsuspend.
*
* Used for suspending and unsuspending channels. Suspended channels can not be used but their settings are stored.
*/
module { name = "cs_suspend" }
command { service = "ChanServ"; name = "SUSPEND"; command = "chanserv/suspend"; permission = "chanserv/suspend"; }
command { service = "ChanServ"; name = "UNSUSPEND"; command = "chanserv/unsuspend"; permission = "chanserv/suspend"; }
/*
* cs_sync
*
* Provides the command chanserv/sync.
*
* Used to sync users channel status modes with what access they have.
*/
module { name = "cs_sync" }
command { service = "ChanServ"; name = "SYNC"; command = "chanserv/sync"; }
/*
* cs_topic
*
* Provides the command chanserv/topic.
*
* Used for changing the channel topic. Usedful in conjunction with chanserv/set/topiclock.
*/
module { name = "cs_topic" }
command { service = "ChanServ"; name = "TOPIC"; command = "chanserv/topic"; }
/*
* cs_unban
*
* Provides the command chanserv/unban.
*
* Used for unbanning users from channels.
*/
module { name = "cs_unban" }
command { service = "ChanServ"; name = "UNBAN"; command = "chanserv/unban"; }
/*
* cs_xop
*
* Provides the commands chanserv/qop, chanserv/sop, chanserv/aop, chanserv/hop, and chanserv/vop.
* Provides the access system "XOP".
*
* Used for giving users access in channels.
*/
module { name = "cs_xop" }
command { service = "ChanServ"; name = "QOP"; command = "chanserv/qop"; }
command { service = "ChanServ"; name = "SOP"; command = "chanserv/sop"; }
command { service = "ChanServ"; name = "AOP"; command = "chanserv/aop"; }
command { service = "ChanServ"; name = "HOP"; command = "chanserv/hop"; }
command { service = "ChanServ"; name = "VOP"; command = "chanserv/vop"; }
+1427 -263
View File
File diff suppressed because it is too large Load Diff
-115
View File
@@ -1,115 +0,0 @@
/*
* Example configuration file for Global.
*/
/*
* First, create the service.
*/
service
{
/*
* The name of the Global client
*/
nick = "Global"
/*
* The username of the Global client.
*/
user = "services"
/*
* The hostname of the Global client.
*/
host = "services.host"
/*
* The realname of the Global client.
*/
gecos = "Global Noticer"
/*
* The modes this client should use.
* Do not modify this unless you know what you are doing.
*
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
}
/*
* Core Global module.
*
* Provides essential functionality for Global.
*/
module { name = "gl_main" }
/*
* Configuration for Global provided by gl_main.
*/
global
{
/*
* The name of the client that should be Global.
*/
name = "Global"
/*
* If set, Services will send global messages on starting up and shutting
* down/restarting.
*
* This directive is optional.
*/
#globaloncycle = yes
/*
* This is the global message that will be sent when Services are being
* shutdown/restarted. This directive is only required if you enable
* globaloncycle above.
*/
globaloncycledown = "Services are restarting, they will be back shortly - please be good while we're gone"
/*
* This is the global message that will be sent when Services (re)join the
* network. This directive is only required if you enable globaloncycle above.
*/
globaloncycleup = "Services are now back online - have a nice day"
/*
* If set, Services will hide the IRC operator's nick in a global
* message/notice.
*
* This directive is optional.
*/
#anonymousglobal = yes
}
/*
* Core Global commands.
*
* In Anope modules can provide (multiple) commands, each of which has a unique command name. Once these modules
* are loaded you can then configure the commands to be added to any client you like with any name you like.
*
* Additionally, you may provide a permission name that must be in the opertype of users executing the command.
*
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
command { service = "Global"; name = "HELP"; command = "generic/help"; }
/*
* gl_global
*
* Provides the command global/global.
*
* Used for sending a message to every online user.
*/
module { name = "gl_global" }
command { service = "OperServ"; name = "GLOBAL"; command = "global/global"; permission = "operserv/global"; }
command { service = "Global"; name = "GLOBAL"; command = "global/global"; permission = "global/global"; }
-163
View File
@@ -1,163 +0,0 @@
/*
* Example configuration file for HostServ.
*/
/*
* First, create the service.
*/
service
{
/*
* The name of the HostServ client
*/
nick = "HostServ"
/*
* The username of the HostServ client.
*/
user = "services"
/*
* The hostname of the HostServ client.
*/
host = "services.host"
/*
* The realname of the HostServ client.
*/
gecos = "vHost Service"
/*
* The modes this client should use.
* Do not modify this unless you know what you are doing.
*
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
}
/*
* Core HostServ module.
*
* Provides essential functionality for HostServ.
*/
module { name = "hs_main" }
/*
* Configuration for HostServ provided by hs_main.
*/
hostserv
{
/*
* The name of the client that should be HostServ.
*/
name = "HostServ"
}
/*
* Core HostServ commands.
*
* In Anope modules can provide (multiple) commands, each of which has a unique command name. Once these modules
* are loaded you can then configure the commands to be added to any client you like with any name you like.
*
* Additionally, you may provide a permission name that must be in the opertype of users executing the command.
*
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
command { service = "HostServ"; name = "HELP"; command = "generic/help"; }
/*
* hs_del
*
* Provides the commands hostserv/del and hostserv/delall.
*
* Used for removing users vHosts.
*/
module { name = "hs_del" }
command { service = "HostServ"; name = "DEL"; command = "hostserv/del"; permission = "hostserv/del"; }
command { service = "HostServ"; name = "DELALL"; command = "hostserv/delall"; permission = "hostserv/del"; }
/*
* hs_group
*
* Provides the command hostserv/group.
*
* Used for grouping one vHost to many nicks.
*/
module { name = "hs_group" }
command { service = "HostServ"; name = "GROUP"; command = "hostserv/group"; }
/*
* hs_list
*
* Provides the command hostserv/list.
*
* Used for listing actively set vHosts.
*/
module { name = "hs_list" }
command { service = "HostServ"; name = "LIST"; command = "hostserv/list"; permission = "hostserv/list"; }
/*
* hs_off
*
* Provides the command hostserv/off.
*
* Used for turning off your vHost.
*/
module { name = "hs_off" }
command { service = "HostServ"; name = "OFF"; command = "hostserv/off"; }
/*
* hs_on
*
* Provides the command hostserv/on.
*
* Used for turning on your vHost.
*/
module { name = "hs_on" }
command { service = "HostServ"; name = "ON"; command = "hostserv/on"; }
/*
* hs_request
*
* Provides the commands hostserv/request, hostserv/active, hostserv/reject, and hostserv/waiting.
*
* Used to manage vhosts requested by users.
*/
module { name = "hs_request" }
command { service = "HostServ"; name = "REQUEST"; command = "hostserv/request"; }
command { service = "HostServ"; name = "ACTIVATE"; command = "hostserv/activate"; permission = "hostserv/set"; }
command { service = "HostServ"; name = "REJECT"; command = "hostserv/reject"; permission = "hostserv/set"; }
command { service = "HostServ"; name = "WAITING"; command = "hostserv/waiting"; permission = "hostserv/set"; }
hs_request
{
/*
* If set, Services will send a memo to the user requesting a vHost when it's been
* approved or rejected.
*/
#memouser = yes
/*
* If set, Services will send a memo to all Services staff when a new vHost is requested.
*/
#memooper = yes
}
/*
* hs_set
*
* Provides the commands hostserv/set and hostserv/setall.
*
* Used for setting users vhosts.
*/
module { name = "hs_set" }
command { service = "HostServ"; name = "SET"; command = "hostserv/set"; permission = "hostserv/set"; }
command { service = "HostServ"; name = "SETALL"; command = "hostserv/setall"; permission = "hostserv/set"; }
-228
View File
@@ -1,228 +0,0 @@
/*
* Example configuration file for MemoServ.
*/
/*
* First, create the service.
*/
service
{
/*
* The name of the MemoServ client
*/
nick = "MemoServ"
/*
* The username of the MemoServ client.
*/
user = "services"
/*
* The hostname of the MemoServ client.
*/
host = "services.host"
/*
* The realname of the MemoServ client.
*/
gecos = "Memo Service"
/*
* The modes this client should use.
* Do not modify this unless you know what you are doing.
*
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
}
/*
* Core MemoServ module.
*
* Provides essential functionality for MemoServ.
*/
module { name = "ms_main" }
/*
* Configuration for MemoServ provided by ms_main.
*/
memoserv
{
/*
* The name of the client that should be MemoServ. Clients are configured
* with the service blocks.
*/
name = "MemoServ"
/*
* The maximum number of memos a user is allowed to keep by default. Normal users may set the
* limit anywhere between 0 and this value. Services Admins can change it to any value or
* disable it.
*
* This directive is optional, but recommended. If not set, the limit is disabled
* by default, and normal users can set any limit they want.
*/
maxmemos = 20
/*
* The delay between consecutive uses of the MemoServ SEND command. This can help prevent spam
* as well as denial-of-service attacks from sending large numbers of memos and filling up disk
* space (and memory). The default 3-second wait means a maximum average of 150 bytes of memo
* per second per user under the current IRC protocol.
*
* This directive is optional, but recommended.
*/
senddelay = 3s
/*
* Allow the use of memo receipts for the following groups:
*
* 1 - Opers Only
* 2 - Everybody
*
* This directive is optional.
*/
#memoreceipt = 1
}
/*
* Core MemoServ commands.
*
* In Anope modules can provide (multiple) commands, each of which has a unique command name. Once these modules
* are loaded you can then configure the commands to be added to any client you like with any name you like.
*
* Additionally, you may provide a permission name that must be in the opertype of users executing the command.
*
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
command { service = "MemoServ"; name = "HELP"; command = "generic/help"; }
/*
* ms_cancel
*
* Provides the command memoserv/cancel.
*
* Used to cancel memos already sent but not yet read.
*/
module { name = "ms_cancel" }
command { service = "MemoServ"; name = "CANCEL"; command = "memoserv/cancel"; }
/*
* ms_check
*
* Provides the command memoserv/check.
*
* Used to check if a sent memo has been read.
*/
module { name = "ms_check" }
command { service = "MemoServ"; name = "CHECK"; command = "memoserv/check"; }
/*
* ms_del
*
* Provides the command memoserv/del.
*
* Used to delete your memos.
*/
module { name = "ms_del" }
command { service = "MemoServ"; name = "DEL"; command = "memoserv/del"; }
/*
* ms_ignore
*
* Provides the command memoserv/ignore.
*
* Used to ignore memos from specific users.
*/
module { name = "ms_ignore" }
command { service = "MemoServ"; name = "IGNORE"; command = "memoserv/ignore"; }
/*
* ms_info
*
* Provides the command memoserv/info.
*
* Used to show memo related information about an account or a channel.
*/
module { name = "ms_info" }
command { service = "MemoServ"; name = "INFO"; command = "memoserv/info"; }
/*
* ms_list
*
* Provides the command memoserv/list.
*
* Used to list your current memos.
*/
module { name = "ms_list" }
command { service = "MemoServ"; name = "LIST"; command = "memoserv/list"; }
/*
* ms_read
*
* Provides the command memoserv/read.
*
* Used to read your memos.
*/
module { name = "ms_read" }
command { service = "MemoServ"; name = "READ"; command = "memoserv/read"; }
/*
* ms_rsend
*
* Provides the command memoserv/rsend.
*
* Used to send a memo requiring a receipt be sent back once it is read.
*
* Requires configuring memoserv:memoreceipt.
*/
#module { name = "ms_rsend" }
#command { service = "MemoServ"; name = "RSEND"; command = "memoserv/rsend"; }
/*
* ms_send
*
* Provides the command memoserv/send
*
* Used to send memos.
*/
module { name = "ms_send" }
command { service = "MemoServ"; name = "SEND"; command = "memoserv/send"; }
/*
* ms_sendlal
*
* Provides the command memoserv/sendall
*
* Used to send a mass memo to every registered user.
*/
module { name = "ms_sendall" }
command { service = "MemoServ"; name = "SENDALL"; command = "memoserv/sendall"; permission = "memoserv/sendall"; }
/*
* ms_set
*
* Provides the command memoserv/set.
*
* Used to set settings such as how you are notified of new memos, and your memo limit.
*/
module { name = "ms_set" }
command { service = "MemoServ"; name = "SET"; command = "memoserv/set"; }
/*
* ms_staff
*
* Provides the command memoserv/staff.
*
* Used to send a memo to all registered staff members.
*/
module { name = "ms_staff" }
command { service = "MemoServ"; name = "STAFF"; command = "memoserv/staff"; permission = "memoserv/staff"; }
-276
View File
@@ -1,276 +0,0 @@
/*
* [OPTIONAL] Non-Core Modules
*
* The following blocks are used to load all non-core modules, including 3rd-party modules.
* Modules can be prevented from loading by commenting out the line, other modules can be added by
* adding a module block. These modules will be loaded prior to Services connecting to your network.
*/
/*
* help
*
* Provides commands generic/help
*
* Is a generic help command that can be used with any client.
*/
module { name = "help" }
/*
* m_dnsbl
*
* Allows configurable DNS blacklists to check connecting users against. If a user
* is found on the blacklist they will be immediately banned. This is a crucial module
* to prevent bot attacks.
*/
module { name = "m_dnsbl" }
m_dnsbl
{
/*
* If set, Services will check clients against the DNSBLs when services connect to its uplink.
* This is not recommended, and on large networks will open a very large amount of DNS queries.
* Whilst services are not drastically affected by this, your nameserver/DNSBL might care.
*/
check_on_connect = no
/*
* If set, Services will check clients when coming back from a netsplit. This can cause a large number
* of DNS queries open at once. Whilst services are not drastically affected by this, your nameserver/DNSBL
* might care.
*/
check_on_netburst = no
/*
* If set, OperServ will add clients found in the DNSBL to the akill list. Without it, OperServ simply sends
* a timed G/K-line to the IRCd and forgets about it. Can be useful if your akill list is being fill up by bots.
*/
add_to_akill = yes
}
blacklist
{
/* Name of the blacklist */
name = "rbl.efnetrbl.org"
/* How long to set the ban for */
time = 4h
/* Reason for akill.
* %n is the nick of the user
* %u is the ident/username of the user
* %g is the realname of the user
* %h is the hostname of the user
* %i is the IP of the user
* %r is the reason (configured below). Will be nothing if not configured.
* %N is the network name set in networkinfo:networkname
*/
reason = "You are listed in the efnet RBL, visit http://rbl.efnetrbl.org/?i=%i for info"
/* Replies to ban and their reason. If this is totally ommited all replies get banned */
1 = "Open Proxy"
/* Don't ban for result 2 or 3 */
#2 = "spamtrap666"
#3 = "spamtrap50"
4 = "TOR"
5 = "Drones / Flooding"
}
blacklist
{
name = "dnsbl.dronebl.org"
time = 4h
reason = "You have a host listed in the DroneBL. For more information, visit http://dronebl.org/lookup_branded.do?ip=%i&network=%N"
}
/*
* m_helpchan
*
* Gives users who are op in the specified help channel usermode +h (helpop).
*/
#module { name = "m_helpchan" }
m_helpchan
{
helpchannel = "#help"
}
/*
* m_ldap
*
* This module allows other modules to use LDAP. By itself, this module does nothing useful.
*/
#module { name = "m_ldap" }
ldap
{
server = "ldap://127.0.0.1"
port = 389
admin_binddn = "cn=Manager,dc=anope,dc=org"
admin_password = "secret"
}
/*
* m_ldap_authentication
*
* This module allows many commands such as IDENTIFY, RELEASE, RECOVER, GHOST, etc. use
* LDAP to authenticate users. Requires m_ldap.
*/
#module { name = "m_ldap_authentication" }
m_ldap_authentication
{
/*
* The distinguished name we should bind to when a user tries to identify.
*/
binddn = "ou=users,dc=anope,dc=org"
/*
* The object class used by LDAP to store user account information.
* Used for adding new users to LDAP if disable_ns_register is false
*/
object_class = "anopeUser"
/*
* The attribute value used for account names.
*/
username_attribute = "uid"
/*
* The attribute value used for email addresses.
* This directive is optional.
*/
email_attribute = "email"
/*
* The attribute value used for passwords.
* Used when registering new accounts in LDAP.
*/
password_attribute = "userPassword"
/*
* Enable to have this module disable /nickserv register.
*/
disable_ns_register = false
/*
* The reason to give the users who try to /ns register if
* disable_ns_register is enabled.
*/
#disable_reason = "To register on this network visit http://some.misconfigured.site/register"
}
/*
* m_ldap_oper
*
* This module dynamically ties users to Anope opertypes when they identify
* via LDAP group membership. Requires m_ldap.
*
* Note that this doesn't give the user privileges on the IRCd, only in Services.
*/
#module { name = "m_ldap_oper" }
m_ldap_oper
{
/*
* An optional binddn to use when searching for groups.
* %a is replaced with the account name of the user.
*/
#binddn = "cn=Manager,dc=anope,dc=org"
/*
* An optional password to bind with.
*/
#password = "secret"
/*
* The base DN where the groups are.
*/
basedn = "ou=groups,dc=anope,dc=org"
/*
* The filter to use when searching for users.
* %a is replaced with the account name of the user.
*/
filter = "(member=uid=%a,ou=users,dc=anope,dc=org)"
/*
* The attribute of the group that is the name of the opertype.
* The cn attribute should match a known opertype in the config.
*/
opertype_attribute = "cn"
}
/*
* m_mysql
*
* This module allows other modules (db_mysql/db_mysql_live) to use MySQL.
* Be sure you have imported the table schema with mydbgen before
* trying to use MySQL
*/
#module { name = "m_mysql" }
mysql
{
database = "anope"
server = "127.0.0.1"
username = "anope"
password = "mypassword"
port = 3306
}
/*
* m_ssl
*
* This module uses SSL to connect to the uplink server(s)
*/
module { name = "m_ssl" }
/*
* m_statusupdate
*
* This module automatically updates users status on channels when the
* channel's access list is modified.
*/
module { name = "m_statusupdate" }
/*
* m_xmlrpc
*
* Allows remote applications (websites) to execute queries in real time to retrieve data from Anope.
* By itself this module does nothing, but allows other modules (m_xmlrpc_main) to receive and send XMLRPC queries.
*/
#module { name = "m_xmlrpc" }
m_xmlrpc
{
/* IP to listen on */
bindip = "127.0.0.1"
/* Port to listen on */
port = 26673
/* Enable for IPv6 */
ipv6 = no
/* If enabled, requires m_ssl to be loaded */
ssl = no
/* IPs allowed to connect (separate with spaces), this should be secured. We also recommend you firewall this
* with an outside program to increase security.
*/
allowed = "127.0.0.0/24"
}
/*
* m_xmlrpc_main
*
* Adds the main XMLRPC core functions.
* Requires m_xmlrpc.
*/
#module { name = "m_xmlrpc_main" }
/*
* ns_maxemail
*
* Limits how many times the same email address may be used in Anope
* to register accounts.
*/
module { name = "ns_maxemail" }
ns_maxemail
{
/*
* The limit to how many registered nicks can use the same e-mail address. If set to 0 or left
* commented, there will be no limit enforced when registering new accounts or using
* /msg NickServ SET EMAIL.
*/
#maxemails = 1
}
+29 -10
View File
@@ -3,9 +3,9 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 07, 2011 at 03:53 PM
-- Generation Time: Apr 28, 2011 at 07:08 PM
-- Server version: 5.1.50
-- PHP Version: 5.3.6-pl0-gentoo
-- PHP Version: 5.3.3-pl1-gentoo
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@@ -63,14 +63,12 @@ CREATE TABLE IF NOT EXISTS `anope_bs_info_metadata` (
--
CREATE TABLE IF NOT EXISTS `anope_cs_access` (
`provider` varchar(255) NOT NULL DEFAULT '',
`data` varchar(255) NOT NULL DEFAULT '',
`mask` varchar(255) NOT NULL DEFAULT '',
`level` int(11) NOT NULL DEFAULT '0',
`display` varchar(255) NOT NULL DEFAULT '',
`channel` varchar(255) NOT NULL DEFAULT '',
`last_seen` int(10) unsigned NOT NULL DEFAULT '0',
`creator` varchar(255) NOT NULL DEFAULT '',
`created` int(11) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`mask`)
UNIQUE KEY `channel` (`channel`,`display`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -107,6 +105,8 @@ CREATE TABLE IF NOT EXISTS `anope_cs_info` (
`last_topic_setter` text NOT NULL,
`last_topic_time` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
`forbidby` text NOT NULL,
`forbidreason` text NOT NULL,
`bantype` smallint(6) NOT NULL DEFAULT '0',
`memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
`botnick` varchar(255) NOT NULL DEFAULT '',
@@ -250,7 +250,6 @@ CREATE TABLE IF NOT EXISTS `anope_ns_alias` (
`last_quit` text NOT NULL,
`last_realname` text NOT NULL,
`last_usermask` text NOT NULL,
`last_realhost` text NOT NULL,
`time_registered` int(10) unsigned NOT NULL DEFAULT '0',
`last_seen` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
@@ -285,6 +284,7 @@ CREATE TABLE IF NOT EXISTS `anope_ns_core` (
`greet` text NOT NULL,
`flags` text NOT NULL,
`language` varchar(5) NOT NULL DEFAULT '',
`channelcount` smallint(5) unsigned NOT NULL DEFAULT '0',
`memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`display`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -303,13 +303,32 @@ CREATE TABLE IF NOT EXISTS `anope_ns_core_metadata` (
-- --------------------------------------------------------
--
-- Table structure for table `anope_os_akills`
--
CREATE TABLE IF NOT EXISTS `anope_os_akills` (
`user` varchar(255) NOT NULL,
`host` varchar(255) NOT NULL,
`xby` text NOT NULL,
`reason` text NOT NULL,
`seton` int(10) unsigned NOT NULL DEFAULT '0',
`expire` int(10) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_os_core`
--
CREATE TABLE IF NOT EXISTS `anope_os_core` (
`maxusercnt` int(11) NOT NULL DEFAULT '0',
`maxusertime` int(10) unsigned NOT NULL DEFAULT '0'
`maxusertime` int(10) unsigned NOT NULL DEFAULT '0',
`akills_count` int(11) NOT NULL DEFAULT '0',
`snlines_count` int(11) NOT NULL DEFAULT '0',
`sqlines_count` int(11) NOT NULL DEFAULT '0',
`szlines_count` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -334,7 +353,7 @@ CREATE TABLE IF NOT EXISTS `anope_os_exceptions` (
--
CREATE TABLE IF NOT EXISTS `anope_os_xlines` (
`type` varchar(1) NOT NULL,
`type` varchar(20) NOT NULL,
`mask` varchar(255) NOT NULL,
`xby` text NOT NULL,
`reason` text NOT NULL,
-619
View File
@@ -1,619 +0,0 @@
/*
* Example configuration file for NickServ.
*/
/*
* First, create the service.
*/
service
{
/*
* The name of the NickServ client
*/
nick = "NickServ"
/*
* The username of the NickServ client.
*/
user = "services"
/*
* The hostname of the NickServ client.
*/
host = "services.host"
/*
* The realname of the NickServ client.
*/
gecos = "Nickname Registration Service"
/*
* The modes this client should use.
* Do not modify this unless you know what you are doing.
*
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
}
/*
* Core NickServ module.
*
* Provides essential functionality for NickServ.
*/
module { name = "ns_main" }
/*
* Configuration for NickServ provided by ns_main.
*/
nickserv
{
/*
* The name of the client that should be NickServ.
*/
name = "NickServ"
/*
* Force users to give an e-mail address when they register a nick.
*
* This directive is recommended to be enabled, and required if e-mail registration is enabled.
*/
forceemail = yes
/*
* Require users who change their email address to confirm they
* own it.
*/
confirmemailchanges = no
/*
* Require an e-mail to be sent to the user before they can register their nick.
*/
#emailregistration = yes
/*
* The default options for newly registered nicks. Note that changing these options
* will have no effect on nicks which are already registered. The list must be separated
* by spaces.
*
* The options are:
* - kill: Kill nick if not identified within 60 seconds
* - killquick: Kill nick if not identified within 20 seconds, this one overrides the above
* option and the above must be specified with this one
* - secure: Enable nickname security, requiring the nick's password before any operations
* can be done on it
* - private: Hide the nick from NickServ's LIST command
* - hideemail: Hide's the nick's e-mail address from NickServ's INFO command
* - hideusermask: Hide's the nick's last or current user@host from NickServ's INFO command
* - hidequit: Hide's the nick's last quit message
* - memosignon: Notify user if they have a new memo when they sign into the nick
* - memoreceive: Notify user if they have a new memo as soon as it's received
* - autoop: User will be automatically opped in channels they enter and have access to
* - msg: Services messages will be sent as PRIVMSGs instead of NOTICEs, requires UsePrivmsg
* to be enabled as well
*
* This directive is optional, if left blank, the options will default to secure, memosignon, and
* memoreceive. If you really want no defaults, use "none" by itself as the option.
*/
defaults="secure private hideemail hideusermask memosignon memoreceive autoop"
/*
* A list of languages to load on startup that will be available in /nickserv set language.
* Useful if you translate Anope to your language. (Explained further in docs/LANGUAGE).
* Note that english should not be listed here because it is the base language.
*/
languages = "ca_ES de_DE el_GR es_ES fr_FR hu_HU it_IT nl_NL pl_PL pt_PT ru_RU tr_TR"
/*
* Default language that non- and newly-registered nicks will receive messages in.
* Leave empty to default to English.
*/
#defaultlanguage = "es_ES"
/*
* The minimum length of time between consecutive uses of NickServ's REGISTER command. This
* directive is optional, but recommended. If not set, this restriction will be disabled.
*/
regdelay = 30s
/*
* The minimum length of time between consecutive uses of NickServ's RESEND command.
*
* This directive is optional, but recommended. If not set, this restriction will be disabled.
*/
resenddelay = 90s
/*
* The length of time before a nick registration expires.
*
* This directive is optional, but recommended. If not set, the default is 21 days.
*/
expire = 21d
/*
* The length of time before a suspended nick becomes unsuspended.
*
* This directive is optional. If not set, the default is to never.
*/
#suspendexpire = 90d
/*
* The length of time a user using an unconfirmed account has
* before the account will be released for general use again.
*
* This directive is only required if the e-mail registration option is enabled.
*/
#unconfirmedexpire = 1d
/*
* The maximum number of nicks allowed in a group.
*
* This directive is optional, but recommended. If not set or set to 0, no limits will be applied.
*/
maxaliases = 16
/*
* The maximum number of entries allowed on a nickname's access list.
*/
accessmax = 32
/*
* The username (and possibly hostname) used for the fake user created when NickServ collides
* a user. Should be in the user@host format.
*/
enforceruser = "enforcer"
enforcerhost = "localhost.net"
/*
* The delay before a NickServ collided nick is released.
*/
releasetimeout = 1m
/*
* Allow the use of the IMMED option in the NickServ SET KILL command.
*
* This directive is optional.
*/
#allowkillimmed = yes
/*
* If set, the NickServ GROUP command won't allow any group change. This is recommended for
* better performance and to protect against nick stealing, however users will have less
* flexibility.
*
* This directive is optional, but recommended.
*/
#nogroupchange = yes
/*
* The maximum number of nicks to be returned for a NickServ LIST command.
*/
listmax = 50
/*
* When a user's nick is forcibly changed to enforce a "nick kill", their new nick will start
* with this value. The rest will be made up of 6 or 7 digits.
*/
guestnickprefix = "Guest"
/*
* Prevents the use of the DROP, FORBID, GETPASS, and SET PASSWORD commands by Services Admins
* on other Services Admins or the Services Root(s).
*
* This directive is optional, but recommended.
*/
secureadmins = yes
/*
* If set, any user wanting to use the privileges of Services Root, Services Admin, or Services
* Operator must have been logged as an IRC Operator with the /oper command.
*
* This directive is optional, but recommended.
*/
strictprivileges = yes
/*
* If set, Services will set the channel modes a user has access to upon identifying, assuming
* they are not already set.
*
* This directive is optional.
*/
modeonid = yes
/*
* If set, Services will add the usermask of registering users to the access list of their
* newly created account. If not set, users will always have to identify to NickServ before
* being recognized, unless they manually add an address to the access list of their account.
* This directive is optional.
*/
addaccessonreg = yes
/*
* The maximum number of channels a user can have on NickServ's AJOIN command.
*/
ajoinmax = 10
}
/*
* Core NickServ commands.
*
* In Anope modules can provide (multiple) commands, each of which has a unique command name. Once these modules
* are loaded you can then configure the commands to be added to any client you like with any name you like.
*
* Additionally, you may provide a permission name that must be in the opertype of users executing the command.
*
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
command { service = "NickServ"; name = "HELP"; command = "generic/help"; }
/*
* ns_access
*
* Provides the command nickserv/access.
*
* Used for configuring what hosts have access to your account.
*/
module { name = "ns_access" }
command { service = "NickServ"; name = "ACCESS"; command = "nickserv/access"; }
/*
* ns_ajoin
*
* Provides the command nickserv/ajoin.
*
* Used for configuring channels to join once you identify.
*/
module { name = "ns_ajoin" }
command { service = "NickServ"; name = "AJOIN"; command = "nickserv/ajoin"; }
/*
* ns_alist
*
* Provides the command nickserv/alist.
*
* Used for viewing what channels you have access to.
*/
module { name = "ns_alist" }
command { service = "NickServ"; name = "ALIST"; command = "nickserv/alist"; }
/*
* ns_cert
*
* Provides the command nickserv/cert.
*
* Used for configuring your SSL certificate list, which can be used to automatically identify you.
*/
module { name = "ns_cert" }
command { service = "NickServ"; name = "CERT"; command = "nickserv/cert"; }
/*
* ns_drop
*
* Provides the command nickserv/drop.
*
* Used for unregistering names.
*/
module { name = "ns_drop" }
command { service = "NickServ"; name = "DROP"; command = "nickserv/drop"; }
/*
* ns_getemail
*
* Provides the command nickserv/getemail.
*
* Used for getting registered accounts by searching for emails.
*/
module { name = "ns_getemail" }
command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; permission = "nickserv/getemail"; }
/*
* ns_getpass
*
* Provides the command nickserv/getpass.
*
* Used for getting users passwords.
*
* Requires no encryption is being used.
*/
#module { name = "ns_getpass" }
#command { service = "NickServ"; name = "GETPASS"; command = "nickserv/getpass"; permission = "nickserv/getpass"; }
/*
* ns_ghost
*
* Provides the command nickserv/ghost.
*
* Used for disconnecting "ghost" sessions.
*/
module { name = "ns_ghost" }
command { service = "NickServ"; name = "GHOST"; command = "nickserv/ghost"; }
/*
* ns_group
*
* Provides the commands nickserv/group, nickserv/glist, and nickserv/ungroup.
*
* Used for controlling nick groups.
*/
module { name = "ns_group" }
command { service = "NickServ"; name = "GLIST"; command = "nickserv/glist"; }
command { service = "NickServ"; name = "GROUP"; command = "nickserv/group"; }
command { service = "NickServ"; name = "UNGROUP"; command = "nickserv/ungroup"; }
/*
* ns_identify
*
* Provides the command nickserv/identify.
*
* Used for identifying to accounts.
*/
module { name = "ns_identify" }
command { service = "NickServ"; name = "ID"; command = "nickserv/identify"; }
command { service = "NickServ"; name = "IDENTIFY"; command = "nickserv/identify"; }
/*
* ns_info
*
* Provides the command nickserv/info.
*
* Used for gathering information about an account.
*/
module { name = "ns_info" }
command { service = "NickServ"; name = "INFO"; command = "nickserv/info"; }
/*
* ns_list
*
* Provides the command nickserv/list.
*
* Used for retrieving and searching the registered account list.
*/
module { name = "ns_list" }
command { service = "NickServ"; name = "LIST"; command = "nickserv/list"; }
/*
* ns_logout
*
* Provides the command nickserv/logout.
*
* Used for logging out of your account.
*/
module { name = "ns_logout" }
command { service = "NickServ"; name = "LOGOUT"; command = "nickserv/logout"; }
/*
* ns_recover
*
* Provides the command nickserv/recover.
*
* Used for forcing someone on your nick to a guest nick.
*/
module { name = "ns_recover" }
command { service = "NickServ"; name = "RECOVER"; command = "nickserv/recover"; }
/*
* ns_register
*
* Provides the commands nickserv/confirm, nickserv/register, and nickserv/resend.
*
* Used for registering accounts.
*/
module { name = "ns_register" }
command { service = "NickServ"; name = "CONFIRM"; command = "nickserv/confirm"; }
command { service = "NickServ"; name = "REGISTER"; command = "nickserv/register"; }
command { service = "NickServ"; name = "RESEND"; command = "nickserv/resend"; }
/*
* ns_release
*
* Provides the command nickserv/release.
*
* Used for releasing names held by nickserv/recover.
*/
module { name = "ns_release" }
command { service = "NickServ"; name = "RELEASE"; command = "nickserv/release"; }
/*
* ns_resetpass
*
* Provides the command nickserv/resetpass.
*
* Used for resetting passwords by emailing users a temporary one.
*/
module { name = "ns_resetpass" }
command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpass"; }
/*
* ns_saset
*
* Provides commands nickserv/saset, nickserv/saset/display, and nickserv/saset/password.
*
* Used as a help wrapper for SASET commands, and used to force change users display name or password.
*/
module { name = "ns_saset" }
command { service = "NickServ"; name = "SASET"; command = "nickserv/saset"; }
command { service = "NickServ"; name = "SASET DISPLAY"; command = "nickserv/saset/display"; }
command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/saset/password"; }
/*
* ns_set
*
* Provides the commands nickserv/set, nickserv/set/display, and nickserv/set/password.
*
* Used as a help wrapper for SET commands, and used for users to change their display name or password.
*/
module { name = "ns_set" }
command { service = "NickServ"; name = "SET"; command = "nickserv/set"; }
command { service = "NickServ"; name = "SET DISPLAY"; command = "nickserv/set/display"; }
command { service = "NickServ"; name = "SET PASSWORD"; command = "nickserv/set/password"; }
/*
* ns_set_autoop
*
* Provides the commands nickserv/set/autoop and nickserv/saset/autoop.
*
* Used for setting autoop, which determines whether or not modes are automatically set on you when joining a channel.
*/
module { name = "ns_set_autoop" }
command { service = "NickServ"; name = "SET AUTOOP"; command = "nickserv/set/autoop"; }
command { service = "NickServ"; name = "SASET AUTOOP"; command = "nickserv/saset/autoop"; permission = "nickserv/saset/autoop"; }
/*
* ns_set_email
*
* Provides the commands nickserv/set/email and nickserv/saset/email.
*
* Used for setting users email addresses.
*/
module { name = "ns_set_email" }
command { service = "NickServ"; name = "SET EMAIL"; command = "nickserv/set/email"; }
command { service = "NickServ"; name = "SASET EMAIL"; command = "nickserv/saset/email"; permission = "nickserv/saset/email"; }
/*
* ns_set_greet
*
* Provides the commands nickserv/set/greet and nickserv/saset/greet.
*
* Used for changing users greet message, which is displayed when they enter channels.
*/
module { name = "ns_set_greet" }
command { service = "NickServ"; name = "SET GREET"; command = "nickserv/set/greet"; }
command { service = "NickServ"; name = "SASET GREET"; command = "nickserv/saset/greet"; permission = "nickserv/saset/greet"; }
/*
* ns_set_hide
*
* Provides the commands nickserv/set/hide and nickserv/saset/hide.
*
* Used for configuring which options are publically shown in nickserv/info for your account.
*/
module { name = "ns_set_hide" }
command { service = "NickServ"; name = "SET HIDE"; command = "nickserv/set/hide"; }
command { service = "NickServ"; name = "SASET HIDE"; command = "nickserv/saset/hide"; permission = "nickserv/saset/hide"; }
/*
* ns_set_kill
*
* Provides the commands nickserv/set/kill and nickserv/saset/kill.
*
* Used for configuring if and for how long other users are allowed to use your nick.
*/
module { name = "ns_set_kill" }
command { service = "NickServ"; name = "SET KILL"; command = "nickserv/set/kill"; }
command { service = "NickServ"; name = "SASET KILL"; command = "nickserv/saset/kill"; permission = "nickserv/saset/kill"; }
/*
* ns_set_language
*
* Provides the commands nickserv/set/language and nickserv/saset/language.
*
* Used for configuring what language services use when messaging you.
*/
module { name = "ns_set_language" }
command { service = "NickServ"; name = "SET LANGUAGE"; command = "nickserv/set/language"; }
command { service = "NickServ"; name = "SASET LANGUAGE"; command = "nickserv/saset/language"; permission = "nickserv/saset/language"; }
/*
* ns_set_message
*
* Provides the commands nickserv/set/message and nickserv/saset/message.
*
* Used to configure how services send messages to you.
*/
module { name = "ns_set_message" }
command { service = "NickServ"; name = "SET MESSAGE"; command = "nickserv/set/message"; }
command { service = "NickServ"; name = "SASET MESSAGE"; command = "nickserv/saset/message"; permission = "nickserv/saset/message"; }
/*
* ns_set_private
*
* Provides the commands nickserv/set/private and nickserv/saset/private.
*
* Used for configuring whether or not your account shows up in nickserv/list.
*/
module { name = "ns_set_private" }
command { service = "NickServ"; name = "SET PRIVATE"; command = "nickserv/set/private"; }
command { service = "NickServ"; name = "SASET PRIVATE"; command = "nickserv/saset/private"; permission = "nickserv/saset/private"; }
/*
* ns_set_secure
*
* Provides the commands nickserv/set/secure and nickserv/saset/secure.
*
* Used for configuring whether you can gain access to your nick by simply being recognized by nickserv/access.
*/
module { name = "ns_set_secure" }
command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; }
command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; }
/*
* ns_saset_noexpire
*
* Provides the command nickserv/saset/noexpire.
*
* Used for configuring noexpire, which prevents nicks from expiring.
*/
module { name = "ns_saset_noexpire" }
command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire" }
/*
* ns_sendpass
*
* Provides the command nickserv/sendpass.
*
* Used to send users their password via email.
*
* Requires that no encryption is being used.
*/
module { name = "ns_sendpass" }
command { service = "NickServ"; name = "SENDPASS"; command = "nickserv/sendpass"; permission = "nickserv/sendpass"; }
/*
* ns_set_misc
*
* Provides the command nickserv/set/misc.
*
* Allows you to create arbitrary commands to set data, and have that data show up in nickserv/info.
*/
module { name = "ns_set_misc" }
command { service = "NickServ"; name = "SET URL"; command = "nickserv/set/misc"; }
command { service = "NickServ"; name = "SET ICQ"; command = "nickserv/set/misc"; }
/*
* ns_status
*
* Provides the nickserv/status command.
*
* Used to determine if a user is recognized or identified by services.
*/
module { name = "ns_status" }
command { service = "NickServ"; name = "STATUS"; command = "nickserv/status"; }
/*
* ns_suspend
*
* Provides the commands nickserv/suspend and nickserv/unsuspend.
*
* Used to suspend and unsuspend nicknames. Suspended nicknames can not be used but their settings are stored.
*/
module { name = "ns_suspend" }
command { service = "NickServ"; name = "SUSPEND"; command = "nickserv/suspend"; permission = "nickserv/suspend"; }
command { service = "NickServ"; name = "UNSUSPEND"; command = "nickserv/unsuspend"; permission = "nickserv/suspend"; }
/*
* ns_update
*
* Provides the command nickserv/update.
*
* Used to update your status on all channels, turn on your vHost, etc.
*/
module { name = "ns_update" }
command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; }
-593
View File
@@ -1,593 +0,0 @@
/*
* Example configuration file for OperServ.
*/
/*
* First, create the service.
*/
service
{
/*
* The name of the OperServ client
*/
nick = "OperServ"
/*
* The username of the OperServ client.
*/
user = "services"
/*
* The hostname of the OperServ client.
*/
host = "services.host"
/*
* The realname of the OperServ client.
*/
gecos = "Operator Service"
/*
* The modes this client should use.
* Do not modify this unless you know what you are doing.
*
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
}
/*
* Core OperServ module.
*
* Provides essential functionality for OperServ.
*/
module { name = "os_main" }
/*
* Configuration for OperServ provided by os_main.
*/
operserv
{
/*
* The name of the client that should be OperServ.
*/
name = "OperServ"
/*
* If set, Services Admins will be able to use SUPERADMIN [ON|OFF] which will temporarily grant
* them extra privileges such as being a founder on ALL channels.
*
* This directive is optional.
*/
#superadmin = yes
/*
* These define the default expiration times for, respectively, AKILLs, CHANKILLs, SNLINEs,
* SQLINEs, and SZLINEs.
*/
autokillexpiry = 30d
chankillexpiry = 30d
snlineexpiry = 30d
sqlineexpiry = 30d
szlineexpiry = 30d
/*
* If set, this option will make Services send an AKILL command immediately after it has been
* added with AKILL ADD. This eliminates the need for killing the user after the AKILL has
* been added.
*
* This directive is optional, but recommended.
*/
akillonadd = yes
/*
* If set, this option will make Services send an (SVS)KILL command immediately after SNLINE ADD.
* This eliminates the need for killing the user after the SNLINE has been added.
*
*This directive is optional.
*/
#killonsnline = yes
/*
* If set, this option will make Services send an (SVS)KILL command immediately after SQLINE ADD.
* This eliminates the need for killing the user after the SQLINE has been added.
*
* This directive is optional.
*/
#killonsqline = yes
/*
* Defines what actions should trigger notifications. The list must be separated by spaces.
*
* The notifications are:
* - oper: A user has become an IRC operator
* - bados: A non-IRCop attempts to use OperServ
* - akillexpire: An AKILL has expired
* - snlineexpire: An SNLINE has expired
* - sqlineexpire: An SQLINE has expired
* - szlineexpire: An SZLINE has expired
* - exceptionexpire: A session exception has expired
*
* This directive is optional, if left blank, there will be no notifications.
*/
notifications = "oper"
/*
* Enables session limiting. Session limiting prevents users from connecting more than a certain
* number of times from the same host at the same time - thus preventing most types of cloning.
* Once a host reaches it's session limit, all clients attempting to connect from that host will
* be killed. Exceptions to the default session limit can be defined via the exception list. It
* should be noted that session limiting, along with a large exception list, can degrade Services'
* performance.
*
* See the source and comments in sessions.c and the online help for more information about
* session limiting.
*
* This directive is optional.
*/
limitsessions = yes
/*
* Default session limit per host. Once a host reaches it's session limit, all clients attempting
* to connect from that host will be killed. A value of zero means an unlimited session limit.
*
* This directive is optional.
* If not given and session limiting is enabled, it will default to no limit.
*/
defaultsessionlimit = 3
/*
* The maximum session limit that may be set for a host in an exception.
*
* This directive is only required if session limiting is enabled.
*/
maxsessionlimit = 100
/*
* Sets the default expiry time for session exceptions.
*
* This directive is only required if session limiting is enabled.
*/
exceptionexpiry = 1d
/*
* The message that will be NOTICE'd to a user just before they are removed from the network because
* their host's session limit has been exceeded. It may be used to give a slightly more descriptive
* reason for the impending kill as opposed to simply "Session limit exceeded".
*
* This directive is optional, if not set, nothing will be sent.
*/
sessionlimitexceeded = "The session limit for your host %s has been exceeded."
/*
* Same as above, but should be used to provide a website address where users can find out more
* about session limits and how to go about applying for an exception.
*
* Note: This directive has been intentionally commented out in an effort to remind you to change
* the URL it contains. It is recommended that you supply an address/URL where people can get help
* regarding session limits.
*
* This directive is optional, if not set, nothing will be sent.
*/
#sessionlimitdetailsloc = "Please visit http://your.website.url/ for more information about session limits."
/*
* If set and is not 0, this directive tells Services to add an AKILL the number of subsequent kills
* for the same host exceeds this value, preventing the network from experiencing KILL floods.
*
* This directive is optional.
*/
maxsessionkill = 15
/*
* Sets the expiry time for AKILLs set for hosts exceeding the maxsessionkill directive limit.
*
* This directive is optional, if not set, defaults to 30 minutes.
*/
sessionautokillexpiry = 30m
/*
* Adds the nickname of the IRC Operator issuing an AKILL to the kill reason.
*
* This directive is optional.
*/
addakiller = yes
/*
* If set, only IRC Operators will be permitted to use OperServ, regardless of module-based command
* access restrictions.
*
* This directive is optional, but recommended.
*/
opersonly = yes
}
/*
* Core OperServ commands.
*
* In Anope modules can provide (multiple) commands, each of which has a unique command name. Once these modules
* are loaded you can then configure the commands to be added to any client you like with any name you like.
*
* Additionally, you may provide a permission name that must be in the opertype of users executing the command.
*
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
command { service = "OperServ"; name = "HELP"; command = "generic/help"; }
/*
* os_akill
*
* Provides the command operserv/akill.
*
* Used to ban users from the network.
*/
module { name = "os_akill" }
command { service = "OperServ"; name = "AKILL"; command = "operserv/akill"; permission = "operserv/akill"; }
/*
* os_chankill
*
* Provides the command operserv/chankill.
*
* Used to akill uses from an entire channel.
*/
module { name = "os_chankill" }
command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"; permission = "operserv/chankill"; }
/*
* os_defcon
*
* Provides the command operserv/defcon.
*
* Allows you to set services in defcon mode, which can be used to restrict services access
* during bot attacks.
*/
#module { name = "os_defcon" }
#command { service = "OperServ"; name = "DEFCON"; command = "operserv/defcon"; }
defcon
{
/*
* Default DefCon level (1-5) to use when starting Services up. Level 5 constitutes normal operation
* while level 1 constitutes the most restrictive operation. If this setting is left out or set to
* 0, DefCon will be disabled and the rest of this block will be ignored.
*/
#defaultlevel = 5
/*
* The following 4 directives define what operations will take place when DefCon is set to levels
* 1 through 4. Each level is a list that must be separated by spaces.
*
* The following operations can be defined at each level:
* - nonewchannels: Disables registering new channels
* - nonewnicks: Disables registering new nicks
* - nomlockchanges: Disables changing MLOCK on registered channels
* - forcechanmodes: Forces all channels to have the modes given in the later chanmodes directive
* - reducedsessions: Reduces the session limit to the value given in the later sessionlimit directive
* - nonewclients: KILL any new clients trying to connect
* - operonly: Services will ignore all non-IRCops
* - silentoperonly: Services will silently ignore all non-IRCops
* - akillnewclients: AKILL any new clients trying to connect
* - nonewmemos: No new memos will be sent to block MemoServ attacks
*/
level4 = "nonewchannels nonewnicks nomlockchanges reducedsessions"
level3 = "nonewchannels nonewnicks nomlockchanges forcechanmodes reducedsessions"
level2 = "nonewchannels nonewnicks nomlockchanges forcechanmodes reducedsessions silentoperonly"
level1 = "nonewchannels nonewnicks nomlockchanges forcechanmodes reducedsessions silentoperonly akillnewclients"
/*
* New session limit to use when a DefCon level is using "reduced" session limiting.
*/
#sessionlimit = 2
/*
* Length of time to add an AKILL for when DefCon is preventing new clients from connecting to the
* network.
*/
#akillexpire = 5m
/*
* The channel modes to set on all channels when the DefCon channel mode system is in use.
*
* Note 1: Choose these modes carefully, because when DefCon switches to a level which does NOT have
* the mode setting selected, Services will set the reverse on all channels, e.g. if this setting
* is +RN when DefCon is used, all channels will be set to +RN, when DefCon is removed, all
* channels will be set to -RN. You don't want to set this to +k for example, because when DefCon
* is removed all channels with -k.
*
* Note 2: MLOCKed modes will not be lost.
*/
#chanmodes = "+R"
/*
* This value can be used to automatically return the network to DefCon level 5 after the specified
* time period, just in case any IRC Operator forgets to remove a DefCon setting.
*
* This directive is optional.
*/
#timeout = 15m
/*
* If set, Services will send a global message on DefCon level changes.
*
* This directive is optional.
*/
#globalondefcon = yes
/*
* If set, Services will send the global message defined in the message directive on DefCon level
* changes.
*
* This directive is optional.
*/
#globalondefconmore = yes
/*
* Defines the message that will be sent on DefCon level changes when globalondefconmore is set.
*
* This directive is required only when globalondefconmore is set.
*/
#message = "Put your message to send your users here. Dont forget to uncomment globalondefconmore"
/*
* Defines the message that will be sent when DefCon is returned to level 5. This directive is optional,
* and will also override globalondefcon and globalondefconmore when set.
*/
#offmessage = "Services are now back to normal, sorry for any inconvenience"
/*
* Defines the reason to use when clients are KILLed or AKILLed from the network while the proper
* DefCon operation is in effect.
*/
#akillreason = "This network is currently not accepting connections, please try again later"
}
/*
* os_list
*
* Provides the commands operserv/chanlist and operserv/userlist.
*
* Used to list and search the channels and users currently on the network.
*/
module { name = "os_list" }
command { service = "OperServ"; name = "CHANLIST"; command = "operserv/chanlist"; }
command { service = "OperServ"; name = "USERLIST"; command = "operserv/userlist"; }
/*
* os_config
*
* Provides the command operserv/config.
*
* Used to view and set configuration options while services are running.
*/
module { name = "os_config" }
command { service = "OperServ"; name = "CONFIG"; command = "operserv/config"; permission = "operserv/config"; }
/*
* os_forbid
*
* Provides the command operserv/forbid.
*
* Used to forbid specific nicks, channels, emails, etc. from being used.
*/
module { name = "os_forbid" }
command { service = "OperServ"; name = "FORBID"; command = "operserv/forbid"; permission = "operserv/forbid"; }
/*
* os_ignore
*
* Provides the command operserv/ignore.
*
* Used to make Services ignore users.
*/
module { name = "os_ignore" }
command { service = "OperServ"; name = "IGNORE"; command = "operserv/ignore"; permission = "operserv/ignore"; }
/*
* os_jupe
*
* Provides the command operserv/jupe.
*
* Used to disconnect servers from the network and prevent them from relinking.
*/
module { name = "os_jupe" }
command { service = "OperServ"; name = "JUPE"; command = "operserv/jupe"; permission = "operserv/jupe"; }
/*
* os_kick
*
* Provides the command operserv/kick.
*
* Used to kick users from channels.
*/
module { name = "os_kick" }
command { service = "OperServ"; name = "KICK"; command = "operserv/kick"; permission = "operserv/kick"; }
/*
* os_kill
*
* Provides the command operserv/kill.
*
* Used to forcibly disconnect users from the network.
*/
module { name = "os_kill" }
command { service = "OperServ"; name = "KILL"; command = "operserv/kill"; permission = "operserv/kill"; }
/*
* os_login
*
* Provides the command operserv/login.
*
* Used to login to OperServ, only required if your oper block requires this.
*/
module { name = "os_login" }
command { service = "OperServ"; name = "LOGIN"; command = "operserv/login"; }
/*
* os_mode
*
* Provides the commands operserv/mode and operserv/umode.
*
* Used to change user and channel modes.
*/
module { name = "os_mode" }
command { service = "OperServ"; name = "MODE"; command = "operserv/mode"; permission = "operserv/mode"; }
command { service = "OperServ"; name = "UMODE"; command = "operserv/umode"; permission = "operserv/umode"; }
/*
* os_modinfo
*
* Provides the commands operserv/modinfo and operserv/modlist.
*
* Used to show information about loaded modules.
*/
module { name = "os_modinfo" }
command { service = "OperServ"; name = "MODINFO"; command = "operserv/modinfo"; }
command { service = "OperServ"; name = "MODLIST"; command = "operserv/modlist"; permission = "operserv/modlist"; }
/*
* os_module
*
* Provides the commands operserv/modload, operserv/modreload, and operserv/modunload.
*
* Used to load, reload, and unload modules.
*/
module { name = "os_module" }
command { service = "OperServ"; name = "MODLOAD"; command = "operserv/modload"; permission = "operserv/modload"; }
command { service = "OperServ"; name = "MODRELOAD"; command = "operserv/modreload"; permission = "operserv/modload"; }
command { service = "OperServ"; name = "MODUNLOAD"; command = "operserv/modunload"; permission = "operserv/modload"; }
/*
* os_news
*
* Provides the commands operserv/logonnews, operserv/opernews, and operserv/randomnews.
*
* Used to configure news notices shown to users when they connect, and opers when they oper.
*/
module { name = "os_news" }
command { service = "OperServ"; name = "LOGONNEWS"; command = "operserv/logonnews"; permission = "operserv/news"; }
command { service = "OperServ"; name = "OPERNEWS"; command = "operserv/opernews"; permission = "operserv/news"; }
command { service = "OperServ"; name = "RANDOMNEWS"; command = "operserv/randomnews"; permission = "operserv/news"; }
/*
* os_noop
*
* Provides the command operserv/noop.
*
* Used to NOOP a server, which prevents users from opering on that server.
*/
module { name = "os_noop" }
command { service = "OperServ"; name = "NOOP"; command = "operserv/noop"; permission = "operserv/noop"; }
/*
* os_oline
*
* Provides the command operserv/oline.
*
* Used to set oper flags on users, and is specific to UnrealIRCd.
* See /helpop ?svso on your IRCd for more information.
*/
module { name = "os_oline" }
command { service = "OperServ"; name = "OLINE"; command = "operserv/oline"; permission = "operserv/oline"; }
/*
* os_oper
*
* Provides the command opersev/oper.
*
* Used to configure opers and show information about opertypes.
*/
module { name = "os_oper" }
command { service = "OperServ"; name = "OPER"; command = "operserv/oper"; permission = "operserv/oper"; }
/*
* os_reload
*
* Provides the command operserv/relad.
*
* Used to reload the services.conf configuration file.
*/
module { name = "os_reload" }
command { service = "OperServ"; name = "RELOAD"; command = "operserv/reload"; permission = "operserv/reload"; }
/*
* os_session
*
* Provides the commands operserv/exception and operserv/session.
*
* Used to manage the session limit exception list, and view currently active sessions.
*/
module { name = "os_session" }
command { service = "OperServ"; name = "EXCEPTION"; command = "operserv/exception"; permission = "operserv/exception"; }
command { service = "OperServ"; name = "SESSION"; command = "operserv/session"; permission = "operserv/session"; }
/*
* os_set
*
* Provides the command operserv/set.
*
* Used to set various settinsg such as superadmin, debug mode, etc.
*/
module { name = "os_set" }
command { service = "OperServ"; name = "SET"; command = "operserv/set"; permission = "operserv/set"; }
/*
* os_shutdown
*
* Provides the commands operserv/quit, operserv/restart, and operserv/shutdown.
*
* Used to quit, restart, or shutdown services.
*/
module { name = "os_shutdown" }
command { service = "OperServ"; name = "QUIT"; command = "operserv/quit"; permission = "operserv/quit"; }
command { service = "OperServ"; name = "RESTART"; command = "operserv/restart"; permission = "operserv/restart"; }
command { service = "OperServ"; name = "SHUTDOWN"; command = "operserv/shutdown"; permission = "operserv/shutdown"; }
/*
* os_stats
*
* Provides the operserv/stats command.
*
* Used to show statistics about services.
*/
module { name = "os_stats" }
command { service = "OperServ"; name = "STATS"; command = "operserv/stats"; permission = "operserv/stats"; }
/*
* os_svsnick
*
* Provides the operserv/svsnick command.
*
* Used to force change user's nicks.
*/
module { name = "os_svsnick" }
command { service = "OperServ"; name = "SVSNICK"; command = "operserv/svsnick"; permission = "operserv/svsnick"; }
/*
* os_sxline
*
* Provides the operserv/snline, operserv/sqline, and operserv/szline commands.
*
* Used to ban different things such as realnames, nicknames, and IPs.
*/
module { name = "os_sxline" }
command { service = "OperServ"; name = "SNLINE"; command = "operserv/snline"; permission = "operserv/snline"; }
command { service = "OperServ"; name = "SQLINE"; command = "operserv/sqline"; permission = "operserv/sqline"; }
command { service = "OperServ"; name = "SZLINE"; command = "operserv/szline"; permission = "operserv/szline"; }
/*
* os_update
*
* Provides the opersev/update command.
*
* Use to immediately update the databases.
*/
module { name = "os_update" }
command { service = "OperServ"; name = "UPDATE"; command = "operserv/update"; permission = "operserv/update"; }
+25 -223
View File
@@ -1,226 +1,28 @@
Revision 3cbad7f - Fri, 9 Sep 2011 23:27:15 -0400 - Regenerate language files
Revision b80a0a8 - Fri, 9 Sep 2011 22:27:51 -0400 - Updated Greek language file
Revision f844b0a - Fri, 9 Sep 2011 19:18:43 -0400 - Changed User::IsRecognized check to default to secure
Revision 6bd31b0 - Thu, 8 Sep 2011 19:00:30 -0400 - Bug #1330 & many other small fixes
Revision 7de1a7a - Mon, 5 Sep 2011 18:40:34 -0400 - Don't try and part service bots twice when channels drop
Revision 3815e7d - Sat, 3 Sep 2011 14:39:12 -0400 - Translate whole messages before splitting them up to send to users
Revision 30e6fc0 - Sat, 3 Sep 2011 14:13:14 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision fe1c5d4 - Sat, 3 Sep 2011 14:10:48 -0400 - Bug #1328 - Fixed fantasy to re-split message parameters correctly
Revision fa5ba63 - Sat, 3 Sep 2011 13:44:20 +0100 - Fixed a typo in the OperServ Global command
Revision 073db54 - Sat, 3 Sep 2011 01:29:57 -0400 - Added permission check in cs_sync
Revision ef10b5a - Sat, 3 Sep 2011 06:58:49 +0200 - Fixed operserv global
Revision 1c5ff92 - Mon, 29 Aug 2011 17:08:26 -0400 - Changed a few fatal exceptions to shutdown a bit more gracefully
Revision b24ea29 - Mon, 29 Aug 2011 16:13:37 -0400 - Fixed the /ms del message sent to users when they use /ms read
Revision 5cf3ddb - Mon, 29 Aug 2011 16:03:33 -0400 - Made config rehashing not wipe opers configured with opersev/oper
Revision 1e1a41f - Sat, 27 Aug 2011 20:58:09 -0400 - Added missing ` in docs/LANGUAGE
Revision 28e8190 - Sat, 27 Aug 2011 20:47:30 -0400 - Fixed some cmake warnings
Revision 670c928 - Sat, 27 Aug 2011 17:13:28 -0400 - Tweaked the access operators to allow superadmins to be > channel founders
Revision d07a692 - Sat, 27 Aug 2011 16:52:07 -0400 - Fixed /cs clone to set botmodes on the botserv bot when cloning channels
Revision bb52530 - Sat, 27 Aug 2011 16:45:14 -0400 - Fixed mlock with param modes if you change (but not unset) the mode
Revision 309dfa3 - Sat, 27 Aug 2011 16:14:04 -0400 - Fixed a few mysql problems, including bug #1326
Revision 5c57f5a - Sat, 27 Aug 2011 15:34:09 -0400 - Fixed /ns logout on other users
Revision a36e575 - Thu, 25 Aug 2011 19:01:40 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 8702031 - Thu, 25 Aug 2011 19:01:01 -0400 - Set the creator of default mlocks to the channel founder when a channel is registered
Revision 1571508 - Thu, 25 Aug 2011 10:16:56 +0200 - Only match users against the more "serious" extbans (ones which prevent users from joining)
Revision 6dacec2 - Wed, 24 Aug 2011 21:11:23 +0200 - guested nicks are now logged out from the recovered account on /nickserv recover
Revision fdbbea2 - Wed, 24 Aug 2011 14:27:01 -0400 - Fixed cs_set_misc
Revision dffed5a - Wed, 24 Aug 2011 13:57:56 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 5d681a7 - Wed, 24 Aug 2011 13:56:48 -0400 - Clear NS_HELD from nicks when recover expiry is up
Revision d80e00f - Wed, 24 Aug 2011 13:57:40 +0200 - Fixed automatic fingerprint identify on nickchange between registered nicks
Revision 21a8bff - Tue, 23 Aug 2011 19:04:27 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision fb14f77 - Tue, 23 Aug 2011 19:03:04 -0400 - Set os_session as having first priority for events
Revision 2284c31 - Tue, 23 Aug 2011 11:42:40 +0200 - Replaced some chanserv/forbid with operserv/forbid in example.conf and added a check for ForceForbidReason in os_forbid
Revision b5b2c42 - Mon, 22 Aug 2011 17:14:18 -0400 - Removed this ondeleteobject event, was for m_async_commands which died
Revision a2f92b6 - Mon, 22 Aug 2011 13:14:08 -0400 - Fixed the db_mysql metadata load events to use the right keys
Revision c996356 - Sun, 21 Aug 2011 16:35:22 -0400 - Bugs #1321 & 1322
Revision d71ae41 - Sun, 21 Aug 2011 14:54:06 -0400 - Fixed /cs access add log message to not show override for channel founders
Revision 68a125b - Sun, 21 Aug 2011 14:33:11 -0400 - Fixed ns_set_misc and cs_set_misc to allow unsetting values
Revision 37c7ca8 - Sun, 21 Aug 2011 14:09:55 -0400 - Fixed AddAkiller
Revision 4663970 - Sat, 20 Aug 2011 00:57:35 -0400 - Removed m_async_commands, it can still cause crashes from invalid pointers on the stack & is a giant mess anyway
Revision a68d17c - Sat, 20 Aug 2011 00:51:39 -0400 - Moved the ERROR log message out of debug
Revision fa3b74a - Sat, 20 Aug 2011 00:50:26 -0400 - Fixed zlines to only add the xline host, fixed db_mysql's write function, and prevent adding multiple of the same nick to access lists
Revision fd999b9 - Fri, 19 Aug 2011 16:14:26 -0400 - Fixed some problems with deleting access
Revision b4f5724 - Fri, 19 Aug 2011 04:20:11 -0400 - Fixed AccessGroup::operator> fail
Revision abdc69a - Fri, 19 Aug 2011 09:07:19 +0200 - added some log message for automatic fingerprint identify and removed a unused function from ns_cert
Revision 1b02216 - Thu, 18 Aug 2011 23:08:27 -0400 - Fixed crash in /cs mode
Revision db340f9 - Thu, 18 Aug 2011 22:04:59 -0400 - Fixed some permission checking fail in modules that got messed up from the big commands sed
Revision 0cdca53 - Thu, 18 Aug 2011 17:30:49 -0400 - Moved CA_TOPIC to qop aswell. Newer channels (default) to TOPIC at 5 but older channels will remain at founder only, causing access list to think newer aop are level 10000 due to having this permission on older channels.
Revision 71b9bbd - Thu, 18 Aug 2011 16:48:51 -0400 - Bug #1315 - moved CA_ASSIGN permission from sop to qop
Revision 2f3969b - Thu, 18 Aug 2011 07:59:58 +0200 - Bug #1317 - fixed sha1 fingerprint hashes in the inspircd protocol modules
Revision ff7479f - Thu, 18 Aug 2011 00:47:34 -0400 - Fixed attaching to events in db_mysql & possibly having ChannelInfo::WhoSends return NULL if there really are *no* bots
Revision 487d828 - Wed, 17 Aug 2011 22:05:47 -0400 - Actually made the nickserv block optional
Revision f41081b - Wed, 17 Aug 2011 21:41:30 -0400 - Include when an access entry was created in access view
Revision ede910d - Wed, 17 Aug 2011 15:56:40 -0400 - Made /os oper info also show all inherited commands/privs
Revision 0f4c9a4 - Tue, 16 Aug 2011 16:38:42 -0400 - List supported languages in /ns help saset language
Revision 9aa414b - Tue, 16 Aug 2011 15:28:21 -0400 - Fixed matching acount access entries against nicknames
Revision 2d9ddb0 - Tue, 16 Aug 2011 13:43:01 -0400 - Bug #1316 - added permissions for hs_request commands
Revision 1f542e1 - Tue, 16 Aug 2011 00:16:00 -0400 - Moved cs_seens data purger log message to debug
Revision 68e0d99 - Tue, 16 Aug 2011 00:09:09 -0400 - Fixed select()ing 0 sockets on Windows
Revision f43287f - Sun, 14 Aug 2011 22:10:17 -0400 - Fixed grammar problem in cs_clone
Revision 2e7bd64 - Sun, 14 Aug 2011 21:46:14 -0400 - Fixed /cs clone access
Revision 786397f - Sun, 14 Aug 2011 21:33:07 -0400 - Massive cleanup of cs_seen, added help, syntax messages, command descriptions, removed lots of dead code, fixed memory leaks, etc
Revision 960c339 - Sun, 14 Aug 2011 18:50:22 -0400 - Brought back the old 1.7 behavior of a level -1 matching all users and 0 matching all identified users
Revision fddb230 - Sun, 14 Aug 2011 17:01:28 -0400 - Bug #1312, fixed loading autoowner from db_plain
Revision 1b8dc4d - Sun, 14 Aug 2011 16:34:20 -0400 - Fixed updating exceptions
Revision fcc03f4 - Sun, 14 Aug 2011 15:59:14 -0400 - Do not put users hosts in session akills
Revision 78b8b30 - Sun, 14 Aug 2011 15:27:20 -0400 - Fixed resolving hosts when connecting to our uplink
Revision 91d8cc4 - Sun, 14 Aug 2011 15:25:02 -0400 - Revert "Fixed resolving hosts on connect"
Revision 11619be - Sun, 14 Aug 2011 21:21:50 +0200 - Fixed resolving hosts on connect
Revision e767ded - Sun, 14 Aug 2011 01:01:38 -0400 - Fixed default settings for log blocks
Revision 83a579f - Sat, 13 Aug 2011 23:05:30 -0400 - Fixed number list position when requesting custom lists from akill
Revision 244f879 - Sat, 13 Aug 2011 20:00:45 +0200 - Fixed permission check in botserv set
Revision 6f0da68 - Sat, 13 Aug 2011 09:43:38 -0400 - Fixed anope_os_core insert statement
Revision af43852 - Sat, 13 Aug 2011 09:27:42 -0400 - Fixed /cs saset noexpire syntax
Revision ad4c4e4 - Fri, 12 Aug 2011 13:08:53 -0400 - Send replies back to uses after m_ldap_authentication processes
Revision ed33a4f - Fri, 12 Aug 2011 12:48:29 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision f3d7d4e - Fri, 12 Aug 2011 12:46:11 -0400 - Track when our clients are introduced or not
Revision bd4916e - Fri, 12 Aug 2011 14:54:31 +0200 - Fixed loading/saving XLines in db_plain
Revision feee50e - Fri, 12 Aug 2011 03:13:56 -0400 - Allow bot usermodes to be configurable
Revision 54710a7 - Fri, 12 Aug 2011 01:51:14 -0400 - Removed the unused ChannelModeBan code
Revision d44a1d0 - Thu, 11 Aug 2011 23:10:08 -0400 - Fixed Windows runtime problems
Revision c2780e1 - Thu, 11 Aug 2011 22:21:40 +0200 - Added a separate field for last seen realhost to ns_info, shown to services admins only
Revision 4e1f54f - Thu, 11 Aug 2011 07:03:20 +0200 - added cs_seen
Revision 3755bf5 - Wed, 10 Aug 2011 15:50:45 -0400 - Ignore SIGPIPE
Revision 25d422d - Wed, 10 Aug 2011 15:47:02 -0400 - Fixed flags +* and -*
Revision 697bc8d - Wed, 10 Aug 2011 05:05:09 -0400 - Added a services.host define to easily change every clients hostname
Revision 4bdc982 - Wed, 10 Aug 2011 01:34:14 -0400 - Added two missing files
Revision ded98ed - Wed, 10 Aug 2011 01:32:07 -0400 - Fixed windows build
Revision 13bcc4e - Wed, 10 Aug 2011 00:28:31 -0400 - Replace the old sigaction for a signal when our Signal destructs
Revision ce92c9b - Tue, 9 Aug 2011 22:18:31 -0400 - Remove +P from unregistered channels if persist is set
Revision b332fbd - Tue, 9 Aug 2011 18:34:17 -0400 - Fixed parsing TMODE on ratbox
Revision eaf4e69 - Tue, 9 Aug 2011 17:07:20 -0400 - Updated Changes
Revision 2f67c70 - Tue, 9 Aug 2011 16:38:10 +0200 - fixed the operserv forbid del command
Revision 8348392 - Tue, 9 Aug 2011 13:36:33 +0200 - fixed wrong syntax-message for botserv set msg
Revision 8116ad9 - Tue, 9 Aug 2011 04:38:35 -0400 - Added forgotten founder checks to cs_access, fixed fantasy replies to come from the right service, and fixed the accessgroup operators to acount for founder/superadmin
Revision cb74359 - Tue, 9 Aug 2011 01:56:08 -0400 - Fixed a typo in init.cpp
Revision 776583a - Tue, 9 Aug 2011 01:55:34 -0400 - Simiplied a bit of the access system
Revision 91c3363 - Tue, 9 Aug 2011 00:06:44 -0400 - Hopefully sort this AccessGroup::HasPriv once and for all
Revision b7542fd - Mon, 8 Aug 2011 23:41:03 -0400 - Added a few sanity checks which never really should happen to db-convert
Revision 0c860a7 - Mon, 8 Aug 2011 23:32:52 -0400 - Fixed CMakeLists.txt detecting epoll
Revision 2d591f7 - Mon, 8 Aug 2011 20:34:27 -0400 - When we split from the uplink send a quit for *all* of our clients not just bots
Revision 9cb96f3 - Mon, 8 Aug 2011 06:24:29 +0100 - Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Revision 286a9ed - Mon, 8 Aug 2011 06:19:35 +0100 - Standardized some of the SyntaxError/Help replies and corrected some syntax in BotServ set
Revision c4da496 - Mon, 8 Aug 2011 00:32:09 -0400 - Copy modules to the runtime directory in one big read/write if we can instead of this 1 byte at a time thing, significantly improves startup loading time.
Revision ade9239 - Sun, 7 Aug 2011 22:34:16 -0400 - Fixed the pipengines
Revision c6741d3 - Sun, 7 Aug 2011 19:04:27 -0400 - Always reset the levels of newly created channels, fixed DetermineLevel matching ACCESS_INVALID levels, and added in a disabled config option for levels
Revision 25e3408 - Sun, 7 Aug 2011 17:43:23 -0400 - Fixed generating sid on startup
Revision 35588cc - Sun, 7 Aug 2011 16:04:40 -0400 - Made botserv bots with no commands just ignore messages to them, and made bots only tell users to use HELP if they have a HELP command
Revision 32bb63f - Sun, 7 Aug 2011 15:56:35 -0400 - Updated tables.sql
Revision 27912e1 - Sat, 6 Aug 2011 19:43:06 -0400 - Fixed two of the xop log messages
Revision b678aa6 - Sat, 6 Aug 2011 19:41:37 -0400 - Give channel founders +qo by default
Revision c3e9fc4 - Sat, 6 Aug 2011 18:33:44 -0400 - Show channel founders their channels in /ns alist
Revision 66ab59d - Sat, 6 Aug 2011 18:21:59 -0400 - Fixed loading older access entries
Revision deb79e8 - Sat, 6 Aug 2011 18:05:16 -0400 - sed'd a few typos
Revision a6dd65f - Sat, 6 Aug 2011 17:33:59 -0400 - Fixed suepradmin
Revision 0448e38 - Sat, 6 Aug 2011 16:49:55 -0400 - Document what /os oline does
Revision 749de00 - Sat, 6 Aug 2011 04:32:50 -0400 - Update last used times on channels when someone with access uses them
Revision 7849667 - Sat, 6 Aug 2011 04:16:10 -0400 - Added a define{} block which can be used to easially rename things
Revision e03efde - Sat, 6 Aug 2011 00:31:24 +0100 - Fixed ns_ajoin to check if adding a duplicate channel
Revision d6a8d27 - Fri, 5 Aug 2011 16:07:41 +0100 - Fixed an error and typo in CS SET OPNOTICE
Revision 5e18a72 - Fri, 5 Aug 2011 06:18:38 -0400 - Mark the new commands/ modules as CORE and fixed a typo in the example.conf
Revision e66063e - Fri, 5 Aug 2011 05:35:31 -0400 - Rewrote the example configurations and split them up into seperate files for each pseudo client.
Revision 9ec18a3 - Thu, 4 Aug 2011 21:59:01 -0400 - Added a command:permission setting
Revision 773a1f3 - Thu, 4 Aug 2011 16:41:36 -0400 - Updated a bit of the TODO
Revision b3f4ba0 - Wed, 3 Aug 2011 06:09:27 -0400 - Start the ts6 sid generator off at 00A if none is given
Revision 34da226 - Wed, 3 Aug 2011 05:54:03 -0400 - Generate random SIDs for us if one is not specified
Revision 16280f4 - Wed, 3 Aug 2011 05:42:41 -0400 - Added operserv/kill and removed version.h from .gitignore
Revision 42f954f - Tue, 2 Aug 2011 22:39:14 -0400 - Fixed reintroducing our clients if we disconnect and reconnect to the uplink
Revision 09f5591 - Tue, 2 Aug 2011 05:07:59 -0400 - Fixed /cs clone copying channel access, fixed restricted, and fixed some compiler warnings
Revision f690cd8 - Tue, 2 Aug 2011 02:02:13 -0400 - Made /ns info default to your account or your nick if no arguments are given
Revision d43e1fb - Tue, 2 Aug 2011 01:50:09 -0400 - Added opertype:modes
Revision 41b40f6 - Mon, 1 Aug 2011 23:42:20 -0400 - Split /os mode into /os mode and /os umode to make giving permission to just one possible
Revision f7adc0b - Mon, 1 Aug 2011 22:37:27 -0400 - Rewrote the access systems and added a flags access system
Revision 710c02f - Sun, 31 Jul 2011 19:11:26 +0100 - Fixed bug #1301 - Changed operserv/staff to reflect its renaming to operserv/oper
Revision 7f69d2b - Sun, 31 Jul 2011 14:41:59 +0100 - Fixed bug #1300
Revision a18e3f3 - Sun, 31 Jul 2011 07:00:27 -0400 - Bugs 1297-1299 and made /os stats work like the help describes it does
Revision 63a4201 - Sun, 31 Jul 2011 06:24:24 -0400 - Fixed these ModuleManager::Attach calls once and for all..
Revision b751800 - Sun, 31 Jul 2011 06:24:11 -0400 - Fixed os_defcon
Revision f321491 - Sun, 31 Jul 2011 04:00:35 -0400 - Fixed error message from being unable to connect
Revision 1cb11bb - Sun, 31 Jul 2011 03:22:23 -0400 - Fixed a few small problems, including m_ssl's connect feature sometimes failing for no good reason
Revision f29c88b - Fri, 29 Jul 2011 22:50:45 +0100 - Fixed bug #1294, Crash on NS SET HIDE
Revision f5e78d7 - Thu, 28 Jul 2011 07:06:08 +0100 - Fixed a typo in the nickserv/auspex oper privilege
Revision 25c4985 - Thu, 28 Jul 2011 06:36:29 +0100 - Fixed OS LOGONNEWS
Revision cd4f6da - Wed, 27 Jul 2011 19:24:58 -0400 - Bug #1289 - Fixed hooking to delcore event in cs_main
Revision 6e032de - Wed, 27 Jul 2011 19:17:21 -0400 - Bug #1288 - Fixed crash on /cs help access
Revision e2b47e0 - Wed, 27 Jul 2011 19:06:42 -0400 - Bug #1291 - fixed parsing JOIN on ratbox
Revision b32c961 - Wed, 27 Jul 2011 16:54:50 +0100 - Show the description in cs help set instead of the syntax
Revision 088337e - Tue, 26 Jul 2011 23:18:54 -0400 - Fixed /os ignore, /os exception del, and a crash in /cs entrymsg
Revision e8c00b9 - Tue, 26 Jul 2011 05:44:14 -0400 - A few small fixes
Revision 023d4b4 - Sat, 23 Jul 2011 13:22:56 +0100 - Fixed a typo that broke CS SET RESTRICTD and re-added abbreviation for CS SET DESC
Revision 87d2f4b - Sat, 23 Jul 2011 13:07:19 +0100 - Fix couple of typos in modules
Revision 39ca53c - Sun, 17 Jul 2011 21:58:27 +0100 - Fixed hs_request and corrected a typo(?) in hs activate
Revision 46f2f3b - Sun, 17 Jul 2011 13:08:15 +0100 - Fixed some of the extra modules
Revision cb56d50 - Sun, 17 Jul 2011 06:08:35 -0400 - Fixed up cs_set_misc and ns_set_misc
Revision b19dddb - Sat, 16 Jul 2011 07:03:04 -0400 - Fixed a few of the /cs set syntax messages to reflect the new syntax
Revision acceabe - Sat, 16 Jul 2011 06:52:13 -0400 - Bug #1287 - Only check if users should be deopped on syncing channels when the user is on a server that is also syncing.
Revision c3993b3 - Thu, 14 Jul 2011 22:37:46 -0400 - Fixed appending !*@* to some access list entries that are valid hosts
Revision f277be0 - Thu, 14 Jul 2011 21:40:21 -0400 - Fixed OSOpersOnly & CSOpersOnly
Revision 1a2486d - Thu, 14 Jul 2011 20:52:24 -0400 - These .pot files don't need to be under version control
Revision a735095 - Thu, 14 Jul 2011 20:00:39 -0400 - Added cs_sync
Revision ef75e17 - Thu, 14 Jul 2011 19:11:13 -0400 - Added bs_autoassign
Revision 5bf7dee - Thu, 14 Jul 2011 18:29:03 -0400 - Made channel descriptions optional
Revision f858164 - Thu, 14 Jul 2011 02:31:12 -0400 - Rewrote how commands are handled within Anope. This allows naming commands and having spaces within command names.
Revision 924f684 - Sun, 10 Jul 2011 19:32:10 -0400 - Bug #1283 - Upped the buffer used for messge replies, as some can be really big
Revision b5ec57a - Sun, 10 Jul 2011 19:07:45 -0400 - Bug #1285 - Fixed setting -P on channels with only a service bot in it
Revision 6d97848 - Sun, 10 Jul 2011 18:27:48 -0400 - Bug #1286 - Dont allow actions to mess up the caps kicker
Revision d2832b1 - Thu, 7 Jul 2011 02:23:11 -0400 - Use getrlimit instead of ulimit, fixes freebsd build
Revision 1a4fc39 - Wed, 6 Jul 2011 22:06:07 -0400 - Do not send news when a server is syncing
Revision 97388ab - Wed, 6 Jul 2011 22:05:01 -0400 - Fixed /hs set and /hs setall not allowing only a host
Revision 57ec310 - Wed, 6 Jul 2011 05:20:25 -0400 - Only call send once per write event in dns manager
Revision ffd5c04 - Wed, 6 Jul 2011 00:33:25 -0400 - Fixed chanserv/access/modify permission on non-xop channels
Revision cc3c2b6 - Tue, 5 Jul 2011 01:39:11 -0400 - Send account data once an account is confirmed
Revision c549aa4 - Mon, 4 Jul 2011 22:39:13 -0400 - Bug #1279 - Fixed strftime
Revision 714831b - Mon, 4 Jul 2011 22:34:21 -0400 - Bug #1282
Revision d6879c4 - Mon, 4 Jul 2011 14:25:13 -0400 - Bug #1280 - Fixed reading some na and bi flags in db_plain
Revision 2caf586 - Sun, 3 Jul 2011 00:19:54 -0400 - Clean up some of the dns code, udp is connectionless anyway so this isnt required
Revision c585964 - Mon, 27 Jun 2011 19:14:30 -0400 - Fixed the mode manager from complaining about prefixless modes on insp20
Revision 936a50d - Mon, 27 Jun 2011 15:35:09 -0400 - Fixed build on older cmake versions
Revision 3e98880 - Fri, 24 Jun 2011 03:40:18 -0400 - Fixed mail delay time
Revision 821826a - Fri, 24 Jun 2011 02:58:40 -0400 - The other part of #1277
Revision 7ec803f - Thu, 23 Jun 2011 15:31:57 -0400 - Bug #1277 - Dont send account data for unconfirmed nicks
Revision b1a075b - Thu, 23 Jun 2011 15:10:50 -0400 - Fixed bug #1276 and some other valgrind warnings
Revision 3be75cb - Mon, 20 Jun 2011 23:28:25 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 2667f90 - Mon, 20 Jun 2011 23:25:46 -0400 - Cleaned up some of the logger code which fixes not logging debug logs to files etc when debug is enabled, and some other small things
Revision 2601871 - Mon, 20 Jun 2011 23:09:03 -0400 - Fix long-standing issue with the get token functions if the delimiter wasn't found in the string but you wanted the first "token".
Revision a3d0ab3 - Mon, 20 Jun 2011 23:00:49 -0400 - Use case insensitive matching when looking up servers by name
Revision a1b36ec - Fri, 17 Jun 2011 19:57:43 -0400 - Search all domains for language strings, fixes the mess that we used to use to translate strings in 3rd party modules
Revision 48e995d - Fri, 17 Jun 2011 13:34:47 -0400 - Bug #1275 - Don't log absolutely everything sent to operserv, most of its commands already have their own logs
Revision df971be - Tue, 14 Jun 2011 18:23:53 -0400 - Fixed a few small things
Revision 1cd6587 - Mon, 13 Jun 2011 18:20:22 +0200 - changed some _() to gtl() and updated do_strftime() and duration()
Revision 6148ffa - Sun, 12 Jun 2011 06:28:22 +0200 - added a Anope::string::capacity() function
Revision 717b4c3 - Thu, 9 Jun 2011 06:16:31 +0200 - small improvement for Timer::SetSecs()
Revision 74361be - Tue, 7 Jun 2011 06:16:57 +0200 - added a Timer::SetSecs() function
Revision a087e7f - Sun, 5 Jun 2011 18:18:50 -0400 - Fixed clearing bandata
Revision 3ad93a3 - Thu, 2 Jun 2011 14:59:34 -0400 - Burst our channels with the uplink when we connect & fixed bug #1274
Revision 184b346 - Thu, 2 Jun 2011 12:45:08 -0400 - Place version.h in build/ not include/
Revision b2c807d - Mon, 30 May 2011 13:14:33 -0400 - Fixed /ns alist
Revision 60548aa - Sun, 29 May 2011 19:05:28 -0400 - Fixed ns_update and db_mysql_live sql queries
Revision a45d155 - Mon, 23 May 2011 14:47:14 -0400 - Added an IsServicesOper event
Revision 121ae0b - Mon, 23 May 2011 13:32:01 -0400 - Added m_statusupdate
Revision 8bf8832 - Mon, 23 May 2011 04:41:51 -0400 - Rewrote the signal handling to use sigaction
Revision 4dd7e26 - Sun, 22 May 2011 09:05:21 +0200 - fixed a possible crash on database saving
Revision f4329df - Sat, 21 May 2011 15:33:10 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 98729a6 - Sat, 21 May 2011 15:32:47 -0400 - Bug #1271
Revision 742ba97 - Sat, 21 May 2011 15:15:46 +0200 - fixed bug #1272
Revision 115f94b - Sat, 21 May 2011 04:57:27 -0400 - Made Anope able to process normally when disconnected from the uplink and not sleep(), enable usage of non-blocking connect() and default all sockets to non blocking mode. Some cleanup to m_ssl and some cleanup to main.cpp.
Revision 7e57272 - Thu, 19 May 2011 20:36:39 -0400 - Fixed compile from the earlier merge
Revision 13915d8 - Mon, 16 May 2011 04:10:18 -0400 - Modularized os_news
Revision 9962fae - Mon, 16 May 2011 04:10:18 -0400 - Calculate nc::channelcount at runtime
Revision 9fcbe29 - Mon, 16 May 2011 04:10:18 -0400 - Added os_oper
Revision fd4b52e - Mon, 16 May 2011 04:10:18 -0400 - Added os_forbid
Revision b59602a - Mon, 16 May 2011 04:10:18 -0400 - Check for a valid server in /operserv noop
Revision fd21c36 - Mon, 16 May 2011 04:10:18 -0400 - Fixed some logic fail in ts6_uid_retrieve
Revision b999c6c - Mon, 16 May 2011 04:10:15 -0400 - Expand more on m_alias and changed some std::string usage in sockets.cpp to use Anope::string
Revision 583954d - Mon, 16 May 2011 04:09:32 -0400 - Use module type to determine what type each module is instead of its location in the configuration file.
Revision 8fb1604 - Mon, 16 May 2011 04:09:07 -0400 - Fixed reading empty config values in the multiconfig code, caused by removal of DT_CHARPTR
Revision 284af25 - Mon, 16 May 2011 04:09:07 -0400 - Added more useful functions to our LDAP API, allow adding newly registered accounts to LDAP, removed some unnecessary OnPre events and fixed unloading all modules
Revision e7887c1 - Mon, 16 May 2011 04:08:47 -0400 - Unmodularized the socket engine because its causing problems and really is unnecessary
Revision 076ebaf - Mon, 16 May 2011 04:07:56 -0400 - Moved some global functions to be member functions and misc cleanup
Revision 6922bd2 - Mon, 16 May 2011 04:07:30 -0400 - Fixed up the MySQL Query code and finished some command code I forgot earlier
Revision 13aa58c - Mon, 16 May 2011 04:06:22 -0400 - Removed DT_CHARPTR from the config reader, its unneeded
Revision c8c2315 - Mon, 16 May 2011 04:06:17 -0400 - Moved the core pseudo clients out into their own modules
Revision 1782ce2 - Mon, 16 May 2011 04:01:50 -0400 - Use std::map instead of unordered_map
Revision b28d374 - Mon, 16 May 2011 04:01:46 -0400 - Branch for 1.9.5
Revision 3f3657a - Sat, 27 Aug 2011 21:11:01 -0400 - Fixed windows build
Revision 49b81a5 - Sat, 27 Aug 2011 21:05:48 -0400 - Update changes.conf, bump version to 1.9.4-p1-git
Revision 99e4eae - Sat, 27 Aug 2011 15:35:09 -0400 - Fixed /ns logout on other users
Revision 232af7f - Sun, 21 Aug 2011 14:56:53 -0400 - Moved the ERROR log message out of debug (cherry picked from commit a68d17c17e904881b580d29290ae37bb2627b51b)
Revision 9c8a789 - Thu, 18 Aug 2011 00:46:17 -0400 - Fixed ns alist min level
Revision 389341b - Sat, 13 Aug 2011 21:59:12 -0400 - Fixed number list position when requesting custom lists from akill and sqline
Revision 949f869 - Wed, 10 Aug 2011 17:36:24 -0400 - Use case insensitive matching for server names
Revision 8d551f2 - Tue, 9 Aug 2011 18:37:33 -0400 - Fixed crash in /ns set
Revision 962002b - Tue, 9 Aug 2011 18:36:23 -0400 - Fixed JOIN on plexus & fixed UMODE_NETADMIN
Revision 1ce0199 - Tue, 9 Aug 2011 17:50:15 -0400 - Fixed build
Revision 5d6f4cf - Tue, 9 Aug 2011 17:39:25 -0400 - Added a few sanity checks which never really should happen to db-convert (cherry picked from commit b7542fd6f29b5fec45314dbf65f599c5bd2b3650)
Revision 2b03500 - Tue, 9 Aug 2011 17:38:32 -0400 - Updated TODO
Revision 4d6b824 - Tue, 9 Aug 2011 17:37:12 -0400 - Made /os stats work like the help describes
Revision 389dde0 - Tue, 9 Aug 2011 17:29:38 -0400 - Bug #1291 - fixed parsing JOIN on ratbox (cherry picked from commit e2b47e001fe0f4560bbf050964d9e60d20cb4e2b)
Revision 59fad58 - Tue, 9 Aug 2011 17:29:14 -0400 - Fixed nickserv help output
Revision d5d2a31 - Tue, 9 Aug 2011 17:27:39 -0400 - Fixed appending diff@* to some access list entries that are valid hosts
Revision 7f4eb85 - Tue, 9 Aug 2011 17:25:40 -0400 - Bug #1285 - Fixed setting -P on channels with only a service bot in it (cherry picked from commit b5ec57a3f9fdc9e7c7321392082dec0d475c623c)
Revision e9ce53f - Tue, 9 Aug 2011 17:25:22 -0400 - Use getrlimit instead of ulimit, fixes freebsd build of poll()
Revision 7c06078 - Tue, 9 Aug 2011 17:24:02 -0400 - Do not send news when a server is syncing
Revision 205eb1c - Tue, 9 Aug 2011 17:22:50 -0400 - Fixed chanserv/access/modify permission on non-xop channels (cherry picked from commit ffd5c045e4018849c3ff7084955d50c0f852d00b)
Revision 11fdf16 - Tue, 9 Aug 2011 17:22:31 -0400 - Send account data once an account is confirmed (cherry picked from commit cc3c2b6999fa58a1be791b1ace1f4e7dc83cf9ec)
Revision 0c47383 - Tue, 9 Aug 2011 17:21:58 -0400 - Fixed mail delay time (cherry picked from commit 3e9888092a7859dbf2c7b1cc6baffa192a007132)
Revision fa9f6a3 - Tue, 9 Aug 2011 17:21:28 -0400 - Fixed sending account data for unconfirmed accounts
Revision 6574bca - Tue, 9 Aug 2011 17:14:23 -0400 - Fixed destructing bots with commands and fixed quitting services enforcers
Revision ae72c25 - Tue, 9 Aug 2011 17:12:56 -0400 - Bugs #1271 and #1272
Revision 469a04e - Mon, 16 May 2011 02:58:06 -0400 - Anope 1.9.4 Release
Revision 605b5d5 - Mon, 16 May 2011 02:57:28 -0400 - Removed ngircd as we've decided not to support it at this time
Revision f7aa46f - Mon, 16 May 2011 02:47:23 -0400 - Note m_async_commands is experimental
+17 -17
View File
@@ -1,20 +1,20 @@
Anope Version 1.9.5
--------------------
A Extended LDAP support
A Added os_oper, os_kill, os_forbid, m_statusupdate, cs_sync, and bs_autoassign
A Added a new configuration file format
A Added a new commands system
A Added a new access system, and cs_flags
F Fixed not logging debug logs to file
F Fixed the mail delay time
F Fixed sending account data for unconfirmed nicks
F Fixed poll() engine build on FreeBSD
F Fixed really large HELP replies being truncated
F Fixed sometimes appending !*@* to valid hosts on access lists
F Fixed m_ssl sometimes failing connecting for no reason
F Fixed crash in cs_entrymsg
F Fixed setting -P on channels with only a botserv bot in it
F Fixed modemanager complaining about prefixless modes on InspIRCd
Anope Version 1.9.4-p1
---------------------
F Fixed using /ns logout on other users
F Fixed number list position when requesting /os akill list and /os sqline list
F Fixed server matching to be case insensitive
F Fixed a crash in /ns set
F Fixed parsing TMODE on ratbox
F Fixed parsing JOIN on ratbox and plexus
F Fixed nickserv help output
F Fixed appending !*@* to some access list entries
F Fixed setting -P on channels with only a service bot in it
F Fixed freebsd build of poll engine
F Fixed the chanserv/access/modify permission to work on non-xop channels
F Fixed the mail delay error message to show the correct time
F Fixed sending account data for unconfirmed nicks on InspIRCd
F Fixed deleting bots sometimes causing crashes/other weird behaviors
F Fixed /ms ignore syntax errors
Anope Version 1.9.4
--------------------
-4
View File
@@ -1,7 +1,3 @@
Anope Version 1.9.5
-------------------
Don't even try it, get a new config and start over.
Anope Version 1.9.4
-------------------
** ADDED CONFIGURATION DIRECTIVES **
+6 -13
View File
@@ -7,7 +7,7 @@ Anope Mutli Language Support
1) Building Anope with gettext support
To build Anope with gettext support, gettext and its development libraries must be installed on the system.
To build Anope with gettext support gettext and its devlopmental libraries must be installed on the system.
Anope does not require locales to be installed or enabled on the system, but does require the locales-all
package on Debian and Debian based systems.
@@ -32,15 +32,8 @@ Anope Mutli Language Support
3) Using langages with modules
Module authors can easially add the ability to have their modules translated by adding _() around the strings they
want translated (messages to the user, etc).
If you want to translate a module someone has made, first generate a .pot file if there isn't one already using
`xgettext -s -d modulename -o modulename.pot --from-code=utf-8 modulename.cpp`.
The .pot file is a template of all of the language strings extracted from the source file.
Next, run msginit on the .pot file with
`msginit -l language -o modulename.language.po -i modulename.pot`.
Translate the new .po file and rerun ./Config; make && make install.
All .po and .pot files should be placed in modules/language/third. Additionally an update script is provided there
that will create .pot files and merge any changes to it with existing .po files.
need translated (messages to the user, etc). See a few of the modules in /modules/extras (cs_appendtopic, hs_request)
for examples of this. If you want to translate a module someone has made, first generate a .pot file if there is none.
Run `xgettext -s -d modulename -o modulename.pot --from-code=utf-8 modulename.cpp`. Then, run msginit on the .pot file
with `msginit -l language -o modulename.language.po -i modulename.pot`. Translate the new .po file, then place it in
the lang folder and rerun ./Config; make && make install.
+31
View File
@@ -116,6 +116,37 @@ Table of Contents
* Christopher N. <saka@epiknet.org> (fr.l)
* Yusuf Kurekci <ysfm.20@gmail.com> (tr.l)
Anope uses the strlcat() and strlcpy() functions from OpenSSH 2.5.1p2.
These functions are copyrighted by Todd C. Miller:
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
2) Presentation
Anope is a set of Services for IRC networks that allows users to manage
+25 -16
View File
@@ -3,34 +3,43 @@ Legend:
? = unsure
+ = in progress
1.9.5
1.9.4
-----
[+] More LDAP
[x] Rewrite silly forbid system
[x] Fix the modules language system to work without needing its own functions..
[x] Rewrite commands system
[x] Rewrite access system
[x] NS INFO: separate field for last seen realhost, shown to SRA only
[x] Configurable bot usermodes
[x] MS IGNORE. Make it take nick (accounts) or n!u@h masks. Fake success of memo send still, but send to opers?
[x] Allow users to delete their own access
[x] ChanServ CLONE command
[x] XMLRPC to execute commands and get data from Anope
[+] fantasy: allow replies/notifications to fantasy commands to go to the channel via notice
[x] Method to store listmodes (more generically than AKICK, too) for e.g. +beI and extbans, etc.
[x] understanding extbans for /cs unban etc.
[x] (optional?) A way to confirm email changes by users
[x] Auto identify through SSL key
[x] Optional os_login system that can also use SSL keys.
[x] os_info module to show useful configuration settings to services opers.
[x] Remove nick requests. Instead use an unconfirmed nick group which cant recieve umode +r and auto expires after 1d?
[x] LDAP
Future
------
[ ] NS IDENTIFY changes
[?] Last failed identify? Maybe more useful for sopers only, so users don't get unnecessarily worried
[?] Last successful login time/ip? perhaps both of these should be a new nick setting
[ ] NS INFO: seperate field for last seen realhost, shown to SRA only
[ ] NS SUSPEND: show suspender and reason, probably to sopers only (see CS SUSPEND)
[ ] Allow channel founders to change the fantasy trigger for their channel.
[+] CIDR Akills, session exceptions, etc
[ ] CIDR Akills, session exceptions, etc
[?] Language charset stuff, including collation (1.9.1? phoenix?)
[?] a way for a module to queue itself (or even another module) for unloading
[+] Useful/common "third party" modules to core distro
[x] NS AJOIN
[ ] Useful/common "third party" modules to core distro
[ ] NS AJOIN
[x] CS ENTRYMSG
[?] Don't allow soper accounts to expire
[?] Reason for CS SET RESTRICTED
[ ] Unique IDs on each AKILL/blah so that networks may use them as ticket IDs
[x] AKILL/SGLINE/etc..
[x] Setter
[x] Time added
[+] Time modified (can they be modified?)
[x] Time until expiry/expiry time (YES, time until expiry *instead of* expiry time, more human)
[x] Reason
[ ] Unique IDs on each AKILL/blah so that networks may use them as ticket IDs
[ ] HS ACTIVATE -ALL (rob sez this all needs reviewing)
[ ] No nickname ownership?
[ ] More commands need to be split up such as /bs bot, /ms set, /bs kick, /bs set, /os set? etc.
[ ] Customize email messages
+4 -5
View File
@@ -4,10 +4,9 @@ set_source_files_properties(version.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "$
add_executable(version version.cpp)
set_target_properties(version PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
get_target_property(version_BINARY version LOCATION)
# Modify version.h from the above executable, with dependencies to version.cpp
# and all of the source files in the main build
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_build
COMMAND ${version_BINARY} ${Anope_SOURCE_DIR}/src/version.sh ${CMAKE_CURRENT_BINARY_DIR}/version.h
# Modify version.h from the above executable, with dependencies to the given headers, version.cpp, and all source files in the main Anope build
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
COMMAND ${version_BINARY} ${Anope_SOURCE_DIR}/src/version.sh ${CMAKE_CURRENT_SOURCE_DIR}/version.h
DEPENDS version ${SRC_SRCS}
)
# Add version to list of files for CPack to ignore
@@ -45,4 +44,4 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif(CMAKE_COMPILER_IS_GNUCXX)
# Add a custom target to the above file
add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH})
add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version.h ${PCH_SOURCES_GCH})
-94
View File
@@ -1,94 +0,0 @@
#ifndef ACCESS_H
#define ACCESS_H
enum ChannelAccess
{
CA_ACCESS_LIST,
CA_NOKICK,
CA_FANTASIA,
CA_GREET,
CA_AUTOVOICE,
CA_VOICEME,
CA_VOICE,
CA_INFO,
CA_SAY,
CA_AUTOHALFOP,
CA_HALFOPME,
CA_HALFOP,
CA_KICK,
CA_SIGNKICK,
CA_BAN,
CA_TOPIC,
CA_MODE,
CA_GETKEY,
CA_INVITE,
CA_UNBAN,
CA_AUTOOP,
CA_OPDEOPME,
CA_OPDEOP,
CA_AUTOPROTECT,
CA_AKICK,
CA_BADWORDS,
CA_ASSIGN,
CA_MEMO,
CA_ACCESS_CHANGE,
CA_PROTECTME,
CA_PROTECT,
CA_SET,
CA_AUTOOWNER,
CA_OWNERME,
CA_OWNER,
CA_FOUNDER,
CA_SIZE
};
class ChanAccess;
class CoreExport AccessProvider : public Service
{
public:
AccessProvider(Module *o, const Anope::string &n);
virtual ~AccessProvider();
virtual ChanAccess *Create() = 0;
};
class CoreExport ChanAccess
{
public:
AccessProvider *provider;
ChannelInfo *ci;
Anope::string mask;
Anope::string creator;
time_t last_seen;
time_t created;
ChanAccess(AccessProvider *p);
virtual ~ChanAccess();
virtual bool Matches(User *u, NickCore *nc) = 0;
virtual bool HasPriv(ChannelAccess priv) = 0;
virtual Anope::string Serialize() = 0;
virtual void Unserialize(const Anope::string &data) = 0;
bool operator>(ChanAccess &other);
bool operator<(ChanAccess &other);
bool operator>=(ChanAccess &other);
bool operator<=(ChanAccess &other);
};
class CoreExport AccessGroup : public std::vector<ChanAccess *>
{
public:
ChannelInfo *ci;
NickCore *nc;
bool SuperAdmin, Founder;
AccessGroup();
bool HasPriv(ChannelAccess priv) const;
ChanAccess *Highest() const;
bool operator>(const AccessGroup &other) const;
bool operator<(const AccessGroup &other) const;
bool operator>=(const AccessGroup &other) const;
bool operator<=(const AccessGroup &other) const;
};
#endif
+7 -20
View File
@@ -6,8 +6,8 @@
class NickAlias;
class NickCore;
typedef Anope::insensitive_map<NickAlias *> nickalias_map;
typedef Anope::insensitive_map<NickCore *> nickcore_map;
typedef unordered_map_namespace::unordered_map<Anope::string, NickAlias *, ci::hash, std::equal_to<ci::string> > nickalias_map;
typedef unordered_map_namespace::unordered_map<Anope::string, NickCore *, ci::hash, std::equal_to<ci::string> > nickcore_map;
extern CoreExport nickalias_map NickAliasList;
extern CoreExport nickcore_map NickCoreList;
@@ -20,6 +20,8 @@ enum NickNameFlag
{
NS_BEGIN,
/* Nick may not be registered or used */
NS_FORBIDDEN,
/* Nick never expires */
NS_NO_EXPIRE,
/* This nick is being held after a kill by an enforcer client
@@ -37,7 +39,7 @@ enum NickNameFlag
};
const Anope::string NickNameFlagStrings[] = {
"BEGIN", "NO_EXPIRE", "HELD", "COLLIDED", ""
"BEGIN", "FORBIDDEN", "NO_EXPIRE", "HELD", "COLLIDED", ""
};
/** Flags set on NickCores
@@ -112,7 +114,6 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_EN
Anope::string last_quit; /* Last quit message */
Anope::string last_realname; /* Last realname */
Anope::string last_usermask; /* Last usermask */
Anope::string last_realhost; /* Last uncloaked usermask, requires nickserv/auspex to see */
time_t time_registered; /* When the nick was registered */
time_t last_seen; /* When it was seen online for the last time */
NickCore *nc; /* I'm an alias of this */
@@ -250,7 +251,7 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END
/** Timer for colliding nicks to force people off of nicknames
*/
class CoreExport NickServCollide : public Timer
class NickServCollide : public Timer
{
dynamic_reference<User> u;
Anope::string nick;
@@ -272,23 +273,9 @@ class CoreExport NickServCollide : public Timer
void Tick(time_t t);
};
/** Timers for removing HELD status from nicks.
*/
class NickServHeld : public Timer
{
dynamic_reference<NickAlias> na;
Anope::string nick;
public:
NickServHeld(NickAlias *n, long t);
~NickServHeld();
void Tick(time_t);
};
/** Timers for releasing nicks to be available for use
*/
class CoreExport NickServRelease : public User, public Timer
class NickServRelease : public User, public Timer
{
Anope::string nick;
+18 -56
View File
@@ -156,12 +156,6 @@ namespace Anope
*/
inline size_type length() const { return this->_string.length(); }
/**
* Returns the size of the currently allocated storage space in the string object.
* This can be equal or greater than the length of the string.
*/
inline size_type capacity() const { return this->_string.capacity(); }
/**
* Add a char to the end of the string.
*/
@@ -179,17 +173,6 @@ namespace Anope
inline iterator erase(const iterator &first, const iterator &last) { return this->_string.erase(first, last); }
inline void erase(size_type pos = 0, size_type n = std::string::npos) { this->_string.erase(pos, n); }
/**
* Trim leading and trailing white spaces from the string.
*/
inline void trim()
{
while (!this->_string.empty() && isspace(this->_string[0]))
this->_string.erase(this->_string.begin());
while (!this->_string.empty() && isspace(this->_string[this->_string.length() - 1]))
this->_string.erase(this->_string.length() - 1);
}
/**
* Clears the string.
*/
@@ -333,9 +316,9 @@ namespace Anope
*/
extern CoreExport bool Match(const Anope::string &str, const Anope::string &mask, bool case_sensitive = false);
/** Find a message in the message table
* @param name The name of the message were looking for
* @return NULL if we cant find it, or a pointer to the Message if we can
/** Returns a list of pointers to message handlers
* @param The message name as sent by the IRCd
* @return a vector with pointers to the messagehandlers (you can bind more than one handler to a message)
*/
extern CoreExport std::vector<Message *> FindMessage(const string &name);
@@ -352,18 +335,6 @@ namespace Anope
*/
extern CoreExport void Unhex(const Anope::string &src, Anope::string &dest);
extern CoreExport void Unhex(const Anope::string &src, char *dest);
/** Base 64 encode a string
* @param src The string to encode
* @param target Where the encoded string is placed
*/
extern CoreExport void B64Encode(const Anope::string &src, Anope::string &target);
/** Base 64 decode a string
* @param src The base64 encoded string
* @param target The plain text result
*/
extern CoreExport void B64Decode(const Anope::string &src, Anope::string &target);
/** Returns a sequence of data formatted as the format argument specifies.
** After the format parameter, the function expects at least as many
@@ -374,12 +345,7 @@ namespace Anope
*/
extern CoreExport string printf(const char *fmt, ...);
/** Return the last error code
* @return The error code
*/
extern CoreExport int LastErrorCode();
/** Return the last error, uses errno/GetLastError() to determine this
/** Return the last error, uses errno/GetLastError() to determin this
* @return An error message
*/
extern CoreExport const Anope::string LastError();
@@ -491,7 +457,7 @@ class dynamic_reference : public dynamic_reference_base
this->invalid = false;
this->ref = NULL;
}
else if (this->operator bool())
else if (ref)
ref->DelReference(this);
}
@@ -502,21 +468,7 @@ class dynamic_reference : public dynamic_reference_base
this->invalid = false;
this->ref = NULL;
}
return this->ref != NULL;
}
virtual inline operator T*()
{
if (this->operator bool())
return this->ref;
return NULL;
}
virtual inline T *operator->()
{
if (this->operator bool())
return this->ref;
return NULL;
return this->ref;
}
virtual inline void operator=(T *newref)
@@ -526,12 +478,22 @@ class dynamic_reference : public dynamic_reference_base
this->invalid = false;
this->ref = NULL;
}
else if (this->operator bool())
else if (this->ref)
this->ref->DelReference(this);
this->ref = newref;
if (this->operator bool())
if (this->ref)
this->ref->AddReference(this);
}
virtual inline T *operator->()
{
return this->ref;
}
virtual inline T *operator*()
{
return this->ref;
}
};
#endif // ANOPE_H
+5 -31
View File
@@ -8,11 +8,12 @@
#ifndef BOTS_H
#define BOTS_H
#include "commands.h"
class BotInfo;
extern CoreExport Anope::insensitive_map<BotInfo *> BotListByNick;
extern CoreExport Anope::map<BotInfo *> BotListByUID;
typedef Anope::insensitive_map<BotInfo *> botinfo_map;
/** Flags settable on a bot
*/
@@ -24,13 +25,11 @@ enum BotFlag
BI_CORE,
/* This bot can only be assigned by IRCops */
BI_PRIVATE,
/* This bot is defined in the config */
BI_CONF,
BI_END
};
static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "CONF", "" };
static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "" };
class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
{
@@ -38,26 +37,20 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
uint32 chancount;
time_t created; /* Birth date ;) */
time_t lastmsg; /* Last time we said something */
typedef Anope::insensitive_map<CommandInfo> command_map;
command_map commands; /* Commands, actual name to service name */
Anope::string botmodes; /* Modes the bot should have as configured in service:modes */
bool introduced; /* Whether or not this bot is introduced */
CommandMap Commands; /* Commands on this bot */
/** Create a new bot.
* @param nick The nickname to assign to the bot.
* @param user The ident to give the bot.
* @param host The hostname to give the bot.
* @param real The realname to give the bot.
* @param bmodes The modes to give the bot.
*/
BotInfo(const Anope::string &nick, const Anope::string &user = "", const Anope::string &host = "", const Anope::string &real = "", const Anope::string &bmodes = "");
BotInfo(const Anope::string &nick, const Anope::string &user = "", const Anope::string &host = "", const Anope::string &real = "");
/** Destroy a bot, clearing up appropriately.
*/
virtual ~BotInfo();
void GenerateUID();
/** Change the nickname for the bot.
* @param newnick The nick to change to
*/
@@ -97,25 +90,6 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
* @param reason The reason we're parting
*/
void Part(Channel *c, const Anope::string &reason = "");
/** Called when a user messages this bot
* @param u The user
* @param message The users' message
*/
virtual void OnMessage(User *u, const Anope::string &message);
/** Link a command name to a command in services
* @param cname The command name
* @param sname The service name
* @param permission Permission required to execute the command, if any
*/
void SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
/** Get command info for a command
* @param cname The command name
* @return A struct containing service name and permission
*/
CommandInfo *GetCommand(const Anope::string &cname);
};
#endif // BOTS_H
+33 -6
View File
@@ -9,12 +9,41 @@
#ifndef CHANNELS_H
#define CHANNELS_H
typedef Anope::insensitive_map<Channel *> channel_map;
typedef unordered_map_namespace::unordered_map<Anope::string, Channel *, ci::hash, std::equal_to<ci::string> > channel_map;
extern CoreExport channel_map ChannelList;
struct UserContainer : public Extensible
struct UserData
{
UserData()
{
Clear();
}
virtual ~UserData() { }
void Clear()
{
last_use = last_start = Anope::CurTime;
lines = times = 0;
lastline.clear();
}
/* Data validity */
time_t last_use;
/* for flood kicker */
int16 lines;
time_t last_start;
/* for repeat kicker */
Anope::string lastline;
int16 times;
};
struct UserContainer
{
User *user;
UserData ud;
ChannelStatus *Status;
UserContainer(User *u) : user(u) { }
@@ -25,8 +54,6 @@ typedef std::list<UserContainer *> CUserList;
enum ChannelFlag
{
/* ChanServ is currently holding the channel */
CH_INHABIT,
/* Channel still exists when emptied */
CH_PERSIST,
/* If set the channel is syncing users (channel was just created) and it should not be deleted */
@@ -35,8 +62,6 @@ enum ChannelFlag
CH_LOGCHAN
};
const Anope::string ChannelFlagString[] = { "CH_INABIT", "CH_PERSIST", "CH_SYNCING", "CH_LOGCHAN", "" };
class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
{
public:
@@ -68,6 +93,8 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
Anope::string topic_setter; /* Who set the topic */
time_t topic_time; /* When the topic was set*/
std::list<BanData *> bd;
time_t server_modetime; /* Time of last server MODE */
time_t chanserv_modetime; /* Time of last check_modes() */
int16 server_modecount; /* Number of server MODEs this second */
+59 -27
View File
@@ -18,39 +18,54 @@ class Module;
class BotInfo;
class Command;
typedef std::map<Anope::string, Command *, std::less<ci::string> > CommandMap;
/** The return value from commands.
*/
enum CommandReturn
{
MOD_CONT,
MOD_STOP
};
extern CoreExport Command *FindCommand(BotInfo *bi, const Anope::string &cmd);
extern CoreExport void mod_help_cmd(BotInfo *bi, User *u, ChannelInfo *ci, const Anope::string &cmd);
extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, ChannelInfo *ci, const Anope::string &message);
extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, ChannelInfo *ci, Command *c, const Anope::string &command, const Anope::string &message);
enum CommandFlag
{
CFLAG_ALLOW_UNREGISTERED,
CFLAG_STRIP_CHANNEL
CFLAG_ALLOW_FORBIDDEN,
CFLAG_ALLOW_SUSPENDED,
CFLAG_ALLOW_UNREGISTEREDCHANNEL,
CFLAG_STRIP_CHANNEL,
CFLAG_DISABLE_FANTASY
};
const Anope::string CommandFlagStrings[] = {
"CFLAG_ALLOW_UNREGISTERED",
"CFLAG_ALLOW_FORBIDDEN",
"CFLAG_ALLOW_SUSPENDED",
"CFLAG_ALLOW_UNREGISTEREDCHANNEL",
"CFLAG_STRIP_CHANNEL",
"CFLAG_DISABLE_FANTASY",
""
};
struct CommandInfo
{
Anope::string name;
Anope::string permission;
};
/* The source for a command */
struct CoreExport CommandSource
{
/* User executing the command */
User *u;
/* Channel the command was executed on (fantasy) */
Channel *c;
/* Channel (if applicable) */
ChannelInfo *ci;
/* The service this command is on */
BotInfo *owner;
/* The service the reply should come from, *not* necessarily the service the command is on */
BotInfo *service;
/* The actual name of the command being executed */
Anope::string command;
/* The permission of the command being executed */
Anope::string permission;
/* Whether or not this was a fantasy command */
bool fantasy;
std::list<Anope::string> reply;
@@ -62,49 +77,44 @@ struct CoreExport CommandSource
/** Every services command is a class, inheriting from Command.
*/
class CoreExport Command : public Service, public Flags<CommandFlag>
class CoreExport Command : public Flags<CommandFlag>, public Base
{
Anope::string desc;
std::vector<Anope::string> syntax;
public:
/* Maximum paramaters accepted by this command */
size_t MaxParams;
/* Minimum parameters required to use this command */
size_t MinParams;
/* Command name */
Anope::string name;
/* Permission needed to use this comand */
Anope::string permission;
/* Module which owns us */
Module *module;
/* Service this command is on */
BotInfo *service;
/** Create a new command.
* @param owner The owner of the command
* @param sname The command name
* @param min_params The minimum number of parameters the parser will require to execute this command
* @param max_params The maximum number of parameters the parser will create, after max_params, all will be combined into the last argument.
* NOTE: If max_params is not set (default), there is no limit to the max number of params.
*/
Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
Command(const Anope::string &sname, size_t min_params, size_t max_params = 0, const Anope::string &spermission = "");
virtual ~Command();
protected:
void SetDesc(const Anope::string &d);
void ClearSyntax();
void SetSyntax(const Anope::string &s);
void SendSyntax(CommandSource &);
void SendSyntax(CommandSource &, const Anope::string &syntax);
public:
/** Get the command description
* @return The commands description
*/
const Anope::string &GetDesc() const;
/** Execute this command.
* @param source The source
* @param params Command parameters
*/
virtual void Execute(CommandSource &source, const std::vector<Anope::string> &params) = 0;
virtual CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> &params) = 0;
/** Called when HELP is requsted for the client this command is on.
* @param source The source
@@ -123,6 +133,28 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
* @param subcommand The subcommand the user tried to use
*/
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand);
/** Set which command permission (e.g. chanserv/forbid) is required for this command.
* @param reststr The permission required to successfully execute this command
*/
void SetPermission(const Anope::string &reststr);
/** Add a subcommand to this command
* @param creator The creator of the subcommand
* @param c The command
*/
virtual bool AddSubcommand(Module *creator, Command *c);
/** Delete a subcommand from this command
* @param c The command
*/
virtual bool DelSubcommand(Command *c);
/** Find a subcommand
* @param name The subcommand name
* @return The subcommand
*/
virtual Command *FindSubcommand(const Anope::string &subcommand);
};
#endif // COMMANDS_H
+144 -20
View File
@@ -33,6 +33,7 @@ enum ConfigDataType
DT_INTEGER, // Integer
DT_UINTEGER, // Unsigned Integer
DT_LUINTEGER, // Long Unsigned Integer
DT_CHARPTR, // Char pointer
DT_STRING, // Anope::string
DT_BOOLEAN, // Boolean
DT_HOSTNAME, // Hostname syntax
@@ -41,7 +42,7 @@ enum ConfigDataType
DT_TIME, // Time value
DT_NORELOAD = 32, // Item can't be reloaded after startup
DT_ALLOW_WILD = 64, // Allow wildcards/CIDR in DT_IPADDRESS
DT_ALLOW_NEWLINE = 128 // New line characters allowed in DT_STRING
DT_ALLOW_NEWLINE = 128 // New line characters allowed in DT_CHARPTR
};
/** Holds a config value, either string, integer or boolean.
@@ -56,16 +57,28 @@ class CoreExport ValueItem
/** Actual data */
Anope::string v;
public:
/** Initialize with nothing */
ValueItem();
/** Initialize with an int */
ValueItem(int);
/** Initialize with a bool */
ValueItem(bool);
/** Initialize with a char pointer */
ValueItem(const char *);
/** Initialize with an std::string */
ValueItem(const std::string &);
/** Initialize with a ci::string */
ValueItem(const ci::string &);
/** Initialize with an Anope::string */
ValueItem(const Anope::string &);
/** Initialize with a long */
ValueItem(long);
/** Change value to a char pointer */
//void Set(char *);
/** Change value to a const char pointer */
void Set(const char *);
/** Change value to an std::string */
void Set(const std::string &);
/** Change value to a ci::string */
void Set(const ci::string &);
/** Change value to an Anope::string */
void Set(const Anope::string &);
/** Change value to an int */
@@ -124,6 +137,40 @@ template<typename T> class ValueContainer : public ValueContainerBase
}
};
/** This a specific version of ValueContainer to handle character arrays specially
*/
template<> class ValueContainer<char **> : public ValueContainerBase
{
private:
/** Contained item */
char **val;
public:
/** Initialize with nothing */
ValueContainer() : ValueContainerBase(), val(NULL) { }
/** Initialize with a value of type T */
ValueContainer(char **Val) : ValueContainerBase(), val(Val) { }
/** Initialize with a copy */
ValueContainer(const ValueContainer &Val) : ValueContainerBase(), val(Val.val) { }
ValueContainer &operator=(const ValueContainer &Val)
{
val = Val.val;
return *this;
}
/** Change value to type T of size s */
void Set(const char *newval, size_t s)
{
if (*val)
delete [] *val;
if (!*newval)
{
*val = NULL;
return;
}
*val = new char[s];
strlcpy(*val, newval, s);
}
};
/** This a specific version of ValueContainer to handle Anope::string specially
*/
template<> class ValueContainer<Anope::string *> : public ValueContainerBase
@@ -170,6 +217,11 @@ typedef ValueContainer<unsigned *> ValueContainerUInt;
*/
typedef ValueContainer<long unsigned *> ValueContainerLUInt;
/** A specialization of ValueContainer to hold a pointer to
* a char array.
*/
typedef ValueContainer<char **> ValueContainerChar;
/** A specialization of ValueContainer to hold a pointer to
* an int
*/
@@ -212,6 +264,7 @@ bool ValidateHostServ(ServerConfig *config, const Anope::string &tag, const Anop
bool ValidateLimitSessions(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateOperServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateGlobal(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateDefCon(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateNickLen(ServerConfig *, const Anope::string &, const Anope::string &, ValueItem &data);
bool ValidateMail(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateGlobalOnCycle(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
@@ -342,15 +395,22 @@ class CoreExport ServerConfig
/** Below here is a list of variables which contain the config files values
*/
/* Host to bind to */
/* IRCd module in use */
Anope::string IRCDModule;
/* Host to connect to **/
Anope::string LocalHost;
/* List of uplink servers to try and connect to */
std::vector<Uplink *> Uplinks;
std::list<Uplink *> Uplinks;
/* Our server name */
Anope::string ServerName;
/* Our servers description */
Anope::string ServerDesc;
/* The username/ident of services clients */
Anope::string ServiceUser;
/* The hostname if services clients */
Anope::string ServiceHost;
/* Name of the network were on */
Anope::string NetworkName;
@@ -364,19 +424,41 @@ class CoreExport ServerConfig
/* Max length of passwords */
unsigned PassLen;
/* NickServ Name */
Anope::string s_NickServ;
/* ChanServ Name */
Anope::string s_ChanServ;
/* MemoServ Name */
Anope::string s_MemoServ;
/* BotServ Name */
Anope::string s_BotServ;
/* OperServ name */
Anope::string s_OperServ;
/* Global name */
Anope::string s_GlobalNoticer;
/* NickServs realname */
Anope::string desc_NickServ;
/* ChanServ realname */
Anope::string desc_ChanServ;
/* MemoServ realname */
Anope::string desc_MemoServ;
/* BotServ realname */
Anope::string desc_BotServ;
/* OperServ realname */
Anope::string desc_OperServ;
/* Global realname */
Anope::string desc_GlobalNoticer;
/* HostServ Name */
Anope::string s_HostServ;
/* HostServ realname */
Anope::string desc_HostServ;
/* Filename for the PID file */
Anope::string PIDFilename;
/* MOTD filename */
Anope::string MOTDFilename;
Anope::string BotServ;
Anope::string ChanServ;
Anope::string Global;
Anope::string HostServ;
Anope::string NickServ;
Anope::string OperServ;
Anope::string MemoServ;
/* True if its ok to not be able to save backs */
bool NoBackupOkay;
/* Do password checking when new people register */
@@ -419,6 +501,8 @@ class CoreExport ServerConfig
Anope::string BotModes;
/* THe actual modes */
ChannelStatus BotModeList;
/* How many times to try and reconnect to the uplink before giving up */
unsigned MaxRetries;
/* How long to wait between connection attempts */
int RetryWait;
/* If services should hide unprivileged commands */
@@ -466,6 +550,8 @@ class CoreExport ServerConfig
time_t NSExpire;
/* How long before suspended nicks expire */
time_t NSSuspendExpire;
/* How long before forbidden nicks expire */
time_t NSForbidExpire;
/* Time before unconfirmed nicks expire */
time_t NSUnconfirmedExpire;
/* Force email when registering */
@@ -482,6 +568,8 @@ class CoreExport ServerConfig
Anope::string NSEnforcerHost;
/* How long before recovered nicks are released */
time_t NSReleaseTimeout;
/* /nickserv list is oper only */
bool NSListOpersOnly;
/* Max number of entries that can be returned from the list command */
unsigned NSListMax;
/* Only allow usermode +a etc on real services admins */
@@ -490,8 +578,6 @@ class CoreExport ServerConfig
bool NSStrictPrivileges;
/* Use email to verify new users registering */
bool NSEmailReg;
/* Core NickServ modules */
Anope::string NickCoreModules;
/* Set the proper channel modes on users when they identify */
bool NSModeOnID;
/* Add the users hostnask their access list when they register */
@@ -499,8 +585,6 @@ class CoreExport ServerConfig
/* Maximum number of channels on AJoin */
unsigned AJoinMax;
/* Core ChanServ modules */
Anope::string ChanCoreModules;
/* Default flags for newly registered channels */
Flags<ChannelInfoFlag, CI_END> CSDefFlags;
/* Max number of channels a user can own */
@@ -521,6 +605,8 @@ class CoreExport ServerConfig
Anope::string CSAutokickReason;
/* Time ChanServ should stay in the channel to hold it to keep users from getting in */
time_t CSInhabit;
/* ChanServ's LIST command is oper only */
bool CSListOpersOnly;
/* Max number of entries allowed to be returned from the LIST command */
unsigned CSListMax;
/* true to make ChanServ oper only */
@@ -535,9 +621,7 @@ class CoreExport ServerConfig
/* Who can use memos reciepts */
unsigned MSMemoReceipt;
/* Core BotServ modules */
Anope::string BotCoreModules;
/* Default BotServ flags */
/* Defai;t BotServ flags */
Flags<BotServFlag> BSDefFlags;
/* How long before botserv forgets a user. This is used for flood kickers etc */
time_t BSKeepData;
@@ -622,6 +706,46 @@ class CoreExport ServerConfig
/* List of modules to autoload */
std::list<Anope::string> ModulesAutoLoad;
/* Encryption modules */
std::list<Anope::string> EncModuleList;
/* Database modules */
std::list<Anope::string> DBModuleList;
/* HostServ Core Modules */
std::list<Anope::string> HostServCoreModules;
/* MemoServ Core Modules */
std::list<Anope::string> MemoServCoreModules;
/* BotServ Core Modules */
std::list<Anope::string> BotServCoreModules;
/* OperServ Core Modules */
std::list<Anope::string> OperServCoreModules;
/* NickServ Core Modules */
std::list<Anope::string> NickServCoreModules;
/* ChanServ Core Modules */
std::list<Anope::string> ChanServCoreModules;
/* Default defcon level */
int DefConLevel;
/* Timeout before defcon is reset */
time_t DefConTimeOut;
/* Session limiit to use when using defcon */
unsigned DefConSessionLimit;
/* How long to add akills for defcon */
time_t DefConAKILL;
/* Chan modes for defcon */
Anope::string DefConChanModes;
/* Should we global on defcon */
bool GlobalOnDefcon;
/* Should we send DefconMessage aswell? */
bool GlobalOnDefconMore;
/* Message to send when defcon is off */
Anope::string DefConOffMessage;
/* Message to send when defcon is on*/
Anope::string DefconMessage;
/* Reason to akill clients for defcon */
Anope::string DefConAkillReason;
/* The socket engine in use */
Anope::string SocketEngine;
/* User keys to use for generating random hashes for pass codes etc */
unsigned long UserKey1;
+21 -7
View File
@@ -137,26 +137,40 @@ struct CoreExport DNSRecord
operator bool() const;
};
/** The socket used to talk to the nameserver, uses UDP
*/
class DNSSocket : public ConnectionSocket
{
private:
int SendTo(const unsigned char *buf, size_t len) const;
int RecvFrom(char *buf, size_t size, sockaddrs &addrs) const;
public:
DNSSocket();
virtual ~DNSSocket();
bool ProcessRead();
bool ProcessWrite();
};
/** DNS manager, manages the connection and all requests
*/
class CoreExport DNSManager : public Timer, public Socket
class CoreExport DNSManager : public Timer
{
std::multimap<Anope::string, DNSRecord *> cache;
sockaddrs addrs;
public:
DNSSocket *sock;
std::deque<DNSPacket *> packets;
std::map<short, DNSRequest *> requests;
static const int DNSPort = 53;
DNSManager(const Anope::string &nameserver, int port);
DNSManager();
~DNSManager();
bool ProcessRead();
bool ProcessWrite();
void AddCache(DNSRecord *rr);
bool CheckCache(DNSRequest *request);
void Tick(time_t now);
+138 -12
View File
@@ -17,6 +17,8 @@
#include "hashcomp.h"
E void ModuleRunTimeDirCleanUp();
/* IRC Variables */
E IRCDVar *ircd;
@@ -25,49 +27,101 @@ E IRCdMessage *ircdmessage;
/**** actions.c ****/
E void kill_user(const Anope::string &source, User *user, const Anope::string &reason);
E bool bad_password(User *u);
E void common_unban(ChannelInfo *ci, User *u, bool full = false);
E BotInfo *BotServ;
E BotInfo *ChanServ;
E BotInfo *Global;
E BotInfo *HostServ;
E BotInfo *MemoServ;
E BotInfo *NickServ;
E BotInfo *OperServ;
/**** botserv.c ****/
E void get_botserv_stats(long *nrec, long *memuse);
E void bs_init();
E void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf);
E BotInfo *findbot(const Anope::string &nick);
/** Finds a pseudoclient, given a UID. Useful for TS6 protocol modules.
* @param uid The UID to search for
* @return The pseudoclient structure, or NULL if one could not be found
*/
E Anope::string normalizeBuffer(const Anope::string &);
E void check_ban(ChannelInfo *ci, User *u, int ttbtype);
E void bot_kick(ChannelInfo *ci, User *u, const char *message, ...);
E void bot_raw_ban(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason);
E void bot_raw_kick(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason);
/**** channels.c ****/
E void get_channel_stats(long *nrec, long *memuse);
E Channel *findchan(const Anope::string &chan);
E User *nc_on_chan(Channel *c, const NickCore *nc);
E Anope::string get_xop_level(int level);
E void do_cmode(const Anope::string &source, const Anope::string &channel, const Anope::string &modes, const Anope::string &ts);
E void do_join(const Anope::string &source, const Anope::string &channels, const Anope::string &ts);
E void do_kick(const Anope::string &source, const Anope::string &channel, const Anope::string &users, const Anope::string &reason);
E void do_part(const Anope::string &source, const Anope::string &channels, const Anope::string &reason);
E void MassChannelModes(BotInfo *bi, const Anope::string &modes);
E void chan_set_correct_modes(User *user, Channel *c, int give_modes);
inline BotInfo *whosends(ChannelInfo *ci)
{
if (!ci || !ci->bi || !ci->c || !ci->botflags.HasFlag(BS_SYMBIOSIS) || !ci->c->FindUser(ci->bi))
return ChanServ ? ChanServ : NickServ;
return ci->bi;
}
/**** chanserv.c ****/
E LevelInfo levelinfo[];
E void get_chanserv_stats(long *nrec, long *memuse);
E void reset_levels(ChannelInfo *ci);
E void cs_init();
E void expire_chans();
E void cs_remove_nick(NickCore *nc);
E void check_modes(Channel *c);
E int check_valid_admin(User *user, Channel *chan, int servermode);
E int check_valid_op(User *user, Channel *chan, int servermode);
E ChannelInfo *cs_findchan(const Anope::string &chan);
E int check_access(User *user, ChannelInfo *ci, int what);
E bool IsFounder(User *user, ChannelInfo *ci);
E void update_cs_lastseen(User *user, ChannelInfo *ci);
E int get_idealban(ChannelInfo *ci, User *u, Anope::string &ret);
E int levelinfo_maxwidth;
E Anope::string get_mlock_modes(ChannelInfo *ci, int complete);
/**** config.c ****/
E ConfigurationFile services_conf;
E ServerConfig *Config;
/* hostserv.c */
E void do_on_id(User *u);
E void HostServSyncVhosts(NickAlias *na);
/**** encrypt.c ****/
E void enc_encrypt(const Anope::string &src, Anope::string &dest);
E bool enc_decrypt(const Anope::string &src, Anope::string &dest);
E int enc_encrypt(const Anope::string &src, Anope::string &dest);
E int enc_decrypt(const Anope::string &src, Anope::string &dest);
/**** hostserv.c ****/
E void get_hostserv_stats(long *nrec, long *memuse);
E void hostserv_init();
/**** init.c ****/
@@ -75,6 +129,7 @@ E void introduce_user(const Anope::string &user);
E bool GetCommandLineArgument(const Anope::string &name, char shortname = 0);
E bool GetCommandLineArgument(const Anope::string &name, char shortname, Anope::string &param);
E void Init(int ac, char **av);
E Uplink *uplink_server;
/**** ircd.c ****/
E void pmodule_ircd_proto(IRCDProto *);
@@ -83,12 +138,16 @@ E void pmodule_ircd_message(IRCdMessage *message);
/**** language.cpp ****/
E std::vector<Anope::string> languages;
E std::vector<Anope::string> domains;
E void InitLanguages();
E const char *translate(const char *string);
E const char *translate(User *u, const char *string);
E const char *translate(NickCore *nc, const char *string);
E const char *anope_gettext(const char *lang, const char *string);
E const Anope::string GetString(NickCore *nc, const char *string);
E const Anope::string GetString(const Anope::string &domain, const Anope::string &lang, const char *string);
E void PushLanguage(const Anope::string &, Anope::string);
E void PopLanguage();
E const char *anope_gettext(const char *string);
E void SyntaxError(CommandSource &source, const Anope::string &command, const Anope::string &message);
/*** logger.cpp ***/
E void InitLogChannels(ServerConfig *);
/**** main.c ****/
@@ -102,15 +161,36 @@ E bool noexpire;
E bool protocoldebug;
E bool quitting;
E bool restarting;
E bool shutting_down;
E Anope::string quitmsg;
E bool save_data;
E time_t start_time;
E ConnectionSocket *UplinkSock;
E int CurrentUplink;
E void save_databases();
E void expire_all();
E void sighandler(int signum);
E void do_restart_services();
/* The socket to our uplink */
class CoreExport UplinkSocket : public ConnectionSocket
{
public:
UplinkSocket(bool ipv6 = false);
virtual ~UplinkSocket();
bool Read(const Anope::string &buf);
};
/**** memoserv.c ****/
E void ms_init();
E void rsend_notify(CommandSource &source, Memo *m, const Anope::string &chan);
E void check_memos(User *u);
E MemoInfo *getmemoinfo(const Anope::string &name, bool &ischan, bool &isforbid);
E void memo_send(CommandSource &source, const Anope::string &name, const Anope::string &text, int z);
/**** messages.cpp ****/
@@ -145,11 +225,17 @@ E bool OnError(const Anope::string &, const std::vector<Anope::string> &);
E bool IsFile(const Anope::string &filename);
E int toupper(char);
E int tolower(char);
#ifndef HAVE_STRLCPY
E size_t strlcpy(char *, const char *, size_t);
#endif
#ifndef HAVE_STRLCAT
E size_t strlcat(char *, const char *, size_t);
#endif
E time_t dotime(const Anope::string &s);
E Anope::string duration(const time_t &seconds, NickCore *nc = NULL);
E Anope::string duration(time_t seconds);
E Anope::string expire_left(NickCore *nc, time_t expires);
E Anope::string do_strftime(const time_t &t, NickCore *nc = NULL, bool short_output = false);
E Anope::string do_strftime(const time_t &t);
E bool doValidHost(const Anope::string &host, int type);
E bool isValidHost(const Anope::string &host, int type);
@@ -158,6 +244,7 @@ E bool isvalidchar(char c);
E Anope::string myStrGetToken(const Anope::string &str, char dilim, int token_number);
E Anope::string myStrGetTokenRemainder(const Anope::string &str, char dilim, int token_number);
E int myNumToken(const Anope::string &str, char dilim);
E void EnforceQlinedNick(const Anope::string &nick, const Anope::string &killer);
E bool nickIsServices(const Anope::string &nick, bool bot);
E void add_entropy_userkeys();
@@ -166,12 +253,13 @@ E unsigned char getrandom8();
E uint16 getrandom16();
E uint32 getrandom32();
E char *str_signed(unsigned char *str);
E std::list<Anope::string> BuildStringList(const Anope::string &, char = ' ');
E std::vector<Anope::string> BuildStringVector(const Anope::string &, char = ' ');
E bool str_is_wildcard(const Anope::string &str);
E bool str_is_pure_wildcard(const Anope::string &str);
E Anope::string normalizeBuffer(const Anope::string &);
/**** modes.cpp ****/
/* Number of generic modes we support */
@@ -181,9 +269,15 @@ E void SetDefaultMLock(ServerConfig *config);
/**** nickserv.c ****/
E void get_aliases_stats(long &count, long &mem);
E void get_core_stats(long &count, long &mem);
E void change_core_display(NickCore *nc);
E void change_core_display(NickCore *nc, const Anope::string &newdisplay);
E int do_setmodes(User *u);
E void ns_init();
E int validate_user(User *u);
E void expire_nicks();
E NickAlias *findnick(const Anope::string &nick);
E NickCore *findcore(const Anope::string &nick);
E bool is_on_access(const User *u, const NickCore *nc);
@@ -198,8 +292,27 @@ E void send_cmd(const Anope::string &source, const char *fmt, ...) FORMAT(printf
E void notice_server(const Anope::string &source, const Server *s, const char *fmt, ...) FORMAT(printf, 3, 4);
/**** sessions.c ****/
E std::vector<Exception *> exceptions;
E void get_session_stats(long &count, long &mem);
E void get_exception_stats(long &count, long &mem);
E void add_session(User *u);
E void del_session(User *u);
E void expire_exceptions();
E Session *findsession(const Anope::string &host);
E Exception *find_host_exception(const Anope::string &host);
E Exception *find_hostip_exception(const Anope::string &host, const Anope::string &hostip);
E int exception_add(User *u, const Anope::string &mask, unsigned limit, const Anope::string &reason, const Anope::string &who, time_t expires);
/**** sockets.cpp ****/
E SocketEngineBase *SocketEngine;
E int32 TotalRead;
E int32 TotalWritten;
E SocketIO normalSocketIO;
@@ -210,6 +323,8 @@ E int32 opcnt;
E uint32 maxusercnt, usercnt;
E time_t maxusertime;
E void get_user_stats(long &count, long &mem);
E User *finduser(const Anope::string &nick);
E User *do_nick(const Anope::string &source, const Anope::string &nick, const Anope::string &username, const Anope::string &host, const Anope::string &server, const Anope::string &realname, time_t ts, const Anope::string &ip, const Anope::string &vhost, const Anope::string &uid, const Anope::string &modes);
@@ -218,7 +333,18 @@ E void do_umode(const Anope::string &user, const Anope::string &modes);
E void do_kill(User *user, const Anope::string &reason);
E bool matches_list(Channel *c, User *user, ChannelModeName mode);
E bool is_excepted_mask(ChannelInfo *ci, const Anope::string &mask);
E Anope::string create_mask(User *u);
/******************************************************************************/
E void b64_encode(const Anope::string &src, Anope::string &target);
E void b64_decode(const Anope::string &src, Anope::string &target);
#ifdef _WIN32
E Anope::string GetWindowsVersion();
E bool SupportedWindowsVersion();
#endif
#endif /* EXTERN_H */
+105 -90
View File
@@ -6,95 +6,110 @@
* Please read COPYING and README for further details.
*/
#define MORE_INFO _("\002%s%s HELP %s\002 for more information.")
#define BAD_USERHOST_MASK _("Mask must be in the form \037user\037@\037host\037.")
#define BAD_EXPIRY_TIME _("Invalid expiry time.")
#define USERHOST_MASK_TOO_WIDE _("%s coverage is too wide; Please use a more specific mask.")
#define READ_ONLY_MODE _("Services are in read-only mode!")
#define PASSWORD_INCORRECT _("Password incorrect.")
#define ACCESS_DENIED _("Access denied.")
#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should be at least\n" \
"five characters long, should not be something easily guessed\n" \
"(e.g. your real name or your nick), and cannot contain the space or tab characters.")
#define PASSWORD_TOO_LONG _("Your password is too long. Please try again with a shorter password.")
#define NICK_NOT_REGISTERED _("Your nick isn't registered.")
#define NICK_X_NOT_REGISTERED _("Nick \002%s\002 isn't registered.")
#define NICK_X_NOT_IN_USE _("Nick \002%s\002 isn't currently in use.")
#define NICK_X_NOT_ON_CHAN _("\002%s\002 is not currently on channel %s.")
#define NICK_X_SUSPENDED _("Nick %s is currently suspended.")
#define CHAN_X_SUSPENDED _("Channel %s is currently suspended.")
#define CHAN_X_NOT_REGISTERED _("Channel \002%s\002 isn't registered.")
#define CHAN_X_NOT_IN_USE _("Channel \002%s\002 doesn't exist.")
#define NICK_IDENTIFY_REQUIRED _("Password authentication required for that command.")
#define MAIL_X_INVALID _("\002%s\002 is not a valid e-mail address.")
#define NO_REASON _("No reason")
#define UNKNOWN _("<unknown>")
#define NO_EXPIRE _("does not expire")
#define END_OF_ANY_LIST _("End of \002%s\002 list.")
#define LIST_INCORRECT_RANGE _("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")
#define UNKNOWN_OPTION _("Unknown option \002%s\002.\n" \
"Type %s%s HELP %s for more information.")
#define NICK_IS_REGISTERED _("This nick is owned by someone else. Please choose another.\n" \
"(If this is your nick, type \002%s%s IDENTIFY \037password\037\002.)")
#define NICK_IS_SECURE _("This nickname is registered and protected. If it is your\n" \
#define MORE_INFO "\002%s%s HELP %s\002 for more information."
#define BAD_USERHOST_MASK "Mask must be in the form \037user\037@\037host\037."
#define BAD_EXPIRY_TIME "Invalid expiry time."
#define USERHOST_MASK_TOO_WIDE "%s coverage is too wide; Please use a more specific mask."
#define READ_ONLY_MODE "Services are in read-only mode!"
#define PASSWORD_INCORRECT "Password incorrect."
#define ACCESS_DENIED "Access denied."
#define MORE_OBSCURE_PASSWORD "Please try again with a more obscure password. Passwords should be at least five characters long, should not be something easily guessed (e.g. your real name or your nick), and cannot contain the space or tab characters."
#define PASSWORD_TOO_LONG "Your password is too long. Please try again with a shorter password."
#define NICK_NOT_REGISTERED "Your nick isn't registered."
#define NICK_X_NOT_REGISTERED "Nick \002%s\002 isn't registered."
#define NICK_X_NOT_IN_USE "Nick \002%s\002 isn't currently in use."
#define NICK_X_NOT_ON_CHAN "\002%s\002 is not currently on channel %s."
#define NICK_X_FORBIDDEN "Nick \002%s\002 may not be registered or used."
#define NICK_X_FORBIDDEN_OPER "Nick \002%s\002 has been forbidden by %s:\n" \
"%s"
#define NICK_X_SUSPENDED "Nick %s is currently suspended."
#define CHAN_X_NOT_REGISTERED "Channel \002%s\002 isn't registered."
#define CHAN_X_NOT_IN_USE "Channel \002%s\002 doesn't exist."
#define CHAN_X_FORBIDDEN "Channel \002%s\002 may not be registered or used."
#define CHAN_X_FORBIDDEN_OPER "Channel \002%s\002 has been forbidden by %s:\n" \
"%s"
#define NICK_IDENTIFY_REQUIRED "Password authentication required for that command.\n" \
"Retry after typing \002%s%s IDENTIFY \037password\037\002."
#define MAIL_X_INVALID "\002%s\002 is not a valid e-mail address."
#define NO_REASON "No reason"
#define UNKNOWN "<unknown>"
#define NO_EXPIRE "does not expire"
#define END_OF_ANY_LIST "End of \002%s\002 list."
#define LIST_INCORRECT_RANGE "Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002."
#define UNKNOWN_OPTION "Unknown option \002%s\002.\n" \
"Type %s%s HELP %s for more information."
#define NICK_IS_REGISTERED "This nick is owned by someone else. Please choose another.\n" \
"(If this is your nick, type \002%s%s IDENTIFY \037password\037\002.)"
#define NICK_IS_SECURE "This nickname is registered and protected. If it is your\n" \
"nick, type \002%s%s IDENTIFY \037password\037\002. Otherwise,\n" \
"please choose a different nick.")
#define FORCENICKCHANGE_NOW _("This nickname has been registered; you may not use it.")
#define NICK_CANNOT_BE_REGISTERED _("Nickname \002%s\002 may not be registered.")
#define NICK_ALREADY_REGISTERED _("Nickname \002%s\002 is already registered!")
#define NICK_SET_SYNTAX _("SET \037option\037 \037parameters\037")
#define NICK_SET_DISABLED _("Sorry, nickname option setting is temporarily disabled.")
#define NICK_SET_UNKNOWN_OPTION _("Unknown SET option \002%s%s\002.")
#define NICK_SET_DISPLAY_CHANGED _("The new display is now \002%s\002.")
#define NICK_LIST_SYNTAX _("LIST \037pattern\037")
#define LIST_HEADER _("List of entries matching \002%s\002:")
#define NICK_RECOVERED _("User claiming your nick has been killed.\n" \
"\002%s%s RELEASE %s\002 to get it back before %s timeout.")
#define NICK_REQUESTED _("This nick has already been requested, please check your e-mail address for the pass code")
#define NICK_CONFIRM_INVALID _("Invalid passcode has been entered, please check the e-mail again, and retry")
#define CHAN_NOT_ALLOWED_TO_JOIN _("You are not permitted to be on this channel.")
#define CHAN_X_INVALID _("Channel %s is not a valid channel.")
#define CHAN_REACHED_CHANNEL_LIMIT _("Sorry, you have already reached your limit of \002%d\002 channels.")
#define CHAN_EXCEEDED_CHANNEL_LIMIT _("Sorry, you have already exceeded your limit of \002%d\002 channels.")
#define CHAN_SYMBOL_REQUIRED _("Please use the symbol of \002#\002 when attempting to register")
#define CHAN_SET_DISABLED _("Sorry, channel option setting is temporarily disabled.")
#define CHAN_SETTING_CHANGED _("%s for %s set to %s.")
#define CHAN_SETTING_UNSET _("%s for %s unset.")
#define CHAN_SET_MLOCK_DEPRECATED _("MLOCK is deprecated. Use \002%s%s HELP MODE\002 instead.")
#define CHAN_ACCESS_LEVEL_RANGE _("Access level must be between %d and %d inclusive.")
#define CHAN_ACCESS_LIST_HEADER _("Access list for %s:\n" \
" Num Lev Mask")
#define CHAN_ACCESS_VIEW_AXS_FORMAT _(" %3d %4d %s\n" \
" by %s on %s, last seen %s")
#define CHAN_AKICK_VIEW_FORMAT _("%3d %s (by %s on %s)\n" \
" %s")
#define CHAN_INFO_HEADER _("Information for channel \002%s\002:")
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except have been removed.")
#define CHAN_LIST_ENTRY _("%3d %s\n" \
" Added by %s on %s")
#define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \
"Type \002%s%s READ %s %d\002 to read it.")
#define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \
"Type \002%s%s READ %d\002 to read it.")
#define MEMO_HAVE_NO_MEMOS _("You have no memos.")
#define MEMO_X_HAS_NO_MEMOS _("%s has no memos.")
#define MEMO_SEND_SYNTAX _("SEND {\037nick\037 | \037channel\037} \037memo-text\037")
#define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.")
#define MEMO_HAVE_NO_NEW_MEMOS _("You have no new memos.")
#define MEMO_X_HAS_NO_NEW_MEMOS _("%s has no new memos.")
#define BOT_DOES_NOT_EXIST _("Bot \002%s\002 does not exist.")
#define BOT_NOT_ASSIGNED _("You must assign a bot to the channel before using this command.")
#define BOT_NOT_ON_CHANNEL _("Bot is not on channel \002%s\002.")
#define BOT_ASSIGN_READONLY _("Sorry, bot assignment is temporarily disabled.")
#define ENABLED _("Enabled")
#define DISABLED _("Disabled")
#define OPER_LIST_FORMAT _(" %3d %-32s %s")
#define OPER_VIEW_FORMAT _("%3d %s (by %s on %s; %s)\n" \
" %s")
#define HOST_SET_ERROR _("A vhost must be in the format of a valid hostmask.")
#define HOST_SET_IDENT_ERROR _("A vhost ident must be in the format of a valid ident")
#define HOST_SET_TOOLONG _("Error! The vhost is too long, please use a host shorter than %d characters.")
#define HOST_SET_IDENTTOOLONG _("Error! The Ident is too long, please use an ident shorter than %d characters.")
#define HOST_NOT_ASSIGNED _("Please contact an Operator to get a vhost assigned to this nick.")
#define HOST_NO_VIDENT _("Your IRCD does not support vIdent's, if this is incorrect, please report this as a possible bug")
"please choose a different nick."
#define FORCENICKCHANGE_NOW "This nickname has been registered; you may not use it."
#define NICK_CANNOT_BE_REGISTERED "Nickname \002%s\002 may not be registered."
#define NICK_ALREADY_REGISTERED "Nickname \002%s\002 is already registered!"
#define NICK_SET_SYNTAX "SET \037option\037 \037parameters\037"
#define NICK_SET_DISABLED "Sorry, nickname option setting is temporarily disabled."
#define NICK_SET_UNKNOWN_OPTION "Unknown SET option \002%s%s\002."
#define NICK_SET_DISPLAY_CHANGED "The new display is now \002%s\002."
#define NICK_SASET_SYNTAX "SASET \037nickname\037 \037option\037 \037parameters\037"
#define NICK_SASET_DISPLAY_INVALID "The new display for \002%s\002 MUST be a nickname of the nickname group!"
#define NICK_SASET_PASSWORD_FAILED "Sorry, couldn't change password for \002%s\002."
#define NICK_SASET_PASSWORD_CHANGED "Password for \002%s\002 changed."
#define NICK_SASET_PASSWORD_CHANGED_TO "Password for \002%s\002 changed to \002%s\002."
#define NICK_INFO_OPTIONS " Options: %s"
#define NICK_LIST_SYNTAX "LIST \037pattern\037"
#define LIST_HEADER "List of entries matching \002%s\002:"
#define NICK_RECOVERED "User claiming your nick has been killed.\n" \
"\002%s%s RELEASE %s\002 to get it back before %s timeout."
#define NICK_REQUESTED "This nick has already been requested, please check your e-mail address for the pass code"
#define NICK_CONFIRM_INVALID "Invalid passcode has been entered, please check the e-mail again, and retry"
#define CHAN_NOT_ALLOWED_TO_JOIN "You are not permitted to be on this channel."
#define CHAN_X_INVALID "Channel %s is not a valid channel."
#define CHAN_REACHED_CHANNEL_LIMIT "Sorry, you have already reached your limit of \002%d\002 channels."
#define CHAN_EXCEEDED_CHANNEL_LIMIT "Sorry, you have already exceeded your limit of \002%d\002 channels."
#define CHAN_SYMBOL_REQUIRED "Please use the symbol of \002#\002 when attempting to register"
#define CHAN_SASET_SYNTAX "SASET \002channel\002 \037option\037 \037parameters\037"
#define CHAN_SET_SYNTAX "SET \037channel\037 \037option\037 \037parameters\037"
#define CHAN_SET_DISABLED "Sorry, channel option setting is temporarily disabled."
#define CHAN_SETTING_CHANGED "%s for %s set to %s."
#define CHAN_SETTING_UNSET "%s for %s unset."
#define CHAN_SET_MLOCK_DEPRECATED "MLOCK is deprecated. Use \002%s%s HELP MODE\002 instead."
#define CHAN_ACCESS_LEVEL_RANGE "Access level must be between %d and %d inclusive."
#define CHAN_ACCESS_LIST_HEADER "Access list for %s:\n" \
" Num Lev Mask"
#define CHAN_ACCESS_VIEW_XOP_FORMAT " %3d %s %s\n" \
" by %s, last seen %s"
#define CHAN_ACCESS_VIEW_AXS_FORMAT " %3d %4d %s\n" \
" by %s, last seen %s"
#define CHAN_AKICK_VIEW_FORMAT "%3d %s (by %s on %s)\n" \
" %s"
#define CHAN_INFO_HEADER "Information for channel \002%s\002:"
#define CHAN_EXCEPTED "\002%s\002 matches an except on %s and cannot be banned until the except have been removed."
#define CHAN_LIST_ENTRY "%3d %s\n" \
" Added by %s on %s"
#define MEMO_NEW_X_MEMO_ARRIVED "There is a new memo on channel %s.\n" \
"Type \002%s%s READ %s %d\002 to read it."
#define MEMO_NEW_MEMO_ARRIVED "You have a new memo from %s.\n" \
"Type \002%s%s READ %d\002 to read it."
#define MEMO_HAVE_NO_MEMOS "You have no memos."
#define MEMO_X_HAS_NO_MEMOS "%s has no memos."
#define MEMO_SEND_SYNTAX "SEND {\037nick\037 | \037channel\037} \037memo-text\037"
#define MEMO_SEND_DISABLED "Sorry, memo sending is temporarily disabled."
#define MEMO_HAVE_NO_NEW_MEMOS "You have no new memos."
#define MEMO_X_HAS_NO_NEW_MEMOS "%s has no new memos."
#define BOT_DOES_NOT_EXIST "Bot \002%s\002 does not exist."
#define BOT_NOT_ASSIGNED "You must assign a bot to the channel before using this command.\n" \
"Type %s%s HELP ASSIGN for more information."
#define BOT_NOT_ON_CHANNEL "Bot is not on channel \002%s\002."
#define BOT_ASSIGN_READONLY "Sorry, bot assignment is temporarily disabled."
#define ENABLED "Enabled"
#define DISABLED "Disabled"
#define OPER_LIST_FORMAT " %3d %-32s %s"
#define OPER_VIEW_FORMAT "%3d %s (by %s on %s; %s)\n" \
" %s"
#define HOST_SET_ERROR "A vhost must be in the format of a valid hostmask."
#define HOST_SET_IDENT_ERROR "A vhost ident must be in the format of a valid ident"
#define HOST_SET_TOOLONG "Error! The vhost is too long, please use a host shorter than %d characters."
#define HOST_SET_IDENTTOOLONG "Error! The Ident is too long, please use an ident shorter than %d characters."
#define HOST_NOT_ASSIGNED "Please contact an Operator to get a vhost assigned to this nick."
#define HOST_NO_VIDENT "Your IRCD does not support vIdent's, if this is incorrect, please report this as a possible bug"
+6 -4
View File
@@ -29,8 +29,6 @@ struct LogFile
Anope::string GetName() const;
};
class Command;
class CoreExport Log
{
public:
@@ -41,7 +39,7 @@ class CoreExport Log
std::stringstream buf;
Log(LogType type = LOG_NORMAL, const Anope::string &category = "", BotInfo *bi = NULL);
Log(LogType type = LOG_NORMAL, const Anope::string &category = "", BotInfo *bi = Global);
/* LOG_COMMAND/OVERRIDE/ADMIN */
Log(LogType type, User *u, Command *c, ChannelInfo *ci = NULL);
@@ -90,7 +88,11 @@ class CoreExport LogInfo
void AddType(std::list<Anope::string> &list, const Anope::string &type);
bool HasType(LogType ltype, const Anope::string &type) const;
bool HasType(std::list<Anope::string> &list, const Anope::string &type) const;
std::list<Anope::string> &GetList(LogType type);
bool HasType(LogType Type);
void ProcessMessage(const Log *l);
};
+11 -1
View File
@@ -193,7 +193,7 @@ class CoreExport ChannelMode : public Mode
* NOTE: User CAN be NULL, this is for checking if it can be locked with defcon
* @param u The user, or NULL
*/
virtual bool CanSet(User *u) const;
bool CanSet(User *u) const;
/** Returns the mode name as a string
*/
@@ -289,6 +289,16 @@ class CoreExport ChannelModeStatus : public ChannelMode
virtual ~ChannelModeStatus();
};
/** Channel mode +b
*/
class CoreExport ChannelModeBan : public ChannelModeList
{
public:
ChannelModeBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { }
void OnAdd(Channel *chan, const Anope::string &mask);
};
/** Channel mode +k (key)
*/
class CoreExport ChannelModeKey : public ChannelModeParam
+1 -2
View File
@@ -2,8 +2,7 @@
#define MODULE_H
#include "services.h"
#include "modules.h"
#include "oper.h"
#include "commands.h"
#include "modules.h"
#endif // MODULE_H
+177 -138
View File
@@ -17,6 +17,7 @@
#include <stdio.h>
#include "timers.h"
#include "hashcomp.h"
#include "commands.h"
/* Cross OS compatibility macros */
#ifdef _WIN32
@@ -26,7 +27,7 @@
# define dlsym(file, symbol) (HMODULE)GetProcAddress(file, symbol)
# define dlclose(file) FreeLibrary(file) ? 0 : 1
# define ano_modclearerr() SetLastError(0)
# define ano_moderr() (Anope::LastError().empty() ? NULL : Anope::LastError().c_str())
# define ano_moderr() Anope::LastError().c_str()
#else
typedef void * ano_module_t;
@@ -126,6 +127,10 @@ else \
class Message;
extern CoreExport Module *FindModule(const Anope::string &name);
int protocol_module_init();
extern CoreExport bool moduleMinVersion(int major, int minor, int patch, int build);
enum ModuleReturn
{
MOD_ERR_OK,
@@ -133,9 +138,15 @@ enum ModuleReturn
MOD_ERR_PARAMS,
MOD_ERR_EXISTS,
MOD_ERR_NOEXIST,
MOD_ERR_NOUSER,
MOD_ERR_NOLOAD,
MOD_ERR_NOUNLOAD,
MOD_ERR_SYNTAX,
MOD_ERR_NODELETE,
MOD_ERR_UNKNOWN,
MOD_ERR_FILE_IO,
MOD_ERR_NOSERVICE,
MOD_ERR_NO_MOD_NAME,
MOD_ERR_EXCEPTION,
MOD_ERR_VERSION
};
@@ -144,7 +155,7 @@ enum ModuleReturn
*/
enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFORE, PRIORITY_AFTER };
/* Module types, in the order in which they are unloaded. The order these are in is IMPORTANT */
enum ModType { MT_BEGIN, THIRD, SUPPORTED, CORE, DATABASE, ENCRYPTION, PROTOCOL, MT_END };
enum MODType { MT_BEGIN, THIRD, QATESTED, SUPPORTED, CORE, DATABASE, ENCRYPTION, PROTOCOL, SOCKETENGINE, MT_END };
typedef std::multimap<Anope::string, Message *> message_map;
extern CoreExport message_map MessageMap;
@@ -186,9 +197,8 @@ class Version
int GetBuild() const;
};
/* Forward declaration of CallBack class for the Module class */
class CallBack;
class XLineManager;
struct CommandSource;
/** Every module in Anope is actually a class.
*/
@@ -201,10 +211,6 @@ class CoreExport Module : public Extensible
*/
Anope::string name;
/** What type this module is
*/
ModType type;
/** The temporary path/filename
*/
Anope::string filename;
@@ -229,17 +235,24 @@ class CoreExport Module : public Extensible
*/
Anope::string author;
/** Creates and initialises a new module.
* @param modname The module name
* @param loadernick The nickname of the user loading the module.
* @param type The module type
/** What type this module is
*/
Module(const Anope::string &modname, const Anope::string &loadernick, ModType type = THIRD);
MODType type;
/** Creates and initialises a new module.
* @param loadernick The nickname of the user loading the module.
*/
Module(const Anope::string &modname, const Anope::string &loadernick);
/** Destroys a module, freeing resources it has allocated.
*/
virtual ~Module();
/** Sets a given type (CORE,PROTOCOL,3RD etc) on a module.
* @param type The type to set the module as.
*/
void SetType(MODType type);
/** Toggles the permanent flag on a module. If a module is permanent,
* then it may not be unloaded.
*
@@ -270,6 +283,28 @@ class CoreExport Module : public Extensible
*/
Version GetVersion() const;
/** Send a message to a user in their language, if a translation is available
* @param source The source of the message
* @param fmt The message
*/
void SendMessage(CommandSource &source, const char *fmt, ...);
/**
* Add a module provided command to the given service.
* @param bi The service to add the command to
* @param c The command to add
* @return MOD_ERR_OK on successfully adding the command
*/
int AddCommand(BotInfo *bi, Command *c);
/**
* Delete a command from the service given.
* @param bi The service to remove the command from
* @param c Thec command to delete
* @return returns MOD_ERR_OK on success
*/
int DelCommand(BotInfo *bi, Command *c);
/** Called when the ircd notifies that a user has been kicked from a channel.
* @param c The channel the user has been kicked from.
* @param target The user that has been kicked.
@@ -279,8 +314,9 @@ class CoreExport Module : public Extensible
virtual void OnUserKicked(Channel *c, User *target, const Anope::string &source, const Anope::string &kickmsg) { }
/** Called when Services' configuration has been loaded.
* @param startup True if Services is starting for the first time, false otherwise.
*/
virtual void OnReload() { }
virtual void OnReload(bool startup) {}
/** Called before a bot is assigned to a channel.
* @param sender The user assigning the bot
@@ -297,11 +333,20 @@ class CoreExport Module : public Extensible
*/
virtual EventReturn OnBotUnAssign(User *sender, ChannelInfo *ci) { return EVENT_CONTINUE; }
/** Called after a user has been introduced, but before any type
* of checking has been done (akills, defcon, s*lines, etc)
* return EVENT_STOP here to allow the user to get by untouched,
* or kill them then return EVENT_STOP to tell Anope the user no
* longer exists
* @param u The user
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
*/
virtual EventReturn OnPreUserConnect(User *u) { return EVENT_CONTINUE; }
/** Called when a new user connects to the network.
* @param u The connecting user.
* @param exempt set to true/is true if the user should be excepted from bans etc
*/
virtual void OnUserConnect(dynamic_reference<User> &u, bool &exempt) { }
virtual void OnUserConnect(User *u) { }
/** Called when a new server connects to the network.
* @param s The server that has connected to the network
@@ -314,17 +359,15 @@ class CoreExport Module : public Extensible
*/
virtual void OnUserNickChange(User *u, const Anope::string &oldnick) { }
/** Called when someone uses the generic/help command
* @param source Command source
* @param params Params
/** Called immediatly when a user tries to run a command
* @param u The user
* @param bi The bot the command is being run from
* @param command The command
* @param message The parameters used for the command
* @param ci If a tanasy command, the channel the comman was used on
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) { }
/** Called when someone uses the generic/help command
* @param source Command source
* @param params Params
*/
virtual void OnPostHelp(CommandSource &source, const std::vector<Anope::string> &params) { }
virtual EventReturn OnPreCommandRun(User *&u, BotInfo *&bi, Anope::string &command, Anope::string &message, ChannelInfo *&ci) { return EVENT_CONTINUE; }
/** Called before a command is due to be executed.
* @param source The source of the command
@@ -332,7 +375,7 @@ class CoreExport Module : public Extensible
* @param params The parameters the user is sending
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
virtual EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called after a command has been executed.
* @param source The source of the command
@@ -431,13 +474,6 @@ class CoreExport Module : public Extensible
*/
virtual void OnPartChannel(User *u, Channel *c, const Anope::string &channel, const Anope::string &msg) { }
/** Called when a user leaves a channel.
* From either parting, being kicked, or quitting/killed!
* @param u The user
* @param c The channel
*/
virtual void OnLeaveChannel(User *u, Channel *c) { }
/** Called before a user joins a channel
* @param u The user
* @param c The channel
@@ -468,9 +504,12 @@ class CoreExport Module : public Extensible
*/
virtual void OnChanExpire(ChannelInfo *ci) { }
/** Called before Anope connecs to its uplink
/** Called before Anope connects to its uplink
* @param u The uplink we're going to connect to
* @param Number What number the uplink is
* @return Other than EVENT_CONTINUE to stop attempting to connect
*/
virtual void OnPreServerConnect() { }
virtual EventReturn OnPreServerConnect(Uplink *u, int Number) { return EVENT_CONTINUE; }
/** Called when Anope connects to its uplink
*/
@@ -484,6 +523,16 @@ class CoreExport Module : public Extensible
*/
virtual void OnServerDisconnect() { }
/** Called before the database expire routines are called
* Note: Code that is in seperate expiry routines should just be done
* when we save the DB, theres no need to have both
*/
virtual void OnPreDatabaseExpire() { }
/** Called when the database expire routines are called
*/
virtual void OnDatabaseExpire() { }
/** Called when the flatfile dbs are being written
* @param Write A callback to the function used to insert a line into the database
*/
@@ -551,14 +600,28 @@ class CoreExport Module : public Extensible
*/
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const Anope::string &, const Anope::string &), ChannelInfo *ci) { }
/** Called before services restart
*/
virtual void OnPreRestart() { }
/** Called when services restart
*/
virtual void OnRestart() { }
/** Called before services shutdown
*/
virtual void OnPreShutdown() { }
/** Called when services shutdown
*/
virtual void OnShutdown() { }
/** Called on signal
* @param signum The signum
* @param msg The quitmsg
*/
virtual void OnSignal(int signum, const Anope::string &msg) { }
/** Called before a nick expires
* @param na The nick
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
@@ -575,11 +638,25 @@ class CoreExport Module : public Extensible
*/
virtual void OnDefconLevel(int level) { }
/** Called before an akill is added
* @param u The user adding the akill
* @param ak The akill
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnAddAkill(User *u, XLine *ak) { return EVENT_CONTINUE; }
/** Called before an akill is deleted
* @param u The user removing the akill
* @param ak The akill, can be NULL for all akills!
*/
virtual void OnDelAkill(User *u, XLine *ak) { }
/** Called after an exception has been added
* @param u The user who added it
* @param ex The exception
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnExceptionAdd(Exception *ex) { return EVENT_CONTINUE; }
virtual EventReturn OnExceptionAdd(User *u, Exception *ex) { return EVENT_CONTINUE; }
/** Called before an exception is deleted
* @param u The user who is deleting it
@@ -589,24 +666,18 @@ class CoreExport Module : public Extensible
/** Called before a XLine is added
* @param u The user adding the XLine
* @param x The XLine
* @param xlm The xline manager it was added to
* @param sx The XLine
* @param Type The type of XLine this is
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnAddXLine(User *u, XLine *x, XLineManager *xlm) { return EVENT_CONTINUE; }
virtual EventReturn OnAddXLine(User *u, XLine *x, XLineType Type) { return EVENT_CONTINUE; }
/** Called before a XLine is deleted
* @param u The user deleting the XLine
* @param x The XLine, can be NULL for all XLines
* @param xlm The xline manager it was deleted from
* @param sx The XLine, can be NULL for all XLines
* @param Type The type of XLine this is
*/
virtual void OnDelXLine(User *u, XLine *x, XLineManager *xlm) { }
/** Called when a user is checked for whether they are a services oper
* @param u The user
* @return EVENT_ALLOW to allow, anything else to deny
*/
virtual EventReturn IsServicesOper(User *u) { return EVENT_CONTINUE; }
virtual void OnDelXLine(User *u, XLine *x, XLineType Type) { }
/** Called when a server quits
* @param server The server
@@ -646,6 +717,13 @@ class CoreExport Module : public Extensible
*/
virtual void OnAccessDel(ChannelInfo *ci, User *u, ChanAccess *access) { }
/** Called when access is changed
* @param ci The channel
* @param u The user who changed the access
* @param u access The access changed
*/
virtual void OnAccessChange(ChannelInfo *ci, User *u, ChanAccess *access) { }
/** Called when access is added
* @param ci The channel
* @param u The user who added the access
@@ -692,11 +770,6 @@ class CoreExport Module : public Extensible
*/
virtual void OnChanUnsuspend(ChannelInfo *ci) { }
/** Called when a channel is being created, for any reason
* @param ci The channel
*/
virtual void OnCreateChan(ChannelInfo *ci) { }
/** Called when a channel is being deleted, for any reason
* @param ci The channel
*/
@@ -726,14 +799,6 @@ class CoreExport Module : public Extensible
*/
virtual void OnAkickDel(User *u, ChannelInfo *ci, AutoKick *ak) { }
/** Called after a user join a channel when we decide whether to kick them or not
* @param u The user
* @param ci The channel
* @param kick Set to true to kick
* @return EVENT_ALLOW to stop processing immediatly
*/
virtual EventReturn OnCheckKick(User *u, ChannelInfo *ci, bool &kick) { return EVENT_CONTINUE; }
/** Called when a user requests info for a channel
* @param source The user requesting info
* @param ci The channel the user is requesting info for
@@ -746,20 +811,6 @@ class CoreExport Module : public Extensible
*/
virtual void OnFindChan(const Anope::string &chname) { }
/** Checks if access has the channel privilege 'priv'.
* @param access THe access struct
* @param priv The privilege being checked for
* @return EVENT_ALLOW for yes, EVENT_STOP to stop all processing
*/
virtual EventReturn OnCheckPriv(ChanAccess *access, ChannelAccess priv) { return EVENT_CONTINUE; }
/** Check whether an access group has a privilege
* @param group The group
* @param priv The privilege
* @return MOD_ALLOW to allow, MOD_STOP to stop
*/
virtual EventReturn OnGroupCheckPriv(const AccessGroup *group, ChannelAccess priv) { return EVENT_CONTINUE; }
/** Called when a nick is dropped
* @param u The user dropping the nick
* @param na The nick
@@ -879,12 +930,7 @@ class CoreExport Module : public Extensible
* @param password The password
* @return EVENT_ALLOW to allow the password, EVENT_STOP to stop processing completely
*/
virtual EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) { return EVENT_CONTINUE; }
/** Called when a user does /ns update
* @param u The user
*/
virtual void OnNickUpdate(User *u) { }
virtual EventReturn OnCheckAuthentication(User *u, Command *c, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) { return EVENT_CONTINUE; }
/** Called when we get informed about a users SSL fingerprint
* when we call this, the fingerprint should already be stored in the user struct
@@ -892,11 +938,6 @@ class CoreExport Module : public Extensible
*/
virtual void OnFingerprint(User *u) { }
/** Called when a user becomes (un)away
* @param message The message, is .empty() if unaway
*/
virtual void OnUserAway(User *u, const Anope::string &message) { }
/** Called when a vhost is deleted
* @param na The nickalias of the vhost
*/
@@ -908,12 +949,18 @@ class CoreExport Module : public Extensible
virtual void OnSetVhost(NickAlias *na) { }
/** Called when a memo is sent
* @param source The source of the memo
* @param target The target of the memo
* @param mi Memo info for target
* @param u The user sending the memo
* @param nc The nickcore of who the memo was sent to
* @param m The memo
*/
virtual void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m) { }
virtual void OnMemoSend(User *u, NickCore *nc, Memo *m) { }
/** Called when a memo is sent
* @param u The user sending the memo
* @param ci The channel the memo was sent to
* @param m The memo
*/
virtual void OnMemoSend(User *u, ChannelInfo *ci, Memo *m) { }
/** Called when a memo is deleted
* @param nc The nickcore of the memo being deleted
@@ -1011,14 +1058,21 @@ class CoreExport Module : public Extensible
* @param message The message
* @return EVENT_STOP to halt processing
*/
virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) { return EVENT_CONTINUE; }
virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, const Anope::string &message) { return EVENT_CONTINUE; }
/** Called when we receive a PRIVMSG for a registered channel we are in
* @param u The source of the message
* @param c The channel
* @param ci The channel
* @param msg The message
* @param Allow set to false to make the flood kickers halt
* @return MOD_STOP to stop processing completely
*/
virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg) { }
virtual EventReturn OnPrivmsg(User *u, ChannelInfo *ci, Anope::string &msg, bool &Allow) { return EVENT_CONTINUE; }
/** Called when any object is destroyed
* @param b The object
*/
virtual void OnObjectDestroy(Base *b) { }
};
/** Implementation-specific flags which may be set in ModuleManager::Attach()
@@ -1033,13 +1087,12 @@ enum Implementation
I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess,
I_OnNickClearCert, I_OnNickAddCert, I_OnNickEraseCert,
I_OnNickInfo, I_OnFindNick, I_OnFindCore, I_OnCheckAuthentication,
I_OnNickUpdate,
/* ChanServ */
I_OnChanForbidden, I_OnChanSuspend, I_OnChanDrop, I_OnPreChanExpire, I_OnChanExpire, I_OnAccessAdd,
I_OnAccessDel, I_OnAccessClear, I_OnLevelChange, I_OnChanRegistered, I_OnChanUnsuspend, I_OnCreateChan, I_OnDelChan, I_OnChannelCreate,
I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick,
I_OnChanInfo, I_OnFindChan, I_OnCheckPriv, I_OnGroupCheckPriv,
I_OnChanForbidden, I_OnChanSuspend, I_OnChanDrop, I_OnPreChanExpire, I_OnChanExpire, I_OnAccessAdd, I_OnAccessChange,
I_OnAccessDel, I_OnAccessClear, I_OnLevelChange, I_OnChanRegistered, I_OnChanUnsuspend, I_OnDelChan, I_OnChannelCreate,
I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel,
I_OnChanInfo, I_OnFindChan,
/* BotServ */
I_OnBotJoin, I_OnBotKick, I_OnBotCreate, I_OnBotChange, I_OnBotDelete, I_OnBotAssign, I_OnBotUnAssign,
@@ -1052,27 +1105,28 @@ enum Implementation
I_OnMemoSend, I_OnMemoDel,
/* Users */
I_OnUserConnect, I_OnUserNickChange, I_OnUserQuit, I_OnUserLogoff, I_OnPreJoinChannel,
I_OnJoinChannel, I_OnPrePartChannel, I_OnPartChannel, I_OnLeaveChannel, I_OnFingerprint, I_OnUserAway,
I_OnPreUserConnect, I_OnUserConnect, I_OnUserNickChange, I_OnUserQuit, I_OnUserLogoff, I_OnPreJoinChannel,
I_OnJoinChannel, I_OnPrePartChannel, I_OnPartChannel, I_OnFingerprint,
/* OperServ */
I_OnDefconLevel, I_OnAddAkill, I_OnDelAkill, I_OnExceptionAdd, I_OnExceptionDel,
I_OnAddXLine, I_OnDelXLine, I_IsServicesOper,
I_OnAddXLine, I_OnDelXLine,
/* Database */
I_OnPostLoadDatabases, I_OnSaveDatabase, I_OnLoadDatabase,
I_OnDatabaseExpire,
I_OnDatabaseWrite, I_OnDatabaseRead, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata,
/* Modules */
I_OnModuleLoad, I_OnModuleUnload,
/* Other */
I_OnReload, I_OnNewServer, I_OnPreServerConnect, I_OnServerConnect, I_OnPreUplinkSync, I_OnServerDisconnect,
I_OnPreHelp, I_OnPostHelp, I_OnPreCommand, I_OnPostCommand, I_OnRestart, I_OnShutdown,
I_OnReload, I_OnPreServerConnect, I_OnNewServer, I_OnServerConnect, I_OnPreUplinkSync, I_OnServerDisconnect, I_OnPreCommandRun,
I_OnPreCommand, I_OnPostCommand, I_OnPreDatabaseExpire, I_OnPreRestart, I_OnRestart, I_OnPreShutdown, I_OnShutdown, I_OnSignal,
I_OnServerQuit, I_OnTopicUpdated,
I_OnEncrypt, I_OnDecrypt,
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnPrivmsg,
I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnPrivmsg, I_OnObjectDestroy,
I_END
};
@@ -1092,10 +1146,6 @@ class CoreExport ModuleManager
*/
static std::vector<Module *> EventHandlers[I_END];
/** Clean up the module runtime directory
*/
static void CleanupRuntimeDirectory();
/** Load up a list of modules.
* @param module_list The list of modules to load
**/
@@ -1115,27 +1165,6 @@ class CoreExport ModuleManager
*/
static ModuleReturn UnloadModule(Module *m, User * u);
/** Find a module
* @param name The module name
* @return The module
*/
static Module *FindModule(const Anope::string &name);
/** Find the first module of a certain type
* @param type The module type
* @return The module
*/
static Module *FindFirstOf(ModType type);
/** Checks whether this version of Anope is at least major.minor.patch.build
* Throws a ModuleException if not
* @param major The major version
* @param minor The minor vesion
* @param patch The patch version
* @param build The build version
*/
static void RequireVersion(int major, int minor, int patch, int build);
/** Change the priority of one event in a module.
* Each module event has a list of modules which are attached to that event type. If you wish to be called before or after other specific modules, you may use this
* method (usually within void Module::Prioritize()) to set your events priority. You may use this call in other methods too, however, this is not supported behaviour
@@ -1193,7 +1222,8 @@ class CoreExport ModuleManager
*/
static void ClearCallBacks(Module *m);
/** Unloading all modules except the protocol module.
/** Unloading all modules, NEVER call this when Anope isn't shutting down.
* Ever.
*/
static void UnloadAll();
@@ -1215,17 +1245,11 @@ class CoreExport ModuleManager
*/
static Service *GetService(const Anope::string &name);
/** Get the existing service key names
* @return The keys
*/
static std::vector<Anope::string> GetServiceKeys();
private:
/** Call the module_delete function to safely delete the module
* @param m the module to delete
* @return MOD_ERR_OK on success, anything else on fail
*/
static ModuleReturn DeleteModule(Module *m);
static void DeleteModule(Module *m);
};
/** Class used for callbacks within modules
@@ -1248,6 +1272,17 @@ class CallBack : public Timer
}
};
class CoreExport Service : public Base
{
public:
Module *owner;
Anope::string name;
Service(Module *o, const Anope::string &n);
virtual ~Service();
};
template<typename T>
class service_reference : public dynamic_reference<T>
{
@@ -1258,6 +1293,10 @@ class service_reference : public dynamic_reference<T>
{
}
virtual ~service_reference()
{
}
operator bool()
{
if (this->invalid)
+104 -16
View File
@@ -6,10 +6,41 @@
* Please read COPYING and README for further details.
*/
#ifndef OPER_H
#define OPER_H
#ifndef OPERSERV_H
#define OPERSERV_H
extern CoreExport std::vector<NewsItem *> News;
extern CoreExport std::vector<std::bitset<32> > DefCon;
extern CoreExport bool DefConModesSet;
extern CoreExport Flags<ChannelModeName, CMODE_END * 2> DefConModesOn;
extern CoreExport Flags<ChannelModeName, CMODE_END * 2> DefConModesOff;
extern CoreExport std::map<ChannelModeName, Anope::string> DefConModesOnParams;
class XLineManager;
extern CoreExport XLineManager *SGLine;
extern CoreExport XLineManager *SZLine;
extern CoreExport XLineManager *SQLine;
extern CoreExport XLineManager *SNLine;
extern CoreExport bool SetDefConParam(ChannelModeName, const Anope::string &);
extern CoreExport bool GetDefConParam(ChannelModeName, Anope::string &);
extern CoreExport void UnsetDefConParam(ChannelModeName);
extern CoreExport bool CheckDefCon(DefconLevel Level);
extern CoreExport bool CheckDefCon(int level, DefconLevel Level);
extern CoreExport void AddDefCon(int level, DefconLevel Level);
extern CoreExport void DelDefCon(int level, DefconLevel Level);
extern CoreExport void os_init();
extern CoreExport void oper_global(const Anope::string &nick, const char *fmt, ...);
extern CoreExport void server_global(const Server *s, const Anope::string &message);
enum XLineType
{
X_SNLINE,
X_SQLINE,
X_SZLINE
};
class CoreExport XLine
{
@@ -29,29 +60,24 @@ class CoreExport XLine
Anope::string GetHost() const;
};
class CoreExport XLineManager : public Service
class CoreExport XLineManager
{
char type;
private:
/* List of XLine managers we check users against in XLineManager::CheckAll */
static std::list<XLineManager *> XLineManagers;
protected:
/* List of XLines in this XLineManager */
std::vector<XLine *> XLines;
public:
/* List of XLine managers we check users against in XLineManager::CheckAll */
static std::list<XLineManager *> XLineManagers;
/** Constructor
*/
XLineManager(Module *creator, const Anope::string &name, char t);
XLineManager();
/** Destructor
*/
virtual ~XLineManager();
/** The type of xline provided by this service
* @return The type
*/
const char &Type();
/** Register a XLineManager, places it in XLineManagers for use in XLineManager::CheckAll
* It is important XLineManagers are registered in the proper order. Eg, if you had one akilling
* clients and one handing them free olines, you would want the akilling one first. This way if a client
@@ -103,13 +129,14 @@ class CoreExport XLineManager : public Service
void Clear();
/** Add an entry to this XLine Manager
* @param bi The bot error replies should be sent from
* @param u The user adding the XLine
* @param mask The mask of the XLine
* @param creator The creator of the XLine
* @param expires When this should expire
* @param reaosn The reason
* @return A pointer to the XLine
*/
virtual XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason);
virtual XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
private:
/** Delete an XLine, eg, remove it from the IRCd.
@@ -159,4 +186,65 @@ class CoreExport XLineManager : public Service
virtual void Send(User *u, XLine *x) = 0;
};
#endif // OPER_H
/* This is for AKILLS */
class SGLineManager : public XLineManager
{
public:
XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
void Del(XLine *x);
void OnMatch(User *u, XLine *x);
void OnExpire(XLine *x);
void Send(User *u, XLine *x);
};
class SNLineManager : public XLineManager
{
public:
XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
void Del(XLine *x);
void OnMatch(User *u, XLine *x);
void OnExpire(XLine *x);
void Send(User *u, XLine *x);
XLine *Check(User *u);
};
class SQLineManager : public XLineManager
{
public:
XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
void Del(XLine *x);
void OnMatch(User *u, XLine *x);
void OnExpire(XLine *x);
void Send(User *u, XLine *x);
static bool Check(Channel *c);
};
class SZLineManager : public XLineManager
{
public:
XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
void Del(XLine *x);
void OnMatch(User *u, XLine *x);
void OnExpire(XLine *x);
void Send(User *u, XLine *x);
};
#endif // OPERSERV_H
+4 -9
View File
@@ -12,16 +12,15 @@
class OperType;
struct CoreExport Oper
struct Oper
{
Anope::string name;
Anope::string password;
Anope::string certfp;
OperType *ot;
bool config;
Oper(const Anope::string &n, const Anope::string &p, const Anope::string &c, OperType *o) :
name(n), password(p), certfp(c), ot(o), config(false) { }
name(n), password(p), certfp(c), ot(o) { }
/** Find an oper block by name
* @param name The name
@@ -56,10 +55,6 @@ class CoreExport OperType
*/
std::set<OperType *> inheritances;
public:
/** Modes to set when someone identifys using this opertype
*/
Anope::string modes;
/** Find an oper type by name
* @param name The name
* @return The oper type
@@ -105,12 +100,12 @@ class CoreExport OperType
/** Gets the icommands for this opertype
* @return A list of commands
*/
const std::list<Anope::string> GetCommands() const;
const std::list<Anope::string> &GetCommands() const;
/** Gets the privileges for this opertype
* @return A list of privileges
*/
const std::list<Anope::string> GetPrivs() const;
const std::list<Anope::string> &GetPrivs() const;
};
#endif // OPERTYPE_H
+75 -40
View File
@@ -9,7 +9,7 @@
#ifndef REGCHANNEL_H
#define REGCHANNEL_H
typedef Anope::insensitive_map<ChannelInfo *> registered_channel_map;
typedef unordered_map_namespace::unordered_map<Anope::string, ChannelInfo *, ci::hash, std::equal_to<ci::string> > registered_channel_map;
extern CoreExport registered_channel_map RegisteredChannelList;
/** Flags used for the ChannelInfo class
@@ -18,6 +18,8 @@ enum ChannelInfoFlag
{
CI_BEGIN,
/* ChanServ is currently holding the channel */
CI_INHABIT,
/* Retain the topic even after the channel is emptied */
CI_KEEPTOPIC,
/* Don't allow non-authorized users to be opped */
@@ -32,6 +34,8 @@ enum ChannelInfoFlag
CI_PEACE,
/* Don't allow any privileges unless a user is IDENTIFIED with NickServ */
CI_SECURE,
/* Don't allow the channel to be registered or used */
CI_FORBIDDEN,
/* Channel does not expire */
CI_NO_EXPIRE,
/* Channel memo limit may not be changed */
@@ -44,6 +48,8 @@ enum ChannelInfoFlag
CI_SIGNKICK,
/* Sign kicks if level is < than the one defined by the SIGNKIGK level */
CI_SIGNKICK_LEVEL,
/* Uses XOP */
CI_XOP,
/* Channel is suspended */
CI_SUSPENDED,
/* Channel still exists when emptied, this can be caused by setting a perm
@@ -57,9 +63,22 @@ enum ChannelInfoFlag
};
const Anope::string ChannelInfoFlagStrings[] = {
"BEGIN", "KEEPTOPIC", "SECUREOPS", "PRIVATE", "TOPICLOCK", "RESTRICTED",
"PEACE", "SECURE", "NO_EXPIRE", "MEMO_HARDMAX", "OPNOTICE", "SECUREFOUNDER",
"SIGNKICK", "SIGNKICK_LEVEL", "SUSPENDED", "PERSIST", ""
"BEGIN", "INHABIT", "KEEPTOPIC", "SECUREOPS", "PRIVATE", "TOPICLOCK", "RESTRICTED",
"PEACE", "SECURE", "FORBIDDEN", "NO_EXPIRE", "MEMO_HARDMAX", "OPNOTICE", "SECUREFOUNDER",
"SIGNKICK", "SIGNKICK_LEVEL", "XOP", "SUSPENDED", "PERSIST", ""
};
class CoreExport ChanAccess
{
Anope::string mask; /* Mask of the access entry */
public:
int16 level;
NickCore *nc; /* NC of the entry, if the entry is a valid nickcore */
time_t last_seen;
Anope::string creator;
ChanAccess(const Anope::string &umask);
const Anope::string &GetMask();
};
/** Flags for auto kick
@@ -101,15 +120,14 @@ struct ModeLock
class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, CI_END>
{
private:
NickCore *founder; /* Channel founder */
std::vector<ChanAccess *> access; /* List of authorized users */
typedef std::multimap<ChannelModeName, ModeLock> ModeList;
private:
std::vector<ChanAccess *> access; /* List of authorized users */
std::vector<AutoKick *> akick; /* List of users to kickban */
std::vector<BadWord *> badwords; /* List of badwords */
public:
typedef std::multimap<ChannelModeName, ModeLock> ModeList;
ModeList mode_locks;
public:
/** Default constructor
* @param chname The channel name
*/
@@ -118,13 +136,14 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** Copy constructor
* @param ci The ChannelInfo to copy settings to
*/
ChannelInfo(ChannelInfo &ci);
ChannelInfo(ChannelInfo *ci);
/** Default destructor
*/
~ChannelInfo();
Anope::string name; /* Channel name */
NickCore *founder;
NickCore *successor; /* Who gets the channel if the founder nick is dropped or expires */
Anope::string desc;
@@ -135,41 +154,38 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
Anope::string last_topic_setter; /* Setter */
time_t last_topic_time; /* Time */
// These two should be using extensible
Anope::string forbidby;
Anope::string forbidreason;
int16 bantype;
int16 levels[CA_SIZE];
int16 *levels; /* Access levels for commands */
MemoInfo memos;
Channel *c; /* Pointer to channel record (if channel is currently in use) */
/* For BotServ */
BotInfo *bi; /* Bot used on this channel */
Flags<BotServFlag> botflags;
int16 ttb[TTB_SIZE]; /* Times to ban for each kicker */
int16 *ttb; /* Times to ban for each kicker */
int16 capsmin, capspercent; /* For CAPS kicker */
int16 floodlines, floodsecs; /* For FLOOD kicker */
int16 repeattimes; /* For REPEAT kicker */
/** Change the founder of the channek
* @params nc The new founder
*/
void SetFounder(NickCore *nc);
/** Get the founder of the channel
* @return The founder
*/
NickCore *GetFounder() const;
/** Find which bot should send mode/topic/etc changes for this channel
* @return The bot
*/
BotInfo *WhoSends();
/** Add an entry to the channel access list
* @param access The entry
*
* @param mask The mask of the access entry
* @param level The channel access level the user has on the channel
* @param creator The user who added the access
* @param last_seen When the user was last seen within the channel
* @return The new access class
*
* Creates a new access list entry and inserts it into the access list.
*/
void AddAccess(ChanAccess *access);
ChanAccess *AddAccess(const Anope::string &mask, int16 level, const Anope::string &creator, int32 last_seen = 0);
/** Get an entry from the channel access list by index
*
@@ -180,11 +196,36 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*/
ChanAccess *GetAccess(unsigned index);
/** Retrieve the access for a user or group in the form of a vector of access entries
* (as multiple entries can affect a single user).
/** Get an entry from the channel access list by User
*
* @param u The User to find within the access list vector
* @param level Optional channel access level to compare the access entries to
* @return A ChanAccess struct corresponding to the User, or NULL if not found
*
* Retrieves an entry from the access list that matches the given User, optionally also matching a certain level.
*/
AccessGroup AccessFor(User *u);
AccessGroup AccessFor(NickCore *nc);
ChanAccess *GetAccess(User *u, int16 level = 0);
/** Get an entry from the channel access list by NickCore
*
* @param u The NickCore to find within the access list vector
* @param level Optional channel access level to compare the access entries to
* @return A ChanAccess struct corresponding to the NickCore, or NULL if not found
*
* Retrieves an entry from the access list that matches the given NickCore, optionally also matching a certain level.
*/
ChanAccess *GetAccess(NickCore *nc, int16 level = 0);
/** Get an entry from the channel access list by mask
*
* @param u The mask to find within the access list vector
* @param level Optional channel access level to compare the access entries to
* @param wildcard True to match using wildcards
* @return A ChanAccess struct corresponding to the mask, or NULL if not found
*
* Retrieves an entry from the access list that matches the given mask, optionally also matching a certain level.
*/
ChanAccess *GetAccess(const Anope::string &mask, int16 level = 0, bool wildcard = true);
/** Get the size of the accss vector for this channel
* @return The access vector size
@@ -330,12 +371,6 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*/
ModeLock *GetMLock(ChannelModeName mname, const Anope::string &param = "");
/** Get the current mode locks as a string
* @param complete True to show mlock parameters aswell
* @return A string of mode locks, eg: +nrt
*/
Anope::string GetMLockAsString(bool complete) const;
/** Check whether a user is permitted to be on this channel
* @param u The user
* @return true if they are allowed, false if they aren't and were kicked
@@ -357,7 +392,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** A timer used to keep the BotServ bot/ChanServ in the channel
* after kicking the last user in a channel
*/
class CoreExport ChanServTimer : public Timer
class ChanServTimer : public Timer
{
private:
dynamic_reference<Channel> c;
+2 -7
View File
@@ -6,8 +6,8 @@ extern CoreExport Server *Me;
extern CoreExport void do_server(const Anope::string &source, const Anope::string &servername, unsigned int hops, const Anope::string &descript, const Anope::string &numeric);
extern CoreExport const Anope::string ts6_uid_retrieve();
extern CoreExport const Anope::string ts6_sid_retrieve();
extern CoreExport const char *ts6_uid_retrieve();
extern CoreExport const char *ts6_sid_retrieve();
/* Types of capab
*/
@@ -107,11 +107,6 @@ class CoreExport Server : public Flags<ServerFlag>
*/
const Anope::string &GetDescription() const;
/** Change this servers SID
* @param sid The new SID
*/
void SetSID(const Anope::string &sid);
/** Get the server numeric/SID
* @return The numeric/SID
*/
+164 -73
View File
@@ -45,8 +45,10 @@
#if GETTEXT_FOUND
# include <libintl.h>
# define _(x) anope_gettext(x)
#else
# define _(x) x
#endif
#define _(x) x
#ifndef _WIN32
# include <unistd.h>
@@ -57,6 +59,9 @@
# include <sys/socket.h>
# include <sys/time.h>
# include <dirent.h>
# ifdef HAVE_BACKTRACE
# include <execinfo.h>
# endif
# define DllExport
# define CoreExport
# define MARK_DEPRECATED __attribute((deprecated))
@@ -239,23 +244,6 @@ class DatabaseException : public CoreException
virtual ~DatabaseException() throw() { }
};
class Signal
{
static std::vector<Signal *> SignalHandlers;
static void SignalHandler(int signal);
struct sigaction action, old;
sig_atomic_t called;
public:
static void Process();
int signal;
Signal(int s);
~Signal();
virtual void OnSignal() = 0;
};
/** Debug cast to be used instead of dynamic_cast, this uses dynamic_cast
* for debug builds and static_cast on releass builds to speed up the program
* because dynamic_cast relies on RTTI.
@@ -284,7 +272,6 @@ template<typename T, size_t Size = 32> class Flags
const Anope::string *Flag_Strings;
public:
Flags() : Flag_Strings(NULL) { }
Flags(const Anope::string *flag_strings) : Flag_Strings(flag_strings) { }
/** Add a flag to this item
@@ -345,20 +332,6 @@ template<typename T, size_t Size = 32> class Flags
}
};
class Module;
class CoreExport Service : public Base
{
public:
Module *owner;
Anope::string name;
Service(Module *o, const Anope::string &n);
virtual ~Service();
};
#include "sockets.h"
#include "socketengine.h"
#include "extensible.h"
@@ -436,6 +409,7 @@ class ChannelInfo;
class Channel;
class Server;
class Entry;
struct Session;
#include "threadengine.h"
#include "opertype.h"
@@ -480,11 +454,13 @@ enum MemoFlag
/* Memo is unread */
MF_UNREAD,
/* Sender requests a receipt */
MF_RECEIPT
MF_RECEIPT,
/* Memo is a notification of receipt */
MF_NOTIFYS
};
const Anope::string MemoFlagStrings[] = {
"MF_UNREAD", "MF_RECEIPT", ""
"MF_UNREAD", "MF_RECEIPT", "MF_NOTIFYS", ""
};
/* Memo info structures. Since both nicknames and channels can have memos,
@@ -502,7 +478,7 @@ struct CoreExport MemoInfo
{
int16 memomax;
std::vector<Memo *> memos;
std::vector<Anope::string> ignores;
std::vector<ci::string> ignores;
unsigned GetIndex(Memo *m) const;
void Del(unsigned index);
@@ -510,23 +486,6 @@ struct CoreExport MemoInfo
bool HasIgnore(User *u);
};
struct Session
{
Anope::string host; /* Host of the session */
unsigned count; /* Number of clients with this host */
unsigned hits; /* Number of subsequent kills for a host */
};
struct Exception
{
Anope::string mask; /* Hosts to which this exception applies */
unsigned limit; /* Session limit for exception */
Anope::string who; /* Nick of person who added the exception */
Anope::string reason; /* Reason for exception's addition */
time_t time; /* When this exception was added */
time_t expires; /* Time when it expires. 0 == no expiry */
};
/*************************************************************************/
class CoreExport HostInfo
@@ -576,6 +535,28 @@ class CoreExport HostInfo
const time_t GetTime() const;
};
enum AccessLevel
{
/* Note that these two levels also serve as exclusive boundaries for valid
* access levels. ACCESS_FOUNDER may be assumed to be strictly greater
* than any valid access level, and ACCESS_INVALID may be assumed to be
* strictly less than any valid access level. Also read below.
*/
ACCESS_FOUNDER = 10001, /* Numeric level indicating founder access */
ACCESS_INVALID = -10000, /* Used in levels[] for disabled settings */
/* There is one exception to the above access levels: SuperAdmins will have
* access level 10001. This level is never stored, however; it is only used
* in comparison and to let SuperAdmins win from founders where needed
*/
ACCESS_SUPERADMIN = 10002,
/* Levels for xOP */
ACCESS_VOP = 3,
ACCESS_HOP = 4,
ACCESS_AOP = 5,
ACCESS_SOP = 10,
ACCESS_QOP = 10000
};
/** Flags for badwords
*/
enum BadWordType
@@ -597,6 +578,51 @@ struct BadWord
BadWordType type;
};
/* Indices for cmd_access[]: */
enum ChannelAccess
{
CA_INVITE,
CA_AKICK,
CA_SET, /* but not FOUNDER or PASSWORD */
CA_UNBAN,
CA_AUTOOP,
CA_AUTOVOICE,
CA_OPDEOP, /* ChanServ commands OP and DEOP */
CA_ACCESS_LIST,
CA_NOJOIN, /* Maximum */
CA_ACCESS_CHANGE,
CA_MEMO,
CA_ASSIGN, /* BotServ ASSIGN command */
CA_BADWORDS, /* BotServ BADWORDS command */
CA_NOKICK, /* Not kicked by the bot */
CA_FANTASIA,
CA_SAY,
CA_GREET,
CA_VOICEME,
CA_VOICE,
CA_GETKEY,
CA_AUTOHALFOP,
CA_AUTOPROTECT,
CA_OPDEOPME,
CA_HALFOPME,
CA_HALFOP,
CA_PROTECTME,
CA_PROTECT,
CA_KICKME,
CA_KICK,
CA_SIGNKICK,
CA_BANME,
CA_BAN,
CA_TOPIC,
CA_MODE,
CA_INFO,
CA_AUTOOWNER,
CA_OWNER,
CA_OWNERME,
CA_FOUNDER,
CA_SIZE
};
/* BotServ SET flags */
enum BotServFlag
{
@@ -607,6 +633,8 @@ enum BotServFlag
BS_DONTKICKVOICES,
/* BotServ bot accepts fantasy commands */
BS_FANTASY,
/* BotServ bot sets modes etc instead of ChanServ */
BS_SYMBIOSIS,
/* BotServ should show greets */
BS_GREET,
/* BotServ bots are not allowed to be in this channel */
@@ -641,7 +669,7 @@ enum BotServFlag
};
const Anope::string BotServFlagStrings[] = {
"BEGIN", "DONTKICKOPS", "DONTKICKVOICES", "FANTASY", "GREET", "NOBOT",
"BEGIN", "DONTKICKOPS", "DONTKICKVOICES", "FANTASY", "SYMBIOSIS", "GREET", "NOBOT",
"KICK_BOLDs", "KICK_COLORS", "KICK_REVERSES", "KICK_UNDERLINES", "KICK_BADWORDS", "KICK_CAPS",
"KICK_FLOOD", "KICK_REPEAT", "KICK_ITALICS", "KICK_AMSGS", "MSG_PRIVMSG", "MSG_NOTICE",
"MSG_NOTICEOPS", ""
@@ -663,7 +691,6 @@ enum
TTB_SIZE
};
#include "access.h"
#include "regchannel.h"
/*************************************************************************/
@@ -674,8 +701,22 @@ enum
#include "users.h"
#include "account.h"
#include "commands.h"
#include "bots.h"
struct BanData
{
Anope::string mask; /* Since a nick is unsure and a User structure is unsafe */
time_t last_use; /* Since time is the only way to check whether it's still useful */
int16 ttb[TTB_SIZE];
};
struct LevelInfo
{
int what;
Anope::string name;
const char *desc;
};
#include "channels.h"
/** Channelban type flags
@@ -722,6 +763,33 @@ class CoreExport Entry : public Flags<EntryType>
/*************************************************************************/
/* News stuff */
enum NewsType
{
NEWS_LOGON,
NEWS_RANDOM,
NEWS_OPER
};
struct NewsMessages
{
NewsType type;
Anope::string name;
const char *msgs[10];
};
struct NewsItem
{
NewsType type;
uint32 num;
Anope::string Text;
Anope::string who;
time_t time;
};
/*************************************************************************/
/* Mail data */
struct MailInfo
@@ -733,7 +801,43 @@ struct MailInfo
/*************************************************************************/
struct Exception
{
Anope::string mask; /* Hosts to which this exception applies */
unsigned limit; /* Session limit for exception */
Anope::string who; /* Nick of person who added the exception */
Anope::string reason; /* Reason for exception's addition */
time_t time; /* When this exception was added */
time_t expires; /* Time when it expires. 0 == no expiry */
};
/*************************************************************************/
extern CoreExport Anope::map<Session *> SessionList;
struct Session
{
Anope::string host;
unsigned count; /* Number of clients with this host */
unsigned hits; /* Number of subsequent kills for a host */
};
/*************************************************************************/
/* Defcon */
enum DefconLevel
{
DEFCON_NO_NEW_CHANNELS,
DEFCON_NO_NEW_NICKS,
DEFCON_NO_MLOCK_CHANGE,
DEFCON_FORCE_CHAN_MODES,
DEFCON_REDUCE_SESSION,
DEFCON_NO_NEW_CLIENTS,
DEFCON_OPER_ONLY,
DEFCON_SILENT_OPER_ONLY,
DEFCON_AKILL_NEW_CLIENTS,
DEFCON_NO_NEW_MEMOS
};
/*************************************************************************/
@@ -756,10 +860,10 @@ class IRCdMessage;
struct Uplink;
class ServerConfig;
class ConfigurationFile;
class XLine;
#include "extern.h"
#include "language.h"
#include "operserv.h"
#include "mail.h"
#include "servers.h"
#include "logger.h"
@@ -784,7 +888,7 @@ class CoreExport IRCDProto
public:
virtual ~IRCDProto() { }
virtual void SendSVSNOOP(const Server *, bool) { }
virtual void SendSVSNOOP(const Anope::string &, int) { }
virtual void SendTopic(BotInfo *, Channel *) = 0;
virtual void SendVhostDel(User *) { }
virtual void SendAkill(User *, const XLine *) = 0;
@@ -792,7 +896,7 @@ class CoreExport IRCDProto
virtual void SendSVSKill(const BotInfo *source, const User *user, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const Channel *dest, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const User *u, const char *fmt, ...);
virtual void SendClientIntroduction(const User *u) = 0;
virtual void SendClientIntroduction(const User *u, const Anope::string &) = 0;
virtual void SendKick(const BotInfo *bi, const Channel *chan, const User *user, const char *fmt, ...);
virtual void SendNoticeChanops(const BotInfo *bi, const Channel *dest, const char *fmt, ...);
virtual void SendMessage(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
@@ -805,7 +909,7 @@ class CoreExport IRCDProto
virtual void SendQuit(const User *u, const char *fmt, ...);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
virtual void SendJoin(User *, Channel *, const ChannelStatus *) = 0;
virtual void SendJoin(BotInfo *, Channel *, const ChannelStatus *) = 0;
virtual void SendSQLineDel(const XLine *x) { }
virtual void SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick);
virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...);
@@ -891,19 +995,6 @@ struct Uplink
bool ipv6;
Uplink(const Anope::string &_host, int _port, const Anope::string &_password, bool _ipv6) : host(_host), port(_port), password(_password), ipv6(_ipv6) { }
bool operator==(const Uplink &other) const
{
if (this->host != other.host)
return false;
if (this->port != other.port)
return false;
if (this->password != other.password)
return false;
if (this->ipv6 != other.ipv6)
return false;
return true;
}
inline bool operator!=(const Uplink &other) const { return !(*this == other); }
};
/** A class to process numbered lists (passed to most DEL/LIST/VIEW commands).
+15 -11
View File
@@ -12,43 +12,47 @@
#ifndef SOCKETENGINE_H
#define SOCKETENGINE_H
class CoreExport SocketEngine
class CoreExport SocketEngineBase
{
public:
#ifdef _WIN32
/* Windows crap */
WSADATA wsa;
#endif
/* Map of sockets */
static std::map<int, Socket *> Sockets;
std::map<int, Socket *> Sockets;
/** Called to initialize the socket engine
/** Default constructor
*/
static void Init();
SocketEngineBase();
/** Called to shutdown the socket engine
/** Default destructor
*/
static void Shutdown();
virtual ~SocketEngineBase();
/** Add a socket to the internal list
* @param s The socket
*/
static void AddSocket(Socket *s);
virtual void AddSocket(Socket *s) { }
/** Delete a socket from the internal list
* @param s The socket
*/
static void DelSocket(Socket *s);
virtual void DelSocket(Socket *s) { }
/** Mark a socket as writeable
* @param s The socket
*/
static void MarkWritable(Socket *s);
virtual void MarkWritable(Socket *s) { }
/** Unmark a socket as writeable
* @param s The socket
*/
static void ClearWritable(Socket *s);
virtual void ClearWritable(Socket *s) { }
/** Read from sockets and do things
*/
static void Process();
virtual void Process() { }
};
#endif // SOCKETENGINE_H
+19 -76
View File
@@ -137,46 +137,27 @@ class CoreExport SocketIO
* @param sz How much to read
* @return Number of bytes received
*/
virtual int Recv(Socket *s, char *buf, size_t sz);
virtual int Recv(Socket *s, char *buf, size_t sz) const;
/** Write something to the socket
* @param s The socket
* @param buf What to write
* @return Number of bytes written
*/
virtual int Send(Socket *s, const Anope::string &buf);
virtual int Send(Socket *s, const Anope::string &buf) const;
/** Accept a connection from a socket
* @param s The socket
* @return The new socket
*/
virtual ClientSocket *Accept(ListenSocket *s);
/** Check if a connection has been accepted
* @param s The client socket
* @return -1 on error, 0 to wait, 1 on success
*/
virtual int Accepted(ClientSocket *cs);
/** Bind a socket
* @param s The socket
* @param ip The IP to bind to
* @param port The optional port to bind to
*/
virtual void Bind(Socket *s, const Anope::string &ip, int port = 0);
virtual void Accept(ListenSocket *s);
/** Connect the socket
* @param s The socket
* @param s THe socket
* @param target IP to connect to
* @param port to connect to
* @param bindip IP to bind to, if any
*/
virtual void Connect(ConnectionSocket *s, const Anope::string &target, int port);
/** Check if this socket is connected
* @param s The socket
* @return -1 for error, 0 for wait, 1 for connected
*/
virtual int Connected(ConnectionSocket *s);
virtual void Connect(ConnectionSocket *s, const Anope::string &target, int port, const Anope::string &bindip = "");
/** Called when the socket is destructing
*/
@@ -192,9 +173,6 @@ class CoreExport Socket : public Flags<SocketFlag, 2>
bool IPv6;
public:
/* Sockaddrs for bind() (if it's bound) */
sockaddrs bindaddr;
/* I/O functions used for this socket */
SocketIO *IO;
@@ -236,12 +214,6 @@ class CoreExport Socket : public Flags<SocketFlag, 2>
*/
bool SetNonBlocking();
/** Bind the socket to an ip and port
* @param ip The ip
* @param port The port
*/
void Bind(const Anope::string &ip, int port = 0);
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
*/
@@ -262,11 +234,11 @@ class CoreExport BufferedSocket : public Socket
{
protected:
/* Things to be written to the socket */
Anope::string WriteBuffer;
std::string WriteBuffer;
/* Part of a message sent from the server, but not totally received */
Anope::string extrabuf;
std::string extrabuf;
/* How much data was received from this socket */
int RecvLen;
size_t RecvLen;
public:
/** Blank constructor
@@ -309,16 +281,20 @@ class CoreExport BufferedSocket : public Socket
/** Get the length of the read buffer
* @return The length of the read buffer
*/
int ReadBufferLen() const;
size_t ReadBufferLen() const;
/** Get the length of the write buffer
* @return The length of the write buffer
*/
int WriteBufferLen() const;
size_t WriteBufferLen() const;
};
class CoreExport ListenSocket : public Socket
{
protected:
/* Sockaddrs for bindip/port */
sockaddrs listenaddrs;
public:
/** Constructor
* @param bindip The IP to bind to
@@ -347,10 +323,10 @@ class CoreExport ListenSocket : public Socket
class CoreExport ConnectionSocket : public BufferedSocket
{
public:
/* Sockaddrs for bindip (if there is one) */
sockaddrs bindaddr;
/* Sockaddrs for connection ip/port */
sockaddrs conaddr;
/* True if connected */
bool connected;
/** Constructor
* @param ipv6 true to use IPv6
@@ -361,32 +337,9 @@ class CoreExport ConnectionSocket : public BufferedSocket
/** Connect the socket
* @param TargetHost The target host to connect to
* @param Port The target port to connect to
* @param BindHost The host to bind to for connecting
*/
void Connect(const Anope::string &TargetHost, int Port);
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
*/
bool ProcessRead();
/** Called when the socket is ready to be written to
* @return true on success, false to drop this socket
*/
bool ProcessWrite();
/** Called when there is an error for this socket
* @return true on success, false to drop this socket
*/
void ProcessError();
/** Called on a successful connect
*/
virtual void OnConnect();
/** Called when a connection is not successful
* @param error The error
*/
virtual void OnError(const Anope::string &error);
void Connect(const Anope::string &TargetHost, int Port, const Anope::string &BindHost = "");
};
class CoreExport ClientSocket : public BufferedSocket
@@ -403,16 +356,6 @@ class CoreExport ClientSocket : public BufferedSocket
* @param addr Address the connection came from
*/
ClientSocket(ListenSocket *ls, int fd, const sockaddrs &addr);
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
*/
bool ProcessRead();
/** Called when the socket is ready to be written to
* @return true on success, false to drop this socket
*/
bool ProcessWrite();
};
class CoreExport Pipe : public BufferedSocket
+3 -2
View File
@@ -7,14 +7,15 @@
#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_STDDEF_H 1
#cmakedefine HAVE_BACKTRACE 1
#cmakedefine HAVE_SETGRENT 1
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE_STRICMP 1
#cmakedefine HAVE_STRINGS_H 1
#cmakedefine HAVE_STRLCAT 1
#cmakedefine HAVE_STRLCPY 1
#cmakedefine HAVE_UMASK 1
#cmakedefine HAVE_EVENTFD 1
#cmakedefine HAVE_EPOLL 1
#cmakedefine HAVE_POLL 1
#cmakedefine GETTEXT_FOUND 1
#cmakedefine RUNGROUP "@RUNGROUP@"
+1 -5
View File
@@ -63,11 +63,6 @@ class CoreExport Timer : public Extensible
*/
bool GetRepeat() const;
/** Set the interval between ticks
* @paramt t The new interval
*/
void SetSecs(time_t t);
/** Returns the interval between ticks
* @return The interval
*/
@@ -90,6 +85,7 @@ class CoreExport Timer : public Extensible
*/
class CoreExport TimerManager : public Extensible
{
protected:
/** A list of timers
*/
static std::vector<Timer *> Timers;
+4 -14
View File
@@ -54,7 +54,8 @@ class CoreExport User : public Extensible
Server *server; /* Server user is connected to */
time_t timestamp; /* Timestamp of the nick */
time_t my_signon; /* When did _we_ see the user? */
bool SuperAdmin; /* is SuperAdmin on or off? */
int isSuperAdmin; /* is SuperAdmin on or off? */
/* Channels the user is in */
UChannelList chans;
@@ -76,7 +77,7 @@ class CoreExport User : public Extensible
* @param shost The hostname of the user
* @param suid The unique identifier of the user.
*/
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &suid = "");
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &suid);
/** Destroy a user.
*/
@@ -194,7 +195,7 @@ class CoreExport User : public Extensible
* @param CheckSecure Only returns true if the user has secure off
* @return true or false
*/
virtual bool IsRecognized(bool CheckSecure = true);
virtual bool IsRecognized(bool CheckSecure = false);
/** Check if the user is a services oper
* @return true if they are an oper
@@ -271,11 +272,6 @@ class CoreExport User : public Extensible
*/
void SetModesInternal(const char *umodes, ...);
/** Get modes set for this user.
* @return A string of modes set on the user
*/
Anope::string GetModes() const;
/** Find the channel container for Channel c that the user is on
* This is preferred over using FindUser in Channel, as there are usually more users in a channel
* than channels a user is in
@@ -288,12 +284,6 @@ class CoreExport User : public Extensible
* @return true or false
*/
bool IsProtected() const;
/** Kill a user
* @param source The user/server doing the kill
* @param reason The reason for the kill
*/
void Kill(const Anope::string &source, const Anope::string &reason);
};
#endif // USERS_H
+8241 -8401
View File
File diff suppressed because it is too large Load Diff
+8288 -8536
View File
File diff suppressed because it is too large Load Diff
+9824 -13981
View File
File diff suppressed because it is too large Load Diff
+8038 -8175
View File
File diff suppressed because it is too large Load Diff
+8634 -8938
View File
File diff suppressed because it is too large Load Diff
+8558 -8967
View File
File diff suppressed because it is too large Load Diff
+8189 -8396
View File
File diff suppressed because it is too large Load Diff
+7994 -8143
View File
File diff suppressed because it is too large Load Diff
+8494 -8794
View File
File diff suppressed because it is too large Load Diff
+8641
View File
File diff suppressed because it is too large Load Diff
+8357 -8615
View File
File diff suppressed because it is too large Load Diff
+8912 -14191
View File
File diff suppressed because it is too large Load Diff
+8357 -8761
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,20 +1,20 @@
#!/bin/bash
rm -f anope.pot
rm anope.pot
touch anope.pot
cd ..
FILES=`find ./ -name *.cpp -o -name *.h | grep -v /modules/third/`
FILES=`find ./ -name *.cpp -o -name *.h | grep -v /modules/extra/`
for f in $FILES
do
xgettext -E -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword --keyword=_ $f
xgettext -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword=_ $f
done
cd -
for f in *.po
do
msgmerge -E -v -s -U $f `echo $f | cut -d'.' -f1`.pot
msgmerge -v -s -U $f `echo $f | cut -d'.' -f1`.pot
done
rm -f *~
+4 -10
View File
@@ -1,4 +1,4 @@
add_subdirectory("third/language")
add_subdirectory("extra/language")
# Get a list of ALL files and directories within the current directory
file(GLOB MODULES_FOLDERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
@@ -77,10 +77,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
set(WIN32_NO_LIBS)
endif(WIN32)
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${TEMP_LDFLAGS} ${WIN32_NO_LIBS}")
add_dependencies(${SO} ${PROGRAM_NAME})
if(GETTEXT_FOUND)
add_dependencies(${SO} module_language)
endif(GETTEXT_FOUND)
add_dependencies(${SO} ${PROGRAM_NAME} module_language)
# For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
if(WIN32)
target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY} ${TEMP_DEPENDENCIES})
@@ -99,7 +96,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Get a list of ALL files and directories within this modules directory
file(GLOB SUBMODULE_DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${MODULE_FOLDER}/*")
remove_item_from_list(SUBMODULE_DIRS "CMakeFiles")
remove_item_from_list(SUBMODULE_DIRS "third/language")
remove_item_from_list(SUBMODULE_DIRS "extra/language")
foreach(SUBDIR ${SUBMODULE_DIRS})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
@@ -177,10 +174,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${SO} MODULE ${MODULES_SUBDIR_SRCS})
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${SUBDIR_LDFLAGS}")
add_dependencies(${SO} ${PROGRAM_NAME})
if(GETTEXT_FOUND)
add_dependencies(${SO} module_language)
endif(GETTEXT_FOUND)
add_dependencies(${SO} ${PROGRAM_NAME} module_language)
# For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
if(WIN32)
target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY} ${SUBDIR_EXTRA_DEPENDS})
-168
View File
@@ -1,168 +0,0 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSAssign : public Command
{
public:
CommandBSAssign(Module *creator) : Command(creator, "botserv/assign", 2, 2)
{
this->SetDesc(_("Assigns a bot to a channel"));
this->SetSyntax(_("\037channel\037 \037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &chan = params[0];
const Anope::string &nick = params[1];
User *u = source.u;
if (readonly)
{
source.Reply(BOT_ASSIGN_READONLY);
return;
}
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
BotInfo *bi = findbot(nick);
if (!bi)
{
source.Reply(BOT_DOES_NOT_EXIST, nick.c_str());
return;
}
if (ci->botflags.HasFlag(BS_NOBOT) || (!ci->AccessFor(u).HasPriv(CA_ASSIGN) && !u->HasPriv("botserv/administration")))
{
source.Reply(ACCESS_DENIED);
return;
}
if (bi->HasFlag(BI_PRIVATE) && !u->HasCommand("botserv/assign/private"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (ci->bi == bi)
{
source.Reply(_("Bot \002%s\002 is already assigned to channel \002%s\002."), ci->bi->nick.c_str(), chan.c_str());
return;
}
bool override = !ci->AccessFor(u).HasPriv(CA_ASSIGN);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << bi->nick;
bi->Assign(u, ci);
source.Reply(_("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), ci->name.c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Assigns a bot pointed out by nick to the channel chan. You\n"
"can then configure the bot for the channel so it fits\n"
"your needs."));
return true;
}
};
class CommandBSUnassign : public Command
{
public:
CommandBSUnassign(Module *creator) : Command(creator, "botserv/unassign", 1, 1)
{
this->SetDesc(_("Unassigns a bot from a channel"));
this->SetSyntax(_("\037channel\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
if (readonly)
{
source.Reply(BOT_ASSIGN_READONLY);
return;
}
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv(CA_ASSIGN))
{
source.Reply(ACCESS_DENIED);
return;
}
if (!ci->bi)
{
source.Reply(BOT_NOT_ASSIGNED);
return;
}
if (ci->HasFlag(CI_PERSIST) && !ModeManager::FindChannelModeByName(CMODE_PERM))
{
source.Reply(_("You can not unassign bots while persist is set on the channel."));
return;
}
bool override = !ci->AccessFor(u).HasPriv(CA_ASSIGN);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << ci->bi->nick;
ci->bi->UnAssign(u, ci);
source.Reply(_("There is no bot assigned to %s anymore."), ci->name.c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Unassigns a bot from a channel. When you use this command,\n"
"the bot won't join the channel anymore. However, bot\n"
"configuration for the channel is kept, so you will always\n"
"be able to reassign a bot later without have to reconfigure\n"
"it entirely."));
return true;
}
};
class BSAssign : public Module
{
CommandBSAssign commandbsassign;
CommandBSUnassign commandbsunassign;
public:
BSAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbsassign(this), commandbsunassign(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbsassign);
ModuleManager::RegisterService(&commandbsunassign);
}
};
MODULE_INIT(BSAssign)
-158
View File
@@ -1,158 +0,0 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSay : public Command
{
public:
CommandBSSay(Module *creator) : Command(creator, "botserv/say", 2, 2)
{
this->SetDesc(_("Makes the bot say the given text on the given channel"));
this->SetSyntax(_("\037channel\037 \037text\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &text = params[1];
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!ci->AccessFor(u).HasPriv(CA_SAY))
{
source.Reply(ACCESS_DENIED);
return;
}
if (!ci->bi)
{
source.Reply(BOT_NOT_ASSIGNED);
return;
}
if (!ci->c || !ci->c->FindUser(ci->bi))
{
source.Reply(BOT_NOT_ON_CHANNEL, ci->name.c_str());
return;
}
if (text[0] == '\001')
{
this->OnSyntaxError(source, "");
return;
}
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str());
ci->bi->lastmsg = Anope::CurTime;
// XXX need a way to find if someone is overriding this
Log(LOG_COMMAND, u, this, ci) << text;
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Makes the bot say the given text on the given channel."));
return true;
}
};
class CommandBSAct : public Command
{
public:
CommandBSAct(Module *creator) : Command(creator, "botserv/act", 2, 2)
{
this->SetDesc(_("Makes the bot do the equivalent of a \"/me\" command"));
this->SetSyntax(_("\037channel\037 \037text\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
Anope::string message = params[1];
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!ci->AccessFor(u).HasPriv(CA_SAY))
{
source.Reply(ACCESS_DENIED);
return;
}
if (!ci->bi)
{
source.Reply(BOT_NOT_ASSIGNED);
return;
}
if (!ci->c || !ci->c->FindUser(ci->bi))
{
source.Reply(BOT_NOT_ON_CHANNEL, ci->name.c_str());
return;
}
size_t i = 0;
while ((i = message.find(1)) && i != Anope::string::npos)
message.erase(i, 1);
ircdproto->SendAction(ci->bi, ci->name, "%s", message.c_str());
ci->bi->lastmsg = Anope::CurTime;
// XXX Need to be able to find if someone is overriding this.
Log(LOG_COMMAND, u, this, ci) << message;
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Makes the bot do the equivalent of a \"/me\" command\n"
"on the given channel using the given text."));
return true;
}
};
class BSControl : public Module
{
CommandBSSay commandbssay;
CommandBSAct commandbsact;
public:
BSControl(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbssay(this), commandbsact(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbssay);
ModuleManager::RegisterService(&commandbsact);
}
};
MODULE_INIT(BSControl)
-937
View File
@@ -1,937 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
enum
{
ACCESS_INVALID = -10000,
ACCESS_FOUNDER = 10001
};
static struct AccessLevels
{
ChannelAccess priv;
int default_level;
Anope::string config_name;
Anope::string name;
Anope::string desc;
} defaultLevels[] = {
{ CA_ACCESS_CHANGE, 10, "level_change", "ACC-CHANGE", _("Allowed to modify the access list") },
{ CA_ACCESS_LIST, 1, "level_list", "ACC-LIST", _("Allowed to view the access list") },
{ CA_AKICK, 10, "level_akick", "AKICK", _("Allowed to use AKICK command") },
{ CA_ASSIGN, ACCESS_FOUNDER, "level_assign", "ASSIGN", _("Allowed to assign/unassign a bot") },
{ CA_AUTOHALFOP, 4, "level_autohalfop", "AUTOHALFOP", _("Automatic mode +h") },
{ CA_AUTOOP, 5, "level_autoop", "AUTOOP", _("Automatic channel operator status") },
{ CA_AUTOOWNER, 10000, "level_autoowner", "AUTOOWNER", _("Automatic mode +q") },
{ CA_AUTOPROTECT, 10, "level_autoprotect", "AUTOPROTECT", _("Automatic mode +a") },
{ CA_AUTOVOICE, 3, "level_autovoice", "AUTOVOICE", _("Automatic mode +v") },
{ CA_BADWORDS, 10, "level_badwords", "BADWORDS", _("Allowed to modify channel badwords list") },
{ CA_BAN, 4, "level_ban", "BAN", _("Allowed to use ban users") },
{ CA_FANTASIA, 3, "level_fantasia", "FANTASIA", _("Allowed to use fantaisist commands") },
{ CA_FOUNDER, ACCESS_FOUNDER, "level_founder", "FOUNDER", _("Allowed to issue commands restricted to channel founders") },
{ CA_GETKEY, 5, "level_getkey", "GETKEY", _("Allowed to use GETKEY command") },
{ CA_GREET, 5, "level_greet", "GREET", _("Greet message displayed") },
{ CA_HALFOP, 5, "level_halfop", "HALFOP", _("Allowed to (de)halfop users") },
{ CA_HALFOPME, 4, "level_halfopme", "HALFOPME", _("Allowed to (de)halfop him/herself") },
{ CA_INFO, 10000, "level_info", "INFO", _("Allowed to use INFO command with ALL option") },
{ CA_INVITE, 5, "level_invite", "INVITE", _("Allowed to use the INVITE command") },
{ CA_KICK, 4, "level_kick", "KICK", _("Allowed to use the KICK command") },
{ CA_MEMO, 10, "level_memo", "MEMO", _("Allowed to read channel memos") },
{ CA_MODE, 5, "level_mode", "MODE", _("Allowed to change channel modes") },
{ CA_NOKICK, 1, "level_nokick", "NOKICK", _("Never kicked by the bot's kickers") },
{ CA_OPDEOP, 5, "level_opdeop", "OPDEOP", _("Allowed to (de)op users") },
{ CA_OPDEOPME, 5, "level_opdeopme", "OPDEOPME", _("Allowed to (de)op him/herself") },
{ CA_OWNER, ACCESS_FOUNDER, "level_owner", "OWNER", _("Allowed to use (de)owner users") },
{ CA_OWNERME, 10000, "level_ownerme", "OWNERME", _("Allowed to (de)owner him/herself") },
{ CA_PROTECT, 10000, "level_protect", "PROTECT", _("Allowed to (de)protect users") },
{ CA_PROTECTME, 10, "level_protectme", "PROTECTME", _("Allowed to (de)protect him/herself"), },
{ CA_SAY, 5, "level_say", "SAY", _("Allowed to use SAY and ACT commands") },
{ CA_SIGNKICK, ACCESS_FOUNDER, "level_signkick", "SIGNKICK", _("No signed kick when SIGNKICK LEVEL is used") },
{ CA_SET, 10000, "level_set", "SET", _("Allowed to set channel settings") },
{ CA_TOPIC, 5, "level_topic", "TOPIC", _("Allowed to change channel topics") },
{ CA_UNBAN, 4, "level_unban", "UNBAN", _("Allowed to unban users") },
{ CA_VOICE, 4, "level_voice", "VOICE", _("Allowed to (de)voice users") },
{ CA_VOICEME, 3, "level_voiceme", "VOICEME", _("Allowed to (de)voice him/herself") },
{ CA_SIZE, -1, "", "", "" }
};
static void reset_levels(ChannelInfo *ci)
{
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
ci->levels[defaultLevels[i].priv] = defaultLevels[i].default_level;
}
class AccessChanAccess : public ChanAccess
{
public:
int level;
AccessChanAccess(AccessProvider *p) : ChanAccess(p)
{
}
bool Matches(User *u, NickCore *nc)
{
if (u && this->mask.find_first_of("!@?*") != Anope::string::npos && (Anope::Match(u->nick, this->mask) || Anope::Match(u->GetMask(), this->mask)))
return true;
else if (nc && Anope::Match(nc->display, this->mask))
return true;
return false;
}
bool HasPriv(ChannelAccess priv)
{
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
if (defaultLevels[i].priv == priv)
return this->ci->levels[priv] != ACCESS_INVALID && DetermineLevel(this) >= this->ci->levels[priv];
return false;
}
Anope::string Serialize()
{
return stringify(this->level);
}
void Unserialize(const Anope::string &data)
{
this->level = convertTo<int>(data);
}
static int DetermineLevel(ChanAccess *access)
{
if (access->provider->name == "access/access")
{
AccessChanAccess *aaccess = debug_cast<AccessChanAccess *>(access);
return aaccess->level;
}
else
{
int highest = 1;
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
if (access->ci->levels[defaultLevels[i].priv] > highest && access->HasPriv(defaultLevels[i].priv))
highest = access->ci->levels[defaultLevels[i].priv];
if (highest >= ACCESS_FOUNDER)
highest = ACCESS_FOUNDER - 1;
return highest;
}
}
};
class AccessAccessProvider : public AccessProvider
{
public:
AccessAccessProvider(Module *o) : AccessProvider(o, "access/access")
{
}
ChanAccess *Create()
{
return new AccessChanAccess(this);
}
};
class AccessListCallback : public NumberList
{
protected:
CommandSource &source;
ChannelInfo *ci;
bool SentHeader;
public:
AccessListCallback(CommandSource &_source, ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, false), source(_source), ci(_ci), SentHeader(false)
{
}
~AccessListCallback()
{
if (SentHeader)
source.Reply(_("End of access list."));
else
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
}
virtual void HandleNumber(unsigned Number)
{
if (!Number || Number > ci->GetAccessCount())
return;
if (!SentHeader)
{
SentHeader = true;
source.Reply(CHAN_ACCESS_LIST_HEADER, ci->name.c_str());
}
DoList(source, ci, Number - 1, ci->GetAccess(Number - 1));
}
static void DoList(CommandSource &source, ChannelInfo *ci, unsigned Number, ChanAccess *access)
{
source.Reply(_(" %3d %4d %s"), Number + 1, AccessChanAccess::DetermineLevel(access), access->mask.c_str());
}
};
class AccessViewCallback : public AccessListCallback
{
public:
AccessViewCallback(CommandSource &_source, ChannelInfo *_ci, const Anope::string &numlist) : AccessListCallback(_source, _ci, numlist)
{
}
void HandleNumber(unsigned Number)
{
if (!Number || Number > ci->GetAccessCount())
return;
if (!SentHeader)
{
SentHeader = true;
source.Reply(CHAN_ACCESS_LIST_HEADER, ci->name.c_str());
}
DoList(source, ci, Number - 1, ci->GetAccess(Number - 1));
}
static void DoList(CommandSource &source, ChannelInfo *ci, unsigned Number, ChanAccess *access)
{
Anope::string timebuf;
if (ci->c)
for (CUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end; ++cit)
if (access->Matches((*cit)->user, (*cit)->user->Account()))
timebuf = "Now";
if (timebuf.empty())
{
if (access->last_seen == 0)
timebuf = "Never";
else
timebuf = do_strftime(access->last_seen, NULL, true);
}
source.Reply(CHAN_ACCESS_VIEW_AXS_FORMAT, Number + 1, AccessChanAccess::DetermineLevel(access), access->mask.c_str(), access->creator.c_str(), do_strftime(access->created, NULL, true).c_str(), timebuf.c_str());
}
};
class AccessDelCallback : public NumberList
{
CommandSource &source;
ChannelInfo *ci;
Command *c;
unsigned Deleted;
Anope::string Nicks;
bool Denied;
bool override;
public:
AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), Deleted(0), Denied(false)
{
if (!ci->AccessFor(source.u).HasPriv(CA_ACCESS_CHANGE) && source.u->HasPriv("chanserv/access/modify"))
this->override = true;
}
~AccessDelCallback()
{
if (Denied && !Deleted)
source.Reply(ACCESS_DENIED);
else if (!Deleted)
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
else
{
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, c, ci) << "for user" << (Deleted == 1 ? " " : "s ") << Nicks;
if (Deleted == 1)
source.Reply(_("Deleted 1 entry from %s access list."), ci->name.c_str());
else
source.Reply(_("Deleted %d entries from %s access list."), Deleted, ci->name.c_str());
}
}
void HandleNumber(unsigned Number)
{
if (!Number || Number > ci->GetAccessCount())
return;
User *u = source.u;
ChanAccess *access = ci->GetAccess(Number - 1);
AccessGroup u_access = ci->AccessFor(u);
ChanAccess *u_highest = u_access.Highest();
if (u_highest ? AccessChanAccess::DetermineLevel(u_highest) : 0 <= AccessChanAccess::DetermineLevel(access) && !u->HasPriv("chanserv/access/modify"))
{
Denied = true;
return;
}
++Deleted;
if (!Nicks.empty())
Nicks += ", " + access->mask;
else
Nicks = access->mask;
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, u, access));
ci->EraseAccess(Number - 1);
}
};
class CommandCSAccess : public Command
{
void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
User *u = source.u;
Anope::string mask = params[2];
int level = ACCESS_INVALID;
try
{
level = convertTo<int>(params[3]);
}
catch (const ConvertException &) { }
if (!level)
{
source.Reply(_("Access level must be non-zero."));
return;
}
AccessGroup u_access = ci->AccessFor(u);
ChanAccess *highest = u_access.Highest();
int u_level = (highest ? AccessChanAccess::DetermineLevel(highest) : 0);
if (level >= u_level && !u_access.Founder && !u->HasPriv("chanserv/access/modify"))
{
source.Reply(ACCESS_DENIED);
return;
}
else if (level <= ACCESS_INVALID || level >= ACCESS_FOUNDER)
{
source.Reply(CHAN_ACCESS_LEVEL_RANGE, ACCESS_INVALID + 1, ACCESS_FOUNDER - 1);
return;
}
bool override = !ci->AccessFor(u).HasPriv(CA_ACCESS_CHANGE) || (level >= u_level && !u_access.Founder);
if (mask.find_first_of("!*@") == Anope::string::npos && findnick(mask) == NULL)
mask += "!*@*";
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->mask))
{
/* Don't allow lowering from a level >= u_level */
if (AccessChanAccess::DetermineLevel(access) >= u_level && !u_access.Founder && !u->HasPriv("chanserv/access/modify"))
{
source.Reply(ACCESS_DENIED);
return;
}
ci->EraseAccess(i - 1);
break;
}
}
if (ci->GetAccessCount() >= Config->CSAccessMax)
{
source.Reply(_("Sorry, you can only have %d access entries on a channel."), Config->CSAccessMax);
return;
}
service_reference<AccessProvider> provider("access/access");
if (!provider)
return;
AccessChanAccess *access = debug_cast<AccessChanAccess *>(provider->Create());
access->ci = ci;
access->mask = mask;
access->creator = u->nick;
access->level = level;
access->last_seen = 0;
access->created = Anope::CurTime;
ci->AddAccess(access);
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, access));
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << mask << " (level: " << level << ") as level " << u_level;
source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), level);
return;
}
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &mask = params[2];
if (!ci->GetAccessCount())
source.Reply(_("%s access list is empty."), ci->name.c_str());
else if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
{
AccessDelCallback list(source, ci, this, mask);
list.Process();
}
else
{
AccessGroup u_access = ci->AccessFor(u);
ChanAccess *highest = u_access.Highest();
int u_level = (highest ? AccessChanAccess::DetermineLevel(highest) : 0);
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->mask))
{
int access_level = AccessChanAccess::DetermineLevel(access);
if (!access->mask.equals_ci(u->Account()->display) && !u_access.Founder && u_level <= access_level && !u->HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
else
{
source.Reply(_("\002%s\002 deleted from %s access list."), access->mask.c_str(), ci->name.c_str());
bool override = !u_access.Founder && !u_access.HasPriv(CA_ACCESS_CHANGE) && !access->mask.equals_ci(u->Account()->display);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "DEL " << access->mask;
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, u, access));
ci->EraseAccess(access);
}
return;
}
}
source.Reply(_("\002%s\002 not found on %s access list."), mask.c_str(), ci->name.c_str());
}
return;
}
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
const Anope::string &nick = params.size() > 2 ? params[2] : "";
if (!ci->GetAccessCount())
source.Reply(_("%s access list is empty."), ci->name.c_str());
else if (!nick.empty() && nick.find_first_not_of("1234567890,-") == Anope::string::npos)
{
AccessListCallback list(source, ci, nick);
list.Process();
}
else
{
bool SentHeader = false;
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
{
ChanAccess *access = ci->GetAccess(i);
if (!nick.empty() && !Anope::Match(access->mask, nick))
continue;
if (!SentHeader)
{
SentHeader = true;
source.Reply(CHAN_ACCESS_LIST_HEADER, ci->name.c_str());
}
AccessListCallback::DoList(source, ci, i, access);
}
if (SentHeader)
source.Reply(_("End of access list."));
else
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
}
return;
}
void DoView(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
const Anope::string &nick = params.size() > 2 ? params[2] : "";
if (!ci->GetAccessCount())
source.Reply(_("%s access list is empty."), ci->name.c_str());
else if (!nick.empty() && nick.find_first_not_of("1234567890,-") == Anope::string::npos)
{
AccessViewCallback list(source, ci, nick);
list.Process();
}
else
{
bool SentHeader = false;
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
{
ChanAccess *access = ci->GetAccess(i);
if (!nick.empty() && !Anope::Match(access->mask, nick))
continue;
if (!SentHeader)
{
SentHeader = true;
source.Reply(CHAN_ACCESS_LIST_HEADER, ci->name.c_str());
}
AccessViewCallback::DoList(source, ci, i, access);
}
if (SentHeader)
source.Reply(_("End of access list."));
else
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
}
return;
}
void DoClear(CommandSource &source, ChannelInfo *ci)
{
User *u = source.u;
if (!IsFounder(u, ci) && !u->HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
else
{
ci->ClearAccess();
FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u));
source.Reply(_("Channel %s access list has been cleared."), ci->name.c_str());
bool override = !IsFounder(u, ci);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "CLEAR";
}
return;
}
public:
CommandCSAccess(Module *creator) : Command(creator, "chanserv/access", 2, 4)
{
this->SetDesc(_("Modify the list of privileged users"));
this->SetSyntax(_("\037channel\037 ADD \037mask\037 \037level\037"));
this->SetSyntax(_("\037channel\037 DEL {\037mask\037 | \037entry-num\037 | \037list\037}"));
this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 VIEW [\037mask\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 CLEAR\002"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &cmd = params[1];
const Anope::string &nick = params.size() > 2 ? params[2] : "";
const Anope::string &s = params.size() > 3 ? params[3] : "";
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
bool is_list = cmd.equals_ci("LIST") || cmd.equals_ci("VIEW");
bool is_clear = cmd.equals_ci("CLEAR");
bool is_del = cmd.equals_ci("DEL");
bool has_access = false;
if (u->HasPriv("chanserv/access/modify"))
has_access = true;
else if (is_list && ci->AccessFor(u).HasPriv(CA_ACCESS_LIST))
has_access = true;
else if (ci->AccessFor(u).HasPriv(CA_ACCESS_CHANGE))
has_access = true;
else if (is_del)
{
NickAlias *na = findnick(nick);
if (na && na->nc == u->Account())
has_access = true;
}
/* If LIST, we don't *require* any parameters, but we can take any.
* If DEL, we require a nick and no level.
* Else (ADD), we require a level (which implies a nick). */
if (is_list || is_clear ? 0 : (cmd.equals_ci("DEL") ? (nick.empty() || !s.empty()) : s.empty()))
this->OnSyntaxError(source, cmd);
else if (!has_access)
source.Reply(ACCESS_DENIED);
else if (readonly && !is_list)
source.Reply(_("Sorry, channel access list modification is temporarily disabled."));
else if (cmd.equals_ci("ADD"))
this->DoAdd(source, ci, params);
else if (cmd.equals_ci("DEL"))
this->DoDel(source, ci, params);
else if (cmd.equals_ci("LIST"))
this->DoList(source, ci, params);
else if (cmd.equals_ci("VIEW"))
this->DoView(source, ci, params);
else if (cmd.equals_ci("CLEAR"))
this->DoClear(source, ci);
else
this->OnSyntaxError(source, "");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Maintains the \002access list\002 for a channel. The access\n"
"list specifies which users are allowed chanop status or\n"
"access to %s commands on the channel. Different\n"
"user levels allow for access to different subsets of\n"
"privileges. Any registered user not on the access list has\n"
"a user level of 0, and any unregistered user has a user level\n"
"of -1."), source.owner->nick.c_str());
source.Reply(" ");
source.Reply(_("The \002ACCESS ADD\002 command adds the given mask to the\n"
"access list with the given user level; if the mask is\n"
"already present on the list, its access level is changed to\n"
"the level specified in the command. The \037level\037 specified\n"
"must be less than that of the user giving the command, and\n"
"if the \037mask\037 is already on the access list, the current\n"
"access level of that nick must be less than the access level\n"
"of the user giving the command. When a user joins the channel\n"
"the access they receive is from the highest level entry in the\n"
"access list."));
source.Reply(" ");
source.Reply(_("The \002ACCESS DEL\002 command removes the given nick from the\n"
"access list. If a list of entry numbers is given, those\n"
"entries are deleted. (See the example for LIST below.)\n"
"You may remove yourself from an access list, even if you\n"
"do not have access to modify that list otherwise."));
source.Reply(" ");
source.Reply(_("The \002ACCESS LIST\002 command displays the access list. If\n"
"a wildcard mask is given, only those entries matching the\n"
"mask are displayed. If a list of entry numbers is given,\n"
"only those entries are shown; for example:\n"
" \002ACCESS #channel LIST 2-5,7-9\002\n"
" Lists access entries numbered 2 through 5 and\n"
" 7 through 9.\n"
" \n"
"The \002ACCESS VIEW\002 command displays the access list similar\n"
"to \002ACCESS LIST\002 but shows the creator and last used time.\n"
" \n"
"The \002ACCESS CLEAR\002 command clears all entries of the\n"
"access list."));
source.Reply(_("\002User access levels\002\n"
" \n"
"By default, the following access levels are defined:\n"
" \n"
" \002Founder\002 Full access to %s functions; automatic\n"
" opping upon entering channel. Note\n"
" that only one person may have founder\n"
" status (it cannot be given using the\n"
" \002ACCESS\002 command).\n"
" \002 10\002 Access to AKICK command; automatic opping.\n"
" \002 5\002 Automatic opping.\n"
" \002 3\002 Automatic voicing.\n"
" \002 0\002 No special privileges; can be opped by other\n"
" ops (unless \002secure-ops\002 is set).\n"
" \n"
"These levels may be changed, or new ones added, using the\n"
"\002LEVELS\002 command; type \002%s%s HELP LEVELS\002 for\n"
"information."), source.owner->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
return true;
}
};
class CommandCSLevels : public Command
{
int levelinfo_maxwidth;
void DoSet(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &what = params[2];
const Anope::string &lev = params[3];
int level;
if (lev.equals_ci("FOUNDER"))
level = ACCESS_FOUNDER;
else
{
try
{
level = convertTo<int>(lev);
}
catch (const ConvertException &)
{
this->OnSyntaxError(source, "SET");
return;
}
}
if (level <= ACCESS_INVALID || level > ACCESS_FOUNDER)
source.Reply(_("Level must be between %d and %d inclusive."), ACCESS_INVALID + 1, ACCESS_FOUNDER - 1);
else
{
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
{
AccessLevels &l = defaultLevels[i];
if (what.equals_ci(l.name))
{
ci->levels[l.priv] = level;
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, i, level));
bool override = !ci->AccessFor(u).HasPriv(CA_FOUNDER);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "SET " << l.name << " to " << level;
if (level == ACCESS_FOUNDER)
source.Reply(_("Level for %s on channel %s changed to founder only."), l.name.c_str(), ci->name.c_str());
else
source.Reply(_("Level for \002%s\002 on channel %s changed to \002%d\002."), l.name.c_str(), ci->name.c_str(), level);
return;
}
}
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS \002 for a list of valid settings."), what.c_str(), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
}
return;
}
void DoDisable(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &what = params[2];
/* Don't allow disabling of the founder level. It would be hard to change it back if you dont have access to use this command */
if (!what.equals_ci("FOUNDER"))
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
{
AccessLevels &l = defaultLevels[i];
if (what.equals_ci(l.name))
{
ci->levels[l.priv] = ACCESS_INVALID;
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, i, l.priv));
bool override = !ci->AccessFor(u).HasPriv(CA_FOUNDER);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "DISABLE " << l.name;
source.Reply(_("\002%s\002 disabled on channel %s."), l.name.c_str(), ci->name.c_str());
return;
}
}
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS \002 for a list of valid settings."), what.c_str(), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
return;
}
void DoList(CommandSource &source, ChannelInfo *ci)
{
source.Reply(_("Access level settings for channel %s:"), ci->name.c_str());
if (!levelinfo_maxwidth)
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
{
AccessLevels &l = defaultLevels[i];
int len = l.name.length();
if (len > levelinfo_maxwidth)
levelinfo_maxwidth = len;
}
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
{
AccessLevels &l = defaultLevels[i];
int j = ci->levels[l.priv];
if (j == ACCESS_INVALID)
source.Reply(_(" %-*s (disabled)"), levelinfo_maxwidth, l.name.c_str());
else if (j == ACCESS_FOUNDER)
source.Reply(_(" %-*s (founder only)"), levelinfo_maxwidth, l.name.c_str());
else
source.Reply(_(" %-*s %d"), levelinfo_maxwidth, l.name.c_str(), j);
}
return;
}
void DoReset(CommandSource &source, ChannelInfo *ci)
{
User *u = source.u;
reset_levels(ci);
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, -1, 0));
bool override = !ci->AccessFor(u).HasPriv(CA_FOUNDER);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "RESET";
source.Reply(_("Access levels for \002%s\002 reset to defaults."), ci->name.c_str());
return;
}
public:
CommandCSLevels(Module *creator) : Command(creator, "chanserv/levels", 2, 4), levelinfo_maxwidth(0)
{
this->SetDesc(_("Redefine the meanings of access levels"));
this->SetSyntax(_("\037channel\037 SET \037type\037 \037level\037"));
this->SetSyntax(_("\037channel\037 {DIS | DISABLE} \037type\037"));
this->SetSyntax(_("\037channel\037 LIST"));
this->SetSyntax(_("\037channel\037 RESET"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &cmd = params[1];
const Anope::string &what = params.size() > 2 ? params[2] : "";
const Anope::string &s = params.size() > 3 ? params[3] : "";
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
/* If SET, we want two extra parameters; if DIS[ABLE] or FOUNDER, we want only
* one; else, we want none.
*/
if (cmd.equals_ci("SET") ? s.empty() : (cmd.substr(0, 3).equals_ci("DIS") ? (what.empty() || !s.empty()) : !what.empty()))
this->OnSyntaxError(source, cmd);
else if (!ci->AccessFor(u).HasPriv(CA_FOUNDER) && !u->HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
else if (cmd.equals_ci("SET"))
this->DoSet(source, ci, params);
else if (cmd.equals_ci("DIS") || cmd.equals_ci("DISABLE"))
this->DoDisable(source, ci, params);
else if (cmd.equals_ci("LIST"))
this->DoList(source, ci);
else if (cmd.equals_ci("RESET"))
this->DoReset(source, ci);
else
this->OnSyntaxError(source, "");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
if (subcommand.equals_ci("DESC"))
{
source.Reply(_("The following feature/function names are understood."));
if (!levelinfo_maxwidth)
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
{
AccessLevels &l = defaultLevels[i];
int len = l.name.length();
if (len > levelinfo_maxwidth)
levelinfo_maxwidth = len;
}
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
{
AccessLevels &l = defaultLevels[i];
source.Reply(_(" %-*s %s"), levelinfo_maxwidth, l.name.c_str(), translate(source.u, l.desc.c_str()));
}
}
else
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("The \002LEVELS\002 command allows fine control over the meaning of\n"
"the numeric access levels used for channels. With this\n"
"command, you can define the access level required for most\n"
"of %s's functions. (The \002SET FOUNDER\002 and this command\n"
"are always restricted to the channel founder.)\n"
" \n"
"\002LEVELS SET\002 allows the access level for a function or group of\n"
"functions to be changed. \002LEVELS DISABLE\002 (or \002DIS\002 for short)\n"
"disables an automatic feature or disallows access to a\n"
"function by anyone, INCLUDING the founder (although, the founder\n"
"can always reenable it).\n"
" \n"
"\002LEVELS LIST\002 shows the current levels for each function or\n"
"group of functions. \002LEVELS RESET\002 resets the levels to the\n"
"default levels of a newly-created channel (see\n"
"\002HELP ACCESS LEVELS\002).\n"
" \n"
"For a list of the features and functions whose levels can be\n"
"set, see \002HELP LEVELS DESC\002."), source.owner->nick.c_str());
}
return true;
}
};
class CSAccess : public Module
{
AccessAccessProvider accessprovider;
CommandCSAccess commandcsaccess;
CommandCSLevels commandcslevels;
public:
CSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
accessprovider(this), commandcsaccess(this), commandcslevels(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&accessprovider);
ModuleManager::RegisterService(&commandcsaccess);
ModuleManager::RegisterService(&commandcslevels);
Implementation i[] = { I_OnReload, I_OnChanRegistered, I_OnCreateChan, I_OnGroupCheckPriv };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
this->OnReload();
}
void OnReload()
{
ConfigReader config;
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
{
AccessLevels &l = defaultLevels[i];
const Anope::string &value = config.ReadValue("chanserv", l.config_name, "", 0);
if (value.equals_ci("founder"))
l.default_level = ACCESS_FOUNDER;
else if (value.equals_ci("disabled"))
l.default_level = ACCESS_INVALID;
else
l.default_level = config.ReadInteger("chanserv", l.config_name, 0, false);
}
}
void OnChanRegistered(ChannelInfo *ci)
{
reset_levels(ci);
}
void OnCreateChan(ChannelInfo *ci)
{
reset_levels(ci);
}
EventReturn OnGroupCheckPriv(const AccessGroup *group, ChannelAccess priv)
{
if (group->ci == NULL)
return EVENT_CONTINUE;
/* Special case. Allows a level of < 0 to match anyone, and a level of 0 to match anyone identified. */
int16 level = group->ci->levels[priv];
if (level < 0)
return EVENT_ALLOW;
else if (level == 0 && group->nc)
return EVENT_ALLOW;
return EVENT_CONTINUE;
}
};
MODULE_INIT(CSAccess)
-455
View File
@@ -1,455 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static struct FlagLevels
{
ChannelAccess priv;
char default_char;
Anope::string config_name;
Anope::string desc;
} flagLevels[] = {
{ CA_ACCESS_CHANGE, 'f', "flag_change", _("Allowed to modify the access list") },
{ CA_ACCESS_LIST, 'l', "flag_list", _("Allowed to view the access list") },
{ CA_AKICK, 'K', "flag_akick", _("Allowed to use AKICK command") },
{ CA_ASSIGN, 's', "flag_assign", _("Allowed to assign/unassign a bot") },
{ CA_AUTOHALFOP, 'H', "flag_autohalfop", _("Automatic mode +h") },
{ CA_AUTOOP, 'O', "flag_autoop", _("Automatic channel operator status") },
{ CA_AUTOOWNER, 'Q', "flag_autoowner", _("Automatic mode +q") },
{ CA_AUTOPROTECT, 'A', "flag_autoprotect", _("Automatic mode +a") },
{ CA_AUTOVOICE, 'V', "flag_autovoice", _("Automatic mode +v") },
{ CA_BADWORDS, 'k', "flag_badwords", _("Allowed to modify channel badwords list") },
{ CA_BAN, 'b', "flag_ban", _("Allowed to use ban users") },
{ CA_FANTASIA, 'c', "flag_fantasia", _("Allowed to use fantasy commands") },
{ CA_FOUNDER, 'F', "flag_founder", _("Allowed to issue commands restricted to channel founders") },
{ CA_GETKEY, 'G', "flag_getkey", _("Allowed to use GETKEY command") },
{ CA_GREET, 'g', "flag_greet", _("Greet message displayed") },
{ CA_HALFOP, 'h', "flag_halfop", _("Allowed to (de)halfop users") },
{ CA_HALFOPME, 'h', "flag_halfopme", _("Allowed to (de)halfop him/herself") },
{ CA_INFO, 'I', "flag_info", _("Allowed to use INFO command with ALL option") },
{ CA_INVITE, 'i', "flag_invite", _("Allowed to use the INVITE command") },
{ CA_KICK, 'k', "flag_kick", _("Allowed to use the KICK command") },
{ CA_MEMO, 'm', "flag_memo", _("Allowed to read channel memos") },
{ CA_MODE, 's', "flag_mode", _("Allowed to change channel modes") },
{ CA_NOKICK, 'N', "flag_nokick", _("Prevents users being kicked by Services") },
{ CA_OPDEOP, 'o', "flag_opdeop", _("Allowed to (de)op users") },
{ CA_OPDEOPME, 'o', "flag_opdeopme", _("Allowed to (de)op him/herself") },
{ CA_OWNER, 'q', "flag_owner", _("Allowed to use (de)owner users") },
{ CA_OWNERME, 'q', "flag_ownerme", _("Allowed to (de)owner him/herself") },
{ CA_PROTECT, 'a', "flag_protect", _("Allowed to (de)protect users") },
{ CA_PROTECTME, 'a', "flag_protectme", _("Allowed to (de)protect him/herself"), },
{ CA_SAY, 'B', "flag_say", _("Allowed to use SAY and ACT commands") },
{ CA_SET, 's', "flag_set", _("Allowed to set channel settings") },
{ CA_SIGNKICK, 'K', "flag_signkick", _("Prevents kicks from being signed") },
{ CA_TOPIC, 't', "flag_topic", _("Allowed to change channel topics") },
{ CA_UNBAN, 'u', "flag_unban", _("Allowed to unban users") },
{ CA_VOICE, 'v', "flag_voice", _("Allowed to (de)voice users") },
{ CA_VOICEME, 'v', "flag_voiceme", _("Allowed to (de)voice him/herself") },
{ CA_SIZE, -1, "", "" }
};
class FlagsChanAccess : public ChanAccess
{
public:
std::set<char> flags;
FlagsChanAccess(AccessProvider *p) : ChanAccess(p)
{
}
bool Matches(User *u, NickCore *nc)
{
if (u && this->mask.find_first_of("!@?*") != Anope::string::npos && (Anope::Match(u->nick, this->mask) || Anope::Match(u->GetMask(), this->mask)))
return true;
else if (nc && Anope::Match(nc->display, this->mask))
return true;
return false;
}
bool HasPriv(ChannelAccess priv)
{
for (int i = 0; flagLevels[i].priv != CA_SIZE; ++i)
if (flagLevels[i].priv == priv)
return this->flags.count(flagLevels[i].default_char);
return false;
}
Anope::string Serialize()
{
return Anope::string(this->flags.begin(), this->flags.end());
}
void Unserialize(const Anope::string &data)
{
for (unsigned i = data.length(); i > 0; --i)
this->flags.insert(data[i - 1]);
}
static Anope::string DetermineFlags(ChanAccess *access)
{
if (access->provider->name == "access/flags")
return access->Serialize();
std::set<char> buffer;
for (int i = 0; flagLevels[i].priv != CA_SIZE; ++i)
{
FlagLevels &l = flagLevels[i];
if (access->HasPriv(l.priv))
buffer.insert(l.default_char);
}
return Anope::string(buffer.begin(), buffer.end());
}
};
class FlagsAccessProvider : public AccessProvider
{
public:
FlagsAccessProvider(Module *o) : AccessProvider(o, "access/flags")
{
}
ChanAccess *Create()
{
return new FlagsChanAccess(this);
}
};
class CommandCSFlags : public Command
{
void DoModify(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
User *u = source.u;
Anope::string mask = params.size() > 2 ? params[2] : "";
Anope::string flags = params.size() > 3 ? params[3] : "";
if (flags.empty())
{
this->OnSyntaxError(source, "");
return;
}
AccessGroup u_access = ci->AccessFor(u);
if (mask.find_first_of("!*@") == Anope::string::npos && findnick(mask) == NULL)
mask += "!*@*";
ChanAccess *current = NULL;
std::set<char> current_flags;
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->mask))
{
current = access;
Anope::string cur_flags = FlagsChanAccess::DetermineFlags(access);
for (unsigned j = cur_flags.length(); j > 0; --j)
current_flags.insert(cur_flags[j - 1]);
break;
}
}
if (ci->GetAccessCount() >= Config->CSAccessMax)
{
source.Reply(_("Sorry, you can only have %d access entries on a channel."), Config->CSAccessMax);
return;
}
bool override = false;
int add = -1;
for (size_t i = 0; i < flags.length(); ++i)
{
char f = flags[i];
switch (f)
{
case '+':
add = 1;
break;
case '-':
add = 0;
break;
case '*':
if (add == -1)
break;
for (int j = 0; flagLevels[j].priv != CA_SIZE; ++j)
{
FlagLevels &l = flagLevels[j];
if (!u_access.HasPriv(l.priv))
{
if (u->HasPriv("chanserv/access/modify"))
override = true;
else
continue;
}
if (add == 1)
current_flags.insert(l.default_char);
else if (add == 0)
current_flags.erase(l.default_char);
}
break;
default:
if (add == -1)
break;
for (int j = 0; flagLevels[j].priv != CA_SIZE; ++j)
{
FlagLevels &l = flagLevels[j];
if (f != l.default_char)
continue;
else if (!u_access.HasPriv(l.priv))
{
if (u->HasPriv("chanserv/access/modify"))
override = true;
else
{
source.Reply(_("You can not set the \002%c\002 flag."), f);
continue;
}
}
if (add == 1)
current_flags.insert(f);
else if (add == 0)
current_flags.erase(f);
break;
}
}
}
if (current_flags.empty())
{
if (current != NULL)
{
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, u, current));
ci->EraseAccess(current);
source.Reply(_("\002%s\002 removed from the %s access list."), mask.c_str(), ci->name.c_str());
}
else
{
source.Reply(_("Insufficient flags given"));
}
return;
}
service_reference<AccessProvider> provider("access/flags");
if (!provider)
return;
FlagsChanAccess *access = debug_cast<FlagsChanAccess *>(provider->Create());
access->ci = ci;
access->mask = mask;
access->creator = u->nick;
access->last_seen = current ? current->last_seen : 0;
access->created = Anope::CurTime;
access->flags = current_flags;
if (current != NULL)
ci->EraseAccess(current);
ci->AddAccess(access);
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, access));
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "MODIFY " << mask << " with flags " << access->Serialize();
source.Reply(_("Access for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->Serialize().c_str());
return;
}
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
const Anope::string &arg = params.size() > 2 ? params[2] : "";
if (!ci->GetAccessCount())
source.Reply(_("%s access list is empty."), ci->name.c_str());
else
{
unsigned total = 0;
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
{
ChanAccess *access = ci->GetAccess(i);
const Anope::string &flags = FlagsChanAccess::DetermineFlags(access);
if (!arg.empty())
{
if (arg[0] == '+')
{
bool pass = true;
for (size_t j = 1; j < arg.length(); ++j)
if (flags.find(arg[j]) == Anope::string::npos)
pass = false;
if (pass == false)
continue;
}
else if (!Anope::Match(access->mask, arg))
continue;
}
if (++total == 1)
{
source.Reply(_("Flags list for %s"), ci->name.c_str());
}
source.Reply(_(" %3d %-10s +%-10s [last modified on %s by %s]"), i + 1, access->mask.c_str(), FlagsChanAccess::DetermineFlags(access).c_str(), do_strftime(access->created, source.u->Account(), true).c_str(), access->creator.c_str());
}
if (total == 0)
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
else if (total == ci->GetAccessCount())
source.Reply(_("End of access list."));
else
source.Reply(_("End of access list - %d/%d entries shown."), total, ci->GetAccessCount());
}
}
void DoClear(CommandSource &source, ChannelInfo *ci)
{
User *u = source.u;
if (!IsFounder(u, ci) && !u->HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
else
{
ci->ClearAccess();
FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u));
source.Reply(_("Channel %s access list has been cleared."), ci->name.c_str());
bool override = !IsFounder(u, ci);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "CLEAR";
}
return;
}
public:
CommandCSFlags(Module *creator) : Command(creator, "chanserv/flags", 2, 4)
{
this->SetDesc(_("Modify the list of privileged users"));
this->SetSyntax(_("\037channel\037 MODIFY \037mask\037 \037changes\037"));
this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | +\037flags\037]"));
this->SetSyntax(_("\037channel\037 CLEAR\002"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &chan = params[0];
const Anope::string &cmd = params[1];
User *u = source.u;
ChannelInfo *ci = cs_findchan(chan);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
return;
}
bool is_list = cmd.equals_ci("LIST");
bool has_access = false;
if (u->HasPriv("chanserv/access/modify"))
has_access = true;
else if (is_list && ci->AccessFor(u).HasPriv(CA_ACCESS_LIST))
has_access = true;
else if (ci->AccessFor(u).HasPriv(CA_ACCESS_CHANGE))
has_access = true;
if (!has_access)
source.Reply(ACCESS_DENIED);
else if (readonly && !is_list)
source.Reply(_("Sorry, channel access list modification is temporarily disabled."));
else if (cmd.equals_ci("MODIFY"))
this->DoModify(source, ci, params);
else if (cmd.equals_ci("LIST"))
this->DoList(source, ci, params);
else if (cmd.equals_ci("CLEAR"))
this->DoClear(source, ci);
else
this->OnSyntaxError(source, cmd);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("%s is another way to modify the channel access list, similar to\n"
"the XOP and ACCESS methods."), source.command.c_str());
source.Reply(" ");
source.Reply(_("The MODIFY command allows you to modify the access list. If mask is\n"
"not already on the access list is it added, then the changes are applied.\n"
"If the mask has no more flags, then the mask is removed from the access list.\n"
"Additionally, you may use +* or -* to add or remove all flags, respectively. You are\n"
"only able to modify the access list if you have the proper permission on the channel,\n"
"and even then you can only give other people access to up what you already have."));
source.Reply(" ");
source.Reply(_("The LIST command allows you to list existing entries on the channel access list.\n"
"If a mask is given, the mask is wildcard matched against all existing entries on the\n"
"access list, and only those entries are returned. If a set of flags is given, only those\n"
"on the access list with the specified flags are returned."));
source.Reply(" ");
source.Reply(_("The CLEAR command clears the channel access list, which requires channel founder."));
source.Reply(" ");
source.Reply(_("The available flags are:"));
std::multimap<char, FlagLevels *, std::less<ci::string> > levels;
for (int i = 0; flagLevels[i].priv != CA_SIZE; ++i)
levels.insert(std::make_pair(flagLevels[i].default_char, &flagLevels[i]));
for (std::multimap<char, FlagLevels *, std::less<ci::string> >::iterator it = levels.begin(), it_end = levels.end(); it != it_end; ++it)
{
FlagLevels *l = it->second;
source.Reply(" %c - %s", l->default_char, translate(source.u->Account(), l->desc.c_str()));
}
return true;
}
};
class CSFlags : public Module
{
FlagsAccessProvider accessprovider;
CommandCSFlags commandcsflags;
public:
CSFlags(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
accessprovider(this), commandcsflags(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&accessprovider);
ModuleManager::RegisterService(&commandcsflags);
Implementation i[] = { I_OnReload };
ModuleManager::Attach(i, this, 1);
this->OnReload();
}
void OnReload()
{
ConfigReader config;
for (int i = 0; flagLevels[i].priv != CA_SIZE; ++i)
{
FlagLevels &l = flagLevels[i];
const Anope::string &value = config.ReadValue("chanserv", l.config_name, "", 0);
if (value.empty())
continue;
l.default_char = value[0];
}
}
};
MODULE_INIT(CSFlags)
-91
View File
@@ -1,91 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSKick : public Command
{
public:
CommandCSKick(Module *creator) : Command(creator, "chanserv/kick", 2, 3)
{
this->SetDesc(_("Kicks a selected nick from a channel"));
this->SetSyntax(_("\037channel\037 \037nick\037 [\037reason\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &chan = params[0];
const Anope::string &target = params[1];
const Anope::string &reason = params.size() > 2 ? params[2] : "Requested";
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
Channel *c = findchan(params[0]);
bool is_same = target.equals_ci(u->nick);
User *u2 = is_same ? u : finduser(target);
AccessGroup u_access = ci->AccessFor(u), u2_access = ci->AccessFor(u2);
if (!c)
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
else if (!ci)
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
else if (!u2)
source.Reply(NICK_X_NOT_IN_USE, target.c_str());
else if (!ci->AccessFor(u).HasPriv(CA_KICK))
source.Reply(ACCESS_DENIED);
else if (!is_same && (ci->HasFlag(CI_PEACE)) && u2_access >= u_access)
source.Reply(ACCESS_DENIED);
else if (u2->IsProtected())
source.Reply(ACCESS_DENIED);
else if (!c->FindUser(u2))
source.Reply(NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str());
else
{
// XXX
Log(LOG_COMMAND, u, this, ci) << "for " << u2->nick;
if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !ci->AccessFor(u).HasPriv(CA_SIGNKICK)))
ci->c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), u->nick.c_str());
else
ci->c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
}
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Kicks a selected nick on a channel.\n"
" \n"
"By default, limited to AOPs or those with level 5 access \n"
"and above on the channel."));
return true;
}
};
class CSKick : public Module
{
CommandCSKick commandcskick;
public:
CSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), commandcskick(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcskick);
}
};
MODULE_INIT(CSKick)
-74
View File
@@ -1,74 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSASet : public Command
{
public:
CommandCSSASet(Module *creator) : Command(creator, "chanserv/saset", 2, 3)
{
this->SetDesc(_("Forcefully set channel options and information"));
this->SetSyntax(_("\037option\037 \037channel\037 \037parameters\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
this->OnSyntaxError(source, "");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows Services Operators to forcefully change settings\n"
"on channels.\n"
" \n"
"Available options:"));
Anope::string this_name = source.command;
for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
CommandInfo &info = it->second;
if (c_name.find_ci(this_name + " ") == 0)
{
service_reference<Command> command(info.name);
if (command)
{
source.command = it->first;
command->OnServHelp(source);
}
}
}
source.Reply(_("Type \002%s%s HELP SASET \037option\037\002 for more information on a\n"
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
return true;
}
};
class CSSASet : public Module
{
CommandCSSASet commandcssaset;
public:
CSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssaset(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssaset);
}
};
MODULE_INIT(CSSASet)
-429
View File
@@ -1,429 +0,0 @@
/* cs_seen: provides a seen command by tracking all users
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
enum TypeInfo
{
NEW, NICK_TO, NICK_FROM, JOIN, PART, QUIT, KICK
};
struct SeenInfo
{
Anope::string vhost;
TypeInfo type;
Anope::string nick2; // for nickchanges and kicks
Anope::string channel; // for join/part/kick
Anope::string message; // for part/kick/quit
time_t last; // the time when the user was last seen
};
class ModuleConfigClass
{
public:
time_t purgetime;
time_t expiretimeout;
};
ModuleConfigClass ModuleConfig;
typedef Anope::insensitive_map<SeenInfo *> database_map;
database_map database;
static SeenInfo *FindInfo(const Anope::string &nick)
{
database_map::iterator iter = database.find(nick);
if (iter != database.end())
return iter->second;
return NULL;
}
static bool ShouldHide(const Anope::string &channel, User *u)
{
Channel *targetchan = findchan(channel);
ChannelInfo *targetchan_ci = targetchan ? targetchan->ci : cs_findchan(channel);
if (targetchan && targetchan->HasMode(CMODE_SECRET))
return true;
else if (targetchan_ci && targetchan_ci->HasFlag(CI_PRIVATE))
return true;
else if (u && u->HasMode(UMODE_PRIV))
return true;
return false;
}
class CommandOSSeen : public Command
{
public:
CommandOSSeen(Module *creator) : Command(creator, "operserv/seen", 1, 2)
{
this->SetDesc(_("Statistics and maintenance for seen data"));
this->SetSyntax(_("\037STATS\037"));
this->SetSyntax(_("\037CLEAR\037 \037time\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
if (params[0].equals_ci("STATS"))
{
size_t mem_counter;
mem_counter = sizeof(database_map);
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end; ++it)
{
mem_counter += (5 * sizeof(Anope::string)) + sizeof(TypeInfo) + sizeof(time_t);
mem_counter += it->first.capacity();
mem_counter += it->second->vhost.capacity();
mem_counter += it->second->nick2.capacity();
mem_counter += it->second->channel.capacity();
mem_counter += it->second->message.capacity();
}
source.Reply(_("%lu nicks are stored in the database, using %.2Lf kB of memory"), database.size(), static_cast<long double>(mem_counter) / 1024);
}
else if (params[0].equals_ci("CLEAR"))
{
time_t time = 0;
if ((params.size() < 2) || (0 >= (time = dotime(params[1]))))
{
this->OnSyntaxError(source, params[0]);
return;
}
time = Anope::CurTime - time;
database_map::iterator buf;
size_t counter = 0;
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;)
{
buf = it;
++it;
if (time < buf->second->last)
{
Log(LOG_DEBUG) << buf->first << " was last seen " << do_strftime(buf->second->last) << ", deleting entry";
database.erase(buf);
counter++;
}
}
Log(LOG_ADMIN, source.u, this) << "CLEAR and removed " << counter << " nicks that were added after " << do_strftime(time, NULL, true);
source.Reply(_("Database cleared, removed %lu nicks that were added after %s"), counter, do_strftime(time, source.u->Account(), true).c_str());
}
else
this->SendSyntax(source);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("The \002STATS\002 command prints out statistics about stored nicks and memory usage."));
source.Reply(_("The \002CLEAR\002 command lets you clean the database by removing all entries from the\n"
"entries from the database that were added within \037time\037.\n"
" \n"
"Example:\n"
"%s CLEAR 30m\n"
"will remove all entries that were added within the last 30 minutes."), source.command.c_str());
return true;
}
};
class CommandSeen : public Command
{
public:
CommandSeen(Module *creator) : Command(creator, "chanserv/seen", 1, 2)
{
this->SetFlag(CFLAG_STRIP_CHANNEL);
this->SetDesc(_("Tells you about the last time a user was seen"));
this->SetSyntax(_("\037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &target = params[0];
User *u = source.u;
if (target.length() > Config->NickLen)
{
source.Reply(_("Nick too long, max length is %u chars"), Config->NickLen);
return;
}
if (findbot(target) != NULL)
{
source.Reply(_("%s is a client on services."), target.c_str());
return;
}
if (target.equals_ci(u->nick))
{
source.Reply(_("You might see yourself in the mirror, %s."), u->nick.c_str());
return;
}
SeenInfo *info = FindInfo(target);
if (!info)
{
source.Reply(_("Sorry, I have not seen %s."), target.c_str());
return;
}
User *u2 = finduser(target);
Anope::string onlinestatus;
if (u2)
onlinestatus = ".";
else
onlinestatus = Anope::printf(_(" but %s mysteriously dematerialized."), target.c_str());
Anope::string timebuf = duration(Anope::CurTime - info->last, u->Account());
Anope::string timebuf2 = do_strftime(info->last, u->Account(), true);
if (info->type == NEW)
{
source.Reply(_("%s (%s) was last seen connecting %s ago (%s)%s"),
target.c_str(), info->vhost.c_str(), timebuf.c_str(), timebuf2.c_str(), onlinestatus.c_str());
}
else if (info->type == NICK_TO)
{
u2 = finduser(info->nick2);
if (u2)
onlinestatus = Anope::printf( _(". %s is still online."), u2->nick.c_str());
else
onlinestatus = Anope::printf(_(", but %s mysteriously dematerialized"), info->nick2.c_str());
source.Reply(_("%s (%s) was last seen changing nick to %s %s ago%s"),
target.c_str(), info->vhost.c_str(), info->nick2.c_str(), timebuf.c_str(), onlinestatus.c_str());
}
else if (info->type == NICK_FROM)
{
source.Reply(_("%s (%s) was last seen changing nick from %s to %s %s ago%s"),
target.c_str(), info->vhost.c_str(), info->nick2.c_str(), target.c_str(), timebuf.c_str(), onlinestatus.c_str());
}
else if (info->type == JOIN)
{
if (ShouldHide(info->channel, u2))
source.Reply(_("%s (%s) was last seen joining a secret channel %s ago%s"),
target.c_str(), info->vhost.c_str(), timebuf.c_str(), onlinestatus.c_str());
else
source.Reply(_("%s (%s) was last seen joining %s %s ago%s"),
target.c_str(), info->vhost.c_str(), info->channel.c_str(), timebuf.c_str(), onlinestatus.c_str());
}
else if (info->type == PART)
{
if (ShouldHide(info->channel, u2))
source.Reply(_("%s (%s) was last seen parting a secret channel %s ago%s"),
target.c_str(), info->vhost.c_str(), timebuf.c_str(), onlinestatus.c_str());
else
source.Reply(_("%s (%s) was last seen parting %s %s ago%s"),
target.c_str(), info->vhost.c_str(), info->channel.c_str(), timebuf.c_str(), onlinestatus.c_str());
}
else if (info->type == QUIT)
{
source.Reply(_("%s (%s) was last seen quitting (%s) %s ago (%s)."),
target.c_str(), info->vhost.c_str(), info->message.c_str(), timebuf.c_str(), timebuf2.c_str());
}
else if (info->type == KICK)
{
if (ShouldHide(info->channel, u2))
source.Reply(_("%s (%s) was kicked from a secret channel %s ago%s"),
target.c_str(), info->vhost.c_str(), timebuf.c_str(), onlinestatus.c_str());
else
source.Reply(_("%s (%s) was kicked from %s (\"%s\") %s ago%s"),
target.c_str(), info->vhost.c_str(), info->channel.c_str(), info->message.c_str(), timebuf.c_str(), onlinestatus.c_str());
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Checks for the last time \037nick\037 was seen joining, leaving,\n"
"or changing nick on the network and tells you when and, depending\n"
"on channel or user settings, where it was."));
return true;
}
};
class DataBasePurger : public CallBack
{
public:
DataBasePurger(Module *owner) : CallBack(owner, 300, Anope::CurTime, true) { }
void Tick(time_t)
{
size_t previous_size = database.size();
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;)
{
database_map::iterator cur = it;
++it;
if ((Anope::CurTime - cur->second->last) > ModuleConfig.purgetime)
{
Log(LOG_DEBUG) << cur->first << " was last seen " << do_strftime(cur->second->last) << ", purging entry";
delete cur->second;
database.erase(cur);
}
}
Log(LOG_DEBUG) << "cs_seen: Purged Database, checked " << previous_size << " nicks and removed " << (previous_size - database.size()) << " old entries.";
}
};
class CSSeen : public Module
{
CommandSeen commandseen;
CommandOSSeen commandosseen;
DataBasePurger purger;
public:
CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), commandseen(this), commandosseen(this), purger(this)
{
this->SetAuthor("Anope");
Implementation eventlist[] = { I_OnReload,
I_OnUserConnect,
I_OnUserNickChange,
I_OnUserQuit,
I_OnJoinChannel,
I_OnPartChannel,
I_OnUserKicked,
I_OnDatabaseRead,
I_OnDatabaseWrite };
ModuleManager::Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
ModuleManager::RegisterService(&commandseen);
ModuleManager::RegisterService(&commandosseen);
OnReload();
}
void OnReload()
{
ConfigReader config;
ModuleConfig.purgetime = dotime(config.ReadValue("cs_seen", "purgetime", "30d", 0));
ModuleConfig.expiretimeout = dotime(config.ReadValue("cs_seen", "expiretimeout", "1d", 0));
if (purger.GetSecs() != ModuleConfig.expiretimeout)
purger.SetSecs(ModuleConfig.expiretimeout);
}
void OnUserConnect(User *u)
{
UpdateUser(u, NEW, u->nick, "", "", "");
}
void OnUserNickChange(User *u, const Anope::string &oldnick)
{
UpdateUser(u, NICK_TO, oldnick, u->nick, "", "");
UpdateUser(u, NICK_FROM, u->nick, oldnick, "", "");
}
void OnUserQuit(User *u, const Anope::string &msg)
{
UpdateUser(u, QUIT, u->nick, "", "", msg);
}
void OnJoinChannel(User *u, Channel *c)
{
UpdateUser(u, JOIN, u->nick, "", c->name, "");
}
void OnPartChannel(User *u, Channel *c, const Anope::string &channel, const Anope::string &msg)
{
UpdateUser(u, PART, u->nick, "", channel, msg);
}
void OnUserKicked(Channel *c, User *target, const Anope::string &source, const Anope::string &msg)
{
UpdateUser(target, KICK, target->nick, source, c->name, msg);
}
void UpdateUser(const User *u, const TypeInfo Type, const Anope::string &nick, const Anope::string &nick2, const Anope::string &channel, const Anope::string &message)
{
SeenInfo *info = FindInfo(nick);
if (!info)
{
info = new SeenInfo;
database.insert(std::pair<Anope::string, SeenInfo *>(nick, info));
}
info->vhost = u->GetVIdent() + "@" + u->GetDisplayedHost();
info->type = Type;
info->last = Anope::CurTime;
info->nick2 = nick2;
info->channel = channel;
info->message = message;
}
EventReturn OnDatabaseRead(const std::vector<Anope::string> &params)
{
if (params[0].equals_ci("SEEN") && (params.size() >= 5))
{
SeenInfo *info = new SeenInfo;
database.insert(std::pair<Anope::string, SeenInfo *>(params[1], info));
info->vhost = params[2];
info->last = params[3].is_pos_number_only() ? convertTo<time_t>(params[3]) : 0 ;
if (params[4].equals_ci("NEW"))
{
info->type = NEW;
}
else if (params[4].equals_ci("NICK_TO") && params.size() == 6)
{
info->type = NICK_TO;
info->nick2 = params[5];
}
else if (params[4].equals_ci("NICK_FROM") && params.size() == 6)
{
info->type = NICK_FROM;
info->nick2 = params[5];
}
else if (params[4].equals_ci("JOIN") && params.size() == 6)
{
info->type = JOIN;
info->channel = params[5];
}
else if (params[4].equals_ci("PART") && params.size() == 7)
{
info->type = PART;
info->channel = params[5];
info->message = params[6];
}
else if (params[4].equals_ci("QUIT") && params.size() == 6)
{
info->type = QUIT;
info->message = params[5];
}
else if (params[4].equals_ci("KICK") && params.size() == 8)
{
info->type = KICK;
info->nick2 = params[5];
info->channel = params[6];
info->message = params[7];
}
return EVENT_STOP;
}
return EVENT_CONTINUE;
}
void OnDatabaseWrite(void (*Write)(const Anope::string &))
{
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end; ++it)
{
std::stringstream buf;
buf << "SEEN " << it->first.c_str() << " " << it->second->vhost << " " << it->second->last << " ";
switch (it->second->type)
{
case NEW:
buf << "NEW"; break;
case NICK_TO:
buf << "NICK_TO " << it->second->nick2; break;
case NICK_FROM:
buf << "NICK_FROM " << it->second->nick2; break;
case JOIN:
buf << "JOIN " << it->second->channel; break;
case PART:
buf << "PART " << it->second->channel << " :" << it->second->message; break;
case QUIT:
buf << "QUIT :" << it->second->message; break;
case KICK:
buf << "KICK " << it->second->nick2 << " " << it->second->channel << " :" << it->second->message; break;
}
Write(buf.str());
}
}
};
MODULE_INIT(CSSeen)
-74
View File
@@ -1,74 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSet : public Command
{
public:
CommandCSSet(Module *creator) : Command(creator, "chanserv/set", 2, 3)
{
this->SetDesc(_("Set channel options and information"));
this->SetSyntax(_("\037option\037 \037channel\037 \037parameters\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
this->OnSyntaxError(source, "");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows the channel founder to set various channel options\n"
"and other information.\n"
" \n"
"Available options:"));
Anope::string this_name = source.command;
for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
CommandInfo &info = it->second;
if (c_name.find_ci(this_name + " ") == 0)
{
service_reference<Command> command(info.name);
if (command)
{
source.command = it->first;
command->OnServHelp(source);
}
}
}
source.Reply(_("Type \002%s%s HELP SET \037option\037\002 for more information on a\n"
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
return true;
}
};
class CSSet : public Module
{
CommandCSSet commandcsset;
public:
CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcsset(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcsset);
}
};
MODULE_INIT(CSSet)
-89
View File
@@ -1,89 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetDescription : public Command
{
public:
CommandCSSetDescription(Module *creator, const Anope::string &cname = "chanserv/set/description") : Command(creator, cname, 1, 2)
{
this->SetDesc(_("Set the channel description"));
this->SetSyntax(_("\037channel\037 [\037description\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params.size() > 1)
{
ci->desc = params[1];
source.Reply(_("Description of %s changed to \002%s\002."), ci->name.c_str(), ci->desc.c_str());
}
else
{
ci->desc.clear();
source.Reply(_("Description of %s unset."), ci->name.c_str());
}
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets the description for the channel, which shows up with\n"
"the \002LIST\002 and \002INFO\002 commands."), this->name.c_str());
return true;
}
};
class CommandCSSASetDescription : public CommandCSSetDescription
{
public:
CommandCSSASetDescription(Module *creator) : CommandCSSetDescription(creator, "chanserv/saset/description")
{
}
};
class CSSetDescription : public Module
{
CommandCSSetDescription commandcssetdescription;
CommandCSSASetDescription commandcssasetdescription;
public:
CSSetDescription(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetdescription(this), commandcssasetdescription(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetdescription);
ModuleManager::RegisterService(&commandcssasetdescription);
}
};
MODULE_INIT(CSSetDescription)
-105
View File
@@ -1,105 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetFounder : public Command
{
public:
CommandCSSetFounder(Module *creator, const Anope::string &cname = "chanserv/set/founder") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Set the founder of a channel"));
this->SetSyntax(_("\037channel\037 \037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv(CA_FOUNDER)))
{
source.Reply(ACCESS_DENIED);
return;
}
NickAlias *na = findnick(params[1]);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str());
return;
}
NickCore *nc = na->nc;
if (Config->CSMaxReg && nc->channelcount >= Config->CSMaxReg && !u->HasPriv("chanserv/no-register-limit"))
{
source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str());
return;
}
Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the founder to " << nc->display;
ci->SetFounder(nc);
source.Reply(_("Founder of %s changed to \002%s\002."), ci->name.c_str(), na->nick.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the founder of a channel. The new nickname must\n"
"be a registered one."), this->name.c_str());
return true;
}
};
class CommandCSSASetFounder : public CommandCSSetFounder
{
public:
CommandCSSASetFounder(Module *creator) : CommandCSSetFounder(creator, "chanserv/saset/founder")
{
}
};
class CSSetFounder : public Module
{
CommandCSSetFounder commandcssetfounder;
CommandCSSASetFounder commandcssasetfounder;
public:
CSSetFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetfounder(this), commandcssasetfounder(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetfounder);
ModuleManager::RegisterService(&commandcssasetfounder);
}
};
MODULE_INIT(CSSetFounder)
-115
View File
@@ -1,115 +0,0 @@
/*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetMisc : public Command
{
public:
CommandCSSetMisc(Module *creator, const Anope::string &cname = "chanserv/set/misc") : Command(creator, cname, 1, 2)
{
this->SetSyntax(_("\037channel\037 [\037parameters\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
else if (source.permission.empty() && !ci->AccessFor(source.u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
ci->Shrink("cs_set_misc:" + source.command.replace_all_cs(" ", "_"));
if (params.size() > 1)
{
ci->Extend("cs_set_misc:" + source.command.replace_all_cs(" ", "_"), new ExtensibleItemRegular<Anope::string>(params[1]));
source.Reply(CHAN_SETTING_CHANGED, source.command.c_str(), ci->name.c_str(), params[1].c_str());
}
else
source.Reply(CHAN_SETTING_UNSET, source.command.c_str(), ci->name.c_str());
}
};
class CommandCSSASetMisc : public CommandCSSetMisc
{
public:
CommandCSSASetMisc(Module *creator) : CommandCSSetMisc(creator, "chanserv/saset/misc")
{
}
};
class CSSetMisc : public Module
{
CommandCSSetMisc commandcssetmisc;
CommandCSSASetMisc commandcssasetmisc;
public:
CSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetmisc(this), commandcssasetmisc(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnChanInfo, I_OnDatabaseWriteMetadata, I_OnDatabaseReadMetadata };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::RegisterService(&this->commandcssetmisc);
ModuleManager::RegisterService(&this->commandcssasetmisc);
}
void OnChanInfo(CommandSource &source, ChannelInfo *ci, bool ShowHidden)
{
std::deque<Anope::string> list;
ci->GetExtList(list);
for (unsigned i = 0; i < list.size(); ++i)
{
if (list[i].find("cs_set_misc:") != 0)
continue;
Anope::string value;
if (ci->GetExtRegular(list[i], value))
source.Reply(" %s: %s", list[i].substr(12).replace_all_cs("_", " ").c_str(), value.c_str());
}
}
void OnDatabaseWriteMetadata(void (*WriteMetadata)(const Anope::string &, const Anope::string &), ChannelInfo *ci)
{
std::deque<Anope::string> list;
ci->GetExtList(list);
for (unsigned i = 0; i < list.size(); ++i)
{
if (list[i].find("cs_set_misc:") != 0)
continue;
Anope::string value;
if (ci->GetExtRegular(list[i], value))
WriteMetadata(list[i], ":" + value);
}
}
EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, const std::vector<Anope::string> &params)
{
if (key.find("cs_set_misc:") == 0)
ci->Extend(key, new ExtensibleItemRegular<Anope::string>(params[0]));
return EVENT_CONTINUE;
}
};
MODULE_INIT(CSSetMisc)
-93
View File
@@ -1,93 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetPeace : public Command
{
public:
CommandCSSetPeace(Module *creator, const Anope::string &cname = "chanserv/set/peace") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Regulate the use of critical commands"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_PEACE);
source.Reply(_("Peace option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_PEACE);
source.Reply(_("Peace option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "PEACE");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002peace\002 option for a channel.\n"
"When \002peace\002 is set, a user won't be able to kick,\n"
"ban or remove a channel status of a user that has\n"
"a level superior or equal to his via %s commands."), source.owner->nick.c_str());
return true;
}
};
class CommandCSSASetPeace : public CommandCSSetPeace
{
public:
CommandCSSASetPeace(Module *creator) : CommandCSSetPeace(creator, "chanserv/saset/peace")
{
}
};
class CSSetPeace : public Module
{
CommandCSSetPeace commandcssetpeace;
CommandCSSASetPeace commandcssasetpeace;
public:
CSSetPeace(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetpeace(this), commandcssasetpeace(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetpeace);
ModuleManager::RegisterService(&commandcssasetpeace);
}
};
MODULE_INIT(CSSetPeace)
-93
View File
@@ -1,93 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetPrivate : public Command
{
public:
CommandCSSetPrivate(Module *creator, const Anope::string &cname = "chanserv/set/private") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Hide channel from LIST command"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_PRIVATE);
source.Reply(_("Private option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_PRIVATE);
source.Reply(_("Private option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "PRIVATE");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002private\002 option for a channel.\n"
"When \002private\002 is set, a \002%s%s LIST\002 will not\n"
"include the channel in any lists."),
Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
return true;
}
};
class CommandCSSASetPrivate : public CommandCSSetPrivate
{
public:
CommandCSSASetPrivate(Module *creator) : CommandCSSetPrivate(creator, "chanserv/saset/private")
{
}
};
class CSSetPrivate : public Module
{
CommandCSSetPrivate commandcssetprivate;
CommandCSSASetPrivate commandcssasetprivate;
public:
CSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetprivate(this), commandcssasetprivate(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetprivate);
ModuleManager::RegisterService(&commandcssasetprivate);
}
};
MODULE_INIT(CSSetPrivate)
-91
View File
@@ -1,91 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetRestricted : public Command
{
public:
CommandCSSetRestricted(Module *creator, const Anope::string &cname = "chanserv/set/restricted") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Restrict access to the channel"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_RESTRICTED);
source.Reply(_("Restricted access option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_RESTRICTED);
source.Reply(_("Restricted access option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "RESTRICTED");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002restricted access\002 option for a\n"
"channel. When \002restricted access\002 is set, users not on the access list will\n"
"instead be kicked and banned from the channel."));
return true;
}
};
class CommandCSSASetRestricted : public CommandCSSetRestricted
{
public:
CommandCSSASetRestricted(Module *creator) : CommandCSSetRestricted(creator, "chanserv/saset/restricted")
{
}
};
class CSSetRestricted : public Module
{
CommandCSSetRestricted commandcssetrestricted;
CommandCSSASetRestricted commandcssasetrestricted;
public:
CSSetRestricted(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetrestricted(this), commandcssasetrestricted(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetrestricted);
ModuleManager::RegisterService(&commandcssasetrestricted);
}
};
MODULE_INIT(CSSetRestricted)
-94
View File
@@ -1,94 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSecure : public Command
{
public:
CommandCSSetSecure(Module *creator, const Anope::string &cname = "chanserv/set/secure") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Activate security features"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_SECURE);
source.Reply(_("Secure option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_SECURE);
source.Reply(_("Secure option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "SECURE");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables security features for a\n"
"channel. When \002%s\002 is set, only users who have\n"
"registered their nicknames and IDENTIFY'd\n"
"with their password will be given access to the channel\n"
"as controlled by the access list."), this->name.c_str());
return true;
}
};
class CommandCSSASetSecure : public CommandCSSetSecure
{
public:
CommandCSSASetSecure(Module *creator) : CommandCSSetSecure(creator, "chanserv/saset/secure")
{
}
};
class CSSetSecure : public Module
{
CommandCSSetSecure commandcssetsecure;
CommandCSSASetSecure commandcssasetsecure;
public:
CSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsecure(this), commandcssasetsecure(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetsecure);
ModuleManager::RegisterService(&commandcssasetsecure);
}
};
MODULE_INIT(CSSetSecure)
-95
View File
@@ -1,95 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSecureFounder : public Command
{
public:
CommandCSSetSecureFounder(Module *creator, const Anope::string &cname = "chanserv/set/securefounder") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Stricter control of channel founder status"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv(CA_FOUNDER))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_SECUREFOUNDER);
source.Reply(_("Secure founder option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_SECUREFOUNDER);
source.Reply(_("Secure founder option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "SECUREFOUNDER");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002secure founder\002 option for a channel.\n"
"When \002secure founder\002 is set, only the real founder will be\n"
"able to drop the channel, change its password, its founder and its\n"
"successor, and not those who have founder level access through\n"
"the access/qop command."));
return true;
}
};
class CommandCSSASetSecureFounder : public CommandCSSetSecureFounder
{
public:
CommandCSSASetSecureFounder(Module *creator) : CommandCSSetSecureFounder(creator, "chanserv/saset/securefounder")
{
}
};
class CSSetSecureFounder : public Module
{
CommandCSSetSecureFounder commandcssetsecurefounder;
CommandCSSASetSecureFounder commandcssasetsecurefounder;
public:
CSSetSecureFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsecurefounder(this), commandcssasetsecurefounder(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetsecurefounder);
ModuleManager::RegisterService(&commandcssasetsecurefounder);
}
};
MODULE_INIT(CSSetSecureFounder)
-92
View File
@@ -1,92 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSecureOps : public Command
{
public:
CommandCSSetSecureOps(Module *creator, const Anope::string &cname = "chanserv/set/secureops") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Stricter control of chanop status"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_SECUREOPS);
source.Reply(_("Secure ops option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_SECUREOPS);
source.Reply(_("Secure ops option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "SECUREOPS");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002secure ops\002 option for a channel.\n"
"When \002secure ops\002 is set, users who are not on the userlist\n"
"will not be allowed chanop status."));
return true;
}
};
class CommandCSSASetSecureOps : public CommandCSSetSecureOps
{
public:
CommandCSSASetSecureOps(Module *creator) : CommandCSSetSecureOps(creator, "chanserv/saset/secureops")
{
}
};
class CSSetSecureOps : public Module
{
CommandCSSetSecureOps commandcssetsecureops;
CommandCSSASetSecureOps commandcssasetsecureops;
public:
CSSetSecureOps(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsecureops(this), commandcssasetsecureops(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetsecureops);
ModuleManager::RegisterService(&commandcssasetsecureops);
}
};
MODULE_INIT(CSSetSecureOps)
-119
View File
@@ -1,119 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSuccessor : public Command
{
public:
CommandCSSetSuccessor(Module *creator, const Anope::string &cname = "chanserv/set/successor") : Command(creator, cname, 1, 2)
{
this->SetDesc(_("Set the successor for a channel"));
this->SetSyntax(_("\037channel\037 \037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv(CA_FOUNDER))
{
source.Reply(ACCESS_DENIED);
return;
}
NickCore *nc;
if (params.size() > 1)
{
NickAlias *na = findnick(params[1]);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str());
return;
}
if (na->nc == ci->GetFounder())
{
source.Reply(_("%s cannot be the successor on channel %s they are the founder."), na->nick.c_str(), ci->name.c_str());
return;
}
nc = na->nc;
}
else
nc = NULL;
Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the successor from " << (ci->successor ? ci->successor->display : "none") << " to " << (nc ? nc->display : "none");
ci->successor = nc;
if (nc)
source.Reply(_("Successor for %s changed to \002%s\002."), ci->name.c_str(), nc->display.c_str());
else
source.Reply(_("Successor for \002%s\002 unset."), ci->name.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the successor of a channel. If the founder's\n"
"nickname expires or is dropped while the channel is still\n"
"registered, the successor will become the new founder of the\n"
"channel. However, if the successor already has too many\n"
"channels registered (%d), the channel will be dropped\n"
"instead, just as if no successor had been set. The new\n"
"nickname must be a registered one."), Config->CSMaxReg);
return true;
}
};
class CommandCSSASetSuccessor : public CommandCSSetSuccessor
{
public:
CommandCSSASetSuccessor(Module *creator) : CommandCSSetSuccessor(creator, "chanserv/saset/successor")
{
}
};
class CSSetSuccessor : public Module
{
CommandCSSetSuccessor commandcssetsuccessor;
CommandCSSASetSuccessor commandcssasetsuccessor;
public:
CSSetSuccessor(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsuccessor(this), commandcssasetsuccessor(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssetsuccessor);
ModuleManager::RegisterService(&commandcssasetsuccessor);
}
};
MODULE_INIT(CSSetSuccessor)
-92
View File
@@ -1,92 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetTopicLock : public Command
{
public:
CommandCSSetTopicLock(Module *creator, const Anope::string &cname = "chanserv/set/topiclock") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Topic can only be changed with TOPIC"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_TOPICLOCK);
source.Reply(_("Topic lock option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_TOPICLOCK);
source.Reply(_("Topic lock option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "TOPICLOCK");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002topic lock\002 option for a channel.\n"
"When \002topic lock\002 is set, the channel topic will be unchangable\n"
" except via the \002TOPIC\002 command."));
return true;
}
};
class CommandCSSASetTopicLock : public CommandCSSetTopicLock
{
public:
CommandCSSASetTopicLock(Module *creator) : CommandCSSetTopicLock(creator, "chanserv/saset/topiclock")
{
}
};
class CSSetTopicLock : public Module
{
CommandCSSetTopicLock commandcssettopiclock;
CommandCSSASetTopicLock commandcssasettopiclock;
public:
CSSetTopicLock(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssettopiclock(this), commandcssasettopiclock(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssettopiclock);
ModuleManager::RegisterService(&commandcssasettopiclock);
}
};
MODULE_INIT(CSSetTopicLock)
-66
View File
@@ -1,66 +0,0 @@
/*
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
#include "module.h"
class CommandCSSync : public Command
{
public:
CommandCSSync(Module *creator) : Command(creator, "chanserv/sync", 1, 1)
{
this->SetDesc(_("Sync users channel modes"));
this->SetSyntax(_("\037channel\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
if (ci == NULL)
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
else if (ci->c == NULL)
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
else if (!ci->AccessFor(u).HasPriv(CA_ACCESS_CHANGE))
source.Reply(ACCESS_DENIED);
else
{
for (CUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
chan_set_correct_modes((*it)->user, ci->c, 1);
source.Reply(_("All user modes on \2%s\2 have been synced."), ci->name.c_str());
}
}
bool OnHelp(CommandSource &source, const Anope::string &params)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Syncs all modes set on users on the channel with the modes\n"
"they should have based on their access."));
return true;
}
};
class CSSync : public Module
{
CommandCSSync commandcssync;
public:
CSSync(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssync(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcssync);
}
};
MODULE_INIT(CSSync)
-64
View File
@@ -1,64 +0,0 @@
/* Global core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "global.h"
class CommandGLGlobal : public Command
{
public:
CommandGLGlobal(Module *creator) : Command(creator, "global/global", 1, 1)
{
this->SetDesc(_("Send a message to all users"));
this->SetSyntax(_("\037message\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &msg = params[0];
if (!global)
source.Reply("No global reference, is gl_main loaded?");
else
{
Log(LOG_ADMIN, u, this);
global->SendGlobal(findbot(Config->Global), u->nick, msg);
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows Administrators to send messages to all users on the \n"
"network. The message will be sent from the nick \002%s\002."), source.owner->nick.c_str());
return true;
}
};
class GLGlobal : public Module
{
CommandGLGlobal commandglglobal;
public:
GLGlobal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandglglobal(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandglglobal);
}
};
MODULE_INIT(GLGlobal)
-130
View File
@@ -1,130 +0,0 @@
/* Core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHelp : public Command
{
public:
CommandHelp(Module *creator) : Command(creator, "generic/help", 0)
{
this->SetDesc(_("Displays this list and give information about commands"));
this->SetFlag(CFLAG_STRIP_CHANNEL);
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
FOREACH_MOD(I_OnPreHelp, OnPreHelp(source, params));
User *u = source.u;
BotInfo *bi = source.owner;
if (params.empty())
{
for (BotInfo::command_map::iterator it = bi->commands.begin(), it_end = bi->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
CommandInfo &info = it->second;
// Smaller command exists
Anope::string cmd = myStrGetToken(c_name, ' ', 0);
if (cmd != it->first && bi->commands.count(cmd))
continue;
service_reference<Command> c(info.name);
if (!c)
continue;
if (!Config->HidePrivilegedCommands || info.permission.empty() || u->HasCommand(info.permission))
{
source.command = c_name;
c->OnServHelp(source);
}
}
}
else
{
bool helped = false;
for (unsigned max = params.size(); max > 0; --max)
{
Anope::string full_command;
for (unsigned i = 0; i < max; ++i)
full_command += " " + params[i];
full_command.erase(full_command.begin());
BotInfo::command_map::iterator it = bi->commands.find(full_command);
if (it == bi->commands.end())
continue;
CommandInfo &info = it->second;
service_reference<Command> c(info.name);
if (!c)
continue;
if (Config->HidePrivilegedCommands && !info.permission.empty() && !u->HasCommand(info.permission))
continue;
const Anope::string &subcommand = params.size() > max ? params[max] : "";
source.command = full_command;
if (!c->OnHelp(source, subcommand))
continue;
helped = true;
/* Inform the user what permission is required to use the command */
if (!info.permission.empty())
{
source.Reply(" ");
source.Reply(_("Access to this command requires the permission \002%s\002 to be present in your opertype."), info.permission.c_str());
}
if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->IsIdentified())
{
if (info.permission.empty())
source.Reply(" ");
source.Reply( _("You need to be identified to use this command."));
}
/* User doesn't have the proper permission to use this command */
else if (!info.permission.empty() && !u->HasCommand(info.permission))
{
source.Reply(_("You cannot use this command."));
}
break;
}
if (helped == false)
source.Reply(_("No help available for \002%s\002."), params[0].c_str());
}
FOREACH_MOD(I_OnPostHelp, OnPostHelp(source, params));
return;
}
};
class Help : public Module
{
CommandHelp commandhelp;
public:
Help(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandhelp(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandhelp);
}
};
MODULE_INIT(Help)
-107
View File
@@ -1,107 +0,0 @@
/* HostServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHSDel : public Command
{
public:
CommandHSDel(Module *creator) : Command(creator, "hostserv/del", 1, 1)
{
this->SetDesc(_("Delete the vhost of another user"));
this->SetSyntax(_("\037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &nick = params[0];
NickAlias *na = findnick(nick);
if (na)
{
Log(LOG_ADMIN, u, this) << "for user " << na->nick;
FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na));
na->hostinfo.RemoveVhost();
source.Reply(_("Vhost for \002%s\002 removed."), nick.c_str());
}
else
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Deletes the vhost assigned to the given nick from the\n"
"database."));
return true;
}
};
class CommandHSDelAll : public Command
{
public:
CommandHSDelAll(Module *creator) : Command(creator, "hostserv/delall", 1, 1)
{
this->SetDesc(_("Delete the vhost for all nicks in a group"));
this->SetSyntax(_("\037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &nick = params[0];
User *u = source.u;
NickAlias *na = findnick(nick);
if (na)
{
FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na));
NickCore *nc = na->nc;
for (std::list<NickAlias *>::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it)
{
na = *it;
na->hostinfo.RemoveVhost();
}
Log(LOG_ADMIN, u, this) << "for all nicks in group " << nc->display;
source.Reply(_("vhosts for group \002%s\002 have been removed."), nc->display.c_str());
}
else
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Deletes the vhost for all nicks in the same group as\n"
"that of the given nick."));
return true;
}
};
class HSDel : public Module
{
CommandHSDel commandhsdel;
CommandHSDelAll commandhsdelall;
public:
HSDel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandhsdel(this), commandhsdelall(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandhsdel);
ModuleManager::RegisterService(&commandhsdelall);
}
};
MODULE_INIT(HSDel)
-236
View File
@@ -1,236 +0,0 @@
/* HostServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHSSet : public Command
{
public:
CommandHSSet(Module *creator) : Command(creator, "hostserv/set", 2, 2)
{
this->SetDesc(_("Set the vhost of another user"));
this->SetSyntax(_("\037nick\037 \037hostmask\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &nick = params[0];
NickAlias *na = findnick(nick);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
return;
}
Anope::string rawhostmask = params[1];
Anope::string user, host;
size_t a = rawhostmask.find('@');
if (a == Anope::string::npos)
host = rawhostmask;
else
{
user = rawhostmask.substr(0, a);
host = rawhostmask.substr(a + 1);
}
if (host.empty())
{
this->OnSyntaxError(source, "");
return;
}
if (!user.empty())
{
if (user.length() > Config->UserLen)
{
source.Reply(HOST_SET_IDENTTOOLONG, Config->UserLen);
return;
}
else if (!ircd->vident)
{
source.Reply(HOST_NO_VIDENT);
return;
}
for (Anope::string::iterator s = user.begin(), s_end = user.end(); s != s_end; ++s)
if (!isvalidchar(*s))
{
source.Reply(HOST_SET_IDENT_ERROR);
return;
}
}
if (host.length() > Config->HostLen)
{
source.Reply(HOST_SET_TOOLONG, Config->HostLen);
return;
}
if (!isValidHost(host, 3))
{
source.Reply(HOST_SET_ERROR);
return;
}
Log(LOG_ADMIN, u, this) << "to set the vhost of " << na->nick << " to " << (!user.empty() ? user + "@" : "") << host;
na->hostinfo.SetVhost(user, host, u->nick);
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
if (!user.empty())
source.Reply(_("VHost for \002%s\002 set to \002%s\002@\002%s\002."), nick.c_str(), user.c_str(), host.c_str());
else
source.Reply(_("VHost for \002%s\002 set to \002%s\002."), nick.c_str(), host.c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets the vhost for the given nick to that of the given\n"
"hostmask. If your IRCD supports vIdents, then using\n"
"SET <nick> <ident>@<hostmask> set idents for users as \n"
"well as vhosts."));
return true;
}
};
class CommandHSSetAll : public Command
{
void Sync(NickAlias *na)
{
if (!na || !na->hostinfo.HasVhost())
return;
for (std::list<NickAlias *>::iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end; ++it)
{
NickAlias *nick = *it;
nick->hostinfo.SetVhost(na->hostinfo.GetIdent(), na->hostinfo.GetHost(), na->hostinfo.GetCreator());
}
}
public:
CommandHSSetAll(Module *creator) : Command(creator, "hostserv/setall", 2, 2)
{
this->SetDesc(_("Set the vhost for all nicks in a group"));
this->SetSyntax(_("\037nick\037 \037hostmask>\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
Anope::string nick = params[0];
NickAlias *na = findnick(nick);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
return;
}
Anope::string rawhostmask = params[1];
Anope::string user, host;
size_t a = rawhostmask.find('@');
if (a == Anope::string::npos)
host = rawhostmask;
else
{
user = rawhostmask.substr(0, a);
host = rawhostmask.substr(a + 1);
}
if (host.empty())
{
this->OnSyntaxError(source, "");
return;
}
if (!user.empty())
{
if (user.length() > Config->UserLen)
{
source.Reply(HOST_SET_IDENTTOOLONG, Config->UserLen);
return;
}
else if (!ircd->vident)
{
source.Reply(HOST_NO_VIDENT);
return;
}
for (Anope::string::iterator s = user.begin(), s_end = user.end(); s != s_end; ++s)
if (!isvalidchar(*s))
{
source.Reply(HOST_SET_IDENT_ERROR);
return;
}
}
if (host.length() > Config->HostLen)
{
source.Reply(HOST_SET_TOOLONG, Config->HostLen);
return;
}
if (!isValidHost(host, 3))
{
source.Reply(HOST_SET_ERROR);
return;
}
Log(LOG_ADMIN, u, this) << "to set the vhost of " << na->nick << " to " << (!user.empty() ? user + "@" : "") << host;
na->hostinfo.SetVhost(user, host, u->nick);
this->Sync(na);
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
if (!user.empty())
source.Reply(_("VHost for group \002%s\002 set to \002%s\002@\002%s\002."), nick.c_str(), user.c_str(), host.c_str());
else
source.Reply(_("VHost for group \002%s\002 set to \002%s\002."), nick.c_str(), host.c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets the vhost for all nicks in the same group as that\n"
"of the given nick. If your IRCD supports vIdents, then\n"
"using SETALL <nick> <ident>@<hostmask> will set idents\n"
"for users as well as vhosts.\n"
"* NOTE, this will not update the vhost for any nicks\n"
"added to the group after this command was used."));
return true;
}
};
class HSSet : public Module
{
CommandHSSet commandhsset;
CommandHSSetAll commandhssetall;
public:
HSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), commandhsset(this), commandhssetall(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandhsset);
ModuleManager::RegisterService(&commandhssetall);
}
};
MODULE_INIT(HSSet)
-70
View File
@@ -1,70 +0,0 @@
/* MemoServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "memoserv.h"
class CommandMSSend : public Command
{
public:
CommandMSSend(Module *creator) : Command(creator, "memoserv/send", 2, 2)
{
this->SetDesc(_("Send a memo to a nick or channel"));
this->SetSyntax(_("{\037nick\037 | \037channel\037} \037memo-text\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &nick = params[0];
const Anope::string &text = params[1];
MemoServService::MemoResult result = memoserv->Send(source.u->nick, nick, text);
if (result == MemoServService::MEMO_SUCCESS)
source.Reply(_("Memo sent to \002%s\002."), nick.c_str());
else if (result == MemoServService::MEMO_INVALID_TARGET)
source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str());
else if (result == MemoServService::MEMO_TOO_FAST)
source.Reply(_("Please wait %d seconds before using the SEND command again."), Config->MSSendDelay);
else if (result == MemoServService::MEMO_TARGET_FULL)
source.Reply(_("%s currently has too many memos and cannot receive more."), nick.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sends the named \037nick\037 or \037channel\037 a memo containing\n"
"\037memo-text\037. When sending to a nickname, the recipient will\n"
"receive a notice that he/she has a new memo. The target\n"
"nickname/channel must be registered."));
return true;
}
};
class MSSend : public Module
{
CommandMSSend commandmssend;
public:
MSSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandmssend(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandmssend);
}
};
MODULE_INIT(MSSend)
-102
View File
@@ -1,102 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSAList : public Command
{
public:
CommandNSAList(Module *creator) : Command(creator, "nickserv/alist", 0, 2)
{
this->SetDesc(_("List channels you have access on"));
this->SetSyntax(_("[\037nickname\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
Anope::string nick = u->Account()->display;
if (params.size() && u->IsServicesOper())
nick = params[0];
NickAlias *na = findnick(nick);
if (!na)
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
else
{
int chan_count = 0;
source.Reply(_("Channels that \002%s\002 has access on:\n"
" Num Channel Access"), na->nick.c_str());
for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it)
{
ChannelInfo *ci = it->second;
if (ci->GetFounder() && ci->GetFounder() == na->nc)
{
source.Reply(_(" %3d %c%-20s Founder"), ++chan_count, ci->HasFlag(CI_NO_EXPIRE) ? '!' : ' ', ci->name.c_str());
continue;
}
AccessGroup access = ci->AccessFor(na->nc);
if (access.empty())
continue;
++chan_count;
if (access.size() > 1)
{
source.Reply(_(" %3d You match %d access entries on %c%s, they are"), chan_count, access.size(), ci->HasFlag(CI_NO_EXPIRE) ? '!' : ' ', ci->name.c_str());
for (unsigned i = 0; i < access.size(); ++i)
source.Reply(_(" %3d %-8s"), i + 1, access[i]->Serialize().c_str());
}
else
source.Reply(_(" %3d %c%-20s %-8s"), chan_count, ci->HasFlag(CI_NO_EXPIRE) ? '!' : ' ', ci->name.c_str(), access[0]->Serialize().c_str());
}
source.Reply(_("End of list - %d channels shown."), chan_count);
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Lists all channels you have access on.\n"
" \n"
"Channels that have the \037NOEXPIRE\037 option set will be\n"
"prefixed by an exclamation mark. The nickname parameter is\n"
"limited to Services Operators"));
return true;
}
};
class NSAList : public Module
{
CommandNSAList commandnsalist;
public:
NSAList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnsalist(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandnsalist);
}
};
MODULE_INIT(NSAList)
-169
View File
@@ -1,169 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSList : public Command
{
public:
CommandNSList(Module *creator) : Command(creator, "nickserv/list", 1, 2)
{
this->SetDesc(_("List all registered nicknames that match a given pattern"));
this->SetSyntax(_("\037pattern\037 [SUSPENDED] [NOEXPIRE] [UNCONFIRMED]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
Anope::string pattern = params[0];
const NickCore *mync;
unsigned nnicks;
bool is_servadmin = u->IsServicesOper();
char noexpire_char = ' ';
int count = 0, from = 0, to = 0;
bool suspended, nsnoexpire, unconfirmed;
suspended = nsnoexpire = unconfirmed = false;
if (pattern[0] == '#')
{
Anope::string n1 = myStrGetToken(pattern.substr(1), '-', 0), /* Read FROM out */
n2 = myStrGetToken(pattern, '-', 1);
try
{
from = convertTo<int>(n1);
to = convertTo<int>(n2);
}
catch (const ConvertException &)
{
source.Reply(LIST_INCORRECT_RANGE);
return;
}
pattern = "*";
}
nnicks = 0;
if (is_servadmin && params.size() > 1)
{
Anope::string keyword;
spacesepstream keywords(params[1]);
while (keywords.GetToken(keyword))
{
if (keyword.equals_ci("NOEXPIRE"))
nsnoexpire = true;
if (keyword.equals_ci("SUSPENDED"))
suspended = true;
if (keyword.equals_ci("UNCONFIRMED"))
unconfirmed = true;
}
}
mync = u->Account();
source.Reply(LIST_HEADER, pattern.c_str());
for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; ++it)
{
NickAlias *na = it->second;
/* Don't show private nicks to non-services admins. */
if (na->nc->HasFlag(NI_PRIVATE) && !is_servadmin && na->nc != mync)
continue;
else if (nsnoexpire && !na->HasFlag(NS_NO_EXPIRE))
continue;
else if (suspended && !na->nc->HasFlag(NI_SUSPENDED))
continue;
else if (unconfirmed && !na->nc->HasFlag(NI_UNCONFIRMED))
continue;
/* We no longer compare the pattern against the output buffer.
* Instead we build a nice nick!user@host buffer to compare.
* The output is then generated separately. -TheShadow */
Anope::string buf = Anope::printf("%s!%s", na->nick.c_str(), !na->last_usermask.empty() ? na->last_usermask.c_str() : "*@*");
if (na->nick.equals_ci(pattern) || Anope::Match(buf, pattern))
{
if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nnicks <= Config->NSListMax)
{
if (is_servadmin && na->HasFlag(NS_NO_EXPIRE))
noexpire_char = '!';
else
noexpire_char = ' ';
if (na->nc->HasFlag(NI_HIDE_MASK) && !is_servadmin && na->nc != mync)
buf = Anope::printf("%-20s [Hostname Hidden]", na->nick.c_str());
else if (na->nc->HasFlag(NI_SUSPENDED))
buf = Anope::printf("%-20s [Suspended]", na->nick.c_str());
else if (na->nc->HasFlag(NI_UNCONFIRMED))
buf = Anope::printf("%-20s [Unconfirmed]", na->nick.c_str());
else
buf = Anope::printf("%-20s %s", na->nick.c_str(), na->last_usermask.c_str());
source.Reply(" %c%s", noexpire_char, buf.c_str());
}
++count;
}
}
source.Reply(_("End of list - %d/%d matches shown."), nnicks > Config->NSListMax ? Config->NSListMax : nnicks, nnicks);
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Lists all registered nicknames which match the given\n"
"pattern, in \037nick!user@host\037 format. Nicks with the \002PRIVATE\002\n"
"option set will only be displayed to Services Operators. Nicks\n"
"with the \002NOEXPIRE\002 option set will have a \002!\002 appended to\n"
"the nickname for Services Operators.\n"
" \n"
"If the SUSPENDED, NOEXPIRE or UNCONFIRMED options are given, only\n"
"nicks which, respectively, are SUSPENDED, UNCONFIRMED or have the\n"
"NOEXPIRE flag set will be displayed. If multiple options are\n"
"given, all nicks matching at least one option will be displayed.\n"
"These options are limited to \037Services Operators\037. \n"
"\n"
"Examples:\n"
" \n"
" \002LIST *!joeuser@foo.com\002\n"
" Lists all registered nicks owned by joeuser@foo.com.\n"
" \n"
" \002LIST *Bot*!*@*\002\n"
" Lists all registered nicks with \002Bot\002 in their\n"
" names (case insensitive).\n"
" \n"
" \002LIST * NOEXPIRE\002\n"
" Lists all registered nicks which have been set to not expire.\n"));
return true;
}
};
class NSList : public Module
{
CommandNSList commandnslist;
public:
NSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnslist(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandnslist);
}
};
MODULE_INIT(NSList)
-173
View File
@@ -1,173 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSASet : public Command
{
public:
CommandNSSASet(Module *creator) : Command(creator, "nickserv/saset", 2, 4)
{
this->SetDesc(_("Set SET-options on another nickname"));
this->SetSyntax(_("\037option\037 \037nickname\037 \037parameters\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
this->OnSyntaxError(source, "");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
Anope::string this_name = source.command;
for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
CommandInfo &info = it->second;
if (c_name.find_ci(this_name + " ") == 0)
{
service_reference<Command> command(info.name);
if (command)
{
source.command = c_name;
command->OnServHelp(source);
}
}
}
source.Reply(_("Type \002%s%s HELP SASET \037option\037\002 for more information\n"
"on a specific option. The options will be set on the given\n"
"\037nickname\037."), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
return true;
}
};
class CommandNSSASetDisplay : public Command
{
public:
CommandNSSASetDisplay(Module *creator) : Command(creator, "nickserv/saset/display", 2, 2)
{
this->SetDesc(_("Set the display of the group in Services"));
this->SetSyntax(_("\037nickname\037 \037new-display\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
NickAlias *setter_na = findnick(params[0]);
if (setter_na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
return;
}
NickCore *nc = setter_na->nc;
NickAlias *na = findnick(params[1]);
if (!na || na->nc != nc)
{
source.Reply(_("The new display for \002%s\002 MUST be a nickname of the nickname group!"), nc->display.c_str());
return;
}
change_core_display(nc, params[1]);
source.Reply(NICK_SET_DISPLAY_CHANGED, nc->display.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(_("Changes the display used to refer to the nickname group in \n"
"Services. The new display MUST be a nick of the group."));
return true;
}
};
class CommandNSSASetPassword : public Command
{
public:
CommandNSSASetPassword(Module *creator) : Command(creator, "nickserv/saset/password", 2, 2)
{
this->SetDesc(_("Set the nickname password"));
this->SetSyntax(_("\037nickname\037 \037new-password\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
NickAlias *setter_na = findnick(params[0]);
if (setter_na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
return;
}
NickCore *nc = setter_na->nc;
size_t len = params[1].length();
if (Config->NSSecureAdmins && u->Account() != nc && nc->IsServicesOper())
{
source.Reply(ACCESS_DENIED);
return;
}
else if (nc->display.equals_ci(params[1]) || (Config->StrictPasswords && len < 5))
{
source.Reply(MORE_OBSCURE_PASSWORD);
return;
}
else if (len > Config->PassLen)
{
source.Reply(PASSWORD_TOO_LONG);
return;
}
enc_encrypt(params[1], nc->pass);
Anope::string tmp_pass;
if (enc_decrypt(nc->pass, tmp_pass) == 1)
source.Reply(_("Password for \002%s\002 changed to \002%s\002."), nc->display.c_str(), tmp_pass.c_str());
else
source.Reply(_("Password for \002%s\002 changed."), nc->display.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the password used to identify as the nick's owner."));
return true;
}
};
class NSSASet : public Module
{
CommandNSSASet commandnssaset;
CommandNSSASetDisplay commandnssasetdisplay;
CommandNSSASetPassword commandnssasetpassword;
public:
NSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssaset(this), commandnssasetdisplay(this), commandnssasetpassword(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandnssaset);
ModuleManager::RegisterService(&commandnssasetdisplay);
ModuleManager::RegisterService(&commandnssasetpassword);
}
};
MODULE_INIT(NSSASet)
-158
View File
@@ -1,158 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSet : public Command
{
public:
CommandNSSet(Module *creator) : Command(creator, "nickserv/set", 1, 3)
{
this->SetDesc(_("Set options, including kill protection"));
this->SetSyntax(_("\037option\037 \037parameters\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
this->OnSyntaxError(source, "");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
Anope::string this_name = source.command;
for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
CommandInfo &info = it->second;
if (c_name.find_ci(this_name + " ") == 0)
{
service_reference<Command> command(info.name);
if (command)
{
source.command = c_name;
command->OnServHelp(source);
}
}
}
source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n"
"on a specific option."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
return true;
}
};
class CommandNSSetDisplay : public Command
{
public:
CommandNSSetDisplay(Module *creator) : Command(creator, "nickserv/set/display", 1)
{
this->SetDesc(_("Set the display of your group in Services"));
this->SetSyntax(_("\037new-display\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
NickAlias *na = findnick(params[1]);
if (!na || na->nc != u->Account())
{
source.Reply(_("The new display MUST be a nickname of your nickname group!"));
return;
}
change_core_display(u->Account(), params[1]);
source.Reply(NICK_SET_DISPLAY_CHANGED, u->Account()->display.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the display used to refer to your nickname group in \n"
"Services. The new display MUST be a nick of your group."));
return true;
}
};
class CommandNSSetPassword : public Command
{
public:
CommandNSSetPassword(Module *creator) : Command(creator, "nickserv/set/password", 1)
{
this->SetDesc(_("Set your nickname password"));
this->SetSyntax(_("\037new-password\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &param = params[1];
unsigned len = param.length();
if (u->Account()->display.equals_ci(param) || (Config->StrictPasswords && len < 5))
{
source.Reply(MORE_OBSCURE_PASSWORD);
return;
}
else if (len > Config->PassLen)
{
source.Reply(PASSWORD_TOO_LONG);
return;
}
enc_encrypt(param, u->Account()->pass);
Anope::string tmp_pass;
if (enc_decrypt(u->Account()->pass, tmp_pass) == 1)
source.Reply(_("Password for \002%s\002 changed to \002%s\002."), u->Account()->display.c_str(), tmp_pass.c_str());
else
source.Reply(_("Password for \002%s\002 changed."), u->Account()->display.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the password used to identify you as the nick's\n"
"owner."));
return true;
}
};
class NSSet : public Module
{
CommandNSSet commandnsset;
CommandNSSetDisplay commandnssetdisplay;
CommandNSSetPassword commandnssetpassword;
public:
NSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnsset(this), commandnssetdisplay(this), commandnssetpassword(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandnsset);
ModuleManager::RegisterService(&commandnssetdisplay);
ModuleManager::RegisterService(&commandnssetpassword);
}
};
MODULE_INIT(NSSet)
-126
View File
@@ -1,126 +0,0 @@
/*
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetMisc : public Command
{
public:
CommandNSSetMisc(Module *creator, const Anope::string &cname = "nickserv/set/misc", size_t min = 0) : Command(creator, cname, min, min + 1)
{
this->SetSyntax(_("[\037parameter\037]"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
NickAlias *na = findnick(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
nc->Shrink("ns_set_misc:" + source.command.replace_all_cs(" ", "_"));
if (!param.empty())
{
nc->Extend("ns_set_misc:" + source.command.replace_all_cs(" ", "_"), new ExtensibleItemRegular<Anope::string>(param));
source.Reply(CHAN_SETTING_CHANGED, source.command.c_str(), nc->display.c_str(), param.c_str());
}
else
source.Reply(CHAN_SETTING_UNSET, source.command.c_str(), nc->display.c_str());
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
this->Run(source, source.u->Account()->display, !params.empty() ? params[0] : "");
}
};
class CommandNSSASetMisc : public CommandNSSetMisc
{
public:
CommandNSSASetMisc(Module *creator) : CommandNSSetMisc(creator, "nickserv/saset/misc", 1)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 [\037parameter\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
this->Run(source, params[0], params.size() > 1 ? params[1] : "");
}
};
class NSSetMisc : public Module
{
CommandNSSetMisc commandnssetmisc;
CommandNSSASetMisc commandnssasetmisc;
public:
NSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetmisc(this), commandnssasetmisc(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnNickInfo, I_OnDatabaseWriteMetadata, I_OnDatabaseReadMetadata };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::RegisterService(&this->commandnssetmisc);
ModuleManager::RegisterService(&this->commandnssasetmisc);
}
void OnNickInfo(CommandSource &source, NickAlias *na, bool ShowHidden)
{
std::deque<Anope::string> list;
na->nc->GetExtList(list);
for (unsigned i = 0; i < list.size(); ++i)
{
if (list[i].find("ns_set_misc:") != 0)
continue;
Anope::string value;
if (na->nc->GetExtRegular(list[i], value))
source.Reply(" %s: %s", list[i].substr(12).replace_all_cs("_", " ").c_str(), value.c_str());
}
}
void OnDatabaseWriteMetadata(void (*WriteMetadata)(const Anope::string &, const Anope::string &), NickCore *nc)
{
std::deque<Anope::string> list;
nc->GetExtList(list);
for (unsigned i = 0; i < list.size(); ++i)
{
if (list[i].find("ns_set_misc:") != 0)
continue;
Anope::string value;
if (nc->GetExtRegular(list[i], value))
WriteMetadata(list[i], ":" + value);
}
}
EventReturn OnDatabaseReadMetadata(NickCore *nc, const Anope::string &key, const std::vector<Anope::string> &params)
{
if (key.find("ns_set_misc:") == 0)
nc->Extend(key, new ExtensibleItemRegular<Anope::string>(params[0]));
return EVENT_CONTINUE;
}
};
MODULE_INIT(NSSetMisc)
-663
View File
@@ -1,663 +0,0 @@
/* OperServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "global.h"
#include "os_session.h"
enum DefconLevel
{
DEFCON_NO_NEW_CHANNELS,
DEFCON_NO_NEW_NICKS,
DEFCON_NO_MLOCK_CHANGE,
DEFCON_FORCE_CHAN_MODES,
DEFCON_REDUCE_SESSION,
DEFCON_NO_NEW_CLIENTS,
DEFCON_OPER_ONLY,
DEFCON_SILENT_OPER_ONLY,
DEFCON_AKILL_NEW_CLIENTS,
DEFCON_NO_NEW_MEMOS
};
bool DefConModesSet = false;
struct DefconConfig
{
std::vector<std::bitset<32> > DefCon;
Flags<ChannelModeName, CMODE_END * 2> DefConModesOn;
Flags<ChannelModeName, CMODE_END * 2> DefConModesOff;
std::map<ChannelModeName, Anope::string> DefConModesOnParams;
int defaultlevel, sessionlimit;
Anope::string chanmodes, message, offmessage, akillreason;
std::vector<Anope::string> defcons;
time_t akillexpire, timeout;
bool globalondefcon;
DefconConfig()
{
this->DefCon.resize(6);
this->defcons.resize(5);
}
bool Check(DefconLevel level)
{
return this->Check(this->defaultlevel, level);
}
bool Check(int dlevel, DefconLevel level)
{
return this->DefCon[dlevel].test(level);
}
void Add(int dlevel, DefconLevel level)
{
this->DefCon[dlevel][level] = true;
}
void Del(int dlevel, DefconLevel level)
{
this->DefCon[dlevel][level] = false;
}
bool SetDefConParam(ChannelModeName Name, const Anope::string &buf)
{
return DefConModesOnParams.insert(std::make_pair(Name, buf)).second;
}
void UnsetDefConParam(ChannelModeName Name)
{
DefConModesOnParams.erase(Name);
}
bool GetDefConParam(ChannelModeName Name, Anope::string &buf)
{
std::map<ChannelModeName, Anope::string>::iterator it = DefConModesOnParams.find(Name);
buf.clear();
if (it != DefConModesOnParams.end())
{
buf = it->second;
return true;
}
return false;
}
};
static DefconConfig DConfig;
/**************************************************************************/
void defcon_sendlvls(CommandSource &source);
void runDefCon();
static Anope::string defconReverseModes(const Anope::string &modes);
class DefConTimeout : public CallBack
{
int level;
public:
DefConTimeout(Module *mod, int newlevel) : CallBack(mod, DConfig.timeout), level(newlevel) { }
void Tick(time_t)
{
if (DConfig.defaultlevel != level)
{
DConfig.defaultlevel = level;
FOREACH_MOD(I_OnDefconLevel, OnDefconLevel(level));
Log(findbot(Config->OperServ), "operserv/defcon") << "Defcon level timeout, returning to level " << level;
if (DConfig.globalondefcon)
{
if (!DConfig.offmessage.empty())
global->SendGlobal(findbot(Config->Global), "", DConfig.offmessage);
else
global->SendGlobal(findbot(Config->Global), "", Anope::printf(translate(_("The Defcon Level is now at Level: \002%d\002")), DConfig.defaultlevel));
if (!DConfig.message.empty())
global->SendGlobal(findbot(Config->Global), "", DConfig.message);
}
runDefCon();
}
}
};
static DefConTimeout *timeout;
class CommandOSDefcon : public Command
{
void SendLevels(CommandSource &source)
{
if (DConfig.Check(DEFCON_NO_NEW_CHANNELS))
source.Reply(_("* No new channel registrations"));
if (DConfig.Check(DEFCON_NO_NEW_NICKS))
source.Reply(_("* No new nick registrations"));
if (DConfig.Check(DEFCON_NO_MLOCK_CHANGE))
source.Reply(_("* No MLOCK changes"));
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && !DConfig.chanmodes.empty())
source.Reply(_("* Force Chan Modes (%s) to be set on all channels"), DConfig.chanmodes.c_str());
if (DConfig.Check(DEFCON_REDUCE_SESSION))
source.Reply(_("* Use the reduced session limit of %d"), DConfig.sessionlimit);
if (DConfig.Check(DEFCON_NO_NEW_CLIENTS))
source.Reply(_("* Kill any NEW clients connecting"));
if (DConfig.Check(DEFCON_OPER_ONLY))
source.Reply(_("* Ignore any non-opers with message"));
if (DConfig.Check(DEFCON_SILENT_OPER_ONLY))
source.Reply(_("* Silently ignore non-opers"));
if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
source.Reply(_("* AKILL any new clients connecting"));
if (DConfig.Check(DEFCON_NO_NEW_MEMOS))
source.Reply(_("* No new memos sent"));
}
public:
CommandOSDefcon(Module *creator) : Command(creator, "operserv/defcon", 1, 1)
{
this->SetDesc(_("Manipulate the DefCon system"));
this->SetSyntax(_("[\0021\002|\0022\002|\0023\002|\0024\002|\0025\002]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &lvl = params[0];
if (lvl.empty())
{
source.Reply(_("Services are now at DEFCON \002%d\002"), DConfig.defaultlevel);
this->SendLevels(source);
return;
}
int newLevel = 0;
try
{
newLevel = convertTo<int>(lvl);
}
catch (const ConvertException &) { }
if (newLevel < 1 || newLevel > 5)
{
this->OnSyntaxError(source, "");
return;
}
DConfig.defaultlevel = newLevel;
FOREACH_MOD(I_OnDefconLevel, OnDefconLevel(newLevel));
if (timeout)
{
delete timeout;
timeout = NULL;
}
if (DConfig.timeout)
timeout = new DefConTimeout(this->module, 5);
source.Reply(_("Services are now at DEFCON \002%d\002"), DConfig.defaultlevel);
this->SendLevels(source);
Log(LOG_ADMIN, u, this) << "to change defcon level to " << newLevel;
/* Global notice the user what is happening. Also any Message that
the Admin would like to add. Set in config file. */
if (DConfig.globalondefcon)
{
if (DConfig.defaultlevel == 5 && !DConfig.offmessage.empty())
global->SendGlobal(findbot(Config->Global), "", DConfig.offmessage);
else if (DConfig.defaultlevel != 5)
{
global->SendGlobal(findbot(Config->Global), "", Anope::printf(_("The Defcon level is now at: \002%d\002"), DConfig.defaultlevel));
if (!DConfig.message.empty())
global->SendGlobal(findbot(Config->Global), "", DConfig.message);
}
}
/* Run any defcon functions, e.g. FORCE CHAN MODE */
runDefCon();
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("The defcon system can be used to implement a pre-defined\n"
"set of restrictions to services useful during an attempted\n"
"attack on the network."));
return true;
}
};
class OSDefcon : public Module
{
service_reference<SessionService> session_service;
service_reference<XLineManager> akills;
CommandOSDefcon commandosdefcon;
void ParseModeString()
{
int add = -1; /* 1 if adding, 0 if deleting, -1 if neither */
unsigned char mode;
ChannelMode *cm;
ChannelModeParam *cmp;
Anope::string modes, param;
spacesepstream ss(DConfig.chanmodes);
DConfig.DefConModesOn.ClearFlags();
DConfig.DefConModesOff.ClearFlags();
ss.GetToken(modes);
/* Loop while there are modes to set */
for (unsigned i = 0, end = modes.length(); i < end; ++i)
{
mode = modes[i];
switch (mode)
{
case '+':
add = 1;
continue;
case '-':
add = 0;
continue;
default:
if (add < 0)
continue;
}
if ((cm = ModeManager::FindChannelModeByChar(mode)))
{
if (cm->Type == MODE_STATUS || cm->Type == MODE_LIST || !cm->CanSet(NULL))
{
Log() << "DefConChanModes mode character '" << mode << "' cannot be locked";
continue;
}
else if (add)
{
DConfig.DefConModesOn.SetFlag(cm->Name);
DConfig.DefConModesOff.UnsetFlag(cm->Name);
if (cm->Type == MODE_PARAM)
{
cmp = debug_cast<ChannelModeParam *>(cm);
if (!ss.GetToken(param))
{
Log() << "DefConChanModes mode character '" << mode << "' has no parameter while one is expected";
continue;
}
if (!cmp->IsValid(param))
continue;
DConfig.SetDefConParam(cmp->Name, param);
}
}
else if (DConfig.DefConModesOn.HasFlag(cm->Name))
{
DConfig.DefConModesOn.UnsetFlag(cm->Name);
if (cm->Type == MODE_PARAM)
DConfig.UnsetDefConParam(cm->Name);
}
}
}
/* We can't mlock +L if +l is not mlocked as well. */
if ((cm = ModeManager::FindChannelModeByName(CMODE_REDIRECT)) && DConfig.DefConModesOn.HasFlag(cm->Name) && !DConfig.DefConModesOn.HasFlag(CMODE_LIMIT))
{
DConfig.DefConModesOn.UnsetFlag(CMODE_REDIRECT);
Log() << "DefConChanModes must lock mode +l as well to lock mode +L";
}
/* Some ircd we can't set NOKNOCK without INVITE */
/* So check if we need there is a NOKNOCK MODE and that we need INVITEONLY */
if (ircd->knock_needs_i && (cm = ModeManager::FindChannelModeByName(CMODE_NOKNOCK)) && DConfig.DefConModesOn.HasFlag(cm->Name) && !DConfig.DefConModesOn.HasFlag(CMODE_INVITE))
{
DConfig.DefConModesOn.UnsetFlag(CMODE_NOKNOCK);
Log() << "DefConChanModes must lock mode +i as well to lock mode +K";
}
}
public:
OSDefcon(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), session_service("session"), akills("xlinemanager/sgline"), commandosdefcon(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnReload, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnPreCommand, I_OnUserConnect, I_OnChannelModeAdd, I_OnChannelCreate };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::RegisterService(&commandosdefcon);
try
{
this->OnReload();
}
catch (const ConfigException &ex)
{
throw ModuleException(ex.GetReason());
}
}
void OnReload()
{
ConfigReader config;
DefconConfig dconfig;
dconfig.defaultlevel = config.ReadInteger("defcon", "defaultlevel", 0, 0);
dconfig.defcons[4] = config.ReadValue("defcon", "level4", 0);
dconfig.defcons[3] = config.ReadValue("defcon", "level3", 0);
dconfig.defcons[2] = config.ReadValue("defcon", "level2", 0);
dconfig.defcons[1] = config.ReadValue("defcon", "level1", 0);
dconfig.sessionlimit = config.ReadInteger("defcon", "sessionlimit", 0, 0);
dconfig.akillreason = config.ReadValue("defcon", "akillreason", 0);
dconfig.akillexpire = dotime(config.ReadValue("defcon", "akillexpire", 0));
dconfig.chanmodes = config.ReadValue("defcon", "chanmodes", 0);
dconfig.timeout = dotime(config.ReadValue("defcon", "timeout", 0));
dconfig.globalondefcon = config.ReadFlag("defcon", "globalondefcon", 0);
dconfig.message = config.ReadValue("defcon", "message", 0);
dconfig.offmessage = config.ReadValue("defcon", "offmessage", 0);
if (dconfig.defaultlevel < 1 || dconfig.defaultlevel > 5)
throw ConfigException("The value for <defcon:defaultlevel> must be between 1 and 5");
else if (dconfig.akillexpire <= 0)
throw ConfigException("The value for <defcon:akillexpire> must be greater than zero!");
for (unsigned level = 1; level < 5; ++level)
{
spacesepstream operations(dconfig.defcons[level]);
Anope::string operation;
while (operations.GetToken(operation))
{
if (operation.equals_ci("nonewchannels"))
dconfig.Add(level, DEFCON_NO_NEW_CHANNELS);
else if (operation.equals_ci("nonewnicks"))
dconfig.Add(level, DEFCON_NO_NEW_NICKS);
else if (operation.equals_ci("nomlockchanges"))
dconfig.Add(level, DEFCON_NO_MLOCK_CHANGE);
else if (operation.equals_ci("forcechanmodes"))
dconfig.Add(level, DEFCON_FORCE_CHAN_MODES);
else if (operation.equals_ci("reducedsessions"))
dconfig.Add(level, DEFCON_REDUCE_SESSION);
else if (operation.equals_ci("nonewclients"))
dconfig.Add(level, DEFCON_NO_NEW_CLIENTS);
else if (operation.equals_ci("operonly"))
dconfig.Add(level, DEFCON_OPER_ONLY);
else if (operation.equals_ci("silentoperonly"))
dconfig.Add(level, DEFCON_SILENT_OPER_ONLY);
else if (operation.equals_ci("akillnewclients"))
dconfig.Add(level, DEFCON_AKILL_NEW_CLIENTS);
else if (operation.equals_ci("nonewmemos"))
dconfig.Add(level, DEFCON_NO_NEW_MEMOS);
}
if (dconfig.Check(level, DEFCON_REDUCE_SESSION) && dconfig.sessionlimit <= 0)
throw ConfigException("The value for <defcon:sessionlimit> must be greater than zero!");
else if (dconfig.Check(level, DEFCON_AKILL_NEW_CLIENTS) && dconfig.akillreason.empty())
throw ConfigException("The value for <defcon:akillreason> must not be empty!");
else if (dconfig.Check(level, DEFCON_FORCE_CHAN_MODES) && dconfig.chanmodes.empty())
throw ConfigException("The value for <defcon:chanmodes> must not be empty!");
}
DConfig = dconfig;
this->ParseModeString();
}
EventReturn OnUserConnect(User *u, bool &exempt)
{
if (!exempt && u->server->IsSynced() && DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && !u->server->IsULined())
{
if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && akills)
{
Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: adding akill for *@" << u->host;
XLine *x = akills->Add("*@" + u->host, Config->OperServ, Anope::CurTime + DConfig.akillexpire, DConfig.akillreason);
if (x)
x->By = Config->OperServ;
}
if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
u->Kill(Config->OperServ, DConfig.akillreason);
return EVENT_STOP;
}
return EVENT_CONTINUE;
}
EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name, const Anope::string &param)
{
ChannelMode *cm = ModeManager::FindChannelModeByName(Name);
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && cm && DConfig.DefConModesOff.HasFlag(Name))
{
c->RemoveMode(findbot(Config->OperServ), Name, param);
return EVENT_STOP;
}
return EVENT_CONTINUE;
}
EventReturn OnChannelModeUnset(Channel *c, ChannelModeName Name, const Anope::string &)
{
ChannelMode *cm = ModeManager::FindChannelModeByName(Name);
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && cm && DConfig.DefConModesOn.HasFlag(Name))
{
Anope::string param;
if (DConfig.GetDefConParam(Name, param))
c->SetMode(findbot(Config->OperServ), Name, param);
else
c->SetMode(findbot(Config->OperServ), Name);
return EVENT_STOP;
}
return EVENT_CONTINUE;
}
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params)
{
if (command->name == "nickserv/register" || command->name == "nickserv/group")
{
if (DConfig.Check(DEFCON_NO_NEW_NICKS))
{
source.Reply(_("Services are in Defcon mode, Please try again later."));
return EVENT_STOP;
}
}
else if (command->name == "chanserv/set/mlock")
{
if (DConfig.Check(DEFCON_NO_MLOCK_CHANGE))
{
source.Reply(_("Services are in Defcon mode, Please try again later."));
return EVENT_STOP;
}
}
else if (command->name == "chanserv/register")
{
if (DConfig.Check(DEFCON_NO_NEW_CHANNELS))
{
source.Reply(_("Services are in Defcon mode, Please try again later."));
return EVENT_STOP;
}
}
else if (command->name == "memoserv/send")
{
if (DConfig.Check(DEFCON_NO_NEW_MEMOS))
{
source.Reply(_("Services are in Defcon mode, Please try again later."));
return EVENT_STOP;
}
}
return EVENT_CONTINUE;
}
void OnUserConnect(dynamic_reference<User> &u, bool &exempt)
{
if (exempt || !u || !u->server->IsSynced() || u->server->IsULined())
return;
if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && akills)
{
Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: adding akill for *@" << u->host;
XLine *x = akills->Add("*@" + u->host, Config->OperServ, Anope::CurTime + DConfig.akillexpire, DConfig.akillreason);
if (x)
x->By = Config->OperServ;
}
if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
{
u->Kill(Config->OperServ, DConfig.akillreason);
return;
}
if (!DConfig.sessionlimit)
return;
if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && akills)
{
Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: adding akill for *@" << u->host;
XLine *x = akills->Add("*@" + u->host, Config->OperServ, Anope::CurTime + DConfig.akillexpire, !DConfig.akillreason.empty() ? DConfig.akillreason : "DEFCON AKILL");
if (x)
x->By = Config->OperServ;
}
if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
{
u->Kill(Config->OperServ, DConfig.akillreason);
return;
}
Session *session = session_service->FindSession(u->host);
Exception *exception = session_service->FindException(u);
if (DConfig.Check(DEFCON_REDUCE_SESSION) && !exception)
{
if (session && session->count > DConfig.sessionlimit)
{
if (!Config->SessionLimitExceeded.empty())
ircdproto->SendMessage(findbot(Config->OperServ), u->nick, Config->SessionLimitExceeded.c_str(), u->host.c_str());
if (!Config->SessionLimitDetailsLoc.empty())
ircdproto->SendMessage(findbot(Config->OperServ), u->nick, "%s", Config->SessionLimitDetailsLoc.c_str());
u->Kill(Config->OperServ, "Defcon session limit exceeded");
++session->hits;
if (akills && Config->MaxSessionKill && session->hits >= Config->MaxSessionKill)
{
akills->Add("*@" + u->host, Config->OperServ, Anope::CurTime + Config->SessionAutoKillExpiry, "Defcon session limit exceeded");
ircdproto->SendGlobops(findbot(Config->OperServ), "[DEFCON] Added a temporary AKILL for \2*@%s\2 due to excessive connections", u->host.c_str());
}
}
}
}
void OnChannelModeAdd(ChannelMode *cm)
{
if (DConfig.chanmodes.find(cm->ModeChar) != Anope::string::npos)
this->ParseModeString();
}
void OnChannelCreate(Channel *c)
{
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES))
c->SetModes(findbot(Config->OperServ), false, "%s", DConfig.chanmodes.c_str());
}
};
/**
* Send a message to the oper about which precautions are "active" for this level
**/
void defcon_sendlvls(CommandSource &source)
{
if (DConfig.Check(DEFCON_NO_NEW_CHANNELS))
source.Reply(_("* No new channel registrations"));
if (DConfig.Check(DEFCON_NO_NEW_NICKS))
source.Reply(_("* No new nick registrations"));
if (DConfig.Check(DEFCON_NO_MLOCK_CHANGE))
source.Reply(_("* No MLOCK changes"));
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && !DConfig.chanmodes.empty())
source.Reply(_("* Force Chan Modes (%s) to be set on all channels"), DConfig.chanmodes.c_str());
if (DConfig.Check(DEFCON_REDUCE_SESSION))
source.Reply(_("* Use the reduced session limit of %d"), DConfig.sessionlimit);
if (DConfig.Check(DEFCON_NO_NEW_CLIENTS))
source.Reply(_("* Kill any NEW clients connecting"));
if (DConfig.Check(DEFCON_OPER_ONLY))
source.Reply(_("* Ignore any non-opers with message"));
if (DConfig.Check(DEFCON_SILENT_OPER_ONLY))
source.Reply(_("* Silently ignore non-opers"));
if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
source.Reply(_("* AKILL any new clients connecting"));
if (DConfig.Check(DEFCON_NO_NEW_MEMOS))
source.Reply(_("* No new memos sent"));
}
void runDefCon()
{
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES))
{
if (!DConfig.chanmodes.empty() && !DefConModesSet)
{
if (DConfig.chanmodes[0] == '+' || DConfig.chanmodes[0] == '-')
{
Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: setting " << DConfig.chanmodes << " on all channels";
DefConModesSet = true;
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
it->second->SetModes(findbot(Config->OperServ), false, "%s", DConfig.chanmodes.c_str());
}
}
}
else
{
if (!DConfig.chanmodes.empty() && DefConModesSet)
{
if (DConfig.chanmodes[0] == '+' || DConfig.chanmodes[0] == '-')
{
DefConModesSet = false;
Anope::string newmodes = defconReverseModes(DConfig.chanmodes);
if (!newmodes.empty())
{
Log(findbot(Config->OperServ), "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels";
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
it->second->SetModes(findbot(Config->OperServ), false, "%s", newmodes.c_str());
}
}
}
}
}
static Anope::string defconReverseModes(const Anope::string &modes)
{
if (modes.empty())
return "";
Anope::string newmodes;
for (unsigned i = 0, end = modes.length(); i < end; ++i)
{
if (modes[i] == '+')
newmodes += '-';
else if (modes[i] == '-')
newmodes += '+';
else
newmodes += modes[i];
}
return newmodes;
}
MODULE_INIT(OSDefcon)
-350
View File
@@ -1,350 +0,0 @@
/* OperServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "os_forbid.h"
class MyForbidService : public ForbidService
{
std::vector<ForbidData *> forbidData;
public:
MyForbidService(Module *m) : ForbidService(m) { }
void AddForbid(ForbidData *d)
{
this->forbidData.push_back(d);
}
void RemoveForbid(ForbidData *d)
{
std::vector<ForbidData *>::iterator it = std::find(this->forbidData.begin(), this->forbidData.end(), d);
if (it != this->forbidData.end())
this->forbidData.erase(it);
delete d;
}
ForbidData *FindForbid(const Anope::string &mask, ForbidType type)
{
const std::vector<ForbidData *> &forbids = this->GetForbids();
for (unsigned i = forbids.size(); i > 0; --i)
{
ForbidData *d = this->forbidData[i - 1];
if ((type == FT_NONE || type == d->type) && Anope::Match(mask, d->mask))
return d;
}
return NULL;
}
const std::vector<ForbidData *> &GetForbids()
{
for (unsigned i = this->forbidData.size(); i > 0; --i)
{
ForbidData *d = this->forbidData[i - 1];
if (d->expires && Anope::CurTime >= d->expires)
{
Anope::string type = "none";
if (d->type == FT_NICK)
type = "nick";
else if (d->type == FT_CHAN)
type = "chan";
else if (d->type == FT_EMAIL)
type = "email";
Log(LOG_NORMAL, Config->OperServ + "/forbid") << "Expiring forbid for " << d->mask << " type " << type;
this->forbidData.erase(this->forbidData.begin() + i - 1);
delete d;
}
}
return this->forbidData;
}
};
class CommandOSForbid : public Command
{
service_reference<ForbidService> fs;
public:
CommandOSForbid(Module *creator) : Command(creator, "operserv/forbid", 1, 5), fs("forbid")
{
this->SetDesc(_("Forbid usage of nicknames, channels, and emails"));
this->SetSyntax(_("ADD {NICK|CHAN|EMAIL} [+\037expiry\037] \037entry\037\002 [\037reason\037]"));
this->SetSyntax(_("DEL {NICK|CHAN|EMAIL} \037entry\037"));
this->SetSyntax(_("LIST (NICK|CHAN|EMAIL)"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!this->fs)
return;
const Anope::string &command = params[0];
const Anope::string &subcommand = params.size() > 1 ? params[1] : "";
ForbidType type = FT_NONE;
if (subcommand.equals_ci("NICK"))
type = FT_NICK;
else if (subcommand.equals_ci("CHAN"))
type = FT_CHAN;
else if (subcommand.equals_ci("EMAIL"))
type = FT_EMAIL;
if (command.equals_ci("ADD") && params.size() > 2 && type != FT_NONE)
{
const Anope::string &expiry = params[2][0] == '+' ? params[2] : "";
const Anope::string &entry = params.size() > 3 && !expiry.empty() ? params[3] : params[2];
Anope::string reason = !expiry.empty() && params.size() > 4 ? params[4] : (params.size() > 3 ? params[3] : "");
time_t expiryt = 0;
if (Config->ForceForbidReason && reason.empty())
{
this->OnSyntaxError(source, "");
return;
}
if (!expiry.empty())
{
expiryt = dotime(expiry);
if (expiryt)
expiryt += Anope::CurTime;
}
ForbidData *d = this->fs->FindForbid(entry, type);
bool created = false;
if (d == NULL)
{
d = new ForbidData();
created = true;
}
d->mask = entry;
d->creator = source.u->nick;
d->reason = reason;
d->created = Anope::CurTime;
d->expires = expiryt;
d->type = type;
if (created)
this->fs->AddForbid(d);
Log(LOG_ADMIN, source.u, this) << "to add a forbid on " << entry << " of type " << subcommand;
source.Reply(_("Added a%s forbid on %s to expire on %s"), type == FT_CHAN ? "n" : "", entry.c_str(), d->expires ? do_strftime(d->expires).c_str() : "never");
}
else if (command.equals_ci("DEL") && params.size() > 2 && type != FT_NONE)
{
const Anope::string &entry = params[2];
ForbidData *d = this->fs->FindForbid(entry, type);
if (d != NULL)
{
Log(LOG_ADMIN, source.u, this) << "to remove forbid " << d->mask << " of type " << subcommand;
source.Reply(_("%s deleted from the %s forbid list."), d->mask.c_str(), subcommand.c_str());
this->fs->RemoveForbid(d);
}
else
source.Reply(_("Forbid on %s was not found."), entry.c_str());
}
else if (command.equals_ci("LIST"))
{
const std::vector<ForbidData *> &forbids = this->fs->GetForbids();
if (forbids.empty())
source.Reply(_("Forbid list is empty."));
else
{
source.Reply(_("Forbid list:"));
source.Reply(_("Mask Type Reason"));
for (unsigned i = 0; i < forbids.size(); ++i)
{
ForbidData *d = forbids[i];
Anope::string ftype;
if (d->type == FT_NICK)
ftype = "NICK";
else if (d->type == FT_CHAN)
ftype = "CHAN";
else if (d->type == FT_EMAIL)
ftype = "EMAIL";
else
continue;
source.Reply("%-10s %-5s %s", d->mask.c_str(), ftype.c_str(), d->reason.c_str());
source.Reply(_("By %s, expires on %s"), d->creator.c_str(), d->expires ? do_strftime(d->expires).c_str() : "never");
}
source.Reply(_("End of forbid list."));
}
}
else
this->OnSyntaxError(source, command);
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Forbid allows you to forbid usage of certain nicknames, channels,\n"
"and email addresses. Wildcards are accepted for all entries."));
return true;
}
};
class OSForbid : public Module
{
MyForbidService forbidService;
CommandOSForbid commandosforbid;
public:
OSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
forbidService(this), commandosforbid(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnUserConnect, I_OnUserNickChange, I_OnJoinChannel, I_OnPreCommand, I_OnDatabaseWrite, I_OnDatabaseRead };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::RegisterService(&this->forbidService);
ModuleManager::RegisterService(&commandosforbid);
}
void OnUserConnect(dynamic_reference<User> &u, bool &exempt)
{
if (!u || exempt)
return;
this->OnUserNickChange(u, "");
}
void OnUserNickChange(User *u, const Anope::string &)
{
if (u->HasMode(UMODE_OPER))
return;
ForbidData *d = this->forbidService.FindForbid(u->nick, FT_NICK);
if (d != NULL)
{
BotInfo *bi = findbot(Config->OperServ);
if (bi)
{
if (d->reason.empty())
u->SendMessage(bi, _("This nickname has been forbidden."));
else
u->SendMessage(bi, _("This nickname has been forbidden: %s"), d->reason.c_str());
}
u->Collide(NULL);
}
}
void OnJoinChannel(User *u, Channel *c)
{
if (u->HasMode(UMODE_OPER))
return;
BotInfo *bi = findbot(Config->OperServ);
ForbidData *d = this->forbidService.FindForbid(c->name, FT_CHAN);
if (bi != NULL && d != NULL)
{
if (!c->HasFlag(CH_INHABIT))
{
/* Join ChanServ and set a timer for this channel to part ChanServ later */
new ChanServTimer(c);
/* Set +si to prevent rejoin */
c->SetMode(NULL, CMODE_NOEXTERNAL);
c->SetMode(NULL, CMODE_TOPIC);
c->SetMode(NULL, CMODE_SECRET);
c->SetMode(NULL, CMODE_INVITE);
}
if (d->reason.empty())
c->Kick(bi, u, _("This channel has been forbidden."));
else
c->Kick(bi, u, _("This channel has been forbidden: %s"), d->reason.c_str());
}
}
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params)
{
if (source.u->HasMode(UMODE_OPER))
return EVENT_CONTINUE;
else if (command->name == "nickserv/register" && params.size() > 1)
{
ForbidData *d = this->forbidService.FindForbid(params[1], FT_EMAIL);
if (d != NULL)
{
source.Reply("Your email address is not allowed, choose a different one.");
return EVENT_STOP;
}
}
else if (command->name == "nickserv/set/email" && params.size() > 0)
{
ForbidData *d = this->forbidService.FindForbid(params[0], FT_EMAIL);
if (d != NULL)
{
source.Reply("Your email address is not allowed, choose a different one.");
return EVENT_STOP;
}
}
return EVENT_CONTINUE;
}
void OnDatabaseWrite(void (*Write)(const Anope::string &))
{
std::vector<ForbidData *> forbids = this->forbidService.GetForbids();
for (unsigned i = 0; i < forbids.size(); ++i)
{
ForbidData *f = forbids[i];
Anope::string ftype;
if (f->type == FT_NICK)
ftype = "NICK";
else if (f->type == FT_CHAN)
ftype = "CHAN";
else if (f->type == FT_EMAIL)
ftype = "EMAIL";
Write("FORBID " + f->mask + " " + f->creator + " " + stringify(f->created) + " " + stringify(f->expires) + " " + ftype + " " + f->reason);
}
}
EventReturn OnDatabaseRead(const std::vector<Anope::string> &params)
{
if (params.size() > 5 && params[0] == "FORBID")
{
ForbidData *f = new ForbidData();
f->mask = params[1];
f->creator = params[2];
f->created = convertTo<time_t>(params[3]);
f->expires = convertTo<time_t>(params[4]);
if (params[5] == "NICK")
f->type = FT_NICK;
else if (params[5] == "CHAN")
f->type = FT_CHAN;
else if (params[5] == "EMAIL")
f->type = FT_EMAIL;
else
f->type = FT_NONE;
f->reason = params.size() > 6 ? params[6] : "";
this->forbidService.AddForbid(f);
}
return EVENT_CONTINUE;
}
};
MODULE_INIT(OSForbid)
-37
View File
@@ -1,37 +0,0 @@
#ifndef OS_FORBID_H
#define OS_FORBID_H
enum ForbidType
{
FT_NONE,
FT_NICK,
FT_CHAN,
FT_EMAIL
};
struct ForbidData
{
Anope::string mask;
Anope::string creator;
Anope::string reason;
time_t created;
time_t expires;
ForbidType type;
};
class ForbidService : public Service
{
public:
ForbidService(Module *m) : Service(m, "forbid") { }
virtual void AddForbid(ForbidData *d) = 0;
virtual void RemoveForbid(ForbidData *d) = 0;
virtual ForbidData *FindForbid(const Anope::string &mask, ForbidType type) = 0;
virtual const std::vector<ForbidData *> &GetForbids() = 0;
};
#endif
-72
View File
@@ -1,72 +0,0 @@
/* OperServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSKill : public Command
{
public:
CommandOSKill(Module *creator) : Command(creator, "operserv/kill", 1, 2)
{
this->SetDesc(_("Kill a user"));
this->SetSyntax(_("\037user\037 [\037reason\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &nick = params[0];
Anope::string reason = params.size() > 1 ? params[1] : "";
User *u2 = finduser(nick);
if (u2 == NULL)
source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
else if (u2->IsProtected() || u2->server == Me)
source.Reply(ACCESS_DENIED);
else
{
if (reason.empty())
reason = "No reason specified";
if (Config->AddAkiller)
reason = "(" + u->nick + ") " + reason;
Log(LOG_ADMIN, u, this) << "on " << u2->nick << " for " << reason;
u2->Kill(Config->OperServ, reason);
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows you to kill a user from the network.\n"
"Parameters are the same as for the standard /KILL\n"
"command."));
return true;
}
};
class OSKill : public Module
{
CommandOSKill commandoskill;
public:
OSKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandoskill(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandoskill);
}
};
MODULE_INIT(OSKill)
-187
View File
@@ -1,187 +0,0 @@
/* OperServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSChanList : public Command
{
public:
CommandOSChanList(Module *creator) : Command(creator, "operserv/chanlist", 0, 2)
{
this->SetDesc(_("Lists all channel records"));
this->SetSyntax(_("[{\037pattern\037 | \037nick\037} [\037SECRET\037]]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &pattern = !params.empty() ? params[0] : "";
const Anope::string &opt = params.size() > 1 ? params[1] : "";
std::list<ChannelModeName> Modes;
User *u2;
if (!opt.empty() && opt.equals_ci("SECRET"))
{
Modes.push_back(CMODE_SECRET);
Modes.push_back(CMODE_PRIVATE);
}
if (!pattern.empty() && (u2 = finduser(pattern)))
{
source.Reply(_("\002%s\002 channel list:\n"
"Name Users Modes Topic"), u2->nick.c_str());
for (UChannelList::iterator uit = u2->chans.begin(), uit_end = u2->chans.end(); uit != uit_end; ++uit)
{
ChannelContainer *cc = *uit;
if (!Modes.empty())
for (std::list<ChannelModeName>::iterator it = Modes.begin(), it_end = Modes.end(); it != it_end; ++it)
if (!cc->chan->HasMode(*it))
continue;
source.Reply(_("%-20s %4d +%-6s %s"), cc->chan->name.c_str(), cc->chan->users.size(), cc->chan->GetModes(true, true).c_str(), !cc->chan->topic.empty() ? cc->chan->topic.c_str() : "");
}
}
else
{
source.Reply(_("Channel list:\n"
"Name Users Modes Topic"));
for (channel_map::const_iterator cit = ChannelList.begin(), cit_end = ChannelList.end(); cit != cit_end; ++cit)
{
Channel *c = cit->second;
if (!pattern.empty() && !Anope::Match(c->name, pattern))
continue;
if (!Modes.empty())
for (std::list<ChannelModeName>::iterator it = Modes.begin(), it_end = Modes.end(); it != it_end; ++it)
if (!c->HasMode(*it))
continue;
source.Reply(_("%-20s %4d +%-6s %s"), c->name.c_str(), c->users.size(), c->GetModes(true, true).c_str(), !c->topic.empty() ? c->topic.c_str() : "");
}
}
source.Reply(_("End of channel list."));
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Lists all channels currently in use on the IRC network, whether they\n"
"are registered or not.\n"
"If \002pattern\002 is given, lists only channels that match it. If a nickname\n"
"is given, lists only the channels the user using it is on. If SECRET is\n"
"specified, lists only channels matching \002pattern\002 that have the +s or\n"
"+p mode."));
return true;
}
};
class CommandOSUserList : public Command
{
public:
CommandOSUserList(Module *creator) : Command(creator, "operserv/userlist", 0, 2)
{
this->SetDesc(_("Lists all user records"));
this->SetSyntax(_("[{\037pattern\037 | \037channel\037} [\037INVISIBLE\037]]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &pattern = !params.empty() ? params[0] : "";
const Anope::string &opt = params.size() > 1 ? params[1] : "";
Channel *c;
std::list<UserModeName> Modes;
if (!opt.empty() && opt.equals_ci("INVISIBLE"))
Modes.push_back(UMODE_INVIS);
if (!pattern.empty() && (c = findchan(pattern)))
{
source.Reply(_("\002%s\002 users list:\n"
"Nick Mask"), pattern.c_str());
for (CUserList::iterator cuit = c->users.begin(), cuit_end = c->users.end(); cuit != cuit_end; ++cuit)
{
UserContainer *uc = *cuit;
if (!Modes.empty())
for (std::list<UserModeName>::iterator it = Modes.begin(), it_end = Modes.end(); it != it_end; ++it)
if (!uc->user->HasMode(*it))
continue;
source.Reply(_("%-20s %s@%s"), uc->user->nick.c_str(), uc->user->GetIdent().c_str(), uc->user->GetDisplayedHost().c_str());
}
}
else
{
source.Reply(_("Users list:\n"
"Nick Mask"));
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *u2 = it->second;
if (!pattern.empty())
{
Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost();
if (!Anope::Match(mask, pattern))
continue;
if (!Modes.empty())
for (std::list<UserModeName>::iterator mit = Modes.begin(), mit_end = Modes.end(); mit != mit_end; ++mit)
if (!u2->HasMode(*mit))
continue;
}
source.Reply(_("%-20s %s@%s"), u2->nick.c_str(), u2->GetIdent().c_str(), u2->GetDisplayedHost().c_str());
}
}
source.Reply(_("End of users list."));
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Lists all users currently online on the IRC network, whether their\n"
"nick is registered or not.\n"
" \n"
"If \002pattern\002 is given, lists only users that match it (it must be in\n"
"the format nick!user@host). If \002channel\002 is given, lists only users\n"
"that are on the given channel. If INVISIBLE is specified, only users\n"
"with the +i flag will be listed."));
return true;
}
};
class OSList : public Module
{
CommandOSChanList commandoschanlist;
CommandOSUserList commandosuserlist;
public:
OSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandoschanlist(this), commandosuserlist(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandoschanlist);
ModuleManager::RegisterService(&commandosuserlist);
}
};
MODULE_INIT(OSList)
-109
View File
@@ -1,109 +0,0 @@
/* OperServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSMode : public Command
{
public:
CommandOSMode(Module *creator) : Command(creator, "operserv/mode", 2, 2)
{
this->SetDesc(_("Change channel modes"));
this->SetSyntax(_("\037channel\037 \037modes\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &target = params[0];
const Anope::string &modes = params[1];
Channel *c = findchan(target);
if (!c)
source.Reply(CHAN_X_NOT_IN_USE, target.c_str());
else if (c->bouncy_modes)
source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?"));
else
{
c->SetModes(source.owner, false, modes.c_str());
Log(LOG_ADMIN, u, this) << modes << " on " << target;
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows Services operators to change modes for any channel.\n"
"Parameters are the same as for the standard /MODE command."));
return true;
}
};
class CommandOSUMode : public Command
{
public:
CommandOSUMode(Module *creator) : Command(creator, "operserv/umode", 2, 2)
{
this->SetDesc(_("Change channel or user modes"));
this->SetSyntax(_("\037user\037 \037modes\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &target = params[0];
const Anope::string &modes = params[1];
User *u2 = finduser(target);
if (!u2)
source.Reply(NICK_X_NOT_IN_USE, target.c_str());
else
{
u2->SetModes(source.owner, "%s", modes.c_str());
source.Reply(_("Changed usermodes of \002%s\002 to %s."), u2->nick.c_str(), modes.c_str());
u2->SendMessage(source.owner, _("\002%s\002 changed your usermodes to %s."), u->nick.c_str(), modes.c_str());
Log(LOG_ADMIN, u, this) << modes << " on " << target;
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows Services operators to change modes for any user.\n"
"Parameters are the same as for the standard /MODE command."));
return true;
}
};
class OSMode : public Module
{
CommandOSMode commandosmode;
CommandOSUMode commandosumode;
public:
OSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandosmode(this), commandosumode(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandosmode);
ModuleManager::RegisterService(&commandosumode);
}
};
MODULE_INIT(OSMode)
-205
View File
@@ -1,205 +0,0 @@
/* OperServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSModLoad : public Command
{
public:
CommandOSModLoad(Module *creator) : Command(creator, "operserv/modload", 1, 1)
{
this->SetDesc(_("Load a module"));
this->SetSyntax(_("\037modname\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &mname = params[0];
ModuleReturn status = ModuleManager::LoadModule(mname, u);
if (status == MOD_ERR_OK)
{
ircdproto->SendGlobops(source.owner, "%s loaded module %s", u->nick.c_str(), mname.c_str());
source.Reply(_("Module \002%s\002 loaded"), mname.c_str());
/* If a user is loading this module, then the core databases have already been loaded
* so trigger the event manually
*/
Module *m = ModuleManager::FindModule(mname);
if (m)
m->OnPostLoadDatabases();
}
else if (status == MOD_ERR_EXISTS)
source.Reply(_("Module \002%s\002 is already loaded."), mname.c_str());
else
source.Reply(_("Unable to load module \002%s\002"), mname.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("This command loads the module named FileName from the modules\n"
"directory."));
return true;
}
};
class CommandOSModReLoad : public Command
{
public:
CommandOSModReLoad(Module *creator) : Command(creator, "operserv/modreload", 1, 1)
{
this->SetDesc(_("Reload a module"));
this->SetSyntax(_("\037modname\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &mname = params[0];
Module *m = ModuleManager::FindModule(mname);
if (!m)
{
source.Reply(_("Module \002%s\002 isn't loaded."), mname.c_str());
return;
}
if (!m->handle || m->GetPermanent())
{
source.Reply(_("Unable to remove module \002%s\002"), m->name.c_str());
return;
}
/* Unrecoverable */
bool fatal = m->type == PROTOCOL;
ModuleReturn status = ModuleManager::UnloadModule(m, u);
if (status != MOD_ERR_OK)
{
source.Reply(_("Unable to remove module \002%s\002"), mname.c_str());
return;
}
status = ModuleManager::LoadModule(mname, u);
if (status == MOD_ERR_OK)
{
ircdproto->SendGlobops(source.owner, "%s reloaded module %s", u->nick.c_str(), mname.c_str());
source.Reply(_("Module \002%s\002 reloaded"), mname.c_str());
/* If a user is loading this module, then the core databases have already been loaded
* so trigger the event manually
*/
m = ModuleManager::FindModule(mname);
if (m)
m->OnPostLoadDatabases();
}
else
{
if (fatal)
{
quitmsg = "Unable to reload module " + mname;
quitting = true;
}
else
source.Reply(_("Unable to load module \002%s\002"), mname.c_str());
}
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("This command reloads the module named FileName."));
return true;
}
};
class CommandOSModUnLoad : public Command
{
public:
CommandOSModUnLoad(Module *creator) : Command(creator, "operserv/modunload", 1, 1)
{
this->SetDesc(_("Un-Load a module"));
this->SetSyntax(_("\037modname\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &mname = params[0];
Module *m = ModuleManager::FindModule(mname);
if (!m)
{
source.Reply(_("Module \002%s\002 isn't loaded."), mname.c_str());
return;
}
if (!m->handle || m->GetPermanent() || m->type == PROTOCOL)
{
source.Reply(_("Unable to remove module \002%s\002"), m->name.c_str());
return;
}
Log() << "Trying to unload module [" << mname << "]";
ModuleReturn status = ModuleManager::UnloadModule(m, u);
if (status == MOD_ERR_OK)
{
source.Reply(_("Module \002%s\002 unloaded"), mname.c_str());
ircdproto->SendGlobops(source.owner, "%s unloaded module %s", u->nick.c_str(), mname.c_str());
}
else
source.Reply(_("Unable to remove module \002%s\002"), mname.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("This command unloads the module named FileName from the modules\n"
"directory."));
return true;
}
};
class OSModule : public Module
{
CommandOSModLoad commandosmodload;
CommandOSModReLoad commandosmodreload;
CommandOSModUnLoad commandosmodunload;
public:
OSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandosmodload(this), commandosmodreload(this), commandosmodunload(this)
{
this->SetAuthor("Anope");
this->SetPermanent(true);
ModuleManager::RegisterService(&commandosmodload);
ModuleManager::RegisterService(&commandosmodreload);
ModuleManager::RegisterService(&commandosmodunload);
}
};
MODULE_INIT(OSModule)
-450
View File
@@ -1,450 +0,0 @@
/* OperServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "global.h"
#include "os_news.h"
/* List of messages for each news type. This simplifies message sending. */
enum
{
MSG_SYNTAX,
MSG_LIST_HEADER,
MSG_LIST_NONE,
MSG_ADDED,
MSG_DEL_NOT_FOUND,
MSG_DELETED,
MSG_DEL_NONE,
MSG_DELETED_ALL
};
struct NewsMessages msgarray[] = {
{NEWS_LOGON, "LOGON",
{_("LOGONNEWS {ADD|DEL|LIST} [\037text\037|\037num\037]\002"),
_("Logon news items:"),
_("There is no logon news."),
_("Added new logon news item."),
_("Logon news item #%s not found!"),
_("Logon news item #%d deleted."),
_("No logon news items to delete!"),
_("All logon news items deleted.")}
},
{NEWS_OPER, "OPER",
{_("OPERNEWS {ADD|DEL|LIST} [\037text\037|\037num\037]\002"),
_("Oper news items:"),
_("There is no oper news."),
_("Added new oper news item."),
_("Oper news item #%s not found!"),
_("Oper news item #%d deleted."),
_("No oper news items to delete!"),
_("All oper news items deleted.")}
},
{NEWS_RANDOM, "RANDOM",
{_("RANDOMNEWS {ADD|DEL|LIST} [\037text\037|\037num\037]\002"),
_("Random news items:"),
_("There is no random news."),
_("Added new random news item."),
_("Random news item #%s not found!"),
_("Random news item #%d deleted."),
_("No random news items to delete!"),
_("All random news items deleted.")}
}
};
class MyNewsService : public NewsService
{
std::vector<NewsItem *> newsItems[3];
public:
MyNewsService(Module *m) : NewsService(m) { }
~MyNewsService()
{
for (unsigned i = 0; i < 3; ++i)
for (unsigned j = 0; j < newsItems[i].size(); ++j)
delete newsItems[i][j];
}
void AddNewsItem(NewsItem *n)
{
this->newsItems[n->type].push_back(n);
}
void DelNewsItem(NewsItem *n)
{
std::vector<NewsItem *> &list = this->GetNewsList(n->type);
std::vector<NewsItem *>::iterator it = std::find(list.begin(), list.end(), n);
if (it != list.end())
list.erase(it);
delete n;
}
std::vector<NewsItem *> &GetNewsList(NewsType t)
{
return this->newsItems[t];
}
};
#define lenof(a) (sizeof(a) / sizeof(*(a)))
static const char **findmsgs(NewsType type)
{
for (unsigned i = 0; i < lenof(msgarray); ++i)
if (msgarray[i].type == type)
return msgarray[i].msgs;
return NULL;
}
class NewsBase : public Command
{
service_reference<NewsService> ns;
protected:
void DoList(CommandSource &source, NewsType type, const char **msgs)
{
std::vector<NewsItem *> &list = this->ns->GetNewsList(type);
if (list.empty())
source.Reply(msgs[MSG_LIST_NONE]);
else
{
source.Reply(msgs[MSG_LIST_HEADER]);
for (unsigned i = 0, end = list.size(); i < end; ++i)
source.Reply(_("%5d (%s by %s)\n"" %s"), i + 1, do_strftime(list[i]->time).c_str(), !list[i]->who.empty() ? list[i]->who.c_str() : "<unknown>", list[i]->text.c_str());
source.Reply(END_OF_ANY_LIST, "News");
}
return;
}
void DoAdd(CommandSource &source, const std::vector<Anope::string> &params, NewsType type, const char **msgs)
{
const Anope::string text = params.size() > 1 ? params[1] : "";
if (text.empty())
this->OnSyntaxError(source, "ADD");
else
{
if (readonly)
source.Reply(READ_ONLY_MODE);
NewsItem *news = new NewsItem();
news->type = type;
news->text = text;
news->time = Anope::CurTime;
news->who = source.u->nick;
this->ns->AddNewsItem(news);
source.Reply(msgs[MSG_ADDED]);
}
return;
}
void DoDel(CommandSource &source, const std::vector<Anope::string> &params, NewsType type, const char **msgs)
{
const Anope::string &text = params.size() > 1 ? params[1] : "";
if (text.empty())
this->OnSyntaxError(source, "DEL");
else
{
std::vector<NewsItem *> &list = this->ns->GetNewsList(type);
if (list.empty())
source.Reply(msgs[MSG_LIST_NONE]);
else
{
if (readonly)
source.Reply(READ_ONLY_MODE);
if (!text.equals_ci("ALL"))
{
try
{
unsigned num = convertTo<unsigned>(text);
if (num > 0 && num <= list.size())
{
this->ns->DelNewsItem(list[num - 1]);
source.Reply(msgs[MSG_DELETED], num);
return;
}
}
catch (const ConvertException &) { }
source.Reply(msgs[MSG_DEL_NOT_FOUND], text.c_str());
}
else
{
for (unsigned i = list.size(); i > 0; --i)
this->ns->DelNewsItem(list[i - 1]);
source.Reply(msgs[MSG_DELETED_ALL]);
}
}
}
return;
}
void DoNews(CommandSource &source, const std::vector<Anope::string> &params, NewsType type)
{
if (!this->ns)
return;
const Anope::string &cmd = params[0];
const char **msgs = findmsgs(type);
if (!msgs)
throw CoreException("news: Invalid type to do_news()");
if (cmd.equals_ci("LIST"))
return this->DoList(source, type, msgs);
else if (cmd.equals_ci("ADD"))
return this->DoAdd(source, params, type, msgs);
else if (cmd.equals_ci("DEL"))
return this->DoDel(source, params, type, msgs);
else
this->OnSyntaxError(source, "");
return;
}
public:
NewsBase(Module *creator, const Anope::string &newstype) : Command(creator, newstype, 1, 2), ns("news")
{
this->SetSyntax(_("ADD \037text\037"));
this->SetSyntax(_("DEL {\037num\037 | ALL}"));
this->SetSyntax(_("LIST"));
}
virtual ~NewsBase()
{
}
virtual void Execute(CommandSource &source, const std::vector<Anope::string> &params) = 0;
virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) = 0;
};
class CommandOSLogonNews : public NewsBase
{
public:
CommandOSLogonNews(Module *creator) : NewsBase(creator, "operserv/logonnews")
{
this->SetDesc(_("Define messages to be shown to users at logon"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
return this->DoNews(source, params, NEWS_LOGON);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Edits or displays the list of logon news messages. When a\n"
"user connects to the network, these messages will be sent\n"
"to them. (However, no more than \002%d\002 messages will be\n"
"sent in order to avoid flooding the user. If there are\n"
"more news messages, only the most recent will be sent.)\n"
"NewsCount can be configured in services.conf.\n"
" \n"
"LOGONNEWS may only be used by Services Operators."), Config->NewsCount);
return true;
}
};
class CommandOSOperNews : public NewsBase
{
public:
CommandOSOperNews(Module *creator) : NewsBase(creator, "operserv/opernews")
{
this->SetDesc(_("Define messages to be shown to users who oper"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
return this->DoNews(source, params, NEWS_OPER);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Edits or displays the list of oper news messages. When a\n"
"user opers up (with the /OPER command), these messages will\n"
"be sent to them. (However, no more than \002%d\002 messages will\n"
"be sent in order to avoid flooding the user. If there are\n"
"more news messages, only the most recent will be sent.)\n"
"NewsCount can be configured in services.conf.\n"
" \n"
"OPERNEWS may only be used by Services Operators."), Config->NewsCount);
return true;
}
};
class CommandOSRandomNews : public NewsBase
{
public:
CommandOSRandomNews(Module *creator) : NewsBase(creator, "operserv/randomnews")
{
this->SetDesc(_("Define messages to be randomly shown to users at logon"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
return this->DoNews(source, params, NEWS_RANDOM);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Edits or displays the list of random news messages. When a\n"
"user connects to the network, one (and only one) of the\n"
"random news will be randomly chosen and sent to them.\n"
" \n"
"RANDOMNEWS may only be used by Services Operators."));
return true;
}
};
class OSNews : public Module
{
MyNewsService newsservice;
CommandOSLogonNews commandoslogonnews;
CommandOSOperNews commandosopernews;
CommandOSRandomNews commandosrandomnews;
void DisplayNews(User *u, NewsType Type)
{
std::vector<NewsItem *> &newsList = this->newsservice.GetNewsList(Type);
if (newsList.empty())
return;
Anope::string msg;
if (Type == NEWS_LOGON)
msg = _("[\002Logon News\002 - %s] %s");
else if (Type == NEWS_OPER)
msg = _("[\002Oper News\002 - %s] %s");
else if (Type == NEWS_RANDOM)
msg = _("[\002Random News\002 - %s] %s");
static unsigned cur_rand_news = 0;
unsigned displayed = 0;
for (unsigned i = 0, end = newsList.size(); i < end; ++i)
{
if (Type == NEWS_RANDOM && i != cur_rand_news)
continue;
BotInfo *gl = findbot(Config->Global);
if (!gl && !BotListByNick.empty())
gl = BotListByNick.begin()->second;
BotInfo *os = findbot(Config->OperServ);
if (!os)
os = gl;
if (gl)
u->SendMessage(Type != NEWS_OPER ? gl : os, msg.c_str(), do_strftime(newsList[i]->time).c_str(), newsList[i]->text.c_str());
++displayed;
if (Type == NEWS_RANDOM)
{
++cur_rand_news;
break;
}
else if (displayed >= Config->NewsCount)
break;
}
/* Reset to head of list to get first random news value */
if (Type == NEWS_RANDOM && cur_rand_news >= newsList.size())
cur_rand_news = 0;
}
public:
OSNews(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
newsservice(this), commandoslogonnews(this), commandosopernews(this), commandosrandomnews(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandoslogonnews);
ModuleManager::RegisterService(&commandosopernews);
ModuleManager::RegisterService(&commandosrandomnews);
Implementation i[] = { I_OnUserModeSet, I_OnUserConnect, I_OnDatabaseRead, I_OnDatabaseWrite };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::RegisterService(&this->newsservice);
}
void OnUserModeSet(User *u, UserModeName Name)
{
if (Name == UMODE_OPER)
DisplayNews(u, NEWS_OPER);
}
void OnUserConnect(dynamic_reference<User> &user, bool &)
{
if (!user || !user->server->IsSynced())
return;
DisplayNews(user, NEWS_LOGON);
DisplayNews(user, NEWS_RANDOM);
}
EventReturn OnDatabaseRead(const std::vector<Anope::string> &params)
{
if (params[0].equals_ci("OS") && params.size() >= 7 && params[1].equals_ci("NEWS"))
{
NewsItem *n = new NewsItem();
// params[2] was news number
n->time = params[3].is_number_only() ? convertTo<time_t>(params[3]) : 0;
n->who = params[4];
if (params[5].equals_ci("LOGON"))
n->type = NEWS_LOGON;
else if (params[5].equals_ci("RANDOM"))
n->type = NEWS_RANDOM;
else if (params[5].equals_ci("OPER"))
n->type = NEWS_OPER;
n->text = params[6];
this->newsservice.AddNewsItem(n);
return EVENT_STOP;
}
return EVENT_CONTINUE;
}
void OnDatabaseWrite(void (*Write)(const Anope::string &))
{
for (unsigned i = 0; i < 3; ++i)
{
std::vector<NewsItem *> &list = this->newsservice.GetNewsList(static_cast<NewsType>(i));
for (std::vector<NewsItem *>::iterator it = list.begin(); it != list.end(); ++it)
{
NewsItem *n = *it;
Anope::string ntype;
if (n->type == NEWS_LOGON)
ntype = "LOGON";
else if (n->type == NEWS_RANDOM)
ntype = "RANDOM";
else if (n->type == NEWS_OPER)
ntype = "OPER";
Anope::string buf = "OS NEWS 0 " + stringify(n->time) + " " + n->who + " " + ntype + " :" + n->text;
Write(buf);
}
}
}
};
MODULE_INIT(OSNews)
-39
View File
@@ -1,39 +0,0 @@
#ifndef OS_NEWS
#define OS_NEWS
enum NewsType
{
NEWS_LOGON,
NEWS_RANDOM,
NEWS_OPER
};
struct NewsMessages
{
NewsType type;
Anope::string name;
const char *msgs[10];
};
struct NewsItem
{
NewsType type;
Anope::string text;
Anope::string who;
time_t time;
};
class NewsService : public Service
{
public:
NewsService(Module *m) : Service(m, "news") { }
virtual void AddNewsItem(NewsItem *n) = 0;
virtual void DelNewsItem(NewsItem *n) = 0;
virtual std::vector<NewsItem *> &GetNewsList(NewsType t) = 0;
};
#endif // OS_NEWS
-219
View File
@@ -1,219 +0,0 @@
/* OperServ core functions
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSOper : public Command
{
public:
CommandOSOper(Module *creator) : Command(creator, "operserv/oper", 1, 3)
{
this->SetDesc(_("View and change services operators"));
this->SetSyntax(_("ADD \037oper\037 \037type\037"));
this->SetSyntax(_("DEL [\037oper\037]"));
this->SetSyntax(_("INFO [\037type\037]"));
this->SetSyntax(_("LIST"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &subcommand = params[0];
if (subcommand.equals_ci("ADD") && params.size() > 2)
{
const Anope::string &oper = params[1];
const Anope::string &type = params[2];
NickAlias *na = findnick(oper);
if (na == NULL)
source.Reply(NICK_X_NOT_REGISTERED, oper.c_str());
else if (na->nc->o)
source.Reply(_("Nick \2%s\2 is already an operator."), na->nick.c_str());
else
{
OperType *ot = OperType::Find(type);
if (ot == NULL)
source.Reply(_("Oper type \2%s\2 has not been configured."), type.c_str());
else
{
delete na->nc->o;
na->nc->o = new Oper(na->nc->display, "", "", ot);
Log(LOG_ADMIN, source.u, this) << "ADD " << na->nick << " as type " << ot->GetName();
source.Reply("%s (%s) added to the \2%s\2 list.", na->nick.c_str(), na->nc->display.c_str(), ot->GetName().c_str());
}
}
}
else if (subcommand.equals_ci("DEL") && params.size() > 1)
{
const Anope::string &oper = params[1];
NickAlias *na = findnick(oper);
if (na == NULL)
source.Reply(NICK_X_NOT_REGISTERED, oper.c_str());
else if (!na->nc || !na->nc->o)
source.Reply(_("Nick \2%s\2 is not a services operator."), oper.c_str());
else
{
delete na->nc->o;
na->nc->o = NULL;
Log(LOG_ADMIN, source.u, this) << "DEL " << na->nick;
source.Reply(_("Oper privileges removed from %s (%s)."), na->nick.c_str(), na->nc->display.c_str());
}
}
else if (subcommand.equals_ci("LIST"))
{
source.Reply(_("Name Type"));
for (nickcore_map::const_iterator it = NickCoreList.begin(), it_end = NickCoreList.end(); it != it_end; ++it)
{
NickCore *nc = it->second;
if (!nc->o)
continue;
source.Reply(_("%-8s %s"), nc->o->name.c_str(), nc->o->ot->GetName().c_str());
if (nc->o->config)
source.Reply(_(" This oper is configured in the configuration file."));
for (std::list<User *>::iterator uit = nc->Users.begin(); uit != nc->Users.end(); ++uit)
{
User *u = *uit;
source.Reply(_(" %s is online using this oper block."), u->nick.c_str());
}
}
}
else if (subcommand.equals_ci("INFO") && params.size() > 1)
{
Anope::string fulltype = params[1];
if (params.size() > 2)
fulltype += " " + params[2];
OperType *ot = OperType::Find(fulltype);
if (ot == NULL)
source.Reply(_("Oper type \2%s\2 has not been configured."), fulltype.c_str());
else
{
if (ot->GetCommands().empty())
source.Reply(_("Opertype \2%s\2 has no allowed commands."), ot->GetName().c_str());
else
{
source.Reply(_("Available commands for \2%s\2:"), ot->GetName().c_str());
Anope::string buf;
for (std::list<Anope::string>::const_iterator it = ot->GetCommands().begin(), it_end = ot->GetCommands().end(); it != it_end; ++it)
{
buf += *it + " ";
if (buf.length() > 400)
{
source.Reply("%s", buf.c_str());
buf.clear();
}
}
if (!buf.empty())
{
source.Reply("%s", buf.c_str());
buf.clear();
}
}
if (ot->GetPrivs().empty())
source.Reply(_("Opertype \2%s\2 has no allowed privileges."), ot->GetName().c_str());
else
{
source.Reply(_("Available privileges for \2%s\2:"), ot->GetName().c_str());
Anope::string buf;
for (std::list<Anope::string>::const_iterator it = ot->GetPrivs().begin(), it_end = ot->GetPrivs().end(); it != it_end; ++it)
{
buf += *it + " ";
if (buf.length() > 400)
{
source.Reply("%s", buf.c_str());
buf.clear();
}
}
if (!buf.empty())
{
source.Reply("%s", buf.c_str());
buf.clear();
}
}
if (!ot->modes.empty())
source.Reply(_("Opertype \2%s\2 receives modes \2%s\2 once identifying."), ot->GetName().c_str(), ot->modes.c_str());
}
}
else
this->OnSyntaxError(source, subcommand);
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows you to change and view services operators.\n"
"Note that operators removed by this command but are still set in\n"
"the configuration file are not permanently affected by this."));
return true;
}
};
class OSOper : public Module
{
CommandOSOper commandosoper;
public:
OSOper(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandosoper(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnDatabaseWrite, I_OnDatabaseRead };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::RegisterService(&commandosoper);
}
void OnDatabaseWrite(void (*Write)(const Anope::string &))
{
for (nickcore_map::const_iterator it = NickCoreList.begin(), it_end = NickCoreList.end(); it != it_end; ++it)
{
NickCore *nc = it->second;
if (!nc->o)
continue;
bool found = false;
for (std::list<NickAlias *>::const_iterator it2 = nc->aliases.begin(), it2_end = nc->aliases.end(); it2 != it2_end; ++it2)
if (Oper::Find((*it2)->nick) != NULL)
found = true;
if (found == false)
{
Write("OPER " + nc->display + " :" + nc->o->ot->GetName());
}
}
}
EventReturn OnDatabaseRead(const std::vector<Anope::string> &params)
{
if (params[0] == "OPER" && params.size() > 2)
{
NickCore *nc = findcore(params[1]);
if (!nc || nc->o)
return EVENT_CONTINUE;
OperType *ot = OperType::Find(params[2]);
if (ot == NULL)
return EVENT_CONTINUE;
nc->o = new Oper(nc->display, "", "", ot);
Log(LOG_NORMAL, "operserv/oper") << "Tied oper " << nc->display << " to type " << ot->GetName();
}
return EVENT_CONTINUE;
}
};
MODULE_INIT(OSOper)

Some files were not shown because too many files have changed in this diff Show More