mirror of
https://github.com/anope/anope.git
synced 2026-06-22 10:16:39 +02:00
Compare commits
234 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b578e32531 | |||
| 4d8e3b847d | |||
| eaade23f9b | |||
| f20bac996d | |||
| 93bfd4cbe1 | |||
| 6620f9e9bd | |||
| dc64cfc940 | |||
| f8829783d2 | |||
| d6e600f74b | |||
| 5f7113bc0e | |||
| dc4daa25a7 | |||
| 0cadaedfbe | |||
| 11ad788dfd | |||
| 38a60d9142 | |||
| e8ad509aa5 | |||
| 37b3ed8ef3 | |||
| a6af422184 | |||
| 53acb73193 | |||
| 57f6d4f49c | |||
| d0467adea2 | |||
| 16924f68c0 | |||
| d280c48e6b | |||
| f0c0daa644 | |||
| 7a2d027e1d | |||
| f627a3bacd | |||
| 5a1257b7f0 | |||
| 866f3f32ab | |||
| 20ce170024 | |||
| 4034b3054a | |||
| e581158645 | |||
| 01021131ca | |||
| 13ea98a02e | |||
| db56a61f86 | |||
| df321a118e | |||
| 1931fcf0e5 | |||
| 63b02b8c97 | |||
| 1c8a77ab9f | |||
| 0c7d53f81e | |||
| bcc3ae5742 | |||
| 4e67e0897a | |||
| 76a9538441 | |||
| 91c7862579 | |||
| 6b6bc81999 | |||
| 1f2c385bb9 | |||
| d79dd0b7d7 | |||
| 8b2e8137f6 | |||
| 732466d8f4 | |||
| 3049916ade | |||
| 0afd666f22 | |||
| 8021a53ac4 | |||
| 0663f5e412 | |||
| 2ee496b8ac | |||
| 3abb18721b | |||
| 4eb0a3bdb7 | |||
| 6a03eb69eb | |||
| 4fa2a00bd5 | |||
| 82008d507c | |||
| 2ab4f175a8 | |||
| c9473bcc67 | |||
| 75ed5a9b59 | |||
| f010ab7dbf | |||
| 00b2cc9ce6 | |||
| d52cc7bcbc | |||
| 63838fa77d | |||
| e36f8143e3 | |||
| 72b26043b2 | |||
| f369157906 | |||
| ba46b8e4ab | |||
| 254901aace | |||
| c1c45a5db9 | |||
| a65e95837f | |||
| 43219d3906 | |||
| 1f8dec4c24 | |||
| fb5c5e3442 | |||
| e357c39774 | |||
| 10732baec2 | |||
| 068c6989de | |||
| 317d55f3f1 | |||
| 1397fda786 | |||
| 4ccc478830 | |||
| 100ecbb9be | |||
| cdf636e696 | |||
| 45878bf182 | |||
| f1bec3999d | |||
| a259244297 | |||
| c1da009de3 | |||
| 4f412bc213 | |||
| 1882916dc4 | |||
| f436ce9912 | |||
| ef9729fb02 | |||
| 296a75f2a9 | |||
| bce7237d9f | |||
| 85834e19dc | |||
| ca6b3723a9 | |||
| 23b1086072 | |||
| 860deb14ce | |||
| 62885fa462 | |||
| 3fef01e35b | |||
| b0597e35ec | |||
| 8d1ad6fbe5 | |||
| 750569201a | |||
| 1a1a781b72 | |||
| 4b5ce8a972 | |||
| 98cfdd26c4 | |||
| 051a42b547 | |||
| 220e278213 | |||
| 547fe0da1a | |||
| 09bec79b47 | |||
| 55a5affcb8 | |||
| a8b4297023 | |||
| 5969362425 | |||
| 3ceae33b16 | |||
| 5de4c1fc97 | |||
| fd109048dd | |||
| a0747516ce | |||
| 605e1f2a03 | |||
| dc23c58869 | |||
| b7e646ec83 | |||
| 4d54358745 | |||
| ed0882ec04 | |||
| 526c4e4659 | |||
| b70f72bf2b | |||
| 2ad4c1906e | |||
| 049760cc7e | |||
| e2ecec31b5 | |||
| fee016bb84 | |||
| d24fb03917 | |||
| 5adc8bfefc | |||
| abcf0cde5a | |||
| 8f3bd314ed | |||
| e2d456d4ce | |||
| 96202ae545 | |||
| 2b0229d4e2 | |||
| beaa3196b3 | |||
| b6d771a114 | |||
| d3ed756bd0 | |||
| f8308841a6 | |||
| 1dfdf36fc3 | |||
| 4ac3ade126 | |||
| 212abeb986 | |||
| 7d4427c313 | |||
| e836be489e | |||
| 1db5c555d6 | |||
| bb1b015103 | |||
| e42684ac39 | |||
| d7de7eee60 | |||
| 0a390ad392 | |||
| aa6b12c5eb | |||
| e2bd08fbff | |||
| 2047934060 | |||
| e07dcbff08 | |||
| e3a8a45a61 | |||
| f1ad7fd582 | |||
| 43f2645b32 | |||
| b6935e706c | |||
| a3c845894d | |||
| 5933a5e9b1 | |||
| 109d8f431f | |||
| 1edb7e776b | |||
| 928e2e1b7c | |||
| 5a140e4898 | |||
| f64393941e | |||
| 0db81ca46a | |||
| 7f7144de1f | |||
| 3883716883 | |||
| 5beea4eb7e | |||
| 2d0fdb74d1 | |||
| 80588fba81 | |||
| ef7dc94f88 | |||
| 7b4eec9748 | |||
| baff417652 | |||
| 7074944810 | |||
| 1c39d25cca | |||
| f1c5c27f3f | |||
| 9c0134ee2c | |||
| 959fee5937 | |||
| 3854a5570f | |||
| ab1e0ebfb3 | |||
| cffe864900 | |||
| bc1575318b | |||
| a71d0f6757 | |||
| 50d7bf710e | |||
| d44bcef31b | |||
| c0ce71e55a | |||
| 0eeb0caf08 | |||
| b13bded620 | |||
| 1b1180fda6 | |||
| a4ecfa5bc0 | |||
| 3c8009b495 | |||
| ca85df2d74 | |||
| 5dfa6598c2 | |||
| f428d61045 | |||
| fc50edf046 | |||
| 269c2786e9 | |||
| 96fc940af7 | |||
| 8c8e6d464a | |||
| 22976b8a7c | |||
| 4dff710361 | |||
| fe80d2cded | |||
| 16dac87841 | |||
| 30c59562e0 | |||
| 6d61a84286 | |||
| f6b8596c7b | |||
| da6760f606 | |||
| ad962ad759 | |||
| 5327becf41 | |||
| f43c99c5cc | |||
| c0a491cb06 | |||
| 66cc965fd7 | |||
| 2440514a7b | |||
| fad1da81a3 | |||
| bb0e2a9a07 | |||
| 4f8c4f8fef | |||
| 25957111b2 | |||
| 9a8895359a | |||
| 53f8db0198 | |||
| f94cb7fb11 | |||
| c30fb13a0c | |||
| 7926238fd2 | |||
| 211a944210 | |||
| cff61617e1 | |||
| 4455d4346c | |||
| 405b41ec87 | |||
| bacb276181 | |||
| 4c1f6b48d8 | |||
| 53a78c2688 | |||
| e61a283c02 | |||
| c3302194eb | |||
| cd184596a2 | |||
| f28b1142f5 | |||
| 87230c17b7 | |||
| a29b7897f0 | |||
| e965bc3049 | |||
| 01780c9e7a |
+16
@@ -0,0 +1,16 @@
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
before_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DINSTDIR:STRING=~/services -DDEFUMASK:STRING=077 -DCMAKE_BUILD_TYPE:STRING=DEBUG -DUSE_RUN_CC_PL:BOOLEAN=ON ..
|
||||
|
||||
script:
|
||||
- make
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
- "irc.anope.org#anope-devel"
|
||||
@@ -497,6 +497,10 @@ if(WIN32)
|
||||
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
|
||||
DESTINATION ${BIN_DIR}
|
||||
)
|
||||
|
||||
# Package any DLLs in src/win/
|
||||
file(GLOB EXTRA_DLLS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${Anope_SOURCE_DIR}/src/win32/*.dll")
|
||||
install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR})
|
||||
endif(WIN32)
|
||||
|
||||
install(CODE "file(REMOVE_RECURSE \"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")")
|
||||
|
||||
+6
-2
@@ -432,11 +432,15 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
# Reset libraries
|
||||
set(LIBRARIES)
|
||||
# Check to see if there are any lines matching: /* RequiredLibraries: [something] */
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
|
||||
if(WIN32)
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
|
||||
else(WIN32)
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
|
||||
endif(WIN32)
|
||||
# Iterate through those lines
|
||||
foreach(REQUIRED_LIBRARY ${REQUIRED_LIBRARIES})
|
||||
# Strip off the /* RequiredLibraries: and */ from the line
|
||||
string(REGEX REPLACE "/\\*[ \t]*RequiredLibraries:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_LIBRARY ${REQUIRED_LIBRARY})
|
||||
string(REGEX REPLACE "/\\*[ \t]*Required.*Libraries:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_LIBRARY ${REQUIRED_LIBRARY})
|
||||
# Replace all commas with semicolons
|
||||
string(REGEX REPLACE "," ";" REQUIRED_LIBRARY ${REQUIRED_LIBRARY})
|
||||
# Iterate through the libraries given
|
||||
|
||||
@@ -3,7 +3,17 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* First, create the service.
|
||||
* First, create the service. If you do not want to have a 'BotServ', but do want the ability to have
|
||||
* ChanServ assigned to channels for the use of fantasy commands, you may delete the below 'service' block.
|
||||
*
|
||||
* Note that deleting a 'service' block for a pseudoclient that is already online will not remove the
|
||||
* client, the client becomes no different from a normal service bot, so you will have to use botserv/bot
|
||||
* to manually delete the client.
|
||||
*
|
||||
* You may then waant to map some of the below commands to other services, like placing botserv/bot on
|
||||
* OperServ so you can delete the below client, and mapping assign and unassign to ChanServ so users are
|
||||
* able to control whether or not ChanServ is in the channel. You may also want to map botserv/set/nobot
|
||||
* to OperServ so you can restrict who can assign the other core service clients.
|
||||
*/
|
||||
service
|
||||
{
|
||||
@@ -62,6 +72,8 @@ module
|
||||
|
||||
/*
|
||||
* The name of the client that should be BotServ.
|
||||
*
|
||||
* This directive is optional.
|
||||
*/
|
||||
client = "BotServ"
|
||||
|
||||
@@ -374,6 +386,7 @@ fantasy { name = "LEVELS"; command = "chanserv/levels"; }
|
||||
fantasy { name = "LIST"; command = "chanserv/list"; prepend_channel = false; }
|
||||
fantasy { name = "LOG"; command = "chanserv/log"; }
|
||||
fantasy { name = "MODE"; command = "chanserv/mode"; }
|
||||
fantasy { name = "MUTE"; command = "chanserv/ban"; kick = no; mode = "QUIET"; }
|
||||
fantasy { name = "OP"; command = "chanserv/modes"; }
|
||||
fantasy { name = "OWNER"; command = "chanserv/modes"; }
|
||||
fantasy { name = "PROTECT"; command = "chanserv/modes"; }
|
||||
|
||||
+39
-12
@@ -173,18 +173,18 @@ module
|
||||
* ChanServ privilege configuration.
|
||||
*
|
||||
* ChanServ privileges are used to determine who has what access in channels. By default the core has its own
|
||||
* set of levels it uses for various ChanServ commands, which are defined below. Privilege ranks are used to
|
||||
* determine how powerful privileges are relative to each other, which is used by Anope to determine who has greater
|
||||
* access in a channel.
|
||||
* set of privileges it uses for various commands, which are defined below. Privilege ranks are used to
|
||||
* determine how powerful privileges are relative to other privileges, which is used by Anope to determine
|
||||
* who has greater access in a channel.
|
||||
*
|
||||
* If you loaded cs_access, you may define a level for the privilege, which is used by chanserv/access and chanserv/levels.
|
||||
* If you load cs_access, you may define a level for the privilege, which is used by chanserv/access and chanserv/levels.
|
||||
* The levels defined will be used as the default levels for newly registered channels.
|
||||
* The level "founder" is a special level which means anyone with the privilege FOUNDER on the channel
|
||||
* has that permission. Additionally, the level "disabled" means that no one can use the privilege, including founders.
|
||||
*
|
||||
* If you loaded cs_flags, you may define a flag associated with that privilege for use in chanserv/flags.
|
||||
* If you load cs_flags, you may define a flag associated with that privilege for use in chanserv/flags.
|
||||
*
|
||||
* If you loaded cs_xop, you may define a xop command to associate the privilege with.
|
||||
* If you load cs_xop, you may define a XOP command to associate the privilege with.
|
||||
*
|
||||
* The name of privileges are uesd to associate them with channel modes. If you are using an IRCd that allows you to define additional
|
||||
* channel status modes, such as InspIRCd, you can associate privileges (and thus access levels, flags, xop) with the mode by naming
|
||||
@@ -799,25 +799,25 @@ privilege
|
||||
command_group
|
||||
{
|
||||
name = "chanserv/access"
|
||||
description = "Used to manage the list of privileged users"
|
||||
description = _("Used to manage the list of privileged users")
|
||||
}
|
||||
|
||||
command_group
|
||||
{
|
||||
name = "chanserv/status"
|
||||
description = "Used to modify the channel status of you or other users"
|
||||
description = _("Used to modify the channel status of you or other users")
|
||||
}
|
||||
|
||||
command_group
|
||||
{
|
||||
name = "chanserv/management"
|
||||
description = "Used to manage channels"
|
||||
description = _("Used to manage channels")
|
||||
}
|
||||
|
||||
command_group
|
||||
{
|
||||
name = "chanserv/admin"
|
||||
description = "Services Operator commands"
|
||||
description = _("Services Operator commands")
|
||||
}
|
||||
|
||||
/* Give it a help command. */
|
||||
@@ -829,7 +829,12 @@ command { service = "ChanServ"; name = "HELP"; command = "generic/help"; }
|
||||
* Provides commands chanserv/access and chanserv/levels.
|
||||
* Provides the access system "levels".
|
||||
*
|
||||
* Used for giving users access in channels.
|
||||
* Used for giving users access in channels using a levels system. Allows allows redefining which privileges
|
||||
* are representated by given level on a per channel basis.
|
||||
*
|
||||
* The "LIST" subcommand of chanserv/access will show every access entry on the channel, including access
|
||||
* entries not added by cs_access. The "level" of these entries will be the representation of the access
|
||||
* entry by the other access system, which could be an XOP command name, or a set of flags.
|
||||
*/
|
||||
module { name = "cs_access" }
|
||||
command { service = "ChanServ"; name = "ACCESS"; command = "chanserv/access"; group = "chanserv/access"; }
|
||||
@@ -863,6 +868,12 @@ command { service = "ChanServ"; name = "AKICK"; command = "chanserv/akick"; grou
|
||||
*
|
||||
* Provides the command chanserv/ban.
|
||||
*
|
||||
* The configuration option 'kick' may be set in a command block for this command to control
|
||||
* whether or not users will be kicked from the channel once banned. The default is 'yes'.
|
||||
*
|
||||
* The configuration option 'mode' may be set to control which mode is set, such as BAN or QUIET.
|
||||
* The default is BAN.
|
||||
*
|
||||
* Used for banning users from channels.
|
||||
*/
|
||||
module { name = "cs_ban" }
|
||||
@@ -921,6 +932,10 @@ command { service = "ChanServ"; name = "ENTRYMSG"; command = "chanserv/entrymsg"
|
||||
* Provides the access system "flags".
|
||||
*
|
||||
* Used for giving users access in channels.
|
||||
*
|
||||
* The "LIST" subcommand of chanserv/flags will show every access entry on the channel, including access
|
||||
* entries not added by cs_flags. The "Flags" of these entries will be the flags representation of the
|
||||
* privilege set granted by the access entry.
|
||||
*/
|
||||
module { name = "cs_flags" }
|
||||
command { service = "ChanServ"; name = "FLAGS"; command = "chanserv/flags"; group = "chanserv/access"; }
|
||||
@@ -1032,7 +1047,9 @@ command { service = "ChanServ"; name = "LOG"; command = "chanserv/log"; group =
|
||||
*
|
||||
* Provides the command chanserv/mode and chanserv/modes.
|
||||
*
|
||||
* Used for changing mode locks and changing modes.
|
||||
* Used for changing mode locks and changing modes. Multiple commands may be mapped to chanserv/modes, the
|
||||
* configuration directive 'set' and 'unset' are used to tell chanserv/modes which modes should be set or
|
||||
* unset when the command is executed.
|
||||
*/
|
||||
module
|
||||
{
|
||||
@@ -1198,6 +1215,13 @@ module
|
||||
* If not set, the default is never.
|
||||
*/
|
||||
expire = 90d
|
||||
|
||||
/*
|
||||
* Settings to show to non-opers in ChanServ's INFO output.
|
||||
* Comment to completely disable showing any information about
|
||||
* suspended channels to non-opers.
|
||||
*/
|
||||
show = "suspended, by, reason, on, expires"
|
||||
}
|
||||
command { service = "ChanServ"; name = "SUSPEND"; command = "chanserv/suspend"; permission = "chanserv/suspend"; group = "chanserv/admin"; }
|
||||
command { service = "ChanServ"; name = "UNSUSPEND"; command = "chanserv/unsuspend"; permission = "chanserv/suspend"; group = "chanserv/admin"; }
|
||||
@@ -1255,6 +1279,9 @@ command { service = "ChanServ"; name = "UP"; command = "chanserv/up"; group = "c
|
||||
* privileges given by each is determined by the privilege:xop settings above. These commands should
|
||||
* be ordered from highest to lowest, as each command inherits the privileges of the commands below
|
||||
* it.
|
||||
*
|
||||
* The "LIST" subcommand of chanserv/xop will show only XOP access entries of the given XOP type. You
|
||||
* can not view the entire access list at once, and instead should use another access system to do that.
|
||||
*/
|
||||
module { name = "cs_xop" }
|
||||
command { service = "ChanServ"; name = "QOP"; command = "chanserv/xop"; group = "chanserv/access"; }
|
||||
|
||||
+2
-1
@@ -37,7 +37,8 @@ cd $ANOPATH
|
||||
if [ -f "$ANODATA/$ANOPIDF" ]
|
||||
then
|
||||
ANOPID=`cat "$ANODATA/$ANOPIDF"`
|
||||
if [ `ps auwx | grep $ANOPROG | grep $ANOPID | grep -v -c grep` = 1 ]
|
||||
kill -0 $ANOPID 2>/dev/null
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
+6
-23
@@ -168,7 +168,7 @@ uplink
|
||||
|
||||
/*
|
||||
* Enable if Services should connect using SSL.
|
||||
* You must have m_ssl loaded for this to work.
|
||||
* You must have an SSL module loaded for this to work.
|
||||
*/
|
||||
ssl = no
|
||||
|
||||
@@ -276,13 +276,6 @@ module
|
||||
* If the protocol module you have loaded does not support this, this setting will have no effect.
|
||||
*/
|
||||
use_server_side_topiclock = yes
|
||||
|
||||
/*
|
||||
* Some IRCds allow "SASL" authentication to let users identify to Services
|
||||
* during the IRCd user registration process. If set, Services will allow
|
||||
* authenticating users through this mechanism.
|
||||
*/
|
||||
sasl = yes
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -768,6 +761,7 @@ log
|
||||
* nickserv/confirm - Can confirm other users nicknames
|
||||
* nickserv/drop - Can drop other users nicks
|
||||
* operserv/config - Can modify services's configuration
|
||||
* protected - Can not be kicked from channels by Services
|
||||
*
|
||||
* Available commands:
|
||||
* botserv/bot/del botserv/bot/add botserv/bot/change botserv/set/private
|
||||
@@ -786,7 +780,7 @@ log
|
||||
* memoserv/sendall memoserv/staff
|
||||
*
|
||||
* nickserv/getpass nickserv/getemail nickserv/suspend nickserv/ajoin
|
||||
* nickserv/resetpass nickserv/list
|
||||
* nickserv/list
|
||||
*
|
||||
* nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password
|
||||
* nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message
|
||||
@@ -832,7 +826,7 @@ opertype
|
||||
inherits = "Helper, Another Helper"
|
||||
|
||||
/* What commands (see above) this opertype may use */
|
||||
commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/resetpass nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline"
|
||||
commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline"
|
||||
|
||||
/* What privs (see above) this opertype has */
|
||||
privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auspex nickserv/confirm"
|
||||
@@ -958,18 +952,6 @@ mail
|
||||
*/
|
||||
sendfrom = "services@localhost.net"
|
||||
|
||||
/*
|
||||
* If set, RESETPASS will be restricted to services operators with access to
|
||||
* nickserv/resetpass in their opertype:commands.
|
||||
* This directive is optional.
|
||||
*
|
||||
* WARNING: If you choose to not enable this option, you should limit the
|
||||
* number of processes that the services user can have at a time (you can
|
||||
* create a special user for this; remember to NEVER launch Services as
|
||||
* root).
|
||||
*/
|
||||
restrict = yes
|
||||
|
||||
/*
|
||||
* This controls the minimum amount of time a user must wait before sending
|
||||
* another e-mail after they have sent one. It also controls the minimum time
|
||||
@@ -1065,7 +1047,7 @@ mail
|
||||
|
||||
/*
|
||||
* This is the encryption type used by the databases. This must be set correctly or
|
||||
* your passwords will not work. Valid options are: md5, oldmd5, sha1, and none.
|
||||
* your passwords will not work. Valid options are: md5, oldmd5, sha1, and plain.
|
||||
* You must also be sure to load the correct encryption module below in the Encryption
|
||||
* Modules section so that your passwords work.
|
||||
*/
|
||||
@@ -1223,6 +1205,7 @@ module
|
||||
*
|
||||
*/
|
||||
|
||||
#module { name = "enc_bcrypt" }
|
||||
module { name = "enc_sha256" }
|
||||
#module { name = "enc_md5" }
|
||||
#module { name = "enc_sha1" }
|
||||
|
||||
@@ -103,7 +103,20 @@ command { service = "HostServ"; name = "DELALL"; command = "hostserv/delall"; pe
|
||||
*
|
||||
* Used for grouping one vHost to many nicks.
|
||||
*/
|
||||
module { name = "hs_group" }
|
||||
module
|
||||
{
|
||||
name = "hs_group"
|
||||
|
||||
/*
|
||||
* Upon nickserv/group, this option syncs the nick's main vHost to the grouped nick.
|
||||
*/
|
||||
syncongroup = false
|
||||
|
||||
/*
|
||||
* This makes vhosts act as if they are per account.
|
||||
*/
|
||||
synconset = false
|
||||
}
|
||||
command { service = "HostServ"; name = "GROUP"; command = "hostserv/group"; }
|
||||
|
||||
/*
|
||||
@@ -139,7 +152,7 @@ command { service = "HostServ"; name = "ON"; command = "hostserv/on"; }
|
||||
/*
|
||||
* hs_request
|
||||
*
|
||||
* Provides the commands hostserv/request, hostserv/active, hostserv/reject, and hostserv/waiting.
|
||||
* Provides the commands hostserv/request, hostserv/activate, hostserv/reject, and hostserv/waiting.
|
||||
*
|
||||
* Used to manage vHosts requested by users.
|
||||
*/
|
||||
|
||||
+181
-112
@@ -184,7 +184,7 @@ module { name = "help" }
|
||||
/* Time before connections to this server are timed out. */
|
||||
timeout = 30
|
||||
|
||||
/* Listen using SSL. Requires m_ssl. */
|
||||
/* Listen using SSL. Requires an SSL module. */
|
||||
#ssl = yes
|
||||
|
||||
/* If you are using a reverse proxy that sends one of the
|
||||
@@ -340,6 +340,82 @@ module { name = "help" }
|
||||
port = 3306
|
||||
}
|
||||
}
|
||||
/*
|
||||
* m_redis
|
||||
*
|
||||
* This module allows other modules to use Redis.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_redis"
|
||||
|
||||
/* A redis database */
|
||||
redis
|
||||
{
|
||||
/* The name of this service */
|
||||
name = "redis/main"
|
||||
|
||||
/*
|
||||
* The redis database to use. New connections default to 0.
|
||||
*/
|
||||
db = 0
|
||||
|
||||
ip = "127.0.0.1"
|
||||
port = 6379
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* m_regex_pcre [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/pcre, which uses the Perl Compatible Regular Expressions library.
|
||||
*/
|
||||
#module { name = "m_regex_pcre" }
|
||||
|
||||
/*
|
||||
* m_regex_posix [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/posix, which uses the POSIX compliant regular expressions.
|
||||
* This is likely the only regex module you will not need extra libraries for.
|
||||
*/
|
||||
#module { name = "m_regex_posix" }
|
||||
|
||||
/*
|
||||
* m_regex_tre [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/tre, which uses the TRE regex library.
|
||||
*/
|
||||
#module { name = "m_regex_tre" }
|
||||
|
||||
/*
|
||||
* m_rewrite
|
||||
*
|
||||
* Allows rewriting commands sent to/from clients.
|
||||
*/
|
||||
#module { name = "m_rewrite" }
|
||||
#command
|
||||
{
|
||||
service = "ChanServ"; name = "CLEAR"; command = "rewrite"
|
||||
|
||||
/* Enable m_rewrite. */
|
||||
rewrite = true
|
||||
|
||||
/* Source message to match. A $ can be used to match anything. */
|
||||
rewrite_source = "CLEAR $ USERS"
|
||||
|
||||
/*
|
||||
* Message to rewrite the source message to. A $ followed by a number, eg $0, gets
|
||||
* replaced by the number-th word from the source_message, starting from 0.
|
||||
*/
|
||||
rewrite_target = "KICK $1 *"
|
||||
|
||||
/*
|
||||
* The command description. This only shows up in HELP's output.
|
||||
* Comment this option to prevent the command from showing in the
|
||||
* HELP command.
|
||||
*/
|
||||
rewrite_description = "Clears all users from a channel"
|
||||
}
|
||||
|
||||
/*
|
||||
* m_proxyscan
|
||||
@@ -423,6 +499,97 @@ module { name = "help" }
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* m_sasl
|
||||
*
|
||||
* Some IRCds allow "SASL" authentication to let users identify to Services
|
||||
* during the IRCd user registration process. If this module is loaded, Services will allow
|
||||
* authenticating users through this mechanism. Supported mechanisms are:
|
||||
* PLAIN, EXTERNAL.
|
||||
*/
|
||||
#module { name = "m_sasl" }
|
||||
|
||||
/*
|
||||
* m_sasl_dh-aes [EXTRA]
|
||||
*
|
||||
* Add the DH-AES mechanism to SASL.
|
||||
* Requires m_sasl to be loaded.
|
||||
* Requires openssl.
|
||||
*/
|
||||
#module { name = "m_sasl_dh-aes" }
|
||||
|
||||
/*
|
||||
* m_sasl_dh-blowfish [EXTRA]
|
||||
*
|
||||
* Add the DH-BLOWFISH mechanism to SASL.
|
||||
* Requires m_sasl to be loaded.
|
||||
* Requires openssl.
|
||||
*/
|
||||
#module { name = "m_sasl_dh-blowfish" }
|
||||
|
||||
/*
|
||||
* m_ssl_gnutls [EXTRA]
|
||||
*
|
||||
* This module provides SSL services to Anope using GnuTLS, for example to
|
||||
* connect to the uplink server(s) via SSL.
|
||||
*
|
||||
* You may only load either m_ssl_gnutls or m_ssl_openssl, bot not both.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_ssl_gnutls"
|
||||
|
||||
/*
|
||||
* An optional certificate and key for m_ssl_gnutls to give to the uplink.
|
||||
*
|
||||
* You can generate your own certificate and key pair by using:
|
||||
*
|
||||
* certtool --generate-privkey --bits 2048 --outfile anope.key
|
||||
* certtool --generate-self-signed --load-privkey anope.key --outfile anope.crt
|
||||
*
|
||||
*/
|
||||
cert = "data/anope.crt"
|
||||
key = "data/anope.key"
|
||||
|
||||
/*
|
||||
* Diffie-Hellman parameters to use when acting as a server. This is only
|
||||
* required for TLS servers that want to use ephemeral DH cipher suites.
|
||||
*
|
||||
* This is NOT required for Anope to connect to the uplink server(s) via SSL.
|
||||
*
|
||||
* You can generate DH parameters by using:
|
||||
*
|
||||
* certtool --generate-dh-params --bits 2048 --outfile dhparams.pem
|
||||
*
|
||||
*/
|
||||
# dhparams = "data/dhparams.pem"
|
||||
}
|
||||
|
||||
/*
|
||||
* m_ssl_openssl [EXTRA]
|
||||
*
|
||||
* This module provides SSL services to Anope using OpenSSL, for example to
|
||||
* connect to the uplink server(s) via SSL.
|
||||
*
|
||||
* You may only load either m_ssl_openssl or m_ssl_gnutls, bot not both.
|
||||
*
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_ssl_openssl"
|
||||
|
||||
/*
|
||||
* An optional certificate and key for m_ssl_openssl to give to the uplink.
|
||||
*
|
||||
* You can generate your own certificate and key pair by using:
|
||||
*
|
||||
* openssl genrsa -out anope.key 2048
|
||||
* openssl req -new -x509 -key anope.key -out anope.crt -days 1095
|
||||
*/
|
||||
cert = "data/anope.crt"
|
||||
key = "data/anope.key"
|
||||
}
|
||||
|
||||
/*
|
||||
* m_sql_authentication [EXTRA]
|
||||
*
|
||||
@@ -541,101 +708,26 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_redis
|
||||
* webcpanel
|
||||
*
|
||||
* This module allows other modules to use Redis.
|
||||
* This module creates a web configuration panel that allows users and operators to perform any task
|
||||
* as they could over IRC. If you are using the default configuration you should be able to access
|
||||
* this panel by visiting http://127.0.0.1:8080 in your web browser from the machine Anope is running on.
|
||||
*
|
||||
* This module requires m_httpd.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_redis"
|
||||
name = "webcpanel"
|
||||
|
||||
/* A redis database */
|
||||
redis
|
||||
{
|
||||
/* The name of this service */
|
||||
name = "redis/main"
|
||||
/* Web server to use. */
|
||||
server = "httpd/main";
|
||||
|
||||
/*
|
||||
* The redis database to use. New connections default to 0.
|
||||
*/
|
||||
db = 0
|
||||
/* Template to use. */
|
||||
template = "default";
|
||||
|
||||
ip = "127.0.0.1"
|
||||
port = 6379
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* m_regex_pcre [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/pcre, which uses the Perl Compatible Regular Expressions library.
|
||||
*/
|
||||
#module { name = "m_regex_pcre" }
|
||||
|
||||
/*
|
||||
* m_regex_posix [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/posix, which uses the POSIX compliant regular expressions.
|
||||
* This is likely the only regex module you will not need extra libraries for.
|
||||
*/
|
||||
#module { name = "m_regex_posix" }
|
||||
|
||||
/*
|
||||
* m_regex_tre [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/tre, which uses the TRE regex library.
|
||||
*/
|
||||
#module { name = "m_regex_tre" }
|
||||
|
||||
/*
|
||||
* m_rewrite
|
||||
*
|
||||
* Allows rewriting commands sent to/from clients.
|
||||
*/
|
||||
#module { name = "m_rewrite" }
|
||||
#command
|
||||
{
|
||||
service = "ChanServ"; name = "CLEAR"; command = "rewrite"
|
||||
|
||||
/* Enable m_rewrite. */
|
||||
rewrite = true
|
||||
|
||||
/* Source message to match. A $ can be used to match anything. */
|
||||
rewrite_source = "CLEAR $ USERS"
|
||||
|
||||
/*
|
||||
* Message to rewrite the source message to. A $ followed by a number, eg $0, gets
|
||||
* replaced by the number-th word from the source_message, starting from 0.
|
||||
*/
|
||||
rewrite_target = "KICK $1 *"
|
||||
|
||||
/*
|
||||
* The command description. This only shows up in HELP's output.
|
||||
* Comment this option to prevent the command from showing in the
|
||||
* HELP command.
|
||||
*/
|
||||
rewrite_description = "Clears all users from a channel"
|
||||
}
|
||||
|
||||
/*
|
||||
* m_ssl [EXTRA]
|
||||
*
|
||||
* This module uses SSL to connect to the uplink server(s).
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_ssl"
|
||||
|
||||
/*
|
||||
* An optional certificate and key for m_ssl to give to the uplink.
|
||||
*
|
||||
* You can generate your own certificate and key pair by using:
|
||||
*
|
||||
* openssl genrsa -out anope.key 2048
|
||||
* openssl req -new -x509 -key anope.key -out anope.crt -days 1095
|
||||
*/
|
||||
cert = "data/anope.crt"
|
||||
key = "data/anope.key"
|
||||
/* Page title. */
|
||||
title = "Anope IRC Services";
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -659,26 +751,3 @@ module { name = "help" }
|
||||
* Requires m_xmlrpc.
|
||||
*/
|
||||
#module { name = "m_xmlrpc_main" }
|
||||
|
||||
/*
|
||||
* webcpanel
|
||||
*
|
||||
* This module creates a web configuration panel that allows users and operators to perform any task
|
||||
* as they could over IRC. If you are using the default configuration you should be able to access
|
||||
* this panel by visiting http://127.0.0.1:8080 in your web browser from the machine Anope is running on.
|
||||
*
|
||||
* This module requires m_httpd.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "webcpanel"
|
||||
|
||||
/* Web server to use. */
|
||||
server = "httpd/main";
|
||||
|
||||
/* Template to use. */
|
||||
template = "default";
|
||||
|
||||
/* Page title. */
|
||||
title = "Anope IRC Services";
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ module
|
||||
* - hide_quit: Hide's the nick's last quit message
|
||||
* - memo_signon: Notify user if they have a new memo when they sign into the nick
|
||||
* - memo_receive: Notify user if they have a new memo as soon as it's received
|
||||
* - memo_mail: Notify user if they have a new memo by mail
|
||||
* - 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
|
||||
* options:useprivmsg to be enabled as well
|
||||
@@ -230,7 +231,7 @@ module
|
||||
command_group
|
||||
{
|
||||
name = "nickserv/admin"
|
||||
description = "Services Operator commands"
|
||||
description = _("Services Operator commands")
|
||||
}
|
||||
|
||||
/* Give it a help command. */
|
||||
@@ -306,7 +307,7 @@ module
|
||||
* The maximum number of entries allowed on a nickname's certificate fingerprint list.
|
||||
* The default is 5. This number cannot be set to 0.
|
||||
*/
|
||||
accessmax = 5
|
||||
max = 5
|
||||
}
|
||||
command { service = "NickServ"; name = "CERT"; command = "nickserv/cert"; }
|
||||
|
||||
@@ -615,6 +616,13 @@ module
|
||||
* This directive is optional. If not set, the default is never.
|
||||
*/
|
||||
#suspendexpire = 90d
|
||||
|
||||
/*
|
||||
* Settings to show to non-opers in NickServ's INFO output.
|
||||
* Comment to completely disable showing any information about
|
||||
* suspended nicknames to non-opers.
|
||||
*/
|
||||
show = "suspended, by, reason, on, expires"
|
||||
}
|
||||
command { service = "NickServ"; name = "SUSPEND"; command = "nickserv/suspend"; permission = "nickserv/suspend"; group = "nickserv/admin"; }
|
||||
command { service = "NickServ"; name = "UNSUSPEND"; command = "nickserv/unsuspend"; permission = "nickserv/suspend"; group = "nickserv/admin"; }
|
||||
@@ -640,7 +648,7 @@ command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; }
|
||||
* Limits how many times the same email address may be used in Anope
|
||||
* to register accounts.
|
||||
*/
|
||||
module
|
||||
#module
|
||||
{
|
||||
name = "ns_maxemail"
|
||||
|
||||
@@ -649,5 +657,5 @@ module
|
||||
* commented, there will be no limit enforced when registering new accounts or using
|
||||
* /msg NickServ SET EMAIL.
|
||||
*/
|
||||
#maxemails = 1
|
||||
maxemails = 1
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ uplink
|
||||
|
||||
/*
|
||||
* Enable if Services should connect using SSL.
|
||||
* You must have m_ssl loaded for this to work.
|
||||
* You must have an SSL module loaded for this to work.
|
||||
*/
|
||||
ssl = no
|
||||
|
||||
|
||||
-4747
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
git log --pretty=format:"Revision %h - %cD - %s" > version.log
|
||||
@@ -1,3 +1,17 @@
|
||||
Anope Version 2.0.1
|
||||
-------------------
|
||||
Fix access entries on accounts sometimes not updating when a user's display name changes
|
||||
Fix ns_group to properly validate the account of the user against the target
|
||||
Fix os_stats not saving max user count and time when using SQL
|
||||
Fix nickalias's 'nc' field sometimes not being updated when using SQL
|
||||
Fix several crashes on Windows related to being unable to load modules
|
||||
Fix bs_bot change not properly reintroducing bots after changing their ident, host, or realname
|
||||
|
||||
Add English language file to allow users to easily modify language strings
|
||||
Add configuring which mode cs_ban sets, and added a MUTE command to BotServ's fantasy
|
||||
Allow SVSPART to take an optional reason
|
||||
Allow cs_list to search channel topics and descriptions
|
||||
|
||||
Anope Version 2.0.0
|
||||
-------------------
|
||||
Added irc2sql stats module
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
Anope Version 2.0.1
|
||||
-------------------
|
||||
Add MUTE command to BotServ fantasy configuration
|
||||
Document memo_mail option in nickserv.conf
|
||||
Add 'show' setting to ns_info and cs_info to control which fields are shown to non opers
|
||||
|
||||
Anope Version 2.0.0
|
||||
-------------------
|
||||
options:passlen, enforceruser, enforcerhost, releasetimeout, and guestnickprefix moved to nickserv's module configuration
|
||||
options:hideregisteredcommands added
|
||||
m_ssl renamed to m_ssl_openssl
|
||||
mail:restrict removed
|
||||
|
||||
Anope Version 1.9.9
|
||||
-------------------
|
||||
|
||||
+7
-10
@@ -67,20 +67,17 @@ Note: You should also read the README and FAQ files!
|
||||
cause trouble on your network if passwords are not encrypted, or read
|
||||
the memos of any user.
|
||||
|
||||
If you see errors during this process, please mail us with the *complete*
|
||||
error output, and don't forget to mention your OS, compiler and C++ library
|
||||
versions.
|
||||
|
||||
Now go into the data directory (by default, ~/services/data). Copy the example
|
||||
Now go into the conf directory (by default, ~/services/conf). Copy the example
|
||||
configuration file (example.conf) to services.conf, and open the latter
|
||||
with your favorite text editor. It contains all the configuration
|
||||
directives Anope will use at startup. Read the instructions contained in
|
||||
the file carefully. Using the default values is NOT a good idea, and will
|
||||
most likely not work!
|
||||
|
||||
If you need help, you should subscribe to the Anope mailing list and mail
|
||||
there to get help from other users. See the README file for more
|
||||
information.
|
||||
If you need help, you should visit http://forum.anope.org/ or #anope on
|
||||
irc.anope.org. Provide *complete* error output, along with other relevant
|
||||
information eg. OS, compiler and C++ library versions.
|
||||
See the README file for more information.
|
||||
|
||||
2) Upgrading Anope
|
||||
|
||||
@@ -134,7 +131,7 @@ Note: You should also read the README and FAQ files!
|
||||
still running, and restart it if not.
|
||||
|
||||
First rename the example.chk script that is in Anope path (by default,
|
||||
this is ~/services/data) to services.chk and edit it. You'll need to
|
||||
this is ~/services/conf) to services.chk and edit it. You'll need to
|
||||
modify the CONFIGURATION part of the file. Then ensure that the file is
|
||||
marked as executable by typing chmod +x services.chk, and try to launch the
|
||||
script to see if it works (Anope must not be running when you do this ;))
|
||||
@@ -143,7 +140,7 @@ Note: You should also read the README and FAQ files!
|
||||
This will open the default text editor with the crontab file. Enter the
|
||||
following (with correct path):
|
||||
|
||||
*/5 * * * * /home/ircd/services/data/services.chk >/dev/null 2>&1
|
||||
*/5 * * * * /home/ircd/services/conf/services.chk >/dev/null 2>&1
|
||||
|
||||
The */5 at the beginning means "check every 5 minutes". You may replace
|
||||
the 5 with other another number if you want (but less than 60). Consult
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
How To Add IRCd Support
|
||||
-----------------------
|
||||
|
||||
1) Files to Edit
|
||||
2) The Code
|
||||
3) The IRCDVar struct
|
||||
4) Modes
|
||||
5) Functions / Events
|
||||
6) CAPAB/PROTOCTL
|
||||
7) IRCDProto Class
|
||||
|
||||
1) Files to Edit
|
||||
|
||||
When preparing to add supprt to Anope for your IRCd, you need to edit
|
||||
the following files
|
||||
|
||||
A) Make a copy of the .cpp file of the IRCd that matches the IRCd that
|
||||
you are attempting to add support for best.
|
||||
B) Add your IRCd into the supported IRCds in example.conf
|
||||
|
||||
2) The Code
|
||||
|
||||
Here is where the code of the .cpp file comes in. Be prepared to spend at
|
||||
least an hour, if not longer, going over the code and getting it right;
|
||||
Especially if you are setting up an ircd that is completely different
|
||||
than the one you used as a base. This section covers the majority of the
|
||||
code that is in use.
|
||||
|
||||
The first bit of code you will face is the IRCDVar structure, This is one
|
||||
of two structs which holds your IRCd information; This allows you to quickly
|
||||
setup your specific ircd.
|
||||
|
||||
IRCDVar myIrcd[] = { };
|
||||
|
||||
This struct contains your basic IRCd functions. Your base source file has
|
||||
the list of all available variables; note that you should not swap any
|
||||
around, or you will break stuff. Here is a brief description of the usage
|
||||
of each.
|
||||
|
||||
1) Name: This member tells Anope about the IRCD's name. It may contain
|
||||
text about it's name and version. This is used to identify the
|
||||
build on startup.
|
||||
|
||||
2) Pseudo Client Mode: This is the user mode set by Anope on all BotServ
|
||||
bots. Normally you want this to be a some form of
|
||||
service or bot flag; you can use + for no mode at
|
||||
all.
|
||||
|
||||
3) Max Channelmode Symbols: This is the total number of possible channel
|
||||
modes that can appear before a nick. Do
|
||||
remember to count each possible mode, so +ov
|
||||
is 2.
|
||||
|
||||
4) SVSNICK: Can the ircd use SVSNICK to change some ones nick? Otherwise,
|
||||
KILL is used. Use 1 for yes, 0 for no.
|
||||
|
||||
5) VHOST: Can a user's host be changed on the fly? Enabling this allow
|
||||
HostServ online. Use 1 for yes, 0 for no.
|
||||
|
||||
6) SNLINE: Does the IRCd support realname (geocs) bans? Use 1 for yes,
|
||||
0 for no.
|
||||
|
||||
7) SQLINE: Does the IRCd support nick bans? Use 1 for yes, 0 for no.
|
||||
|
||||
8) SZLINE: Does the IRCd support SZLINES? Use 1 for yes, 0 for no.
|
||||
|
||||
10) Join to Message: Services must join a channel to send any message to
|
||||
that channel (cannot override +n). Use 1 for yes,
|
||||
0 for no.
|
||||
|
||||
11) SQline Channels: The IRCd's supports banning channel names via
|
||||
SQLINES. Use 1 for yes, 0 for no.
|
||||
|
||||
12) Quit On Kill: When we (SVS)KILL a user, does the IRCd send back a
|
||||
QUIT message for that user? Use 1 for yes, 0 for no.
|
||||
|
||||
13) SVSMODE UNBAN: We can use SVSMODE to unban hosts from a channel. Use
|
||||
1 for yes, 0 for no.
|
||||
|
||||
14) Reverse: We can do a reverse check when unbanning. For use with
|
||||
DreamForge based IRCd's. Use 1 for yes, 0 for no.
|
||||
|
||||
15) vIdent: Support for including a user's ident in their vHost. Use
|
||||
1 for yes, 0 for no.
|
||||
|
||||
16) SVSHOLD: Support for temporarily 'holding' a nick, instead of using
|
||||
a nick enforcer client. Use 1 for yes, 0 for no.
|
||||
|
||||
17) TS on MODE: We need to send a timestamp when modes are being changed.
|
||||
Use 1 for yes, 0 for no.
|
||||
|
||||
18) Umode: We can use OperServ to change a user's mode. Use 1 for yes,
|
||||
0 for no.
|
||||
|
||||
19) OMODE: We can use OperServ to give some user a temporary O:LINE.
|
||||
Use 1 for yes, 0 for no.
|
||||
|
||||
20) No Knock Requires +i: Does the No Knock channel mode require invite
|
||||
only channels? Use 1 for yes, 0 for no.
|
||||
|
||||
21) SVSMODE UCMODE: Can we clear user channel modes with SVSMODE? Use
|
||||
1 for yes, 0 for no.
|
||||
|
||||
22) SGline Enforce: Does the IRCd enforce SNLINES for us or do we need to
|
||||
do so? Use 1 for yes, 0 for no.
|
||||
|
||||
23) TS6: Does the IRCd support TS6? Use 1 for yes, 0 for no.
|
||||
|
||||
24) Global TLD Prefix: Prefix used to send global messages, should probably
|
||||
be "$"
|
||||
|
||||
25) Max Modes: The max number of mode changes we can send in one line
|
||||
|
||||
3) Modes
|
||||
|
||||
Anope is told about modes in the protocol module.
|
||||
For the most part, the syntax for adding channel and user modes are:
|
||||
|
||||
ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, "UMODE_NETADMIN", 'N'));
|
||||
Where 'N' is the char for the mode, and UMODE_NETADMIN shows what the
|
||||
mode does. Or:
|
||||
|
||||
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c'));
|
||||
Where 'c' is the char for the mode and CMODE_BLOCKCOLOR shows what
|
||||
the mode does
|
||||
|
||||
A full list of valid mode names for the second param can be found
|
||||
in services.h in the enum for ChannelModeName and UserModeName
|
||||
If necessary, you can add additional modes to this list.
|
||||
|
||||
Adding simple modes with parameters is similar, instead adding a
|
||||
'new ChannelMode', use 'new ChannelModeParam', set the third optional
|
||||
arg of ChannelModeParam to false if the param should NOT be sent when unsetting
|
||||
it. Eg:
|
||||
|
||||
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, "CMODE_JOINFLOOD", 'j', true));
|
||||
|
||||
Anope will internally track the params, and they can be retrieved through
|
||||
Channel::GetParam();
|
||||
|
||||
If you want to make param validity checking for a mode, you must create a new
|
||||
class which inherits from ChannelModeParam and overload the IsValid function.
|
||||
Modes CMODE_OPERONLY, CMODE_ADMINONLY, and CMODE_REGISTERED already exist
|
||||
internally as classes, to overload the CanSet function to disable non opers
|
||||
from mlocking (or in CMODE_REGISTERED's case, anyone) from setting them.
|
||||
This should be added like:
|
||||
|
||||
ModeManager::AddChannelMode(new ChannelModeOper('O'));
|
||||
|
||||
4) Functions and Events
|
||||
|
||||
A brief word about functions and events. All events are captured by creating a Message struct
|
||||
with the name of the message and the callback function:
|
||||
|
||||
Message my_message("MESSAGE", do_my_messsage);
|
||||
|
||||
Each message should have a message handler if its important enough to be
|
||||
processed by services. All event functions should be formed like this:
|
||||
|
||||
bool do_my_message(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
They will receive the source; this can be empty at times depending on the
|
||||
event. Next, params holds the arguments for the event. Events are likely to
|
||||
pass to various upper level event handlers; see the previous ircd source for
|
||||
how they handle these events.
|
||||
|
||||
5) CAPAB/PROTOCTL
|
||||
|
||||
Most IRCDs send a CAPAB or PROTOCTL line so that they can work out what
|
||||
the other end of the connection is capable of doing. The protocol module should
|
||||
handle all of these without the cores knowledge with the exception of the following:
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
Define | Description
|
||||
----------------|---------------------------------------------------------
|
||||
CAPAB_NOQUIT | NOQUIT protocol support
|
||||
CAPAB_TSMODE | Chanmodes are timestamped
|
||||
CAPAB_UNCONNECT | UNCONNECT protocol support
|
||||
CAPAB_QS | Quitstorm - same as NOQUIT
|
||||
|
||||
You can override the default OnCapab method in IRCdMessage if required.
|
||||
|
||||
6) IRCDProto Class
|
||||
|
||||
The IRCDProto class is set up like:
|
||||
|
||||
class MyIRCdProto : public IRCDProto { } ircdproto;
|
||||
|
||||
And told to Anope through the
|
||||
|
||||
pmodule_ircd_proto(&ircd_proto);
|
||||
|
||||
function.
|
||||
|
||||
This is used for sending out specific messages from Anope to your IRCd.
|
||||
A list of all of the valid function names to overload and their args
|
||||
are in services.h. If the protocol module you are editing is similar enough
|
||||
to the IRCd you are adding support for, many of these probably won't need to
|
||||
be changed.
|
||||
+4
-3
@@ -71,9 +71,10 @@ Anope for Windows
|
||||
our IRC Support channel for assistance.
|
||||
|
||||
Some Anope modules require third party libraries, such as m_mysql and
|
||||
m_ssl. If these libraries are installed in nonstandard locations, cmake
|
||||
will probably not find them and should be told where they are by passing
|
||||
additional search paths to the last question in Config, such as:
|
||||
the SSL modules. If these libraries are installed in nonstandard
|
||||
locations, cmake will probably not find them and should be told where
|
||||
they are by passing additional search paths to the last question in
|
||||
Config, such as:
|
||||
|
||||
-DEXTRA_INCLUDE:STRING=c:/openssl/include;c:/mysql/include
|
||||
-DEXTRA_LIBS:STRING=c:/openssl/lib;c:/mysql/lib
|
||||
|
||||
@@ -147,7 +147,7 @@ while (1)
|
||||
chop($input); # remove the trailing \n from the user input
|
||||
|
||||
if ($input eq "q") {
|
||||
if (-e "build") {
|
||||
if (-e "build/CMakeFiles") {
|
||||
if (-e "cmake-bin") {
|
||||
my $cmake_path = `find cmake-bin -name cmake -print0`;
|
||||
system($cmake_path, "build/.");
|
||||
|
||||
+8
-3
@@ -74,6 +74,10 @@ class CoreExport AccessProvider : public Service
|
||||
/* Represents one entry of an access list on a channel. */
|
||||
class CoreExport ChanAccess : public Serializable
|
||||
{
|
||||
Anope::string mask;
|
||||
/* account this access entry is for, if any */
|
||||
Serialize::Reference<NickCore> nc;
|
||||
|
||||
public:
|
||||
typedef std::multimap<const ChanAccess *, const ChanAccess *> Set;
|
||||
/* shows the 'path' taken to determine if an access entry matches a user
|
||||
@@ -86,9 +90,6 @@ class CoreExport ChanAccess : public Serializable
|
||||
AccessProvider *provider;
|
||||
/* Channel this access entry is on */
|
||||
Serialize::Reference<ChannelInfo> ci;
|
||||
/* account this access entry is for, if any */
|
||||
Serialize::Reference<NickCore> nc;
|
||||
Anope::string mask;
|
||||
Anope::string creator;
|
||||
time_t last_seen;
|
||||
time_t created;
|
||||
@@ -96,6 +97,10 @@ class CoreExport ChanAccess : public Serializable
|
||||
ChanAccess(AccessProvider *p);
|
||||
virtual ~ChanAccess();
|
||||
|
||||
void SetMask(const Anope::string &mask, ChannelInfo *ci);
|
||||
const Anope::string &Mask() const;
|
||||
NickCore *GetAccount() const;
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
|
||||
+9
-8
@@ -115,6 +115,7 @@ namespace Anope
|
||||
* The following functions return the various types of strings.
|
||||
*/
|
||||
inline const char *c_str() const { return this->_string.c_str(); }
|
||||
inline const char *data() const { return this->_string.data(); }
|
||||
inline std::string &str() { return this->_string; }
|
||||
inline const std::string &str() const { return this->_string; }
|
||||
inline ci::string ci_str() const { return ci::string(this->_string.c_str()); }
|
||||
@@ -159,24 +160,24 @@ namespace Anope
|
||||
* Trim leading and trailing white spaces from the string.
|
||||
*/
|
||||
|
||||
inline string& ltrim()
|
||||
inline string& ltrim(const Anope::string &what = " \t\r\n")
|
||||
{
|
||||
while (!this->_string.empty() && isspace(this->_string[0]))
|
||||
while (!this->_string.empty() && what.find(this->_string[0]) != Anope::string::npos)
|
||||
this->_string.erase(this->_string.begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline string& rtrim()
|
||||
inline string& rtrim(const Anope::string &what = " \t\r\n")
|
||||
{
|
||||
while (!this->_string.empty() && isspace(this->_string[this->_string.length() - 1]))
|
||||
while (!this->_string.empty() && what.find(this->_string[this->_string.length() - 1]) != Anope::string::npos)
|
||||
this->_string.erase(this->_string.length() - 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline string& trim()
|
||||
inline string& trim(const Anope::string &what = " \t\r\n")
|
||||
{
|
||||
this->ltrim();
|
||||
this->rtrim();
|
||||
this->ltrim(what);
|
||||
this->rtrim(what);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -621,7 +622,7 @@ class commasepstream : public sepstream
|
||||
public:
|
||||
/** Initialize with comma seperator
|
||||
*/
|
||||
commasepstream(const Anope::string &source) : sepstream(source, ',') { }
|
||||
commasepstream(const Anope::string &source, bool allowempty = false) : sepstream(source, ',', allowempty) { }
|
||||
};
|
||||
|
||||
/** A derived form of sepstream, which seperates on spaces
|
||||
|
||||
@@ -60,6 +60,8 @@ class CoreExport BotInfo : public User, public Serializable
|
||||
|
||||
void GenerateUID();
|
||||
|
||||
void OnKill();
|
||||
|
||||
/** Change the nickname for the bot.
|
||||
* @param newnick The nick to change to
|
||||
*/
|
||||
|
||||
+2
-1
@@ -276,10 +276,11 @@ class CoreExport Channel : public Base, public Extensible
|
||||
|
||||
/** Unbans a user from this channel.
|
||||
* @param u The user to unban
|
||||
* @param mode The mode to unban
|
||||
* @param full Whether or not to match using the user's real host and IP
|
||||
* @return whether or not a ban was removed
|
||||
*/
|
||||
bool Unban(User *u, bool full = false);
|
||||
bool Unban(User *u, const Anope::string &mode, bool full = false);
|
||||
|
||||
/** Check whether a user is permitted to be on this channel
|
||||
* @param u The user
|
||||
|
||||
+10
-8
@@ -51,14 +51,13 @@ namespace Configuration
|
||||
template<typename T> T Get(const Anope::string &tag, const Anope::string &def) const
|
||||
{
|
||||
const Anope::string &value = this->Get<const Anope::string>(tag, def);
|
||||
try
|
||||
{
|
||||
return convertTo<T>(value);
|
||||
}
|
||||
catch (const ConvertException &)
|
||||
{
|
||||
return T();
|
||||
}
|
||||
if (!value.empty())
|
||||
try
|
||||
{
|
||||
return convertTo<T>(value);
|
||||
}
|
||||
catch (const ConvertException &) { }
|
||||
return T();
|
||||
}
|
||||
|
||||
bool Set(const Anope::string &tag, const Anope::string &value);
|
||||
@@ -132,11 +131,14 @@ namespace Configuration
|
||||
~Conf();
|
||||
|
||||
void LoadConf(File &file);
|
||||
void Post(Conf *old);
|
||||
|
||||
Block *GetModule(Module *);
|
||||
Block *GetModule(const Anope::string &name);
|
||||
|
||||
BotInfo *GetClient(const Anope::string &name);
|
||||
|
||||
Block *GetCommand(CommandSource &);
|
||||
};
|
||||
|
||||
struct Uplink
|
||||
|
||||
@@ -52,4 +52,5 @@ struct Exception;
|
||||
struct MemoInfo;
|
||||
struct ModeLock;
|
||||
struct Oper;
|
||||
namespace SASL { struct Message; }
|
||||
|
||||
|
||||
@@ -176,6 +176,8 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem<T>
|
||||
T t;
|
||||
if (data[this->name] >> t)
|
||||
this->Set(e, t);
|
||||
else
|
||||
this->Unset(e);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -196,6 +198,8 @@ class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool>
|
||||
data[this->name] >> b;
|
||||
if (b)
|
||||
this->Set(e);
|
||||
else
|
||||
this->Unset(e);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ namespace Language
|
||||
#define CHAN_SETTING_UNSET _("%s for %s unset.")
|
||||
#define CHAN_ACCESS_LEVEL_RANGE _("Access level must be between %d and %d inclusive.")
|
||||
#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_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.")
|
||||
#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" \
|
||||
|
||||
@@ -96,6 +96,11 @@ class CoreExport Log
|
||||
|
||||
~Log();
|
||||
|
||||
private:
|
||||
Anope::string FormatSource() const;
|
||||
Anope::string FormatCommand() const;
|
||||
|
||||
public:
|
||||
Anope::string BuildPrefix() const;
|
||||
|
||||
template<typename T> Log &operator<<(T val)
|
||||
|
||||
+2
-2
@@ -82,7 +82,7 @@ namespace Message
|
||||
|
||||
struct CoreExport Mode : IRCDMessage
|
||||
{
|
||||
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { }
|
||||
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
@@ -131,7 +131,7 @@ namespace Message
|
||||
|
||||
struct CoreExport SQuit : IRCDMessage
|
||||
{
|
||||
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
+40
-11
@@ -88,7 +88,7 @@ class CoreExport UserModeParam : public UserMode
|
||||
* @param value The param
|
||||
* @return true or false
|
||||
*/
|
||||
virtual bool IsValid(const Anope::string &value) const { return true; }
|
||||
virtual bool IsValid(Anope::string &value) const { return true; }
|
||||
};
|
||||
|
||||
/** This class is a channel mode, all channel modes use this/inherit from this
|
||||
@@ -96,6 +96,9 @@ class CoreExport UserModeParam : public UserMode
|
||||
class CoreExport ChannelMode : public Mode
|
||||
{
|
||||
public:
|
||||
/* channel modes that can posssibly unwrap this mode */
|
||||
std::vector<ChannelMode *> listeners;
|
||||
|
||||
/** constructor
|
||||
* @param name The mode name
|
||||
* @param mc The mode char
|
||||
@@ -103,6 +106,18 @@ class CoreExport ChannelMode : public Mode
|
||||
ChannelMode(const Anope::string &name, char mc);
|
||||
|
||||
bool CanSet(User *u) const anope_override;
|
||||
|
||||
/** 'wrap' this channel mode and param to the underlying mode and param
|
||||
*/
|
||||
virtual ChannelMode *Wrap(Anope::string ¶m);
|
||||
|
||||
/** 'unwrap' this mode to our internal representation
|
||||
*/
|
||||
ChannelMode *Unwrap(Anope::string ¶m);
|
||||
|
||||
/** called when a mode is being unwrapped, and is asking us if we can unwrap it
|
||||
*/
|
||||
virtual ChannelMode *Unwrap(ChannelMode *, Anope::string ¶m);
|
||||
};
|
||||
|
||||
/** This is a mode for lists, eg b/e/I. These modes should inherit from this
|
||||
@@ -120,7 +135,7 @@ class CoreExport ChannelModeList : public ChannelMode
|
||||
* @param mask The mask
|
||||
* @return true for yes, false for no
|
||||
*/
|
||||
virtual bool IsValid(const Anope::string &mask) const { return true; }
|
||||
virtual bool IsValid(Anope::string &mask) const;
|
||||
|
||||
/** Checks if mask affects user
|
||||
* Should only be used for extbans or other weird ircd-specific things.
|
||||
@@ -162,7 +177,7 @@ class CoreExport ChannelModeParam : public ChannelMode
|
||||
* @param value The param
|
||||
* @return true for yes, false for no
|
||||
*/
|
||||
virtual bool IsValid(const Anope::string &value) const { return true; }
|
||||
virtual bool IsValid(Anope::string &value) const { return true; }
|
||||
};
|
||||
|
||||
/** This is a mode that is a channel status, eg +v/h/o/a/q.
|
||||
@@ -186,6 +201,25 @@ class CoreExport ChannelModeStatus : public ChannelMode
|
||||
ChannelModeStatus(const Anope::string &name, char mc, char msymbol, short mlevel);
|
||||
};
|
||||
|
||||
/** A virtual mode. This mode doesn't natively exist on the IRCd (like extbans),
|
||||
* but we still have a representation for it.
|
||||
*/
|
||||
template<typename T>
|
||||
class CoreExport ChannelModeVirtual : public T
|
||||
{
|
||||
Anope::string base;
|
||||
ChannelMode *basech;
|
||||
|
||||
public:
|
||||
ChannelModeVirtual(const Anope::string &mname, const Anope::string &basename);
|
||||
|
||||
~ChannelModeVirtual();
|
||||
|
||||
ChannelMode *Wrap(Anope::string ¶m) anope_override;
|
||||
|
||||
ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) = 0;
|
||||
};
|
||||
|
||||
/* The status a user has on a channel (+v, +h, +o) etc */
|
||||
class CoreExport ChannelStatus
|
||||
{
|
||||
@@ -225,7 +259,7 @@ class CoreExport ChannelModeKey : public ChannelModeParam
|
||||
public:
|
||||
ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { }
|
||||
|
||||
bool IsValid(const Anope::string &value) const anope_override;
|
||||
bool IsValid(Anope::string &value) const anope_override;
|
||||
};
|
||||
|
||||
/** This class is used for oper only channel modes
|
||||
@@ -257,13 +291,6 @@ class CoreExport ChannelModeNoone : public ChannelMode
|
||||
*/
|
||||
class CoreExport ModeManager
|
||||
{
|
||||
protected:
|
||||
/* Array of all modes Anope knows about. Modes are in this array at position
|
||||
* modechar. Additionally, status modes are in this array (again) at statuschar.
|
||||
*/
|
||||
static std::vector<ChannelMode *> ChannelModes;
|
||||
static std::vector<UserMode *> UserModes;
|
||||
|
||||
public:
|
||||
|
||||
/* Number of generic channel and user modes we are tracking */
|
||||
@@ -377,6 +404,8 @@ class CoreExport Entry
|
||||
*/
|
||||
const Anope::string GetMask() const;
|
||||
|
||||
const Anope::string GetNUHMask() const;
|
||||
|
||||
/** Check if this entry matches a user
|
||||
* @param u The user
|
||||
* @param full True to match against a users real host and IP
|
||||
|
||||
+4
-8
@@ -719,11 +719,6 @@ class CoreExport Module : public Extensible
|
||||
*/
|
||||
virtual void OnNickDrop(CommandSource &source, NickAlias *na) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a nick is forbidden
|
||||
* @param na The nick alias of the forbidden nick
|
||||
*/
|
||||
virtual void OnNickForbidden(NickAlias *na) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a user groups their nick
|
||||
* @param u The user grouping
|
||||
* @param target The target they're grouping to
|
||||
@@ -748,8 +743,9 @@ class CoreExport Module : public Extensible
|
||||
/** Called when a nick is registered
|
||||
* @param user The user registering the nick, of any
|
||||
* @param The nick
|
||||
* @param pass The password of the newly registered nick
|
||||
*/
|
||||
virtual void OnNickRegister(User *user, NickAlias *na) { throw NotImplementedException(); }
|
||||
virtual void OnNickRegister(User *user, NickAlias *na, const Anope::string &pass) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a nick is suspended
|
||||
* @param na The nick alias
|
||||
@@ -1010,7 +1006,7 @@ class CoreExport Module : public Extensible
|
||||
* mostly to ensure mlock/+r are set.
|
||||
* @param c The channel
|
||||
*/
|
||||
virtual void OnCheckModes(Channel *c) { throw NotImplementedException(); }
|
||||
virtual void OnCheckModes(Reference<Channel> &c) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a channel is synced.
|
||||
* Channels are synced after a sjoin is finished processing
|
||||
@@ -1094,7 +1090,7 @@ enum Implementation
|
||||
I_OnPreUserLogoff, I_OnPostUserLogoff, I_OnBotCreate, I_OnBotChange, I_OnBotDelete, I_OnAccessDel, I_OnAccessAdd,
|
||||
I_OnAccessClear, I_OnLevelChange, I_OnChanDrop, I_OnChanRegistered, I_OnChanSuspend, I_OnChanUnsuspend,
|
||||
I_OnCreateChan, I_OnDelChan, I_OnChannelCreate, I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick,
|
||||
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnNickDrop, I_OnNickForbidden, I_OnNickGroup, I_OnNickIdentify,
|
||||
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnNickDrop, I_OnNickGroup, I_OnNickIdentify,
|
||||
I_OnUserLogin, I_OnNickLogout, I_OnNickRegister, I_OnNickSuspend, I_OnNickUnsuspended, I_OnDelNick, I_OnNickCoreCreate,
|
||||
I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess, I_OnNickClearCert,
|
||||
I_OnNickAddCert, I_OnNickEraseCert, I_OnNickInfo, I_OnBotInfo, I_OnCheckAuthentication, I_OnNickUpdate,
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* (C) 2003-2014 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
struct EntryMsg
|
||||
{
|
||||
Anope::string chan;
|
||||
Anope::string creator;
|
||||
Anope::string message;
|
||||
time_t when;
|
||||
|
||||
virtual ~EntryMsg() { }
|
||||
protected:
|
||||
EntryMsg() { }
|
||||
};
|
||||
|
||||
struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
|
||||
{
|
||||
protected:
|
||||
EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { }
|
||||
|
||||
public:
|
||||
virtual ~EntryMessageList()
|
||||
{
|
||||
for (unsigned i = (*this)->size(); i > 0; --i)
|
||||
delete (*this)->at(i - 1);
|
||||
}
|
||||
|
||||
virtual EntryMsg* Create() = 0;
|
||||
};
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/* ChanServ core functions
|
||||
*
|
||||
* (C) 2003-2014 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.
|
||||
*/
|
||||
|
||||
struct CSSuspendInfo
|
||||
{
|
||||
Anope::string chan, by, reason;
|
||||
time_t time, expires;
|
||||
|
||||
virtual ~CSSuspendInfo() { }
|
||||
protected:
|
||||
CSSuspendInfo() { }
|
||||
};
|
||||
@@ -60,3 +60,12 @@ struct NSCertList
|
||||
|
||||
virtual void Check() = 0;
|
||||
};
|
||||
|
||||
class CertService : public Service
|
||||
{
|
||||
public:
|
||||
CertService(Module *c) : Service(c, "CertService", "certs") { }
|
||||
|
||||
virtual NickCore* FindAccountFromCert(const Anope::string &cert) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ enum ForbidType
|
||||
FT_SIZE
|
||||
};
|
||||
|
||||
struct ForbidData : Serializable
|
||||
struct ForbidData
|
||||
{
|
||||
Anope::string mask;
|
||||
Anope::string creator;
|
||||
@@ -19,9 +19,9 @@ struct ForbidData : Serializable
|
||||
time_t expires;
|
||||
ForbidType type;
|
||||
|
||||
ForbidData() : Serializable("ForbidData") { }
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
virtual ~ForbidData() { }
|
||||
protected:
|
||||
ForbidData() : created(0), expires(0) { }
|
||||
};
|
||||
|
||||
class ForbidService : public Service
|
||||
@@ -33,6 +33,8 @@ class ForbidService : public Service
|
||||
|
||||
virtual void RemoveForbid(ForbidData *d) = 0;
|
||||
|
||||
virtual ForbidData* CreateForbid() = 0;
|
||||
|
||||
virtual ForbidData *FindForbid(const Anope::string &mask, ForbidType type) = 0;
|
||||
|
||||
virtual std::vector<ForbidData *> GetForbids() = 0;
|
||||
@@ -40,43 +42,5 @@ class ForbidService : public Service
|
||||
|
||||
static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid");
|
||||
|
||||
void ForbidData::Serialize(Serialize::Data &data) const
|
||||
{
|
||||
data["mask"] << this->mask;
|
||||
data["creator"] << this->creator;
|
||||
data["reason"] << this->reason;
|
||||
data["created"] << this->created;
|
||||
data["expires"] << this->expires;
|
||||
data["type"] << this->type;
|
||||
}
|
||||
|
||||
Serializable* ForbidData::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
if (!forbid_service)
|
||||
return NULL;
|
||||
|
||||
ForbidData *fb;
|
||||
if (obj)
|
||||
fb = anope_dynamic_static_cast<ForbidData *>(obj);
|
||||
else
|
||||
fb = new ForbidData;
|
||||
|
||||
data["mask"] >> fb->mask;
|
||||
data["creator"] >> fb->creator;
|
||||
data["reason"] >> fb->reason;
|
||||
data["created"] >> fb->created;
|
||||
data["expires"] >> fb->expires;
|
||||
unsigned int t;
|
||||
data["type"] >> t;
|
||||
fb->type = static_cast<ForbidType>(t);
|
||||
|
||||
if (t > FT_SIZE - 1)
|
||||
return NULL;
|
||||
|
||||
if (!obj)
|
||||
forbid_service->AddForbid(fb);
|
||||
return fb;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+10
-44
@@ -10,70 +10,36 @@
|
||||
*/
|
||||
|
||||
|
||||
struct IgnoreData : Serializable
|
||||
struct IgnoreData
|
||||
{
|
||||
Anope::string mask;
|
||||
Anope::string creator;
|
||||
Anope::string reason;
|
||||
time_t time; /* When do we stop ignoring them? */
|
||||
|
||||
IgnoreData() : Serializable("IgnoreData") { }
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
virtual ~IgnoreData() { }
|
||||
protected:
|
||||
IgnoreData() : time(0) { }
|
||||
};
|
||||
|
||||
class IgnoreService : public Service
|
||||
{
|
||||
protected:
|
||||
std::list<IgnoreData> ignores;
|
||||
|
||||
IgnoreService(Module *c) : Service(c, "IgnoreService", "ignore") { }
|
||||
|
||||
public:
|
||||
virtual IgnoreData* AddIgnore(const Anope::string &mask, const Anope::string &creator, const Anope::string &reason, time_t delta = Anope::CurTime) = 0;
|
||||
virtual void AddIgnore(IgnoreData *) = 0;
|
||||
|
||||
virtual bool DelIgnore(const Anope::string &mask) = 0;
|
||||
virtual void DelIgnore(IgnoreData *) = 0;
|
||||
|
||||
inline void ClearIgnores() { this->ignores.clear(); }
|
||||
virtual void ClearIgnores() = 0;
|
||||
|
||||
virtual IgnoreData *Create() = 0;
|
||||
|
||||
virtual IgnoreData *Find(const Anope::string &mask) = 0;
|
||||
|
||||
inline std::list<IgnoreData> &GetIgnores() { return this->ignores; }
|
||||
virtual std::vector<IgnoreData *> &GetIgnores() = 0;
|
||||
};
|
||||
|
||||
static ServiceReference<IgnoreService> ignore_service("IgnoreService", "ignore");
|
||||
|
||||
void IgnoreData::Serialize(Serialize::Data &data) const
|
||||
{
|
||||
data["mask"] << this->mask;
|
||||
data["creator"] << this->creator;
|
||||
data["reason"] << this->reason;
|
||||
data["time"] << this->time;
|
||||
}
|
||||
|
||||
Serializable* IgnoreData::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
if (!ignore_service)
|
||||
return NULL;
|
||||
|
||||
if (obj)
|
||||
{
|
||||
IgnoreData *ign = anope_dynamic_static_cast<IgnoreData *>(obj);
|
||||
data["mask"] >> ign->mask;
|
||||
data["creator"] >> ign->creator;
|
||||
data["reason"] >> ign->reason;
|
||||
data["time"] >> ign->time;
|
||||
return ign;
|
||||
}
|
||||
|
||||
Anope::string smask, screator, sreason;
|
||||
time_t t;
|
||||
|
||||
data["mask"] >> smask;
|
||||
data["creator"] >> screator;
|
||||
data["reason"] >> sreason;
|
||||
data["time"] >> t;
|
||||
|
||||
return ignore_service->AddIgnore(smask, screator, sreason, t);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ struct Session
|
||||
unsigned count; /* Number of clients with this host */
|
||||
unsigned hits; /* Number of subsequent kills for a host */
|
||||
|
||||
Session(const Anope::string &ip, int len) : addr(ip, len), count(1), hits(0) { }
|
||||
Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { }
|
||||
};
|
||||
|
||||
struct Exception : Serializable
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2014 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
namespace SASL
|
||||
{
|
||||
struct Message
|
||||
{
|
||||
Anope::string source;
|
||||
Anope::string target;
|
||||
Anope::string type;
|
||||
Anope::string data;
|
||||
Anope::string ext;
|
||||
};
|
||||
|
||||
class Mechanism;
|
||||
struct Session;
|
||||
|
||||
class Service : public ::Service
|
||||
{
|
||||
public:
|
||||
Service(Module *o) : ::Service(o, "SASL::Service", "sasl") { }
|
||||
|
||||
virtual void ProcessMessage(const Message &) = 0;
|
||||
|
||||
virtual Anope::string GetAgent() = 0;
|
||||
|
||||
virtual Session* GetSession(const Anope::string &uid) = 0;
|
||||
|
||||
virtual void SendMessage(SASL::Session *session, const Anope::string &type, const Anope::string &data) = 0;
|
||||
|
||||
virtual void Succeed(Session *, NickCore *) = 0;
|
||||
virtual void Fail(Session *) = 0;
|
||||
virtual void SendMechs(Session *) = 0;
|
||||
virtual void DeleteSessions(Mechanism *, bool = false) = 0;
|
||||
virtual void RemoveSession(Session *) = 0;
|
||||
};
|
||||
|
||||
static ServiceReference<SASL::Service> sasl("SASL::Service", "sasl");
|
||||
|
||||
struct Session
|
||||
{
|
||||
time_t created;
|
||||
Anope::string uid;
|
||||
Reference<Mechanism> mech;
|
||||
|
||||
Session(Mechanism *m, const Anope::string &u) : created(Anope::CurTime), uid(u), mech(m) { }
|
||||
virtual ~Session()
|
||||
{
|
||||
if (sasl)
|
||||
sasl->RemoveSession(this);
|
||||
}
|
||||
};
|
||||
|
||||
/* PLAIN, EXTERNAL, etc */
|
||||
class Mechanism : public ::Service
|
||||
{
|
||||
public:
|
||||
Mechanism(Module *o, const Anope::string &sname) : Service(o, "SASL::Mechanism", sname) { }
|
||||
|
||||
virtual Session* CreateSession(const Anope::string &uid) { return new Session(this, uid); }
|
||||
|
||||
virtual void ProcessMessage(Session *session, const Message &) = 0;
|
||||
|
||||
virtual ~Mechanism()
|
||||
{
|
||||
if (sasl)
|
||||
sasl->DeleteSessions(this, true);
|
||||
}
|
||||
};
|
||||
|
||||
class IdentifyRequest : public ::IdentifyRequest
|
||||
{
|
||||
Anope::string uid;
|
||||
|
||||
public:
|
||||
IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass) : ::IdentifyRequest(m, acc, pass), uid(id) { }
|
||||
|
||||
void OnSuccess() anope_override
|
||||
{
|
||||
if (!sasl)
|
||||
return;
|
||||
|
||||
NickAlias *na = NickAlias::Find(GetAccount());
|
||||
if (!na || na->nc->HasExt("NS_SUSPENDED"))
|
||||
return OnFail();
|
||||
|
||||
Session *s = sasl->GetSession(uid);
|
||||
if (s)
|
||||
{
|
||||
Log(Config->GetClient("NickServ")) << "A user identified to account " << this->GetAccount() << " using SASL";
|
||||
sasl->Succeed(s, na->nc);
|
||||
delete s;
|
||||
}
|
||||
}
|
||||
|
||||
void OnFail() anope_override
|
||||
{
|
||||
if (!sasl)
|
||||
return;
|
||||
|
||||
Session *s = sasl->GetSession(uid);
|
||||
if (s)
|
||||
{
|
||||
sasl->Fail(s);
|
||||
delete s;
|
||||
}
|
||||
|
||||
Anope::string accountstatus;
|
||||
NickAlias *na = NickAlias::Find(GetAccount());
|
||||
if (!na)
|
||||
accountstatus = "nonexistent ";
|
||||
else if (na->nc->HasExt("NS_SUSPENDED"))
|
||||
accountstatus = "suspended ";
|
||||
|
||||
Log(Config->GetClient("NickServ")) << "A user failed to identify for " << accountstatus << "account " << this->GetAccount() << " using SASL";
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* (C) 2003-2014 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
struct MiscData
|
||||
{
|
||||
Anope::string object;
|
||||
Anope::string name;
|
||||
Anope::string data;
|
||||
|
||||
MiscData() { }
|
||||
virtual ~MiscData() { }
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* NickServ core functions
|
||||
*
|
||||
/*
|
||||
* (C) 2003-2014 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
@@ -9,12 +8,11 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
struct NSSuspendInfo
|
||||
struct SuspendInfo
|
||||
{
|
||||
Anope::string nick, by, reason;
|
||||
Anope::string what, by, reason;
|
||||
time_t when, expires;
|
||||
|
||||
virtual ~NSSuspendInfo() { }
|
||||
protected:
|
||||
NSSuspendInfo() { }
|
||||
SuspendInfo() { }
|
||||
virtual ~SuspendInfo() { }
|
||||
};
|
||||
@@ -40,6 +40,9 @@ class CoreExport IRCDProto : public Service
|
||||
virtual void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf);
|
||||
|
||||
const Anope::string &GetProtocolName();
|
||||
virtual void Parse(const Anope::string &, Anope::string &, Anope::string &, std::vector<Anope::string> &);
|
||||
virtual Anope::string Format(const Anope::string &source, const Anope::string &message);
|
||||
|
||||
/* Modes used by default by our clients */
|
||||
Anope::string DefaultPseudoclientModes;
|
||||
/* Can we force change a users's nick? */
|
||||
@@ -64,11 +67,17 @@ class CoreExport IRCDProto : public Service
|
||||
bool CanCertFP;
|
||||
/* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */
|
||||
bool RequiresID;
|
||||
/* If this IRCd has unique ids, whether the IDs and nicknames are ambiguous */
|
||||
bool AmbiguousID;
|
||||
/* The maximum number of modes we are allowed to set with one MODE command */
|
||||
unsigned MaxModes;
|
||||
/* The maximum number of bytes a line may have */
|
||||
unsigned MaxLine;
|
||||
|
||||
/* Retrieves the next free UID or SID */
|
||||
virtual Anope::string UID_Retrieve();
|
||||
virtual Anope::string SID_Retrieve();
|
||||
|
||||
/** Sets the server in NOOP mode. If NOOP mode is enabled, no users
|
||||
* will be able to oper on the server.
|
||||
* @param s The server
|
||||
@@ -111,6 +120,8 @@ class CoreExport IRCDProto : public Service
|
||||
virtual void SendSQLine(User *, const XLine *x) { }
|
||||
virtual void SendSQLineDel(const XLine *x) { }
|
||||
|
||||
virtual void SendKill(const MessageSource &source, const Anope::string &target, const Anope::string &reason);
|
||||
|
||||
/** Kills a user
|
||||
* @param source Who is doing the kill
|
||||
* @param user The user to be killed
|
||||
@@ -217,6 +228,9 @@ class CoreExport IRCDProto : public Service
|
||||
*/
|
||||
virtual void SendOper(User *u);
|
||||
|
||||
virtual void SendSASLMessage(const SASL::Message &) { }
|
||||
virtual void SendSVSLogin(const Anope::string &uid, const Anope::string &acc) { }
|
||||
|
||||
virtual bool IsNickValid(const Anope::string &);
|
||||
virtual bool IsChannelValid(const Anope::string &);
|
||||
virtual bool IsIdentValid(const Anope::string &);
|
||||
@@ -227,6 +241,8 @@ class CoreExport IRCDProto : public Service
|
||||
* Defaults to Config->ListSize
|
||||
*/
|
||||
virtual unsigned GetMaxListFor(Channel *c);
|
||||
|
||||
virtual Anope::string NormalizeMask(const Anope::string &mask);
|
||||
};
|
||||
|
||||
class CoreExport MessageSource
|
||||
|
||||
@@ -23,10 +23,6 @@ extern CoreExport Server *Me;
|
||||
|
||||
namespace Servers
|
||||
{
|
||||
/* Retrieves the next free TS6 UID or SID */
|
||||
extern CoreExport const Anope::string TS6_UID_Retrieve();
|
||||
extern CoreExport const Anope::string TS6_SID_Retrieve();
|
||||
|
||||
/* Gets our uplink. Note we don't actually have an "uplink", this is just
|
||||
* the only server whose uplink *is* Me that is not a juped server.
|
||||
* @return Our uplink, or NULL if not uplinked to anything
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@
|
||||
/** Anything that inherits from this class can be referred to
|
||||
* using ServiceReference. Any interfaces provided by modules,
|
||||
* such as commands, use this. This is also used for modules
|
||||
* that publish a service (m_ssl, etc).
|
||||
* that publish a service (m_ssl_openssl, etc).
|
||||
*/
|
||||
class CoreExport Service : public virtual Base
|
||||
{
|
||||
@@ -148,7 +148,7 @@ class ServiceReference : public Reference<T>
|
||||
* creates its own service type (that other modules must include the header file
|
||||
* for), as the core is not compiled with it so there is no RTTI for it.
|
||||
*/
|
||||
this->ref = static_cast<T *>(Service::FindService(this->type, this->name));
|
||||
this->ref = static_cast<T *>(::Service::FindService(this->type, this->name));
|
||||
if (this->ref)
|
||||
this->ref->AddReference(this);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,11 @@ class CoreExport SocketEngine
|
||||
/** Read from sockets and do things
|
||||
*/
|
||||
static void Process();
|
||||
|
||||
static int GetLastError();
|
||||
static void SetLastError(int);
|
||||
|
||||
static bool IgnoreErrno();
|
||||
};
|
||||
|
||||
#endif // SOCKETENGINE_H
|
||||
|
||||
+3
-4
@@ -59,7 +59,7 @@ union CoreExport sockaddrs
|
||||
|
||||
/** Check if this sockaddr has data in it
|
||||
*/
|
||||
bool operator()() const;
|
||||
bool valid() const;
|
||||
|
||||
/** Compares with sockaddr with another. Compares address type, port, and address
|
||||
* @return true if they are the same
|
||||
@@ -82,8 +82,6 @@ union CoreExport sockaddrs
|
||||
* @throws A socket exception if given an invalid structure
|
||||
*/
|
||||
void ntop(int type, const void *src);
|
||||
|
||||
bool valid() const;
|
||||
};
|
||||
|
||||
class CoreExport cidr
|
||||
@@ -94,6 +92,7 @@ class CoreExport cidr
|
||||
public:
|
||||
cidr(const Anope::string &ip);
|
||||
cidr(const Anope::string &ip, unsigned char len);
|
||||
cidr(const sockaddrs &ip, unsigned char len);
|
||||
Anope::string mask() const;
|
||||
bool match(const sockaddrs &other);
|
||||
bool valid() const;
|
||||
@@ -347,7 +346,7 @@ class CoreExport BinarySocket : public virtual Socket
|
||||
|
||||
/** Write data to the socket
|
||||
* @param buffer The data to write
|
||||
* @param l The length of the data
|
||||
* @param l The length of the data; if 0 then this function returns without doing anything
|
||||
*/
|
||||
virtual void Write(const char *buffer, size_t l);
|
||||
void Write(const char *message, ...);
|
||||
|
||||
+8
-5
@@ -20,6 +20,7 @@
|
||||
#include "serialize.h"
|
||||
#include "commands.h"
|
||||
#include "account.h"
|
||||
#include "sockets.h"
|
||||
|
||||
typedef Anope::hash_map<User *> user_map;
|
||||
|
||||
@@ -71,7 +72,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
|
||||
/* SSL Fingerprint */
|
||||
Anope::string fingerprint;
|
||||
/* User's IP */
|
||||
Anope::string ip;
|
||||
sockaddrs ip;
|
||||
/* Server user is connected to */
|
||||
Server *server;
|
||||
/* When the user signed on. Set on connect and never modified. */
|
||||
@@ -92,6 +93,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
|
||||
/* Last time this user sent an email */
|
||||
time_t lastmail;
|
||||
|
||||
protected:
|
||||
/** Create a new user object, initialising necessary fields and
|
||||
* adds it to the hash
|
||||
*
|
||||
@@ -102,19 +104,20 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
|
||||
* @param sip The ip of the user
|
||||
* @param sserver The server of the user
|
||||
* @param srealname The realname/gecos of teh user
|
||||
* @param ssignon User's timestamp
|
||||
* @param ts User's timestamp
|
||||
* @param smodes User's modes
|
||||
* @param suid The unique identifier of the user.
|
||||
* @param nc The account the user is identified as, if any
|
||||
*/
|
||||
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ssignon, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
|
||||
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
|
||||
|
||||
protected:
|
||||
/** Destroy a user.
|
||||
*/
|
||||
virtual ~User();
|
||||
|
||||
public:
|
||||
static User* OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
|
||||
|
||||
/** Update the nickname of a user record accordingly, should be
|
||||
* called from ircd protocol.
|
||||
* @param newnick The new username
|
||||
@@ -323,7 +326,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
|
||||
/** Check if the user is protected from kicks and negative mode changes
|
||||
* @return true or false
|
||||
*/
|
||||
bool IsProtected() const;
|
||||
bool IsProtected();
|
||||
|
||||
/** Kill a user
|
||||
* @param source The user/server doing the kill
|
||||
|
||||
+8
-5
@@ -12,12 +12,15 @@
|
||||
|
||||
#include "serialize.h"
|
||||
#include "service.h"
|
||||
#include "sockets.h"
|
||||
|
||||
/* An Xline, eg, anything added with operserv/akill, or any of the operserv/sxline commands */
|
||||
class CoreExport XLine : public Serializable
|
||||
{
|
||||
void InitRegex();
|
||||
void Init();
|
||||
Anope::string nick, user, host, real;
|
||||
public:
|
||||
cidr *c;
|
||||
Anope::string mask;
|
||||
Regex *regex;
|
||||
Anope::string by;
|
||||
@@ -32,10 +35,10 @@ class CoreExport XLine : public Serializable
|
||||
XLine(const Anope::string &mask, const Anope::string &by, const time_t expires, const Anope::string &reason, const Anope::string &uid = "");
|
||||
~XLine();
|
||||
|
||||
Anope::string GetNick() const;
|
||||
Anope::string GetUser() const;
|
||||
Anope::string GetHost() const;
|
||||
Anope::string GetReal() const;
|
||||
const Anope::string &GetNick() const;
|
||||
const Anope::string &GetUser() const;
|
||||
const Anope::string &GetHost() const;
|
||||
const Anope::string &GetReal() const;
|
||||
|
||||
Anope::string GetReason() const;
|
||||
|
||||
|
||||
+663
-632
File diff suppressed because it is too large
Load Diff
+669
-633
File diff suppressed because it is too large
Load Diff
+670
-634
File diff suppressed because it is too large
Load Diff
+10964
File diff suppressed because it is too large
Load Diff
+956
-1005
File diff suppressed because it is too large
Load Diff
+712
-685
File diff suppressed because it is too large
Load Diff
+661
-630
File diff suppressed because it is too large
Load Diff
+3263
-3889
File diff suppressed because it is too large
Load Diff
+673
-648
File diff suppressed because it is too large
Load Diff
+661
-630
File diff suppressed because it is too large
Load Diff
+661
-630
File diff suppressed because it is too large
Load Diff
+667
-636
File diff suppressed because it is too large
Load Diff
+661
-630
File diff suppressed because it is too large
Load Diff
+1
-5
@@ -5,11 +5,7 @@ touch anope.pot
|
||||
|
||||
cd ..
|
||||
FILES=`find ./ -name *.cpp -o -name *.h -o -name *.conf | grep -v /modules/third/`
|
||||
for f in $FILES
|
||||
do
|
||||
xgettext -E -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword --keyword=_ $f
|
||||
done
|
||||
|
||||
xgettext -E -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword --keyword=_ $FILES
|
||||
cd -
|
||||
|
||||
for f in *.po
|
||||
|
||||
@@ -50,7 +50,7 @@ macro(build_modules SRC)
|
||||
add_library(${SO} MODULE ${MODULE_SRC})
|
||||
# Windows requires this because it's weird
|
||||
if(WIN32)
|
||||
set(WIN32_NO_LIBS "/nodefaultlib:\"libcmt.lib\"")
|
||||
set(WIN32_NO_LIBS "/nodefaultlib:\"libcmt.lib\" /OPT:NOREF")
|
||||
else(WIN32)
|
||||
set(WIN32_NO_LIBS)
|
||||
endif(WIN32)
|
||||
|
||||
@@ -22,7 +22,7 @@ class BSAutoAssign : public Module
|
||||
if (bot.empty())
|
||||
return;
|
||||
|
||||
BotInfo *bi = BotInfo::Find(bot);
|
||||
BotInfo *bi = BotInfo::Find(bot, true);
|
||||
if (bi == NULL)
|
||||
{
|
||||
Log(this) << "bs_autoassign is configured to assign bot " << bot << ", but it does not exist?";
|
||||
|
||||
@@ -189,7 +189,10 @@ class CommandBSBot : public Command
|
||||
}
|
||||
|
||||
if (!user.empty())
|
||||
{
|
||||
IRCD->SendQuit(bi, "Quit: Be right back");
|
||||
bi->introduced = false;
|
||||
}
|
||||
else
|
||||
IRCD->SendNickChange(bi, nick);
|
||||
|
||||
@@ -204,18 +207,7 @@ class CommandBSBot : public Command
|
||||
bi->realname = real;
|
||||
|
||||
if (!user.empty())
|
||||
{
|
||||
IRCD->SendClientIntroduction(bi);
|
||||
unsigned minusers = Config->GetBlock("botserv")->Get<unsigned>("minusers");
|
||||
const std::set<ChannelInfo *> &channels = bi->GetChannels();
|
||||
for (std::set<ChannelInfo *>::const_iterator it = channels.begin(), it_end = channels.end(); it != it_end; ++it)
|
||||
{
|
||||
const ChannelInfo *ci = *it;
|
||||
|
||||
if (ci->c && ci->c->users.size() >= minusers)
|
||||
bi->Join(ci->c);
|
||||
}
|
||||
}
|
||||
bi->OnKill();
|
||||
|
||||
source.Reply(_("Bot \002%s\002 has been changed to %s!%s@%s (%s)."), oldnick.c_str(), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str());
|
||||
Log(LOG_ADMIN, source, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname;
|
||||
|
||||
@@ -325,7 +325,7 @@ class CommandBSKickBolds : public CommandBSKickBase
|
||||
public:
|
||||
CommandBSKickBolds(Module *creator) : CommandBSKickBase(creator, "botserv/kick/bolds", 2, 3)
|
||||
{
|
||||
this->SetDesc(_("Configures badwords kicker"));
|
||||
this->SetDesc(_("Configures bolds kicker"));
|
||||
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]"));
|
||||
}
|
||||
|
||||
@@ -1038,8 +1038,8 @@ class BSKick : public Module
|
||||
|
||||
void check_ban(ChannelInfo *ci, User *u, KickerData *kd, int ttbtype)
|
||||
{
|
||||
/* Don't ban ulines */
|
||||
if (u->server->IsULined())
|
||||
/* Don't ban ulines or protected users */
|
||||
if (u->IsProtected())
|
||||
return;
|
||||
|
||||
BanData::Data &bd = this->GetBanData(u, ci->c);
|
||||
@@ -1065,7 +1065,7 @@ class BSKick : public Module
|
||||
va_list args;
|
||||
char buf[1024];
|
||||
|
||||
if (!ci || !ci->bi || !ci->c || !u || u->server->IsULined() || !ci->c->FindUser(u))
|
||||
if (!ci || !ci->bi || !ci->c || !u || u->IsProtected() || !ci->c->FindUser(u))
|
||||
return;
|
||||
|
||||
Anope::string fmt = Language::Translate(u, message);
|
||||
|
||||
@@ -180,7 +180,7 @@ class CommandCSAccess : public Command
|
||||
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
|
||||
{
|
||||
const ChanAccess *access = ci->GetAccess(i - 1);
|
||||
if (mask.equals_ci(access->mask))
|
||||
if (mask.equals_ci(access->Mask()))
|
||||
{
|
||||
/* Don't allow lowering from a level >= u_level */
|
||||
if ((!highest || *access >= *highest) && !u_access.founder && !source.HasPriv("chanserv/access/modify"))
|
||||
@@ -204,8 +204,7 @@ class CommandCSAccess : public Command
|
||||
if (!provider)
|
||||
return;
|
||||
AccessChanAccess *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
|
||||
access->ci = ci;
|
||||
access->mask = mask;
|
||||
access->SetMask(mask, ci);
|
||||
access->creator = source.GetNick();
|
||||
access->level = level;
|
||||
access->last_seen = 0;
|
||||
@@ -216,9 +215,9 @@ class CommandCSAccess : public Command
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << " with level " << level;
|
||||
if (p != NULL)
|
||||
source.Reply(_("\002%s\002 added to %s access list at privilege %s (level %d)"), access->mask.c_str(), ci->name.c_str(), p->name.c_str(), level);
|
||||
source.Reply(_("\002%s\002 added to %s access list at privilege %s (level %d)"), access->Mask().c_str(), ci->name.c_str(), p->name.c_str(), level);
|
||||
else
|
||||
source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), 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);
|
||||
}
|
||||
|
||||
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
@@ -284,7 +283,7 @@ class CommandCSAccess : public Command
|
||||
AccessGroup ag = source.AccessFor(ci);
|
||||
const ChanAccess *u_highest = ag.Highest();
|
||||
|
||||
if ((!u_highest || *u_highest <= *access) && !ag.founder && !this->override && !access->mask.equals_ci(source.nc->display))
|
||||
if ((!u_highest || *u_highest <= *access) && !ag.founder && !this->override && access->GetAccount() != source.nc)
|
||||
{
|
||||
denied = true;
|
||||
return;
|
||||
@@ -292,9 +291,9 @@ class CommandCSAccess : public Command
|
||||
|
||||
++deleted;
|
||||
if (!Nicks.empty())
|
||||
Nicks += ", " + access->mask;
|
||||
Nicks += ", " + access->Mask();
|
||||
else
|
||||
Nicks = access->mask;
|
||||
Nicks = access->Mask();
|
||||
|
||||
ci->EraseAccess(Number - 1);
|
||||
|
||||
@@ -313,15 +312,15 @@ class CommandCSAccess : public Command
|
||||
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
|
||||
{
|
||||
ChanAccess *access = ci->GetAccess(i - 1);
|
||||
if (mask.equals_ci(access->mask))
|
||||
if (mask.equals_ci(access->Mask()))
|
||||
{
|
||||
if (!access->mask.equals_ci(source.nc->display) && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify"))
|
||||
if (access->GetAccount() != source.nc && !u_access.founder && (!highest || *highest <= *access) && !source.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("ACCESS_CHANGE") && !access->mask.equals_ci(source.nc->display);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->mask;
|
||||
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("ACCESS_CHANGE") && access->GetAccount() != source.nc;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->Mask();
|
||||
|
||||
ci->EraseAccess(i - 1);
|
||||
FOREACH_MOD(OnAccessDel, (ci, source, access));
|
||||
@@ -381,7 +380,7 @@ class CommandCSAccess : public Command
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Number"] = stringify(number);
|
||||
entry["Level"] = access->AccessSerialize();
|
||||
entry["Mask"] = access->mask;
|
||||
entry["Mask"] = access->Mask();
|
||||
entry["By"] = access->creator;
|
||||
entry["Last seen"] = timebuf;
|
||||
this->list.AddEntry(entry);
|
||||
@@ -396,7 +395,7 @@ class CommandCSAccess : public Command
|
||||
{
|
||||
const ChanAccess *access = ci->GetAccess(i);
|
||||
|
||||
if (!nick.empty() && !Anope::Match(access->mask, nick))
|
||||
if (!nick.empty() && !Anope::Match(access->Mask(), nick))
|
||||
continue;
|
||||
|
||||
Anope::string timebuf;
|
||||
@@ -418,7 +417,7 @@ class CommandCSAccess : public Command
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Number"] = stringify(i + 1);
|
||||
entry["Level"] = access->AccessSerialize();
|
||||
entry["Mask"] = access->mask;
|
||||
entry["Mask"] = access->Mask();
|
||||
entry["By"] = access->creator;
|
||||
entry["Last seen"] = timebuf;
|
||||
list.AddEntry(entry);
|
||||
|
||||
+28
-19
@@ -19,15 +19,16 @@ class TempBan : public Timer
|
||||
private:
|
||||
Anope::string channel;
|
||||
Anope::string mask;
|
||||
Anope::string mode;
|
||||
|
||||
public:
|
||||
TempBan(time_t seconds, Channel *c, const Anope::string &banmask) : Timer(me, seconds), channel(c->name), mask(banmask) { }
|
||||
TempBan(time_t seconds, Channel *c, const Anope::string &banmask, const Anope::string &mod) : Timer(me, seconds), channel(c->name), mask(banmask), mode(mod) { }
|
||||
|
||||
void Tick(time_t ctime) anope_override
|
||||
{
|
||||
Channel *c = Channel::Find(this->channel);
|
||||
if (c)
|
||||
c->RemoveMode(NULL, "BAN", this->mask);
|
||||
c->RemoveMode(NULL, mode, this->mask);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,6 +44,8 @@ class CommandCSBan : public Command
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
Configuration::Block *block = Config->GetCommand(source);
|
||||
const Anope::string &mode = block->Get<Anope::string>("mode", "BAN");
|
||||
|
||||
ChannelInfo *ci = ChannelInfo::Find(chan);
|
||||
if (ci == NULL)
|
||||
@@ -57,9 +60,9 @@ class CommandCSBan : public Command
|
||||
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
|
||||
return;
|
||||
}
|
||||
else if (IRCD->GetMaxListFor(c) && c->HasMode("BAN") >= IRCD->GetMaxListFor(c))
|
||||
else if (IRCD->GetMaxListFor(c) && c->HasMode(mode) >= IRCD->GetMaxListFor(c))
|
||||
{
|
||||
source.Reply(_("The ban list for %s is full."), c->name.c_str());
|
||||
source.Reply(_("The %s list for %s is full."), mode.lower().c_str(), c->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -126,12 +129,12 @@ class CommandCSBan : public Command
|
||||
bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask;
|
||||
|
||||
if (!c->HasMode("BAN", mask))
|
||||
if (!c->HasMode(mode, mask))
|
||||
{
|
||||
c->SetMode(NULL, "BAN", mask);
|
||||
c->SetMode(NULL, mode, mask);
|
||||
if (ban_time)
|
||||
{
|
||||
new TempBan(ban_time, c, mask);
|
||||
new TempBan(ban_time, c, mask, mode);
|
||||
source.Reply(_("Ban on \002%s\002 expires in %s."), mask.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str());
|
||||
}
|
||||
}
|
||||
@@ -140,10 +143,13 @@ class CommandCSBan : public Command
|
||||
if (!c->FindUser(u2))
|
||||
return;
|
||||
|
||||
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
|
||||
if (block->Get<bool>("kick", "yes"))
|
||||
{
|
||||
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -152,12 +158,12 @@ class CommandCSBan : public Command
|
||||
bool override = !founder && !u_access.HasPriv("BAN");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << target;
|
||||
|
||||
if (!c->HasMode("BAN", target))
|
||||
if (!c->HasMode(mode, target))
|
||||
{
|
||||
c->SetMode(NULL, "BAN", target);
|
||||
c->SetMode(NULL, mode, target);
|
||||
if (ban_time)
|
||||
{
|
||||
new TempBan(ban_time, c, target);
|
||||
new TempBan(ban_time, c, target, mode);
|
||||
source.Reply(_("Ban on \002%s\002 expires in %s."), target.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str());
|
||||
}
|
||||
}
|
||||
@@ -183,11 +189,14 @@ class CommandCSBan : public Command
|
||||
else if (uc->user->IsProtected())
|
||||
continue;
|
||||
|
||||
++kicked;
|
||||
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
|
||||
if (block->Get<bool>("kick", "yes"))
|
||||
{
|
||||
++kicked;
|
||||
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,13 @@ public:
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, target.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (ci == target_ci)
|
||||
{
|
||||
source.Reply(_("Cannot clone channel \002%s\002 to itself!"), target.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source.IsFounder(ci) || !source.IsFounder(target_ci))
|
||||
{
|
||||
if (!source.HasPriv("chanserv/administration"))
|
||||
@@ -104,7 +111,7 @@ public:
|
||||
unsigned count = 0;
|
||||
|
||||
for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i)
|
||||
masks.insert(target_ci->GetAccess(i)->mask);
|
||||
masks.insert(target_ci->GetAccess(i)->Mask());
|
||||
|
||||
for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
|
||||
{
|
||||
@@ -114,13 +121,12 @@ public:
|
||||
if (access_max && target_ci->GetDeepAccessCount() >= access_max)
|
||||
break;
|
||||
|
||||
if (masks.count(taccess->mask))
|
||||
if (masks.count(taccess->Mask()))
|
||||
continue;
|
||||
masks.insert(taccess->mask);
|
||||
masks.insert(taccess->Mask());
|
||||
|
||||
ChanAccess *newaccess = provider->Create();
|
||||
newaccess->ci = target_ci;
|
||||
newaccess->mask = taccess->mask;
|
||||
newaccess->SetMask(taccess->Mask(), target_ci);
|
||||
newaccess->creator = taccess->creator;
|
||||
newaccess->last_seen = taccess->last_seen;
|
||||
newaccess->created = taccess->created;
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/cs_entrymsg.h"
|
||||
|
||||
struct EntryMsg : Serializable
|
||||
struct EntryMsgImpl : EntryMsg, Serializable
|
||||
{
|
||||
Serialize::Reference<ChannelInfo> ci;
|
||||
Anope::string creator;
|
||||
Anope::string message;
|
||||
time_t when;
|
||||
|
||||
EntryMsg(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) : Serializable("EntryMsg")
|
||||
EntryMsgImpl() : Serializable("EntryMsg")
|
||||
{
|
||||
this->ci = c;
|
||||
}
|
||||
|
||||
EntryMsgImpl(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) : Serializable("EntryMsg")
|
||||
{
|
||||
this->chan = c->name;
|
||||
this->creator = cname;
|
||||
this->message = cmessage;
|
||||
this->when = ct;
|
||||
}
|
||||
|
||||
~EntryMsg();
|
||||
~EntryMsgImpl();
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override
|
||||
{
|
||||
data["ci"] << this->ci->name;
|
||||
data["ci"] << this->chan;
|
||||
data["creator"] << this->creator;
|
||||
data["message"] << this->message;
|
||||
data.SetType("when", Serialize::Data::DT_INT); data["when"] << this->when;
|
||||
@@ -39,30 +39,33 @@ struct EntryMsg : Serializable
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
};
|
||||
|
||||
struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
|
||||
struct EntryMessageListImpl : EntryMessageList
|
||||
{
|
||||
EntryMessageList(Extensible *) : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { }
|
||||
EntryMessageListImpl(Extensible *) { }
|
||||
|
||||
~EntryMessageList()
|
||||
EntryMsg* Create() anope_override
|
||||
{
|
||||
for (unsigned i = (*this)->size(); i > 0; --i)
|
||||
delete (*this)->at(i - 1);
|
||||
return new EntryMsgImpl();
|
||||
}
|
||||
};
|
||||
|
||||
EntryMsg::~EntryMsg()
|
||||
EntryMsgImpl::~EntryMsgImpl()
|
||||
{
|
||||
ChannelInfo *ci = ChannelInfo::Find(this->chan);
|
||||
if (!ci)
|
||||
return;
|
||||
|
||||
EntryMessageList *messages = ci->GetExt<EntryMessageList>("entrymsg");
|
||||
if (messages)
|
||||
{
|
||||
std::vector<EntryMsg *>::iterator it = std::find((*messages)->begin(), (*messages)->end(), this);
|
||||
if (it != (*messages)->end())
|
||||
(*messages)->erase(it);
|
||||
}
|
||||
if (!messages)
|
||||
return;
|
||||
|
||||
std::vector<EntryMsg *>::iterator it = std::find((*messages)->begin(), (*messages)->end(), this);
|
||||
if (it != (*messages)->end())
|
||||
(*messages)->erase(it);
|
||||
}
|
||||
|
||||
|
||||
Serializable* EntryMsg::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
Serializable* EntryMsgImpl::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
Anope::string sci, screator, smessage;
|
||||
time_t swhen;
|
||||
@@ -77,8 +80,8 @@ Serializable* EntryMsg::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
if (obj)
|
||||
{
|
||||
EntryMsg *msg = anope_dynamic_static_cast<EntryMsg *>(obj);
|
||||
msg->ci = ci;
|
||||
EntryMsgImpl *msg = anope_dynamic_static_cast<EntryMsgImpl *>(obj);
|
||||
msg->chan = ci->name;
|
||||
data["creator"] >> msg->creator;
|
||||
data["message"] >> msg->message;
|
||||
data["when"] >> msg->when;
|
||||
@@ -89,7 +92,7 @@ Serializable* EntryMsg::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
data["when"] >> swhen;
|
||||
|
||||
EntryMsg *m = new EntryMsg(ci, screator, smessage, swhen);
|
||||
EntryMsgImpl *m = new EntryMsgImpl(ci, screator, smessage, swhen);
|
||||
(*messages)->push_back(m);
|
||||
return m;
|
||||
}
|
||||
@@ -139,7 +142,7 @@ class CommandEntryMessage : public Command
|
||||
source.Reply(_("The entry message list for \002%s\002 is full."), ci->name.c_str());
|
||||
else
|
||||
{
|
||||
(*messages)->push_back(new EntryMsg(ci, source.GetNick(), message));
|
||||
(*messages)->push_back(new EntryMsgImpl(ci, source.GetNick(), message));
|
||||
Log(source.IsFounder(ci) ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to add a message";
|
||||
source.Reply(_("Entry message added to \002%s\002"), ci->name.c_str());
|
||||
}
|
||||
@@ -257,13 +260,13 @@ class CommandEntryMessage : public Command
|
||||
class CSEntryMessage : public Module
|
||||
{
|
||||
CommandEntryMessage commandentrymsg;
|
||||
ExtensibleItem<EntryMessageList> eml;
|
||||
ExtensibleItem<EntryMessageListImpl> eml;
|
||||
Serialize::Type entrymsg_type;
|
||||
|
||||
public:
|
||||
CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandentrymsg(this),
|
||||
eml(this, "entrymsg"), entrymsg_type("EntryMsg", EntryMsg::Unserialize)
|
||||
eml(this, "entrymsg"), entrymsg_type("EntryMsg", EntryMsgImpl::Unserialize)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ class CommandCSFlags : public Command
|
||||
for (current_idx = ci->GetAccessCount(); current_idx > 0; --current_idx)
|
||||
{
|
||||
ChanAccess *access = ci->GetAccess(current_idx - 1);
|
||||
if (mask.equals_ci(access->mask))
|
||||
if (mask.equals_ci(access->Mask()))
|
||||
{
|
||||
// Flags allows removing others that have the same access as you,
|
||||
// but no other access system does.
|
||||
@@ -175,21 +175,26 @@ class CommandCSFlags : public Command
|
||||
}
|
||||
|
||||
Privilege *p = NULL;
|
||||
int add = 1;
|
||||
bool add = true;
|
||||
for (size_t i = 0; i < flags.length(); ++i)
|
||||
{
|
||||
char f = flags[i];
|
||||
switch (f)
|
||||
{
|
||||
case '+':
|
||||
add = 1;
|
||||
add = true;
|
||||
break;
|
||||
case '-':
|
||||
add = 0;
|
||||
add = false;
|
||||
break;
|
||||
case '*':
|
||||
for (std::map<Anope::string, char>::iterator it = defaultFlags.begin(), it_end = defaultFlags.end(); it != it_end; ++it)
|
||||
{
|
||||
bool has = current_flags.count(it->second);
|
||||
// If we are adding a flag they already have or removing one they don't have, don't bother
|
||||
if (add == has)
|
||||
continue;
|
||||
|
||||
if (!u_access.HasPriv(it->first) && !u_access.founder)
|
||||
{
|
||||
if (source.HasPriv("chanserv/access/modify"))
|
||||
@@ -197,9 +202,10 @@ class CommandCSFlags : public Command
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (add == 1)
|
||||
|
||||
if (add)
|
||||
current_flags.insert(it->second);
|
||||
else if (add == 0)
|
||||
else
|
||||
current_flags.erase(it->second);
|
||||
}
|
||||
break;
|
||||
@@ -225,9 +231,9 @@ class CommandCSFlags : public Command
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (add == 1)
|
||||
if (add)
|
||||
current_flags.insert(f);
|
||||
else if (add == 0)
|
||||
else
|
||||
current_flags.erase(f);
|
||||
break;
|
||||
}
|
||||
@@ -254,8 +260,7 @@ class CommandCSFlags : public Command
|
||||
if (!provider)
|
||||
return;
|
||||
FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
|
||||
access->ci = ci;
|
||||
access->mask = mask;
|
||||
access->SetMask(mask, ci);
|
||||
access->creator = source.GetNick();
|
||||
access->last_seen = current ? current->last_seen : 0;
|
||||
access->created = Anope::CurTime;
|
||||
@@ -272,12 +277,12 @@ class CommandCSFlags : public Command
|
||||
if (p != NULL)
|
||||
{
|
||||
if (add)
|
||||
source.Reply(_("Privilege \002%s\002 added to \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
|
||||
source.Reply(_("Privilege \002%s\002 added to \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
|
||||
else
|
||||
source.Reply(_("Privilege \002%s\002 removed from \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
|
||||
source.Reply(_("Privilege \002%s\002 removed from \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
|
||||
}
|
||||
else
|
||||
source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
|
||||
source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
|
||||
}
|
||||
|
||||
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
@@ -311,14 +316,14 @@ class CommandCSFlags : public Command
|
||||
if (pass == false)
|
||||
continue;
|
||||
}
|
||||
else if (!Anope::Match(access->mask, arg))
|
||||
else if (!Anope::Match(access->Mask(), arg))
|
||||
continue;
|
||||
}
|
||||
|
||||
ListFormatter::ListEntry entry;
|
||||
++count;
|
||||
entry["Number"] = stringify(i + 1);
|
||||
entry["Mask"] = access->mask;
|
||||
entry["Mask"] = access->Mask();
|
||||
entry["Flags"] = flags;
|
||||
entry["Creator"] = access->creator;
|
||||
entry["Created"] = Anope::strftime(access->created, source.nc, true);
|
||||
|
||||
@@ -73,13 +73,14 @@ class CommandCSInvite : public Command
|
||||
if (u2 != u)
|
||||
{
|
||||
source.Reply(_("\002%s\002 has been invited to \002%s\002."), u2->nick.c_str(), c->name.c_str());
|
||||
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002 by \002%s\002."), c->name.c_str(), source.GetNick().c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick;
|
||||
}
|
||||
else
|
||||
{
|
||||
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002."), c->name.c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci);
|
||||
}
|
||||
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002."), c->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/cs_mode.h"
|
||||
|
||||
class CommandCSList : public Command
|
||||
{
|
||||
@@ -58,7 +59,7 @@ class CommandCSList : public Command
|
||||
spacesepstream keywords(params[1]);
|
||||
while (keywords.GetToken(keyword))
|
||||
{
|
||||
if (keyword.equals_ci("CS_SUSPENDED"))
|
||||
if (keyword.equals_ci("SUSPENDED"))
|
||||
suspended = true;
|
||||
if (keyword.equals_ci("NOEXPIRE"))
|
||||
channoexpire = true;
|
||||
@@ -87,6 +88,11 @@ class CommandCSList : public Command
|
||||
continue;
|
||||
if (ci->c && ci->c->HasMode("SECRET"))
|
||||
continue;
|
||||
|
||||
ModeLocks *ml = ci->GetExt<ModeLocks>("modelocks");
|
||||
const ModeLock *secret = ml ? ml->GetMLock("SECRET") : NULL;
|
||||
if (secret && secret->set)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (suspended && !ci->HasExt("CS_SUSPENDED"))
|
||||
@@ -95,7 +101,7 @@ class CommandCSList : public Command
|
||||
if (channoexpire && !ci->HasExt("CS_NO_EXPIRE"))
|
||||
continue;
|
||||
|
||||
if (pattern.equals_ci(ci->name) || ci->name.equals_ci(spattern) || Anope::Match(ci->name, pattern, false, true) || Anope::Match(ci->name, spattern, false, true))
|
||||
if (pattern.equals_ci(ci->name) || ci->name.equals_ci(spattern) || Anope::Match(ci->name, pattern, false, true) || Anope::Match(ci->name, spattern, false, true) || Anope::Match(ci->desc, pattern, false, true) || Anope::Match(ci->last_topic, pattern, false, true))
|
||||
{
|
||||
if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nchans <= listmax)
|
||||
{
|
||||
|
||||
@@ -488,8 +488,7 @@ class CommandCSMode : public Command
|
||||
for (unsigned j = 0; j < ModeManager::GetChannelModes().size(); ++j)
|
||||
{
|
||||
ChannelMode *cm = ModeManager::GetChannelModes()[j];
|
||||
if (!cm)
|
||||
continue;
|
||||
|
||||
if (!u || cm->CanSet(u) || can_override)
|
||||
{
|
||||
if (cm->type == MODE_REGULAR || (!adding && cm->type == MODE_PARAM))
|
||||
@@ -640,26 +639,37 @@ class CommandCSMode : public Command
|
||||
new_params.push_back("SET");
|
||||
new_params.push_back("-*");
|
||||
this->DoSet(source, ci, new_params);
|
||||
return;
|
||||
}
|
||||
else if (param.equals_ci("BANS") || param.equals_ci("EXEMPTS") || param.equals_ci("INVITEOVERRIDES") || param.equals_ci("VOICES") || param.equals_ci("HALFOPS") || param.equals_ci("OPS"))
|
||||
{
|
||||
const Anope::string &mname = param.upper().substr(0, param.length() - 1);
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName(mname);
|
||||
if (cm == NULL)
|
||||
{
|
||||
source.Reply(_("Your IRCD does not support %s."), mname.upper().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Anope::string> new_params;
|
||||
new_params.push_back(params[0]);
|
||||
new_params.push_back("SET");
|
||||
new_params.push_back("-" + stringify(cm->mchar));
|
||||
new_params.push_back("*");
|
||||
this->DoSet(source, ci, new_params);
|
||||
}
|
||||
ChannelMode *cm;
|
||||
if (param.length() == 1)
|
||||
cm = ModeManager::FindChannelModeByChar(param[0]);
|
||||
else
|
||||
this->SendSyntax(source);
|
||||
{
|
||||
cm = ModeManager::FindChannelModeByName(param.upper());
|
||||
if (!cm)
|
||||
cm = ModeManager::FindChannelModeByName(param.substr(0, param.length() - 1).upper());
|
||||
}
|
||||
|
||||
if (!cm)
|
||||
{
|
||||
source.Reply(_("There is no such mode %s."), param.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (cm->type != MODE_STATUS && cm->type != MODE_LIST)
|
||||
{
|
||||
source.Reply(_("Mode %s is not a status or list mode."), param.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Anope::string> new_params;
|
||||
new_params.push_back(params[0]);
|
||||
new_params.push_back("SET");
|
||||
new_params.push_back("-" + stringify(cm->mchar));
|
||||
new_params.push_back("*");
|
||||
this->DoSet(source, ci, new_params);
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -725,8 +735,8 @@ class CommandCSMode : public Command
|
||||
" Clears all extended bans that start with ~c:\n"
|
||||
" \n"
|
||||
"The \002%s CLEAR\002 command is an easy way to clear modes on a channel. \037what\037 may be\n"
|
||||
"one of bans, exempts, inviteoverrides, ops, halfops, or voices. If \037what\037 is not given then all\n"
|
||||
"basic modes are removed."),
|
||||
"any mode name. Examples include bans, excepts, inviteoverrides, ops, halfops, and voices. If \037what\037\n"
|
||||
"is not given then all basic modes are removed."),
|
||||
source.command.upper().c_str(), source.command.upper().c_str(), source.command.upper().c_str());
|
||||
return true;
|
||||
}
|
||||
@@ -891,9 +901,9 @@ class CSMode : public Module
|
||||
}
|
||||
}
|
||||
|
||||
void OnCheckModes(Channel *c) anope_override
|
||||
void OnCheckModes(Reference<Channel> &c) anope_override
|
||||
{
|
||||
if (!c->ci)
|
||||
if (!c || !c->ci)
|
||||
return;
|
||||
|
||||
ModeLocks *locks = modelocks.Get(c->ci);
|
||||
@@ -908,9 +918,9 @@ class CSMode : public Module
|
||||
if (cm->type == MODE_REGULAR)
|
||||
{
|
||||
if (!c->HasMode(cm->name) && ml->set)
|
||||
c->SetMode(NULL, cm);
|
||||
c->SetMode(NULL, cm, "", false);
|
||||
else if (c->HasMode(cm->name) && !ml->set)
|
||||
c->RemoveMode(NULL, cm);
|
||||
c->RemoveMode(NULL, cm, "", false);
|
||||
}
|
||||
else if (cm->type == MODE_PARAM)
|
||||
{
|
||||
@@ -921,26 +931,26 @@ class CSMode : public Module
|
||||
c->GetParam(cm->name, param);
|
||||
|
||||
if (!c->HasMode(cm->name) || (!param.empty() && !ml->param.empty() && !param.equals_cs(ml->param)))
|
||||
c->SetMode(NULL, cm, ml->param);
|
||||
c->SetMode(NULL, cm, ml->param, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (c->HasMode(cm->name))
|
||||
c->RemoveMode(NULL, cm);
|
||||
c->RemoveMode(NULL, cm, "", false);
|
||||
}
|
||||
|
||||
}
|
||||
else if (cm->type == MODE_LIST || cm->type == MODE_STATUS)
|
||||
{
|
||||
if (ml->set)
|
||||
c->SetMode(NULL, cm, ml->param);
|
||||
c->SetMode(NULL, cm, ml->param, false);
|
||||
else
|
||||
c->RemoveMode(NULL, cm, ml->param);
|
||||
c->RemoveMode(NULL, cm, ml->param, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnCreateChan(ChannelInfo *ci) anope_override
|
||||
void OnChanRegistered(ChannelInfo *ci) anope_override
|
||||
{
|
||||
ModeLocks *ml = modelocks.Require(ci);
|
||||
Anope::string mlock;
|
||||
|
||||
@@ -241,7 +241,7 @@ class CommandSeen : public Command
|
||||
{
|
||||
ChanAccess *a = ag[i];
|
||||
|
||||
if (*a->nc == na->nc && a->last_seen > last)
|
||||
if (a->GetAccount() == na->nc && a->last_seen > last)
|
||||
last = a->last_seen;
|
||||
}
|
||||
|
||||
|
||||
+20
-16
@@ -1163,18 +1163,27 @@ class CSSet : public Module
|
||||
return;
|
||||
|
||||
bool created;
|
||||
Channel *c = Channel::FindOrCreate(ci->name, created, ci->time_registered);
|
||||
if (!ci->bi)
|
||||
{
|
||||
BotInfo *ChanServ = Config->GetClient("ChanServ");
|
||||
if (ChanServ)
|
||||
ChanServ->Assign(NULL, ci);
|
||||
}
|
||||
Channel *c = Channel::FindOrCreate(ci->name, created);
|
||||
|
||||
if (ci->bi && !c->FindUser(ci->bi))
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName("PERM");
|
||||
if (cm)
|
||||
{
|
||||
ChannelStatus status(BotModes());
|
||||
ci->bi->Join(c, &status);
|
||||
c->SetMode(NULL, cm);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ci->bi)
|
||||
{
|
||||
BotInfo *ChanServ = Config->GetClient("ChanServ");
|
||||
if (ChanServ)
|
||||
ChanServ->Assign(NULL, ci);
|
||||
}
|
||||
|
||||
if (ci->bi && !c->FindUser(ci->bi))
|
||||
{
|
||||
ChannelStatus status(BotModes());
|
||||
ci->bi->Join(c, &status);
|
||||
}
|
||||
}
|
||||
|
||||
if (created)
|
||||
@@ -1280,12 +1289,6 @@ class CSSet : public Module
|
||||
{
|
||||
if (c->ci)
|
||||
persist.Unset(c->ci);
|
||||
|
||||
if (c->CheckDelete())
|
||||
{
|
||||
delete c;
|
||||
return EVENT_STOP;
|
||||
}
|
||||
}
|
||||
|
||||
if (c->ci && mode->type != MODE_STATUS && !c->syncing && Me->IsSynced())
|
||||
@@ -1319,6 +1322,7 @@ class CSSet : public Module
|
||||
if (noautoop.HasExt(chan->ci))
|
||||
give_modes = false;
|
||||
if (secureops.HasExt(chan->ci))
|
||||
// This overrides what chanserv does because it is loaded after chanserv
|
||||
take_modes = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,32 +9,41 @@
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/set_misc.h"
|
||||
|
||||
static Module *me;
|
||||
|
||||
static std::map<Anope::string, Anope::string> descriptions;
|
||||
static Anope::map<Anope::string> descriptions;
|
||||
|
||||
struct CSMiscData;
|
||||
static Anope::map<ExtensibleItem<CSMiscData> *> items;
|
||||
static ExtensibleItem<CSMiscData> *GetItem(const Anope::string &name);
|
||||
|
||||
struct CSMiscData : Serializable
|
||||
static ExtensibleItem<CSMiscData> *GetItem(const Anope::string &name)
|
||||
{
|
||||
Serialize::Reference<ChannelInfo> ci;
|
||||
Anope::string name;
|
||||
Anope::string data;
|
||||
ExtensibleItem<CSMiscData>* &it = items[name];
|
||||
if (!it)
|
||||
try
|
||||
{
|
||||
it = new ExtensibleItem<CSMiscData>(me, name);
|
||||
}
|
||||
catch (const ModuleException &) { }
|
||||
return it;
|
||||
}
|
||||
|
||||
CSMiscData(Extensible *obj) : Serializable("CSMiscData"), ci(anope_dynamic_static_cast<ChannelInfo *>(obj))
|
||||
{
|
||||
}
|
||||
struct CSMiscData : MiscData, Serializable
|
||||
{
|
||||
CSMiscData(Extensible *obj) : Serializable("CSMiscData") { }
|
||||
|
||||
CSMiscData(ChannelInfo *c, const Anope::string &n, const Anope::string &d) : Serializable("CSMiscData"), ci(c), name(n), data(d)
|
||||
CSMiscData(ChannelInfo *c, const Anope::string &n, const Anope::string &d) : Serializable("CSMiscData")
|
||||
{
|
||||
object = c->name;
|
||||
name = n;
|
||||
data = d;
|
||||
}
|
||||
|
||||
void Serialize(Serialize::Data &sdata) const anope_override
|
||||
{
|
||||
sdata["ci"] << this->ci->name;
|
||||
sdata["ci"] << this->object;
|
||||
sdata["name"] << this->name;
|
||||
sdata["data"] << this->data;
|
||||
}
|
||||
@@ -55,7 +64,7 @@ struct CSMiscData : Serializable
|
||||
if (obj)
|
||||
{
|
||||
d = anope_dynamic_static_cast<CSMiscData *>(obj);
|
||||
d->ci = ci;
|
||||
d->object = ci->name;
|
||||
data["name"] >> d->name;
|
||||
data["data"] >> d->data;
|
||||
}
|
||||
@@ -70,18 +79,6 @@ struct CSMiscData : Serializable
|
||||
}
|
||||
};
|
||||
|
||||
static ExtensibleItem<CSMiscData> *GetItem(const Anope::string &name)
|
||||
{
|
||||
ExtensibleItem<CSMiscData>* &it = items[name];
|
||||
if (!it)
|
||||
try
|
||||
{
|
||||
it = new ExtensibleItem<CSMiscData>(me, name);
|
||||
}
|
||||
catch (const ModuleException &) { }
|
||||
return it;
|
||||
}
|
||||
|
||||
static Anope::string GetAttribute(const Anope::string &command)
|
||||
{
|
||||
size_t sp = command.rfind(' ');
|
||||
@@ -119,7 +116,7 @@ class CommandCSSetMisc : public Command
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -134,11 +131,13 @@ class CommandCSSetMisc : public Command
|
||||
if (!param.empty())
|
||||
{
|
||||
item->Set(ci, CSMiscData(ci, key, param));
|
||||
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change it to " << param;
|
||||
source.Reply(CHAN_SETTING_CHANGED, scommand.c_str(), ci->name.c_str(), params[1].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
item->Unset(ci);
|
||||
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to unset it";
|
||||
source.Reply(CHAN_SETTING_UNSET, scommand.c_str(), ci->name.c_str());
|
||||
}
|
||||
}
|
||||
@@ -165,16 +164,22 @@ class CommandCSSetMisc : public Command
|
||||
|
||||
class CSSetMisc : public Module
|
||||
{
|
||||
Serialize::Type csmiscdata_type;
|
||||
CommandCSSetMisc commandcssetmisc;
|
||||
Serialize::Type csmiscdata_type;
|
||||
|
||||
public:
|
||||
CSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
csmiscdata_type("CSMiscData", CSMiscData::Unserialize), commandcssetmisc(this)
|
||||
commandcssetmisc(this), csmiscdata_type("CSMiscData", CSMiscData::Unserialize)
|
||||
{
|
||||
me = this;
|
||||
}
|
||||
|
||||
~CSSetMisc()
|
||||
{
|
||||
for (Anope::map<ExtensibleItem<CSMiscData> *>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) anope_override
|
||||
{
|
||||
descriptions.clear();
|
||||
@@ -201,7 +206,7 @@ class CSSetMisc : public Module
|
||||
for (Anope::map<ExtensibleItem<CSMiscData> *>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
{
|
||||
ExtensibleItem<CSMiscData> *e = it->second;
|
||||
CSMiscData *data = e->Get(ci);
|
||||
MiscData *data = e->Get(ci);
|
||||
|
||||
if (data != NULL)
|
||||
info[e->name.substr(12).replace_all_cs("_", " ")] = data->data;
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
{
|
||||
ChanAccess *acc = ag[i];
|
||||
|
||||
source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->mask.c_str(), acc->AccessSerialize().c_str());
|
||||
source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->Mask().c_str(), acc->AccessSerialize().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/cs_suspend.h"
|
||||
#include "modules/suspend.h"
|
||||
|
||||
struct CSSuspendInfoImpl : CSSuspendInfo, Serializable
|
||||
struct CSSuspendInfo : SuspendInfo, Serializable
|
||||
{
|
||||
CSSuspendInfoImpl(Extensible *) : Serializable("CSSuspendInfo") { }
|
||||
CSSuspendInfo(Extensible *) : Serializable("CSSuspendInfo") { }
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override
|
||||
{
|
||||
data["chan"] << chan;
|
||||
data["chan"] << what;
|
||||
data["by"] << by;
|
||||
data["reason"] << reason;
|
||||
data["time"] << time;
|
||||
data["time"] << when;
|
||||
data["expires"] << expires;
|
||||
}
|
||||
|
||||
@@ -30,21 +30,21 @@ struct CSSuspendInfoImpl : CSSuspendInfo, Serializable
|
||||
Anope::string schan;
|
||||
data["chan"] >> schan;
|
||||
|
||||
CSSuspendInfoImpl *si;
|
||||
CSSuspendInfo *si;
|
||||
if (obj)
|
||||
si = anope_dynamic_static_cast<CSSuspendInfoImpl *>(obj);
|
||||
si = anope_dynamic_static_cast<CSSuspendInfo *>(obj);
|
||||
else
|
||||
{
|
||||
ChannelInfo *ci = ChannelInfo::Find(schan);
|
||||
if (!ci)
|
||||
return NULL;
|
||||
si = ci->Extend<CSSuspendInfoImpl>("CS_SUSPENDED");
|
||||
data["chan"] >> si->chan;
|
||||
si = ci->Extend<CSSuspendInfo>("CS_SUSPENDED");
|
||||
data["chan"] >> si->what;
|
||||
}
|
||||
|
||||
data["by"] >> si->by;
|
||||
data["reason"] >> si->reason;
|
||||
data["time"] >> si->time;
|
||||
data["time"] >> si->when;
|
||||
data["expires"] >> si->expires;
|
||||
return si;
|
||||
}
|
||||
@@ -99,10 +99,10 @@ class CommandCSSuspend : public Command
|
||||
}
|
||||
|
||||
CSSuspendInfo *si = ci->Extend<CSSuspendInfo>("CS_SUSPENDED");
|
||||
si->chan = ci->name;
|
||||
si->what = ci->name;
|
||||
si->by = source.GetNick();
|
||||
si->reason = reason;
|
||||
si->time = Anope::CurTime;
|
||||
si->when = Anope::CurTime;
|
||||
si->expires = expiry_secs ? expiry_secs + Anope::CurTime : 0;
|
||||
|
||||
if (ci->c)
|
||||
@@ -121,7 +121,7 @@ class CommandCSSuspend : public Command
|
||||
ci->c->Kick(NULL, users[i], "%s", !reason.empty() ? reason.c_str() : Language::Translate(users[i], _("This channel has been suspended.")));
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, source, this, ci) << " (" << (!reason.empty() ? reason : "No reason") << "), expires on " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
Log(LOG_ADMIN, source, this, ci) << "(" << (!reason.empty() ? reason : "No reason") << "), expires on " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
source.Reply(_("Channel \002%s\002 is now suspended."), ci->name.c_str());
|
||||
|
||||
FOREACH_MOD(OnChanSuspend, (ci));
|
||||
@@ -173,7 +173,7 @@ class CommandCSUnSuspend : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, source, this, ci) << " which was suspended by " << si->by << " for: " << (!si->reason.empty() ? si->reason : "No reason");
|
||||
Log(LOG_ADMIN, source, this, ci) << "which was suspended by " << si->by << " for: " << (!si->reason.empty() ? si->reason : "No reason");
|
||||
|
||||
ci->Shrink<CSSuspendInfo>("CS_SUSPENDED");
|
||||
|
||||
@@ -198,31 +198,46 @@ class CSSuspend : public Module
|
||||
{
|
||||
CommandCSSuspend commandcssuspend;
|
||||
CommandCSUnSuspend commandcsunsuspend;
|
||||
ExtensibleItem<CSSuspendInfoImpl> suspend;
|
||||
ExtensibleItem<CSSuspendInfo> suspend;
|
||||
Serialize::Type suspend_type;
|
||||
std::vector<Anope::string> show;
|
||||
|
||||
struct trim
|
||||
{
|
||||
Anope::string operator()(Anope::string s) const
|
||||
{
|
||||
return s.trim();
|
||||
}
|
||||
};
|
||||
|
||||
bool Show(CommandSource &source, const Anope::string &what) const
|
||||
{
|
||||
return source.IsOper() || std::find(show.begin(), show.end(), what) != show.end();
|
||||
}
|
||||
|
||||
public:
|
||||
CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandcssuspend(this), commandcsunsuspend(this), suspend(this, "CS_SUSPENDED"),
|
||||
suspend_type("CSSuspendInfo", CSSuspendInfoImpl::Unserialize)
|
||||
suspend_type("CSSuspendInfo", CSSuspendInfo::Unserialize)
|
||||
{
|
||||
}
|
||||
|
||||
void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) anope_override
|
||||
{
|
||||
CSSuspendInfo *si = suspend.Get(ci);
|
||||
if (si)
|
||||
{
|
||||
if (!si)
|
||||
return;
|
||||
|
||||
if (show_hidden || Show(source, "suspended"))
|
||||
info[_("Suspended")] = _("This channel is \002suspended\002.");
|
||||
if (!si->by.empty())
|
||||
info[_("Suspended by")] = si->by;
|
||||
if (!si->reason.empty())
|
||||
info[_("Suspend reason")] = si->reason;
|
||||
if (si->time)
|
||||
info[_("Suspended on")] = Anope::strftime(si->time, source.GetAccount(), true);
|
||||
if (si->expires)
|
||||
info[_("Suspension expires")] = Anope::strftime(si->expires, source.GetAccount(), true);
|
||||
}
|
||||
if (!si->by.empty() && (show_hidden || Show(source, "by")))
|
||||
info[_("Suspended by")] = si->by;
|
||||
if (!si->reason.empty() && (show_hidden || Show(source, "reason")))
|
||||
info[_("Suspend reason")] = si->reason;
|
||||
if (si->when && (show_hidden || Show(source, "on")))
|
||||
info[_("Suspended on")] = Anope::strftime(si->when, source.GetAccount(), true);
|
||||
if (si->expires && (show_hidden || Show(source, "expires")))
|
||||
info[_("Suspension expires")] = Anope::strftime(si->expires, source.GetAccount(), true);
|
||||
}
|
||||
|
||||
void OnPreChanExpire(ChannelInfo *ci, bool &expire) anope_override
|
||||
|
||||
@@ -22,6 +22,13 @@ class CommandCSUnban : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName("BAN");
|
||||
if (!cm)
|
||||
return;
|
||||
|
||||
std::vector<ChannelMode *> modes = cm->listeners;
|
||||
modes.push_back(cm);
|
||||
|
||||
if (params.empty())
|
||||
{
|
||||
if (!source.GetUser())
|
||||
@@ -38,8 +45,9 @@ class CommandCSUnban : public Command
|
||||
if (!ci->c || !source.AccessFor(ci).HasPriv("UNBAN"))
|
||||
continue;
|
||||
|
||||
if (ci->c->Unban(source.GetUser(), true))
|
||||
++count;
|
||||
for (unsigned j = 0; j < modes.size(); ++j)
|
||||
if (ci->c->Unban(source.GetUser(), modes[j]->name, true))
|
||||
++count;
|
||||
}
|
||||
|
||||
Log(LOG_COMMAND, source, this, NULL) << "on all channels";
|
||||
@@ -80,7 +88,8 @@ class CommandCSUnban : public Command
|
||||
bool override = !source.AccessFor(ci).HasPriv("UNBAN") && source.HasPriv("chanserv/kick");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unban " << u2->nick;
|
||||
|
||||
ci->c->Unban(u2, source.GetUser() == u2);
|
||||
for (unsigned i = 0; i < modes.size(); ++i)
|
||||
ci->c->Unban(u2, modes[i]->name, source.GetUser() == u2);
|
||||
if (u2 == source.GetUser())
|
||||
source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str());
|
||||
else
|
||||
|
||||
@@ -130,8 +130,8 @@ class CommandCSDown : public Command
|
||||
{
|
||||
ChanUserContainer *cu = c->FindUser(u);
|
||||
if (cu != NULL)
|
||||
for (size_t i = 0; i < cu->status.Modes().length(); ++i)
|
||||
c->RemoveMode(NULL, ModeManager::FindChannelModeByChar(cu->status.Modes()[i]), u->GetUID());
|
||||
for (size_t i = cu->status.Modes().length(); i > 0;)
|
||||
c->RemoveMode(NULL, ModeManager::FindChannelModeByChar(cu->status.Modes()[--i]), u->GetUID());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
+11
-12
@@ -182,7 +182,7 @@ class CommandCSXOP : public Command
|
||||
{
|
||||
const ChanAccess *a = ci->GetAccess(i);
|
||||
|
||||
if (a->mask.equals_ci(mask))
|
||||
if (a->Mask().equals_ci(mask))
|
||||
{
|
||||
if ((!highest || *a >= *highest) && !access.founder && !source.HasPriv("chanserv/access/modify"))
|
||||
{
|
||||
@@ -206,8 +206,7 @@ class CommandCSXOP : public Command
|
||||
if (!provider)
|
||||
return;
|
||||
XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
|
||||
acc->ci = ci;
|
||||
acc->mask = mask;
|
||||
acc->SetMask(mask, ci);
|
||||
acc->creator = source.GetNick();
|
||||
acc->type = source.command.upper();
|
||||
acc->last_seen = 0;
|
||||
@@ -217,7 +216,7 @@ class CommandCSXOP : public Command
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask;
|
||||
|
||||
FOREACH_MOD(OnAccessAdd, (ci, source, acc));
|
||||
source.Reply(_("\002%s\002 added to %s %s list."), acc->mask.c_str(), ci->name.c_str(), source.command.c_str());
|
||||
source.Reply(_("\002%s\002 added to %s %s list."), acc->Mask().c_str(), ci->name.c_str(), source.command.c_str());
|
||||
}
|
||||
|
||||
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
@@ -320,9 +319,9 @@ class CommandCSXOP : public Command
|
||||
|
||||
++deleted;
|
||||
if (!nicks.empty())
|
||||
nicks += ", " + caccess->mask;
|
||||
nicks += ", " + caccess->Mask();
|
||||
else
|
||||
nicks = caccess->mask;
|
||||
nicks = caccess->Mask();
|
||||
|
||||
ci->EraseAccess(number - 1);
|
||||
FOREACH_MOD(OnAccessDel, (ci, source, caccess));
|
||||
@@ -341,11 +340,11 @@ class CommandCSXOP : public Command
|
||||
if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize())
|
||||
continue;
|
||||
|
||||
if (a->mask.equals_ci(mask))
|
||||
if (a->Mask().equals_ci(mask))
|
||||
{
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->mask;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->Mask();
|
||||
|
||||
source.Reply(_("\002%s\002 deleted from %s %s list."), a->mask.c_str(), ci->name.c_str(), source.command.c_str());
|
||||
source.Reply(_("\002%s\002 deleted from %s %s list."), a->Mask().c_str(), ci->name.c_str(), source.command.c_str());
|
||||
|
||||
ci->EraseAccess(i);
|
||||
FOREACH_MOD(OnAccessDel, (ci, source, a));
|
||||
@@ -405,7 +404,7 @@ class CommandCSXOP : public Command
|
||||
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Number"] = stringify(Number);
|
||||
entry["Mask"] = a->mask;
|
||||
entry["Mask"] = a->Mask();
|
||||
this->list.AddEntry(entry);
|
||||
}
|
||||
} nl_list(list, ci, nick, source);
|
||||
@@ -419,12 +418,12 @@ class CommandCSXOP : public Command
|
||||
|
||||
if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize())
|
||||
continue;
|
||||
else if (!nick.empty() && !Anope::Match(a->mask, nick))
|
||||
else if (!nick.empty() && !Anope::Match(a->Mask(), nick))
|
||||
continue;
|
||||
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Number"] = stringify(i + 1);
|
||||
entry["Mask"] = a->mask;
|
||||
entry["Mask"] = a->Mask();
|
||||
list.AddEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class CommandGLGlobal : public Command
|
||||
const Anope::string &msg = params[0];
|
||||
|
||||
if (!GService)
|
||||
source.Reply("No global reference, is gl_main loaded?");
|
||||
source.Reply("No global reference, is global loaded?");
|
||||
else
|
||||
{
|
||||
Log(LOG_ADMIN, source, this);
|
||||
|
||||
@@ -13,21 +13,31 @@
|
||||
|
||||
class CommandHSGroup : public Command
|
||||
{
|
||||
bool setting;
|
||||
|
||||
public:
|
||||
void Sync(const NickAlias *na)
|
||||
{
|
||||
if (setting)
|
||||
return;
|
||||
|
||||
if (!na || !na->HasVhost())
|
||||
return;
|
||||
|
||||
|
||||
setting = true;
|
||||
for (unsigned i = 0; i < na->nc->aliases->size(); ++i)
|
||||
{
|
||||
NickAlias *nick = na->nc->aliases->at(i);
|
||||
if (nick)
|
||||
{
|
||||
nick->SetVhost(na->GetVhostIdent(), na->GetVhostHost(), na->GetVhostCreator());
|
||||
FOREACH_MOD(OnSetVhost, (nick));
|
||||
}
|
||||
}
|
||||
setting = false;
|
||||
}
|
||||
|
||||
public:
|
||||
CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0)
|
||||
CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0), setting(false)
|
||||
{
|
||||
this->SetDesc(_("Syncs the vhost for all nicks in a group"));
|
||||
}
|
||||
@@ -69,12 +79,36 @@ class CommandHSGroup : public Command
|
||||
class HSGroup : public Module
|
||||
{
|
||||
CommandHSGroup commandhsgroup;
|
||||
bool syncongroup;
|
||||
bool synconset;
|
||||
|
||||
public:
|
||||
HSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandhsgroup(this)
|
||||
{
|
||||
}
|
||||
|
||||
void OnSetVhost(NickAlias *na) anope_override
|
||||
{
|
||||
if (!synconset)
|
||||
return;
|
||||
|
||||
commandhsgroup.Sync(na);
|
||||
}
|
||||
|
||||
void OnNickGroup(User *u, NickAlias *na) anope_override
|
||||
{
|
||||
if (!syncongroup)
|
||||
return;
|
||||
|
||||
commandhsgroup.Sync(na);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) anope_override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
syncongroup = block->Get<bool>("syncongroup");
|
||||
synconset = block->Get<bool>("synconset");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ class CommandMSSendAll : public Command
|
||||
|
||||
const Anope::string &text = params[0];
|
||||
|
||||
Log(LOG_ADMIN, source, this) << "to send " << text;
|
||||
|
||||
for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
|
||||
{
|
||||
const NickCore *nc = it->second;
|
||||
|
||||
@@ -196,7 +196,7 @@ class NSAccess : public Module
|
||||
{
|
||||
}
|
||||
|
||||
void OnNickRegister(User *u, NickAlias *na) anope_override
|
||||
void OnNickRegister(User *u, NickAlias *na, const Anope::string &) anope_override
|
||||
{
|
||||
if (u && Config->GetModule(this)->Get<bool>("addaccessonreg"))
|
||||
na->nc->AddAccess(u->Mask());
|
||||
|
||||
@@ -118,51 +118,108 @@ class CommandNSAJoin : public Command
|
||||
}
|
||||
}
|
||||
|
||||
void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &chan, const Anope::string &key)
|
||||
void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &chans, const Anope::string &keys)
|
||||
{
|
||||
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
|
||||
|
||||
unsigned i = 0;
|
||||
for (; i < (*channels)->size(); ++i)
|
||||
if ((*channels)->at(i)->channel.equals_ci(chan))
|
||||
break;
|
||||
|
||||
if ((*channels)->size() >= Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"))
|
||||
source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"));
|
||||
else if (i != (*channels)->size())
|
||||
source.Reply(_("%s is already on %s's auto join list."), chan.c_str(), nc->display.c_str());
|
||||
else if (IRCD->IsChannelValid(chan) == false)
|
||||
source.Reply(CHAN_X_INVALID, chan.c_str());
|
||||
else
|
||||
Anope::string addedchans;
|
||||
Anope::string alreadyadded;
|
||||
Anope::string invalidkey;
|
||||
commasepstream ksep(keys, true);
|
||||
commasepstream csep(chans);
|
||||
for (Anope::string chan, key; csep.GetToken(chan);)
|
||||
{
|
||||
AJoinEntry *entry = new AJoinEntry(nc);
|
||||
entry->owner = nc;
|
||||
entry->channel = chan;
|
||||
entry->key = key;
|
||||
(*channels)->push_back(entry);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD channel " << chan << " to " << nc->display;
|
||||
source.Reply(_("%s added to %s's auto join list."), chan.c_str(), nc->display.c_str());
|
||||
ksep.GetToken(key);
|
||||
|
||||
unsigned i = 0;
|
||||
for (; i < (*channels)->size(); ++i)
|
||||
if ((*channels)->at(i)->channel.equals_ci(chan))
|
||||
break;
|
||||
|
||||
if ((*channels)->size() >= Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"))
|
||||
{
|
||||
source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"));
|
||||
return;
|
||||
}
|
||||
else if (i != (*channels)->size())
|
||||
alreadyadded += chan + ", ";
|
||||
else if (IRCD->IsChannelValid(chan) == false)
|
||||
source.Reply(CHAN_X_INVALID, chan.c_str());
|
||||
else
|
||||
{
|
||||
Channel *c = Channel::Find(chan);
|
||||
Anope::string k;
|
||||
if (c && c->GetParam("KEY", k) && key != k)
|
||||
{
|
||||
invalidkey += chan + ", ";
|
||||
continue;
|
||||
}
|
||||
|
||||
AJoinEntry *entry = new AJoinEntry(nc);
|
||||
entry->owner = nc;
|
||||
entry->channel = chan;
|
||||
entry->key = key;
|
||||
(*channels)->push_back(entry);
|
||||
addedchans += chan + ", ";
|
||||
}
|
||||
}
|
||||
|
||||
if (!alreadyadded.empty())
|
||||
{
|
||||
alreadyadded = alreadyadded.substr(0, alreadyadded.length() - 2);
|
||||
source.Reply(_("%s is already on %s's auto join list."), alreadyadded.c_str(), nc->display.c_str());
|
||||
}
|
||||
|
||||
if (!invalidkey.empty())
|
||||
{
|
||||
invalidkey = invalidkey.substr(0, invalidkey.length() - 2);
|
||||
source.Reply(_("%s had an invalid key specified, and was thus ignored."), invalidkey.c_str());
|
||||
}
|
||||
|
||||
if (addedchans.empty())
|
||||
return;
|
||||
|
||||
addedchans = addedchans.substr(0, addedchans.length() - 2);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD channel " << addedchans << " to " << nc->display;
|
||||
source.Reply(_("%s added to %s's auto join list."), addedchans.c_str(), nc->display.c_str());
|
||||
}
|
||||
|
||||
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &chan)
|
||||
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &chans)
|
||||
{
|
||||
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
|
||||
Anope::string delchans;
|
||||
Anope::string notfoundchans;
|
||||
commasepstream sep(chans);
|
||||
|
||||
unsigned i = 0;
|
||||
for (; i < (*channels)->size(); ++i)
|
||||
if ((*channels)->at(i)->channel.equals_ci(chan))
|
||||
break;
|
||||
|
||||
if (i == (*channels)->size())
|
||||
source.Reply(_("%s was not found on %s's auto join list."), chan.c_str(), nc->display.c_str());
|
||||
else
|
||||
for (Anope::string chan; sep.GetToken(chan);)
|
||||
{
|
||||
delete (*channels)->at(i);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE channel " << chan << " from " << nc->display;
|
||||
source.Reply(_("%s was removed from %s's auto join list."), chan.c_str(), nc->display.c_str());
|
||||
unsigned i = 0;
|
||||
for (; i < (*channels)->size(); ++i)
|
||||
if ((*channels)->at(i)->channel.equals_ci(chan))
|
||||
break;
|
||||
|
||||
if (i == (*channels)->size())
|
||||
notfoundchans += chan + ", ";
|
||||
else
|
||||
{
|
||||
delete (*channels)->at(i);
|
||||
delchans += chan + ", ";
|
||||
}
|
||||
}
|
||||
|
||||
if (!notfoundchans.empty())
|
||||
{
|
||||
notfoundchans = notfoundchans.substr(0, notfoundchans.length() - 2);
|
||||
source.Reply(_("%s was not found on %s's auto join list."), notfoundchans.c_str(), nc->display.c_str());
|
||||
}
|
||||
|
||||
if (delchans.empty())
|
||||
return;
|
||||
|
||||
delchans = delchans.substr(0, delchans.length() - 2);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE channel " << delchans << " from " << nc->display;
|
||||
source.Reply(_("%s was removed from %s's auto join list."), delchans.c_str(), nc->display.c_str());
|
||||
|
||||
if ((*channels)->empty())
|
||||
nc->Shrink<AJoinList>("ajoinlist");
|
||||
}
|
||||
@@ -265,7 +322,10 @@ class NSAJoin : public Module
|
||||
|
||||
AJoinList *channels = u->Account()->GetExt<AJoinList>("ajoinlist");
|
||||
if (channels == NULL)
|
||||
channels = u->Account()->Extend<AJoinList>("ajoinlist");
|
||||
return;
|
||||
|
||||
/* Set +r now, so we can ajoin users into +R channels */
|
||||
ModeManager::ProcessModes();
|
||||
|
||||
for (unsigned i = 0; i < (*channels)->size(); ++i)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,21 @@
|
||||
#include "module.h"
|
||||
#include "modules/ns_cert.h"
|
||||
|
||||
static Anope::hash_map<NickCore *> certmap;
|
||||
|
||||
struct CertServiceImpl : CertService
|
||||
{
|
||||
CertServiceImpl(Module *o) : CertService(o) { }
|
||||
|
||||
NickCore* FindAccountFromCert(const Anope::string &cert) anope_override
|
||||
{
|
||||
Anope::hash_map<NickCore *>::iterator it = certmap.find(cert);
|
||||
if (it != certmap.end())
|
||||
return it->second;
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
struct NSCertListImpl : NSCertList
|
||||
{
|
||||
Serialize::Reference<NickCore> nc;
|
||||
@@ -20,6 +35,11 @@ struct NSCertListImpl : NSCertList
|
||||
public:
|
||||
NSCertListImpl(Extensible *obj) : nc(anope_dynamic_static_cast<NickCore *>(obj)) { }
|
||||
|
||||
~NSCertListImpl()
|
||||
{
|
||||
ClearCert();
|
||||
}
|
||||
|
||||
/** Add an entry to the nick's certificate list
|
||||
*
|
||||
* @param entry The fingerprint to add to the cert list
|
||||
@@ -29,6 +49,7 @@ struct NSCertListImpl : NSCertList
|
||||
void AddCert(const Anope::string &entry) anope_override
|
||||
{
|
||||
this->certs.push_back(entry);
|
||||
certmap[entry] = nc;
|
||||
FOREACH_MOD(OnNickAddCert, (this->nc, entry));
|
||||
}
|
||||
|
||||
@@ -75,6 +96,7 @@ struct NSCertListImpl : NSCertList
|
||||
if (it != this->certs.end())
|
||||
{
|
||||
FOREACH_MOD(OnNickEraseCert, (this->nc, entry));
|
||||
certmap.erase(entry);
|
||||
this->certs.erase(it);
|
||||
}
|
||||
}
|
||||
@@ -86,6 +108,8 @@ struct NSCertListImpl : NSCertList
|
||||
void ClearCert() anope_override
|
||||
{
|
||||
FOREACH_MOD(OnNickClearCert, (this->nc));
|
||||
for (unsigned i = 0; i < certs.size(); ++i)
|
||||
certmap.erase(certs[i]);
|
||||
this->certs.clear();
|
||||
}
|
||||
|
||||
@@ -124,9 +148,14 @@ struct NSCertListImpl : NSCertList
|
||||
Anope::string buf;
|
||||
data["cert"] >> buf;
|
||||
spacesepstream sep(buf);
|
||||
for (unsigned i = 0; i < c->certs.size(); ++i)
|
||||
certmap.erase(c->certs[i]);
|
||||
c->certs.clear();
|
||||
while (sep.GetToken(buf))
|
||||
{
|
||||
c->certs.push_back(buf);
|
||||
certmap[buf] = n;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -134,28 +163,28 @@ struct NSCertListImpl : NSCertList
|
||||
class CommandNSCert : public Command
|
||||
{
|
||||
private:
|
||||
void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &certfp)
|
||||
void DoAdd(CommandSource &source, NickCore *nc, Anope::string certfp)
|
||||
{
|
||||
NSCertList *cl = nc->Require<NSCertList>("certificates");
|
||||
unsigned max = Config->GetModule(this->owner)->Get<unsigned>("max", "5");
|
||||
|
||||
if (cl->GetCertCount() >= Config->GetModule(this->owner)->Get<unsigned>("accessmax", "5"))
|
||||
if (cl->GetCertCount() >= max)
|
||||
{
|
||||
source.Reply(_("Sorry, the maximum of %d certificate entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("accessmax"));
|
||||
source.Reply(_("Sorry, the maximum of %d certificate entries has been reached."), max);
|
||||
return;
|
||||
}
|
||||
|
||||
if (certfp.empty())
|
||||
if (source.GetAccount() == nc)
|
||||
{
|
||||
if (source.GetUser() && !source.GetUser()->fingerprint.empty() && !cl->FindCert(source.GetUser()->fingerprint))
|
||||
{
|
||||
cl->AddCert(source.GetUser()->fingerprint);
|
||||
Log(LOG_COMMAND, source, this) << "to ADD its current certificate fingerprint " << source.GetUser()->fingerprint;
|
||||
source.Reply(_("\002%s\002 added to your certificate list."), source.GetUser()->fingerprint.c_str());
|
||||
}
|
||||
else
|
||||
this->OnSyntaxError(source, "ADD");
|
||||
User *u = source.GetUser();
|
||||
|
||||
return;
|
||||
if (!u || u->fingerprint.empty())
|
||||
{
|
||||
source.Reply(_("You are not using a client certificate."));
|
||||
return;
|
||||
}
|
||||
|
||||
certfp = u->fingerprint;
|
||||
}
|
||||
|
||||
if (cl->FindCert(certfp))
|
||||
@@ -164,26 +193,31 @@ class CommandNSCert : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (certmap.find(certfp) != certmap.end())
|
||||
{
|
||||
source.Reply(_("Fingerprint \002%s\002 is already in use."), certfp.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
cl->AddCert(certfp);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD certificate fingerprint " << certfp << " to " << nc->display;
|
||||
source.Reply(_("\002%s\002 added to %s's certificate list."), certfp.c_str(), nc->display.c_str());
|
||||
}
|
||||
|
||||
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &certfp)
|
||||
void DoDel(CommandSource &source, NickCore *nc, Anope::string certfp)
|
||||
{
|
||||
NSCertList *cl = nc->Require<NSCertList>("certificates");
|
||||
|
||||
if (certfp.empty())
|
||||
{
|
||||
if (source.GetUser() && !source.GetUser()->fingerprint.empty() && cl->FindCert(source.GetUser()->fingerprint))
|
||||
{
|
||||
cl->EraseCert(source.GetUser()->fingerprint);
|
||||
Log(LOG_COMMAND, source, this) << "to DELETE its current certificate fingerprint " << source.GetUser()->fingerprint;
|
||||
source.Reply(_("\002%s\002 deleted from your certificate list."), source.GetUser()->fingerprint.c_str());
|
||||
}
|
||||
else
|
||||
this->OnSyntaxError(source, "DEL");
|
||||
User *u = source.GetUser();
|
||||
if (u)
|
||||
certfp = u->fingerprint;
|
||||
}
|
||||
|
||||
if (certfp.empty())
|
||||
{
|
||||
this->OnSyntaxError(source, "DEL");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -221,7 +255,7 @@ class CommandNSCert : public Command
|
||||
CommandNSCert(Module *creator) : Command(creator, "nickserv/cert", 1, 3)
|
||||
{
|
||||
this->SetDesc(_("Modify the nickname client certificate list"));
|
||||
this->SetSyntax(_("ADD [\037nickname\037] \037fingerprint\037"));
|
||||
this->SetSyntax(_("ADD [\037nickname\037] [\037fingerprint\037]"));
|
||||
this->SetSyntax(_("DEL [\037nickname\037] \037fingerprint\037"));
|
||||
this->SetSyntax(_("LIST [\037nickname\037]"));
|
||||
}
|
||||
@@ -308,10 +342,11 @@ class NSCert : public Module
|
||||
{
|
||||
CommandNSCert commandnscert;
|
||||
NSCertListImpl::ExtensibleItem certs;
|
||||
CertServiceImpl cs;
|
||||
|
||||
public:
|
||||
NSCert(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandnscert(this), certs(this, "certificates")
|
||||
commandnscert(this), certs(this, "certificates"), cs(this)
|
||||
{
|
||||
if (!IRCD || !IRCD->CanCertFP)
|
||||
throw ModuleException("Your IRCd does not support ssl client certificates");
|
||||
@@ -319,22 +354,22 @@ class NSCert : public Module
|
||||
|
||||
void OnFingerprint(User *u) anope_override
|
||||
{
|
||||
NickAlias *na = NickAlias::Find(u->nick);
|
||||
BotInfo *NickServ = Config->GetClient("NickServ");
|
||||
if (!NickServ || !na)
|
||||
return;
|
||||
if (u->IsIdentified() && u->Account() == na->nc)
|
||||
return;
|
||||
if (na->nc->HasExt("NS_SUSPENDED"))
|
||||
if (!NickServ || u->IsIdentified())
|
||||
return;
|
||||
|
||||
NSCertList *cl = certs.Get(na->nc);
|
||||
if (!cl || !cl->FindCert(u->fingerprint))
|
||||
NickCore *nc = cs.FindAccountFromCert(u->fingerprint);
|
||||
if (!nc || nc->HasExt("NS_SUSPENDED"))
|
||||
return;
|
||||
|
||||
u->Identify(na);
|
||||
u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified."));
|
||||
Log(NickServ) << u->GetMask() << " automatically identified for account " << na->nc->display << " via SSL certificate fingerprint";
|
||||
NickAlias *na = NickAlias::Find(u->nick);
|
||||
if (na && na->nc == nc)
|
||||
u->Identify(na);
|
||||
else
|
||||
u->Login(nc);
|
||||
|
||||
u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified to \002%s\002."), nc->display.c_str());
|
||||
Log(NickServ) << u->GetMask() << " automatically identified for account " << nc->display << " via SSL certificate fingerprint";
|
||||
}
|
||||
|
||||
EventReturn OnNickValidate(User *u, NickAlias *na) anope_override
|
||||
|
||||
@@ -72,10 +72,10 @@ class NSGroupRequest : public IdentifyRequest
|
||||
class CommandNSGroup : public Command
|
||||
{
|
||||
public:
|
||||
CommandNSGroup(Module *creator) : Command(creator, "nickserv/group", 1, 2)
|
||||
CommandNSGroup(Module *creator) : Command(creator, "nickserv/group", 0, 2)
|
||||
{
|
||||
this->SetDesc(_("Join a group"));
|
||||
this->SetSyntax(_("\037target\037 \037password\037"));
|
||||
this->SetSyntax(_("\037[target]\037 \037[password]\037"));
|
||||
this->AllowUnregistered(true);
|
||||
this->RequireUser(true);
|
||||
}
|
||||
@@ -83,7 +83,23 @@ class CommandNSGroup : public Command
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.GetUser();
|
||||
const Anope::string &nick = params[0];
|
||||
|
||||
Anope::string nick;
|
||||
if (params.empty())
|
||||
{
|
||||
NickCore* core = u->Account();
|
||||
if (core)
|
||||
nick = core->display;
|
||||
}
|
||||
else
|
||||
nick = params[0];
|
||||
|
||||
if (nick.empty())
|
||||
{
|
||||
this->SendSyntax(source);
|
||||
return;
|
||||
}
|
||||
|
||||
const Anope::string &pass = params.size() > 1 ? params[1] : "";
|
||||
|
||||
if (Anope::ReadOnly)
|
||||
@@ -123,12 +139,12 @@ class CommandNSGroup : public Command
|
||||
Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick;
|
||||
source.Reply(NICK_X_SUSPENDED, target->nick.c_str());
|
||||
}
|
||||
else if (na && Config->GetModule(this->owner)->Get<bool>("nogroupchange"))
|
||||
source.Reply(_("Your nick is already registered."));
|
||||
else if (na && *target->nc == *na->nc)
|
||||
source.Reply(_("You are already a member of the group of \002%s\002."), target->nick.c_str());
|
||||
else if (na && na->nc != u->Account())
|
||||
source.Reply(NICK_IDENTIFY_REQUIRED);
|
||||
else if (na && Config->GetModule(this->owner)->Get<bool>("nogroupchange"))
|
||||
source.Reply(_("Your nick is already registered."));
|
||||
else if (maxaliases && target->nc->aliases->size() >= maxaliases && !target->nc->IsServicesOper())
|
||||
source.Reply(_("There are too many nicks in your group."));
|
||||
else if (u->nick.length() <= guestnick.length() + 7 &&
|
||||
@@ -140,7 +156,7 @@ class CommandNSGroup : public Command
|
||||
else
|
||||
{
|
||||
bool ok = false;
|
||||
if (!na && u->Account())
|
||||
if (!na && u->Account() == target->nc)
|
||||
ok = true;
|
||||
|
||||
NSCertList *cl = target->nc->GetExt<NSCertList>("certificates");
|
||||
@@ -297,14 +313,25 @@ class CommandNSGList : public Command
|
||||
|
||||
ListFormatter list(source.GetAccount());
|
||||
list.AddColumn(_("Nick")).AddColumn(_("Expires"));
|
||||
time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire");
|
||||
time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "21d"),
|
||||
unconfirmed_expire = Config->GetModule("nickserv")->Get<time_t>("unconfirmedexpire", "1d");
|
||||
for (unsigned i = 0; i < nc->aliases->size(); ++i)
|
||||
{
|
||||
const NickAlias *na2 = nc->aliases->at(i);
|
||||
|
||||
Anope::string expires;
|
||||
if (na2->HasExt("NS_NO_EXPIRE"))
|
||||
expires = NO_EXPIRE;
|
||||
else if (!nickserv_expire || Anope::NoExpire)
|
||||
;
|
||||
else if (na2->nc->HasExt("UNCONFIRMED") && unconfirmed_expire)
|
||||
expires = Anope::strftime(na2->time_registered + unconfirmed_expire, source.GetAccount());
|
||||
else
|
||||
expires = Anope::strftime(na2->last_seen + nickserv_expire, source.GetAccount());
|
||||
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Nick"] = na2->nick;
|
||||
entry["Expires"] = (na2->HasExt("NS_NO_EXPIRE") || !nickserv_expire || Anope::NoExpire) ? "Does not expire" : Anope::strftime(na2->last_seen + nickserv_expire, source.GetAccount());
|
||||
entry["Expires"] = expires;
|
||||
list.AddEntry(entry);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,9 +62,13 @@ class CommandNSInfo : public Command
|
||||
|
||||
if (nick_online)
|
||||
{
|
||||
bool shown = false;
|
||||
if (show_hidden && !na->last_realhost.empty())
|
||||
{
|
||||
info[_("Online from")] = na->last_realhost;
|
||||
if (show_hidden || !na->nc->HasExt("HIDE_MASK"))
|
||||
shown = true;
|
||||
}
|
||||
if ((show_hidden || !na->nc->HasExt("HIDE_MASK")) && (!shown || na->last_usermask != na->last_realhost))
|
||||
info[_("Online from")] = na->last_usermask;
|
||||
else
|
||||
source.Reply(_("%s is currently online."), na->nick.c_str());
|
||||
|
||||
@@ -62,7 +62,7 @@ class CommandNSList : public Command
|
||||
{
|
||||
if (keyword.equals_ci("NOEXPIRE"))
|
||||
nsnoexpire = true;
|
||||
if (keyword.equals_ci("NS_SUSPENDED"))
|
||||
if (keyword.equals_ci("SUSPENDED"))
|
||||
suspended = true;
|
||||
if (keyword.equals_ci("UNCONFIRMED"))
|
||||
unconfirmed = true;
|
||||
|
||||
@@ -130,12 +130,6 @@ class CommandNSRegister : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsregister.equals_ci("mail") && email.empty())
|
||||
{
|
||||
source.Reply(_("You must specify an email address."));
|
||||
return;
|
||||
}
|
||||
|
||||
time_t nickregdelay = Config->GetModule(this->owner)->Get<time_t>("nickregdelay");
|
||||
time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
|
||||
if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay)
|
||||
@@ -204,7 +198,7 @@ class CommandNSRegister : public Command
|
||||
|
||||
Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
|
||||
|
||||
FOREACH_MOD(OnNickRegister, (source.GetUser(), na));
|
||||
FOREACH_MOD(OnNickRegister, (source.GetUser(), na, pass));
|
||||
|
||||
if (na->nc->GetAccessCount())
|
||||
source.Reply(_("Nickname \002%s\002 registered under your user@host-mask: %s"), u_nick.c_str(), na->nc->GetAccess(0).c_str());
|
||||
@@ -222,15 +216,10 @@ class CommandNSRegister : public Command
|
||||
}
|
||||
else if (nsregister.equals_ci("mail"))
|
||||
{
|
||||
nc->Extend<bool>("UNCONFIRMED");
|
||||
if (SendRegmail(u, na, source.service))
|
||||
if (!email.empty())
|
||||
{
|
||||
time_t unconfirmed_expire = Config->GetModule("ns_register")->Get<time_t>("unconfirmedexpire", "1d");
|
||||
BotInfo *bi;
|
||||
Anope::string cmd;
|
||||
if (Command::FindCommandFromService("nickserv/confirm", bi, cmd))
|
||||
source.Reply(_("A passcode has been sent to %s, please type \002%s%s %s <passcode>\002 to confirm your email address."), email.c_str(), Config->StrictPrivmsg.c_str(), bi->nick.c_str(), cmd.c_str());
|
||||
source.Reply(_("If you do not confirm your email address within %s your account will expire."), Anope::Duration(unconfirmed_expire, source.GetAccount()).c_str());
|
||||
nc->Extend<bool>("UNCONFIRMED");
|
||||
SendRegmail(NULL, na, source.service);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,12 +357,12 @@ class NSRegister : public Module
|
||||
if (nsregister.equals_ci("admin"))
|
||||
u->SendMessage(NickServ, _("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed."));
|
||||
else
|
||||
u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you when you registered."));
|
||||
u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you."));
|
||||
const NickAlias *this_na = NickAlias::Find(u->Account()->display);
|
||||
time_t time_registered = Anope::CurTime - this_na->time_registered;
|
||||
time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d");
|
||||
if (unconfirmed_expire > time_registered)
|
||||
u->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s"), Anope::Duration(unconfirmed_expire - time_registered, u->Account()).c_str());
|
||||
u->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s."), Anope::Duration(unconfirmed_expire - time_registered, u->Account()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@ class CommandNSResetPass : public Command
|
||||
{
|
||||
const NickAlias *na;
|
||||
|
||||
if (Config->GetBlock("mail")->Get<bool>("restrict") && !source.HasCommand("nickserv/resetpass"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!(na = NickAlias::Find(params[0])))
|
||||
if (!(na = NickAlias::Find(params[0])))
|
||||
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
|
||||
else if (!na->nc->email.equals_ci(params[1]))
|
||||
source.Reply(_("Incorrect email address."));
|
||||
|
||||
@@ -119,7 +119,7 @@ class CommandNSSetPassword : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const Anope::string ¶m = params[1];
|
||||
const Anope::string ¶m = params[0];
|
||||
unsigned len = param.length();
|
||||
|
||||
if (Anope::ReadOnly)
|
||||
@@ -330,7 +330,7 @@ class CommandNSSetDisplay : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
const NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
|
||||
NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
|
||||
{
|
||||
@@ -356,6 +356,8 @@ class CommandNSSetDisplay : public Command
|
||||
Log(user_na->nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the display of " << user_na->nc->display << " to " << na->nick;
|
||||
|
||||
user_na->nc->SetDisplay(na);
|
||||
if (source.GetUser())
|
||||
IRCD->SendLogin(source.GetUser(), na);
|
||||
source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str());
|
||||
}
|
||||
|
||||
@@ -449,6 +451,12 @@ class CommandNSSetEmail : public Command
|
||||
}
|
||||
NickCore *nc = na->nc;
|
||||
|
||||
if (nc->HasExt("UNCONFIRMED"))
|
||||
{
|
||||
source.Reply(_("You may not change the email of an unconfirmed account."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (param.empty() && Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
{
|
||||
source.Reply(_("You cannot unset the e-mail on this network."));
|
||||
@@ -786,7 +794,7 @@ class CommandNSSetLanguage : public Command
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
if (param != "en")
|
||||
if (param != "en_US")
|
||||
for (unsigned j = 0; j < Language::Languages.size(); ++j)
|
||||
{
|
||||
if (Language::Languages[j] == param)
|
||||
@@ -818,7 +826,7 @@ class CommandNSSetLanguage : public Command
|
||||
"\037language\037 should be chosen from the following list of\n"
|
||||
"supported languages:"));
|
||||
|
||||
source.Reply(" en (English)");
|
||||
source.Reply(" en_US (English)");
|
||||
for (unsigned j = 0; j < Language::Languages.size(); ++j)
|
||||
{
|
||||
const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English"));
|
||||
|
||||
@@ -10,32 +10,41 @@
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/set_misc.h"
|
||||
|
||||
static Module *me;
|
||||
|
||||
static std::map<Anope::string, Anope::string> descriptions;
|
||||
static Anope::map<Anope::string> descriptions;
|
||||
|
||||
struct NSMiscData;
|
||||
static Anope::map<ExtensibleItem<NSMiscData> *> items;
|
||||
static ExtensibleItem<NSMiscData> *GetItem(const Anope::string &name);
|
||||
|
||||
struct NSMiscData : Serializable
|
||||
static ExtensibleItem<NSMiscData> *GetItem(const Anope::string &name)
|
||||
{
|
||||
Serialize::Reference<NickCore> nc;
|
||||
Anope::string name;
|
||||
Anope::string data;
|
||||
ExtensibleItem<NSMiscData>* &it = items[name];
|
||||
if (!it)
|
||||
try
|
||||
{
|
||||
it = new ExtensibleItem<NSMiscData>(me, name);
|
||||
}
|
||||
catch (const ModuleException &) { }
|
||||
return it;
|
||||
}
|
||||
|
||||
NSMiscData(Extensible *obj) : Serializable("NSMiscData"), nc(anope_dynamic_static_cast<NickCore *>(obj))
|
||||
{
|
||||
}
|
||||
struct NSMiscData : MiscData, Serializable
|
||||
{
|
||||
NSMiscData(Extensible *) : Serializable("NSMiscData") { }
|
||||
|
||||
NSMiscData(NickCore *ncore, const Anope::string &n, const Anope::string &d) : Serializable("NSMiscData"), nc(ncore), name(n), data(d)
|
||||
NSMiscData(NickCore *ncore, const Anope::string &n, const Anope::string &d) : Serializable("NSMiscData")
|
||||
{
|
||||
object = ncore->display;
|
||||
name = n;
|
||||
data = d;
|
||||
}
|
||||
|
||||
void Serialize(Serialize::Data &sdata) const anope_override
|
||||
{
|
||||
sdata["nc"] << this->nc->display;
|
||||
sdata["nc"] << this->object;
|
||||
sdata["name"] << this->name;
|
||||
sdata["data"] << this->data;
|
||||
}
|
||||
@@ -52,11 +61,11 @@ struct NSMiscData : Serializable
|
||||
if (nc == NULL)
|
||||
return NULL;
|
||||
|
||||
NSMiscData *d;
|
||||
NSMiscData *d = NULL;
|
||||
if (obj)
|
||||
{
|
||||
d = anope_dynamic_static_cast<NSMiscData *>(obj);
|
||||
d->nc = nc;
|
||||
d->object = nc->display;
|
||||
data["name"] >> d->name;
|
||||
data["data"] >> d->data;
|
||||
}
|
||||
@@ -65,26 +74,12 @@ struct NSMiscData : Serializable
|
||||
ExtensibleItem<NSMiscData> *item = GetItem(sname);
|
||||
if (item)
|
||||
d = item->Set(nc, NSMiscData(nc, sname, sdata));
|
||||
else
|
||||
d = NULL;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
};
|
||||
|
||||
static ExtensibleItem<NSMiscData> *GetItem(const Anope::string &name)
|
||||
{
|
||||
ExtensibleItem<NSMiscData>* &it = items[name];
|
||||
if (!it)
|
||||
try
|
||||
{
|
||||
it = new ExtensibleItem<NSMiscData>(me, name);
|
||||
}
|
||||
catch (const ModuleException &) { }
|
||||
return it;
|
||||
}
|
||||
|
||||
static Anope::string GetAttribute(const Anope::string &command)
|
||||
{
|
||||
size_t sp = command.rfind(' ');
|
||||
@@ -182,17 +177,23 @@ class CommandNSSASetMisc : public CommandNSSetMisc
|
||||
|
||||
class NSSetMisc : public Module
|
||||
{
|
||||
Serialize::Type nsmiscdata_type;
|
||||
CommandNSSetMisc commandnssetmisc;
|
||||
CommandNSSASetMisc commandnssasetmisc;
|
||||
Serialize::Type nsmiscdata_type;
|
||||
|
||||
public:
|
||||
NSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
nsmiscdata_type("NSMiscData", NSMiscData::Unserialize), commandnssetmisc(this), commandnssasetmisc(this)
|
||||
commandnssetmisc(this), commandnssasetmisc(this), nsmiscdata_type("NSMiscData", NSMiscData::Unserialize)
|
||||
{
|
||||
me = this;
|
||||
}
|
||||
|
||||
~NSSetMisc()
|
||||
{
|
||||
for (Anope::map<ExtensibleItem<NSMiscData> *>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) anope_override
|
||||
{
|
||||
descriptions.clear();
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/ns_suspend.h"
|
||||
#include "modules/suspend.h"
|
||||
|
||||
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
|
||||
|
||||
struct NSSuspendInfoImpl : NSSuspendInfo, Serializable
|
||||
struct NSSuspendInfo : SuspendInfo, Serializable
|
||||
{
|
||||
NSSuspendInfoImpl(Extensible *) : Serializable("NSSuspendInfo") { }
|
||||
NSSuspendInfo(Extensible *) : Serializable("NSSuspendInfo") { }
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override
|
||||
{
|
||||
data["nick"] << nick;
|
||||
data["nick"] << what;
|
||||
data["by"] << by;
|
||||
data["reason"] << reason;
|
||||
data["time"] << when;
|
||||
@@ -32,16 +32,16 @@ struct NSSuspendInfoImpl : NSSuspendInfo, Serializable
|
||||
Anope::string snick;
|
||||
data["nick"] >> snick;
|
||||
|
||||
NSSuspendInfoImpl *si;
|
||||
NSSuspendInfo *si;
|
||||
if (obj)
|
||||
si = anope_dynamic_static_cast<NSSuspendInfoImpl *>(obj);
|
||||
si = anope_dynamic_static_cast<NSSuspendInfo *>(obj);
|
||||
else
|
||||
{
|
||||
NickAlias *na = NickAlias::Find(snick);
|
||||
if (!na)
|
||||
return NULL;
|
||||
si = na->nc->Extend<NSSuspendInfoImpl>("NS_SUSPENDED");
|
||||
data["nick"] >> si->nick;
|
||||
si = na->nc->Extend<NSSuspendInfo>("NS_SUSPENDED");
|
||||
data["nick"] >> si->what;
|
||||
}
|
||||
|
||||
data["by"] >> si->by;
|
||||
@@ -110,7 +110,7 @@ class CommandNSSuspend : public Command
|
||||
NickCore *nc = na->nc;
|
||||
|
||||
NSSuspendInfo *si = nc->Extend<NSSuspendInfo>("NS_SUSPENDED");
|
||||
si->nick = nc->display;
|
||||
si->what = nc->display;
|
||||
si->by = source.GetNick();
|
||||
si->reason = reason;
|
||||
si->when = Anope::CurTime;
|
||||
@@ -181,9 +181,12 @@ class CommandNSUnSuspend : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
NSSuspendInfo *si = na->nc->GetExt<NSSuspendInfo>("NS_SUSPENDED");
|
||||
|
||||
Log(LOG_ADMIN, source, this) << "for " << na->nick << " which was suspended by " << (!si->by.empty() ? si->by : "(none)") << " for: " << (!si->reason.empty() ? si->reason : "No reason");
|
||||
|
||||
na->nc->Shrink<NSSuspendInfo>("NS_SUSPENDED");
|
||||
|
||||
Log(LOG_ADMIN, source, this) << "for " << na->nick;
|
||||
source.Reply(_("Nick %s is now released."), nick.c_str());
|
||||
|
||||
FOREACH_MOD(OnNickUnsuspended, (na));
|
||||
@@ -202,31 +205,53 @@ class NSSuspend : public Module
|
||||
{
|
||||
CommandNSSuspend commandnssuspend;
|
||||
CommandNSUnSuspend commandnsunsuspend;
|
||||
ExtensibleItem<NSSuspendInfoImpl> suspend;
|
||||
ExtensibleItem<NSSuspendInfo> suspend;
|
||||
Serialize::Type suspend_type;
|
||||
std::vector<Anope::string> show;
|
||||
|
||||
struct trim
|
||||
{
|
||||
Anope::string operator()(Anope::string s) const
|
||||
{
|
||||
return s.trim();
|
||||
}
|
||||
};
|
||||
|
||||
bool Show(CommandSource &source, const Anope::string &what) const
|
||||
{
|
||||
return source.IsOper() || std::find(show.begin(), show.end(), what) != show.end();
|
||||
}
|
||||
|
||||
public:
|
||||
NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandnssuspend(this), commandnsunsuspend(this), suspend(this, "NS_SUSPENDED"),
|
||||
suspend_type("NSSuspendInfo", NSSuspendInfoImpl::Unserialize)
|
||||
suspend_type("NSSuspendInfo", NSSuspendInfo::Unserialize)
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) anope_override
|
||||
{
|
||||
Anope::string s = conf->GetModule(this)->Get<Anope::string>("show");
|
||||
commasepstream(s).GetTokens(show);
|
||||
std::transform(show.begin(), show.end(), show.begin(), trim());
|
||||
}
|
||||
|
||||
void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override
|
||||
{
|
||||
NSSuspendInfo *s = suspend.Get(na->nc);
|
||||
if (s)
|
||||
{
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
if (show_hidden || Show(source, "suspended"))
|
||||
info[_("Suspended")] = _("This nickname is \002suspended\002.");
|
||||
if (!s->by.empty())
|
||||
info[_("Suspended by")] = s->by;
|
||||
if (!s->reason.empty())
|
||||
info[_("Suspend reason")] = s->reason;
|
||||
if (s->when)
|
||||
info[_("Suspended on")] = Anope::strftime(s->when, source.GetAccount(), true);
|
||||
if (s->expires)
|
||||
info[_("Suspension expires")] = Anope::strftime(s->expires, source.GetAccount(), true);
|
||||
}
|
||||
if (!s->by.empty() && (show_hidden || Show(source, "by")))
|
||||
info[_("Suspended by")] = s->by;
|
||||
if (!s->reason.empty() && (show_hidden || Show(source, "reason")))
|
||||
info[_("Suspend reason")] = s->reason;
|
||||
if (s->when && (show_hidden || Show(source, "on")))
|
||||
info[_("Suspended on")] = Anope::strftime(s->when, source.GetAccount(), true);
|
||||
if (s->expires && (show_hidden || Show(source, "expires")))
|
||||
info[_("Suspension expires")] = Anope::strftime(s->expires, source.GetAccount(), true);
|
||||
}
|
||||
|
||||
void OnPreNickExpire(NickAlias *na, bool &expire) anope_override
|
||||
|
||||
@@ -160,6 +160,11 @@ class CommandOSAKill : public Command
|
||||
source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str());
|
||||
return;
|
||||
}
|
||||
else if (mask.find('@') == Anope::string::npos)
|
||||
{
|
||||
source.Reply(BAD_USERHOST_MASK);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty())
|
||||
reason = "[" + source.GetNick() + "] " + reason;
|
||||
|
||||
@@ -502,7 +502,7 @@ class OSDefcon : public Module
|
||||
if (DConfig.sessionlimit <= 0 || !session_service)
|
||||
return;
|
||||
|
||||
Session *session = session_service->FindSession(u->ip);
|
||||
Session *session = session_service->FindSession(u->ip.addr());
|
||||
Exception *exception = session_service->FindException(u);
|
||||
|
||||
if (DConfig.Check(DEFCON_REDUCE_SESSION) && !exception)
|
||||
@@ -511,7 +511,7 @@ class OSDefcon : public Module
|
||||
{
|
||||
if (!DConfig.sle_reason.empty())
|
||||
{
|
||||
Anope::string message = DConfig.sle_reason.replace_all_cs("%IP%", u->ip);
|
||||
Anope::string message = DConfig.sle_reason.replace_all_cs("%IP%", u->ip.addr());
|
||||
u->SendMessage(OperServ, message);
|
||||
}
|
||||
if (!DConfig.sle_detailsloc.empty())
|
||||
|
||||
@@ -322,6 +322,12 @@ class CommandOSDNS : public Command
|
||||
s->zones.erase(z->name);
|
||||
}
|
||||
|
||||
if (dnsmanager)
|
||||
{
|
||||
dnsmanager->UpdateSerial();
|
||||
dnsmanager->Notify(z->name);
|
||||
}
|
||||
|
||||
source.Reply(_("Zone %s removed."), z->name.c_str());
|
||||
delete z;
|
||||
}
|
||||
@@ -357,6 +363,12 @@ class CommandOSDNS : public Command
|
||||
z->servers.insert(s->GetName());
|
||||
s->zones.insert(zone);
|
||||
|
||||
if (dnsmanager)
|
||||
{
|
||||
dnsmanager->UpdateSerial();
|
||||
dnsmanager->Notify(zone);
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, source, this) << "to add server " << s->GetName() << " to zone " << z->name;
|
||||
|
||||
source.Reply(_("Server %s added to zone %s."), s->GetName().c_str(), z->name.c_str());
|
||||
@@ -398,6 +410,12 @@ class CommandOSDNS : public Command
|
||||
|
||||
z->servers.insert(s->GetName());
|
||||
s->zones.insert(z->name);
|
||||
|
||||
if (dnsmanager)
|
||||
{
|
||||
dnsmanager->UpdateSerial();
|
||||
dnsmanager->Notify(z->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,6 +448,12 @@ class CommandOSDNS : public Command
|
||||
|
||||
Log(LOG_ADMIN, source, this) << "to remove server " << s->GetName() << " from zone " << z->name;
|
||||
|
||||
if (dnsmanager)
|
||||
{
|
||||
dnsmanager->UpdateSerial();
|
||||
dnsmanager->Notify(z->name);
|
||||
}
|
||||
|
||||
z->servers.erase(s->GetName());
|
||||
source.Reply(_("Removed server %s from zone %s."), s->GetName().c_str(), z->name.c_str());
|
||||
return;
|
||||
@@ -450,6 +474,9 @@ class CommandOSDNS : public Command
|
||||
if (Anope::ReadOnly)
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
|
||||
if (dnsmanager)
|
||||
dnsmanager->UpdateSerial();
|
||||
|
||||
Log(LOG_ADMIN, source, this) << "to delete server " << s->GetName();
|
||||
source.Reply(_("Removed server %s."), s->GetName().c_str());
|
||||
delete s;
|
||||
@@ -626,7 +653,7 @@ class CommandOSDNS : public Command
|
||||
}
|
||||
|
||||
public:
|
||||
CommandOSDNS(Module *creator) : Command(creator, "operserv/dns", 0, 3)
|
||||
CommandOSDNS(Module *creator) : Command(creator, "operserv/dns", 0, 4)
|
||||
{
|
||||
this->SetDesc(_("Manage DNS zones for this network"));
|
||||
this->SetSyntax(_("ADDZONE \037zone.name\037"));
|
||||
|
||||
@@ -14,6 +14,51 @@
|
||||
|
||||
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
|
||||
|
||||
struct ForbidDataImpl : ForbidData, Serializable
|
||||
{
|
||||
ForbidDataImpl() : Serializable("ForbidData") { }
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
};
|
||||
|
||||
void ForbidDataImpl::Serialize(Serialize::Data &data) const
|
||||
{
|
||||
data["mask"] << this->mask;
|
||||
data["creator"] << this->creator;
|
||||
data["reason"] << this->reason;
|
||||
data["created"] << this->created;
|
||||
data["expires"] << this->expires;
|
||||
data["type"] << this->type;
|
||||
}
|
||||
|
||||
Serializable* ForbidDataImpl::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
if (!forbid_service)
|
||||
return NULL;
|
||||
|
||||
ForbidDataImpl *fb;
|
||||
if (obj)
|
||||
fb = anope_dynamic_static_cast<ForbidDataImpl *>(obj);
|
||||
else
|
||||
fb = new ForbidDataImpl();
|
||||
|
||||
data["mask"] >> fb->mask;
|
||||
data["creator"] >> fb->creator;
|
||||
data["reason"] >> fb->reason;
|
||||
data["created"] >> fb->created;
|
||||
data["expires"] >> fb->expires;
|
||||
unsigned int t;
|
||||
data["type"] >> t;
|
||||
fb->type = static_cast<ForbidType>(t);
|
||||
|
||||
if (t > FT_SIZE - 1)
|
||||
return NULL;
|
||||
|
||||
if (!obj)
|
||||
forbid_service->AddForbid(fb);
|
||||
return fb;
|
||||
}
|
||||
|
||||
class MyForbidService : public ForbidService
|
||||
{
|
||||
Serialize::Checker<std::vector<ForbidData *>[FT_SIZE - 1]> forbid_data;
|
||||
@@ -43,6 +88,11 @@ class MyForbidService : public ForbidService
|
||||
delete d;
|
||||
}
|
||||
|
||||
ForbidData *CreateForbid() anope_override
|
||||
{
|
||||
return new ForbidDataImpl();
|
||||
}
|
||||
|
||||
ForbidData *FindForbid(const Anope::string &mask, ForbidType ftype) anope_override
|
||||
{
|
||||
for (unsigned i = this->forbids(ftype).size(); i > 0; --i)
|
||||
@@ -157,7 +207,7 @@ class CommandOSForbid : public Command
|
||||
bool created = false;
|
||||
if (d == NULL)
|
||||
{
|
||||
d = new ForbidData();
|
||||
d = new ForbidDataImpl();
|
||||
created = true;
|
||||
}
|
||||
|
||||
@@ -379,7 +429,7 @@ class OSForbid : public Module
|
||||
|
||||
public:
|
||||
OSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
forbidService(this), forbiddata_type("ForbidData", ForbidData::Unserialize), commandosforbid(this)
|
||||
forbidService(this), forbiddata_type("ForbidData", ForbidDataImpl::Unserialize), commandosforbid(this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user