From 9b031d4d98e5ca35b960d3f9b2498edf19b02939 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 16 Feb 2019 12:06:44 +0000 Subject: Remove obsolete ifdef in m_ssl_gnutls. GNUTLS_DIG_SHA256 was added in version 1.7.4 and we require 2.0.0+ --- src/modules/extra/m_ssl_gnutls.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index f5711cbd7..1e5554f98 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -191,10 +191,8 @@ namespace GnuTLS hash = GNUTLS_DIG_MD5; else if (stdalgo::string::equalsci(hashname, "sha1")) hash = GNUTLS_DIG_SHA1; -#ifdef INSPIRCD_GNUTLS_ENABLE_SHA256_FINGERPRINT else if (stdalgo::string::equalsci(hashname, "sha256")) hash = GNUTLS_DIG_SHA256; -#endif else throw Exception("Unknown hash type " + hashname); #endif -- cgit v1.3.1-10-gc9f91 From 6daf442c77b411517ff656e543f5ecec02384ce8 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 16 Feb 2019 14:25:29 +0000 Subject: Use the local hostname as the server name if one is not specified. --- src/configreader.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/configreader.cpp b/src/configreader.cpp index 5a0ceff06..00880cfff 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -309,6 +309,23 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) } } +static std::string GetServerName() +{ +#ifndef _WIN32 + char hostname[256]; + if (gethostname(hostname, sizeof(hostname)) == 0) + { + std::string name(hostname); + if (name.find('.') == std::string::npos) + name.push_back('.'); + + if (name.length() <= ServerInstance->Config->Limits.MaxHost && InspIRCd::IsHost(name)) + return name; + } +#endif + return "irc.example.com"; +} + void ServerConfig::Fill() { ConfigTag* options = ConfValue("options"); @@ -316,7 +333,7 @@ void ServerConfig::Fill() ConfigTag* server = ConfValue("server"); if (sid.empty()) { - ServerName = server->getString("name", "irc.example.com", InspIRCd::IsHost); + ServerName = server->getString("name", GetServerName(), InspIRCd::IsHost); sid = server->getString("id"); if (!sid.empty() && !InspIRCd::IsSID(sid)) -- cgit v1.3.1-10-gc9f91 From b6e548d8dfb933d8329ea7aed2357c88ecaf2e79 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 16 Feb 2019 15:24:55 +0000 Subject: ircv3_chghost: also send the CHGHOST message to the modified user. --- src/modules/m_ircv3_chghost.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/m_ircv3_chghost.cpp b/src/modules/m_ircv3_chghost.cpp index fd142803f..d78689178 100644 --- a/src/modules/m_ircv3_chghost.cpp +++ b/src/modules/m_ircv3_chghost.cpp @@ -32,7 +32,7 @@ class ModuleIRCv3ChgHost : public Module msg.PushParamRef(ident); msg.PushParamRef(host); ClientProtocol::Event protoev(protoevprov, msg); - IRCv3::WriteNeighborsWithCap(user, protoev, cap); + IRCv3::WriteNeighborsWithCap(user, protoev, cap, true); } public: -- cgit v1.3.1-10-gc9f91 From 35bbf9bb0100800111f5123e378d807bf87ad846 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 17 Feb 2019 10:23:19 +0000 Subject: Fix an off-by-one error in User::GetModeLetters(). --- src/users.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/users.cpp b/src/users.cpp index cf676d2dc..3a6ddbc0f 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -46,7 +46,7 @@ std::string User::GetModeLetters(bool includeparams) const std::string ret(1, '+'); std::string params; - for (unsigned char i = 'A'; i < 'z'; i++) + for (unsigned char i = 'A'; i <= 'z'; i++) { const ModeHandler* const mh = ServerInstance->Modes.FindMode(i, MODETYPE_USER); if ((!mh) || (!IsModeSet(mh))) -- cgit v1.3.1-10-gc9f91 From 21e7efdadfa685ac1ddcb0a0a515502bc873302b Mon Sep 17 00:00:00 2001 From: Robby Date: Sun, 17 Feb 2019 15:58:31 +0100 Subject: Various text improvements: consistency, syntax, help and doc updates/fixes. --- docs/conf/filter.conf.example | 14 +- docs/conf/helpop.conf.example | 402 +++++++++++++++++-------------- docs/conf/inspircd.conf.example | 36 +-- docs/conf/links.conf.example | 26 +- docs/conf/modules.conf.example | 77 +++--- docs/conf/opers.conf.example | 46 ++-- include/iohook.h | 2 +- src/coremods/core_channel/cmd_invite.cpp | 2 +- src/coremods/core_channel/cmd_join.cpp | 2 +- src/coremods/core_channel/cmd_kick.cpp | 4 +- src/coremods/core_channel/cmd_names.cpp | 2 +- src/coremods/core_channel/cmd_topic.cpp | 2 +- src/coremods/core_ison.cpp | 2 +- src/coremods/core_message.cpp | 6 +- src/coremods/core_oper/cmd_die.cpp | 2 +- src/coremods/core_oper/cmd_kill.cpp | 2 +- src/coremods/core_oper/cmd_restart.cpp | 2 +- src/coremods/core_stats.cpp | 2 +- src/coremods/core_stub.cpp | 4 +- src/coremods/core_user/cmd_away.cpp | 2 +- src/coremods/core_user/cmd_mode.cpp | 2 +- src/coremods/core_user/cmd_part.cpp | 2 +- src/coremods/core_user/cmd_quit.cpp | 2 +- src/coremods/core_user/cmd_user.cpp | 2 +- src/coremods/core_userhost.cpp | 2 +- src/coremods/core_wallops.cpp | 2 +- src/coremods/core_who.cpp | 2 +- src/coremods/core_whois.cpp | 2 +- src/coremods/core_whowas.cpp | 2 +- src/coremods/core_xline/cmd_eline.cpp | 2 +- src/coremods/core_xline/cmd_gline.cpp | 2 +- src/coremods/core_xline/cmd_kline.cpp | 2 +- src/coremods/core_xline/cmd_qline.cpp | 2 +- src/mode.cpp | 4 +- src/modules/m_callerid.cpp | 4 +- src/modules/m_cban.cpp | 2 +- src/modules/m_cgiirc.cpp | 2 +- src/modules/m_check.cpp | 2 +- src/modules/m_chghost.cpp | 2 +- src/modules/m_chgident.cpp | 2 +- src/modules/m_chgname.cpp | 2 +- src/modules/m_clearchan.cpp | 2 +- src/modules/m_customtitle.cpp | 2 +- src/modules/m_cycle.cpp | 2 +- src/modules/m_dccallow.cpp | 6 +- src/modules/m_globalload.cpp | 6 +- src/modules/m_globops.cpp | 2 +- src/modules/m_knock.cpp | 2 +- src/modules/m_modenotice.cpp | 2 +- src/modules/m_monitor.cpp | 2 +- src/modules/m_namedmodes.cpp | 2 +- src/modules/m_nicklock.cpp | 4 +- src/modules/m_password_hash.cpp | 2 +- src/modules/m_remove.cpp | 4 +- src/modules/m_repeat.cpp | 6 +- src/modules/m_rline.cpp | 2 +- src/modules/m_rmode.cpp | 2 +- src/modules/m_sajoin.cpp | 4 +- src/modules/m_sakick.cpp | 4 +- src/modules/m_samode.cpp | 2 +- src/modules/m_sanick.cpp | 4 +- src/modules/m_sapart.cpp | 4 +- src/modules/m_saquit.cpp | 4 +- src/modules/m_satopic.cpp | 2 +- src/modules/m_sethost.cpp | 2 +- src/modules/m_setident.cpp | 2 +- src/modules/m_setname.cpp | 2 +- src/modules/m_shun.cpp | 2 +- src/modules/m_silence.cpp | 6 +- src/modules/m_spanningtree/rsquit.cpp | 2 +- src/modules/m_svshold.cpp | 2 +- src/modules/m_userip.cpp | 2 +- src/modules/m_watch.cpp | 2 +- 73 files changed, 422 insertions(+), 355 deletions(-) diff --git a/docs/conf/filter.conf.example b/docs/conf/filter.conf.example index 29e1f530c..f9afc85a8 100644 --- a/docs/conf/filter.conf.example +++ b/docs/conf/filter.conf.example @@ -16,8 +16,8 @@ # block This blocks the line, sends out a notice to all opers with # +s and informs the user that their message was blocked. # -# silent This blocks the line only, and informs the user their message -# was blocked, but does not notify opers. +# silent This blocks the line only, and informs the user that their +# message was blocked, but does not notify opers. # # none This action causes nothing to be done except logging. This # is the default action if none is specified. @@ -26,17 +26,17 @@ # the kill reason. # # gline G-line the user for 'duration' length of time. Durations may -# be specified using the notation 1y2d3h4m6s in a similar way to +# be specified using the notation 1y2w3d4h5m6s in a similar way to # other G-lines, omitting the duration or setting it to 0 makes # any G-lines set by this filter be permanent. # # zline Z-line the user for 'duration' length of time. Durations may -# be specified using the notation 1y2d3h4m6s in a similar way to +# be specified using the notation 1y2w3d4h5m6s in a similar way to # other Z-lines, omitting the duration or setting it to 0 makes # any Z-lines set by this filter be permanent. # # shun Shun the user for 'duration' length of time. Durations may -# be specified using the notation 1y2d3h4m6s in a similar way to +# be specified using the notation 1y2w3d4h5m6s in a similar way to # other X-lines, omitting the duration or setting it to 0 makes # any shuns set by this filter be permanent. # Requires the shun module to be loaded. @@ -59,11 +59,11 @@ # # # -# +# # An example regexp filter: # -# +# # You may specify specific channels that are exempt from being filtered: # diff --git a/docs/conf/helpop.conf.example b/docs/conf/helpop.conf.example index bd184f6ef..3fdff9bee 100644 --- a/docs/conf/helpop.conf.example +++ b/docs/conf/helpop.conf.example @@ -3,7 +3,7 @@ # or you can customize the responses for your network and/or add more. # # The way the new helpop system works is simple. You use one or more helpop tags. -# . +# # key is what the user is looking for (i.e. /helpop moo), and value is what they get back # (note that it can span multiple lines!). # -- w00t 16/dec/2006 @@ -34,14 +34,14 @@ parameter for this command. ACCEPT ADMIN AWAY COMMANDS CYCLE DCCALLOW FPART INFO INVITE ISON JOIN KICK KNOCK LINKS LIST LUSERS MAP MKPASSWD -MODE MODULES MOTD NAMES NICK NOTICE -OPER PART PASS PING PONG PRIVMSG -QUIT REMOVE SETNAME SILENCE SQUERY SSLINFO -STATS TBAN TIME TITLE TOPIC UNINVITE -USER USERHOST VERSION VHOST WATCH WHO -WHOIS WHOWAS"> +MODE MODULES MONITOR MOTD NAMES NICK +NOTICE OPER PART PASS PING PONG +PRIVMSG QUIT REMOVE SETNAME SILENCE SQUERY +SSLINFO STATS TBAN TIME TITLE TOPIC +UNINVITE USER USERHOST VERSION VHOST WATCH +WHO WHOIS WHOWAS"> - @@ -57,76 +57,103 @@ Uninvite a user from a channel, same syntax as INVITE."> +form of 1y2w3d4h5m6s - meaning one year, two weeks, three days, +four hours, five minutes and six seconds. All fields in this +format are optional. Alternatively, the ban may just be specified +as a number of seconds. All timed bans appear in the banlist as +normal bans and may be safely removed before their time is up."> - +form of 1y2w3d4h5m6s - meaning one year, two weeks, three days, +four hours, five minutes and six seconds. All fields in this +format are optional."> + + +This command accepts multiple nicks like so: +/ACCEPT +,-,+"> - - - +/WATCH + - +"> + + - - +Removes listmodes from a channel, optionally matching a glob-based pattern. +E.g. '/RMODE #channel b m:*' will remove all mute extbans on the channel."> - - - - - +Change your nickname to ."> - - - - - - - - - +Return a list of users on the channel(s) you provide."> - - - - - - - - - - +can no longer use it to enter the channel. The time can be specified +in the form of 1y2w3d4h5m6s - meaning one year, two weeks, three days, +four hours, five minutes and six seconds. All fields in this format +are optional. Alternatively, the time may just be specified as a number +of seconds. + +/INVITE without a parameter will list pending invitations for channels +you have been invited to."> +Shows all linked servers."> - +etc. If a servername is provided, then a whois is performed from +the server where the user is actually located rather than locally, +showing idle and signon times."> - - - +Sets your real name to the specified real name."> - +Returns the IP address and nickname of the given user(s)."> +nick!user@host or user@IP (wildcards accepted)."> - @@ -440,8 +479,8 @@ Opens the server up again for new connections."> Retrieves a list of users with more clones than the specified limit."> - +specified server, useful especially if used on a nickname that is +online on a remote server."> +Shows the date and time of all servers on the network."> - +The server matching will try to connect to the first +server in the config file matching ."> - - - +1y2w3d4h5m6s - meaning one year, two weeks, three days, four hours, +five minutes and six seconds. All fields in this format are optional."> - - +Forces the user to part the channel(s), with an optional reason."> - - - +Kicks the given user from the specified channel, with an optional reason."> - - - +Sets your idle time to the specified value. + +The time can be specified in the form of 1y2w3d4h5m6s - meaning one year, +two weeks, three days, four hours, five minutes and six seconds. +All fields in this format are optional. Alternatively, the time may +just be specified as a number of seconds."> Sets your ident to the specified ident."> - +To remove this message again, use: +/SWHOIS :"> - - @@ -601,34 +650,34 @@ it to remain as such for the remainder of the session."> Allows a previously locked user to change nicks again."> - +Changes the host of the user to the specified host."> - +Changes the real name of the user to the specified real name."> - +Changes the ident of the user to the specified ident."> - +1y2w3d4h5m6s - meaning one year, two weeks, three days, four hours, +five minutes and six seconds. All fields in this format are optional."> - - @@ -637,11 +686,11 @@ required, which must match the name of the local server."> Shows all currently available commands."> - - Disconnects the server matching the given server mask from this server."> - - - - - - - +1y2w3d4h5m6s - meaning one year, two weeks, three days, four hours, +five minutes and six seconds. All fields in this format are optional."> +1y2w3d4h5m6s - meaning one year, two weeks, three days, four hours, +five minutes and six seconds. All fields in this format are optional."> +1y2w3d4h5m6s - meaning one year, two weeks, three days, four hours, +five minutes and six seconds. All fields in this format are optional."> +1y2w3d4h5m6s - meaning one year, two weeks, three days, four hours, +five minutes and six seconds. All fields in this format are optional."> - +1y2w3d4h5m6s - meaning one year, two weeks, three days, four hours, +five minutes and six seconds. All fields in this format are optional."> - - commonchans module). d Deaf mode. User will not receive any messages or notices from channels they are in (requires the deaf module). - g In combination with /ACCEPT, provides for server side + g In combination with /ACCEPT, provides for server-side ignore (requires the callerid module). h Marks as 'available for help' in WHOIS (IRCop only, requires the helpop module). @@ -810,8 +859,8 @@ using their cloak when they quit."> hideoper module). I Hides a user's entire channel list in WHOIS from non-IRCops (requires the hidechans module). - L Stops redirections done by m_redirect (mode must be - enabled in the config). + L Stops redirections done by the redirect module (requires + the redirect module). R Blocks private messages from unregistered users (requires the services account module). S Strips formatting codes out of private messages @@ -879,7 +928,8 @@ using their cloak when they quit."> For example, +w o:R:Brain will op anyone identified to the account 'Brain' on join. (requires the autoop module) - z Blocks non-SSL clients from joining the channel. + z Blocks non-SSL clients from joining the channel + (requires the sslmodes module). A Allows anyone to invite users to the channel (normally only chanops can invite, requires @@ -891,7 +941,8 @@ using their cloak when they quit."> noctcp module). D Delays join messages from users until they message the channel (requires the delayjoin module). - E [~*][lines]:[sec]{[:difference]}{[:backlog]} Allows blocking of similar messages. + E [~|*]:[:][:] Allows blocking of + similar messages (requires the repeat module). Kicks as default, blocks with ~ and bans with * The last two parameters are optional. F : Blocks nick changes when they equal or exceed the @@ -905,7 +956,8 @@ using their cloak when they quit."> J Prevents rejoin after kick for the specified number of seconds. This prevents auto-rejoin (requires the kicknorejoin module). - K Blocks /KNOCK on the channel. + K Blocks /KNOCK on the channel (requires the + knock module). L If the channel reaches its limit set by +l, redirect users to (requires the redirect module). @@ -919,8 +971,8 @@ using their cloak when they quit."> topic, modes, and such will not be lost when it empties (can only be set by IRCops, requires the permchannels module). - Q Only ulined servers and their users can kick - (requires the nokicks module) + Q Only U-lined servers and their users can kick + (requires the nokicks module). R Blocks unregistered users from joining (requires the services account module). S Strips formatting codes from messages to the @@ -955,23 +1007,23 @@ being loaded by a server/network administrator. The actual modes available on your network may be very different to this list. Please consult your help channel if you have any questions."> - K Allows receipt of remote kill messages. l Allows receipt of local linking related messages. L Allows receipt of remote linking related messages. - n See local nickname changes (requires the seenicks module). - N See remote nickname changes (requires the seenicks modules). + n Allows receipt of local nickname changes (requires the seenicks module). + N Allows receipt of remote nickname changes (requires the seenicks modules). o Allows receipt of oper-up, oper-down, and oper-failure messages. O Allows receipt of remote oper-up, oper-down, and oper-failure messages. q Allows receipt of local quit messages. diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index 890c9cc4c..7a4148413 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -255,7 +255,7 @@ # # You may also use any of the above other than bcrypt prefixed with # either "hmac-" or "pbkdf2-hmac-" (requires the pbkdf2 module). - # Create hashed passwords with: /mkpasswd + # Create hashed passwords with: /MKPASSWD #hash="bcrypt" # password: Password to use for this block/user(s) @@ -268,7 +268,7 @@ # timeout: How long the server will wait before disconnecting # a user if they do not do anything on connect. # (Note, this is a client-side thing, if the client does not - # send /nick, /user or /pass) + # send /NICK, /USER or /PASS) timeout="10" # localmax: Maximum local connections per IP (or CIDR mask, see below). @@ -300,8 +300,8 @@ # modes: Usermodes that are set on users in this block on connect. # Enabling this option requires that the conn_umodes module be loaded. - # This entry is highly recommended to use for/with IP Cloaking/masking. - # For the example to work, this also requires that the "cloaking" + # This entry is highly recommended to use for/with IP cloaking/masking. + # For the example to work, this also requires that the cloaking # module be loaded as well. modes="+x" @@ -352,7 +352,7 @@ # timeout: How long the server will wait before disconnecting # a user if they do not do anything on connect. # (Note, this is a client-side thing, if the client does not - # send /nick, /user or /pass) + # send /NICK, /USER or /PASS) timeout="10" # pingfreq: How often the server tries to ping connecting clients. @@ -414,7 +414,7 @@ # modes: Usermodes that are set on users in this block on connect. # Enabling this option requires that the conn_umodes module be loaded. - # This entry is highly recommended to use for/with IP Cloaking/masking. + # This entry is highly recommended to use for/with IP cloaking/masking. # For the example to work, this also requires that the cloaking # module be loaded as well. modes="+x"> @@ -647,7 +647,7 @@ # See m_exemptchanops in modules.conf.example for more details. exemptchanops="censor:o filter:o nickflood:o nonick:v regmoderated:o" - # invitebypassmodes: This allows /invite to bypass other channel modes. + # invitebypassmodes: This allows /INVITE to bypass other channel modes. # (Such as +k, +j, +l, etc.) invitebypassmodes="yes" @@ -714,10 +714,10 @@ announceinvites="dynamic" # hideulines: If this value is set to yes, U-lined servers will - # be hidden from non-opers in /links and /map. + # be hidden from non-opers in /LINKS and /MAP. hideulines="no" - # flatlinks: If this value is set to yes, /map and /links will + # flatlinks: If this value is set to yes, /MAP and /LINKS will # be flattened when shown to non-opers. flatlinks="no" @@ -734,7 +734,7 @@ # from the server. hidebans="no" - # hidekills: If defined, replaces who set a /kill with a custom string. + # hidekills: If defined, replaces who executed a /KILL with a custom string. hidekills="" # hideulinekills: Hide kills from clients of ulined servers from server notices. @@ -746,7 +746,7 @@ hidesplits="no" # maxtargets: Maximum number of targets per command. - # (Commands like /notice, /privmsg, /kick, etc) + # (Commands like /NOTICE, /PRIVMSG, /KICK, etc) maxtargets="20" # customversion: A custom message to be displayed in the comments field @@ -777,7 +777,7 @@ # affects the display in WHOIS. genericoper="no" - # userstats: /stats commands that users can run (opers can run all). + # userstats: /STATS commands that users can run (opers can run all). userstats="Pu"> #-#-#-#-#-#-#-#-#-#-#-#-# LIMITS CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-# @@ -845,7 +845,7 @@ # # An example log tag would be: # <log method="file" type="OPER" level="default" target="opers.log"> -# which would log all information on /oper (failed and successful) to +# which would log all information on /OPER (failed and successful) to # a file called opers.log. # # There are many different types which may be used, and modules may @@ -889,17 +889,17 @@ #-#-#-#-#-#-#-#-#-#-#-#-#- WHOWAS OPTIONS -#-#-#-#-#-#-#-#-#-#-#-#-# # # -# This tag lets you define the behaviour of the /whowas command of # +# This tag lets you define the behaviour of the /WHOWAS command of # # your server. # # # <whowas # groupsize: Maximum entries per nick shown when performing - # a /whowas nick. + # a /WHOWAS <nick>. groupsize="10" # maxgroups: Maximum number of nickgroups that can be added to - # the list so that /whowas does not use a lot of resources on + # the list so that /WHOWAS does not use a lot of resources on # large networks. maxgroups="100000" @@ -927,7 +927,7 @@ # nick: Nick to disallow. Wildcards are supported. nick="ChanServ" - # reason: Reason to display on /nick. + # reason: Reason to display on /NICK. reason="Reserved for a network service"> <badhost @@ -947,7 +947,7 @@ # Wildcards and CIDR (if you specify an IP) can be used. host="*@ircop.example.com" - # reason: Reason for exception. Only shown in /stats e + # reason: Reason for exception. Only shown in /STATS e. reason="Oper's hostname"> #-#-#-#-#-#-#-#-#-#-#- INSANE BAN OPTIONS -#-#-#-#-#-#-#-#-#-#-#-#-#-# diff --git a/docs/conf/links.conf.example b/docs/conf/links.conf.example index ad2efa9f7..735cac304 100644 --- a/docs/conf/links.conf.example +++ b/docs/conf/links.conf.example @@ -64,19 +64,19 @@ # servers will not be shown when users do a /MAP or /LINKS. hidden="no" - # passwords: the passwords we send and receive. + # passwords: The passwords we send and receive. # The remote server will have these passwords reversed. # Passwords that contain a space character or begin with # a colon (:) are invalid and may not be used. sendpass="outgoing!password" recvpass="incoming!password"> -# A duplicate of the first link block without comments +# A duplicate of the first link block without comments, # if you like copying & pasting. <link name="hub.example.org" ipaddr="penguin.example.org" port="7000" - allowmask="203.0.113.0/24" + allowmask="203.0.113.0/24 127.0.0.0/8 2001:db8::/32" timeout="5m" ssl="gnutls" bind="1.2.3.4" @@ -94,7 +94,7 @@ sendpass="penguins" recvpass="polarbears"> -# Simple autoconnect block. This enables automatic connection of a server +# Simple autoconnect block. This enables automatic connections to a server. # Recommended setup is to have leaves connect to the hub, and have no # automatic connections started by the hub. <autoconnect period="10m" server="hub.example.org"> @@ -108,15 +108,15 @@ server="hub.us.example.org hub.eu.example.org leaf.eu.example.org"> -#-#-#-#-#-#-#-#-#-#-#-#- ULINES CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-#-# -# This tag defines a ulined server. A U-Lined server has special # -# permissions, and should be used with caution. Services servers are # -# usually u-lined in this manner. # -# # -# The 'silent' value, if set to yes, indicates that this server should# -# not generate quit and connect notices, which can cut down on noise # -# to opers on the network. # -# # +#-#-#-#-#-#-#-#-#-#-#-#-# U-LINES CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-#-# +# This tag defines a U-lined server. A U-lined server has special # +# permissions, and should be used with caution. Services servers are # +# usually U-lined in this manner. # +# # +# The 'silent' value, if set to yes, indicates that this server should # +# not generate quit and connect notices, which can cut down on noise # +# to opers on the network. # +# # <uline server="services.example.com" silent="yes"> # Once you have edited this file you can remove this line. This is just to diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 090096668..964b57e71 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -79,7 +79,7 @@ # read from the top of the file to the bottom. # # # # usercommand - If this is true, the alias can be run simply as # -# /aliasname. Defaults to true. # +# /ALIASNAME. Defaults to true. # # # # channelcommand - If this is true, the alias can be used as an # # in-channel alias or 'fantasy command', prefixed # @@ -780,11 +780,11 @@ # # # chanmodes - One or more channel modes that can not be added/removed # # by users. You can exempt server operators from this # -# with the servers/use-disabled-commands privilege. # +# with the servers/use-disabled-modes privilege. # # # # usermodes - One or more user modes that can not be added/removed by # # users. You can exempt server operators from this with # -# the servers/use-disabled-commands privilege. # +# the servers/use-disabled-modes privilege. # # # # fakenonexistent - Whether to pretend that a disabled command/mode # # does not exist when executed/changed by a user. # @@ -803,7 +803,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # DNS blacklist module: Provides support for looking up IPs on one or # # more blacklists. # -#<module name="dnsbl"> # +#<module name="dnsbl"> # # # For configuration options please see the wiki page for dnsbl at # # https://wiki.inspircd.org/Modules/3.0/dnsbl # @@ -816,8 +816,8 @@ # nonick, nonotice, regmoderated, stripcolor, and topiclock. # # See <options:exemptchanops> in inspircd.conf.example for a more # # detailed list of the restriction modes that can be exempted. # -# These are settable using /mode #chan +X <restriction>:<status> # -#<module name="exemptchanops"> # +# These are settable using: /MODE #chan +X <restriction>:<status> # +#<module name="exemptchanops"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Filter module: Provides message filtering, similar to SPAMFILTER. # @@ -886,7 +886,7 @@ # <connect deny="*" geoip="TR,RU"> # # If enabled you can also ban people from channnels by country code -# using the G: extban (e.g. /mode #channel +b G:US). +# using the G: extban (e.g. /MODE #channel +b G:US). # <geoip extban="yes"> # # The country code must be in capitals and should be an ISO country @@ -1332,7 +1332,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Named modes module: Allows for the display and set/unset of channel # modes via long-form mode names via +Z and the /PROP command. -# For example, to set a ban, do /mode #channel +Z ban=foo!bar@baz or +# For example, to set a ban, do /MODE #channel +Z ban=foo!bar@baz or # /PROP #channel ban=foo!bar@baz #<module name="namedmodes"> @@ -1419,7 +1419,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Oper channels mode: Adds the +O channel mode and extban O:<mask> # to ban, except, etc. specific oper types. For example -# /mode #channel +iI O:* is equivalent to channel mode +O, but you +# /MODE #channel +iI O:* is equivalent to channel mode +O, but you # may also set +iI O:AdminTypeOnly to only allow admins. # Modes +I and +e work in a similar fashion. #<module name="operchans"> @@ -1699,7 +1699,8 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Remove module: Adds the /REMOVE command which is a peaceful -# alternative to /KICK. +# alternative to /KICK. It also provides the /FPART command which works +# in the same way as /REMOVE. #<module name="remove"> # # supportnokicks: If true, /REMOVE is not allowed on channels where the @@ -1709,27 +1710,36 @@ #<remove supportnokicks="true" protectedrank="50000"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# A module to block, kick or ban upon similar messages being uttered several times. -# Syntax [~*][lines]:[sec]{[:difference]}{[:matchlines]} -# ~ is to block, * is to ban, default is kick. -# lines - In mode 1 the amount of lines that has to match consecutively - In mode 2 the size of the backlog to keep for matching -# seconds - How old the message has to be before it's invalidated. -# distance - Edit distance, in percent, between two strings to trigger on. -# matchlines - When set, the function goes into mode 2. In this mode the function will trigger if this many of the last <lines> matches. +# Repeat module: Allows to block, kick or ban upon similar messages +# being uttered several times. Provides channel mode +E. +# +# Syntax: [~|*]<lines>:<sec>[:<difference>][:<backlog>] +# ~ is to block, * is to ban, default is kick. +# lines - In mode 1, the amount of lines that has to match consecutively. +# In mode 2, the size of the backlog to keep for matching. +# seconds - How old the message has to be before it's invalidated. +# difference - Edit distance, in percent, between two strings to trigger on. +# backlog - When set, the function goes into mode 2. In this mode the +# function will trigger if this many of the last <lines> matches. # # As this module can be rather CPU-intensive, it comes with some options. -# maxbacklog - Maximum size that can be specified for backlog. 0 disables multiline matching. -# maxdistance - Max percentage of difference between two lines we'll allow to match. Set to 0 to disable edit-distance matching. -# maxlines - Max lines of backlog to match against. -# maxtime - Maximum period of time a user can set. 0 to allow any. -# size - Maximum number of characters to check for, can be used to truncate messages -# before they are checked, resulting in less CPU usage. Increasing this beyond 512 -# doesn't have any effect, as the maximum length of a message on IRC cannot exceed that. -#<repeat maxbacklog="20" maxlines="20" maxdistance="50" maxtime="0" size="512"> +# maxbacklog - Maximum size that can be specified for backlog. 0 disables +# multiline matching. +# maxdistance - Max percentage of difference between two lines we'll allow +# to match. Set to 0 to disable edit-distance matching. +# maxlines - Max lines of backlog to match against. +# maxtime - Maximum period of time a user can set. 0 to allow any. +# size - Maximum number of characters to check for, can be used to +# truncate messages before they are checked, resulting in +# less CPU usage. Increasing this beyond 512 doesn't have +# any effect, as the maximum length of a message on IRC +# cannot exceed that. +#<repeat maxbacklog="20" maxdistance="50 maxlines="20" maxtime="0" size="512"> #<module name="repeat"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Restricted channels module: Allows only opers or registered users to +# Restricted channels module: Allows only opers with the +# channels/restricted-create priv and/or registered users to # create channels. # # You probably *DO NOT* want to load this module on a public network. @@ -1775,10 +1785,11 @@ # so that at least \s or [[:space:]] is available. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# RMODE module: Adds the /RMODE command -# Allows channel mods to remove list modes en masse. -# Syntax: /rmode <channel> <mode> [pattern] -# E.g. '/rmode #Channel b m:*' will remove all mute-extbans on the channel. +# RMODE module: Adds the /RMODE command. +# Allows channel operators to remove list modes en masse, optionally +# matching a glob-based pattern. +# Syntax: /RMODE <channel> <mode> [<pattern>] +# E.g. '/RMODE #channel b m:*' will remove all mute extbans on the channel. #<module name="rmode"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -1921,8 +1932,8 @@ # changes their real name. Defaults to to yes if # # oper-only and no if usable by everyone. # # # -#<setname notifyopers="yes" # -# operonly="no"> # +#<setname notifyopers="yes" +# operonly="no"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Serverban: Implements extended ban 's', which stops anyone connected @@ -1939,7 +1950,7 @@ # they enter a command. # # This module adds one command for each <showfile> tag that shows the # # given file to the user as a series of messages or numerics. # -#<module name="showfile"> # +#<module name="showfile"> # # #-#-#-#-#-#-#-#-#-#-# SHOWFILE CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#-# # # diff --git a/docs/conf/opers.conf.example b/docs/conf/opers.conf.example index 98bc47c69..c5edb9cb2 100644 --- a/docs/conf/opers.conf.example +++ b/docs/conf/opers.conf.example @@ -1,4 +1,4 @@ -#-#-#-#-#-#-#-#-#-#-#-#- CLASS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#- +#-#-#-#-#-#-#-#-#-#-#-#-# CLASS CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-# # # # Classes are a group of commands which are grouped together and # # given a unique name. They're used to define which commands # @@ -19,19 +19,23 @@ # privs: Special privileges that users with this class may utilise. # VIEWING: - # - channels/auspex: allows opers with this priv to see more detail about channels than normal users. + # - channels/auspex: allows opers with this priv to see more details about channels than normal users. # - users/auspex: allows opers with this priv to view more details about users than normal users, e.g. real host and IP. # - users/channel-spy: allows opers with this priv to view the private/secret channels that a user is on. - # - servers/auspex: allows opers with this priv to see more detail about server information than normal users. + # - servers/auspex: allows opers with this priv to see more details about server information than normal users. # ACTIONS: - # - users/mass-message: allows opers with this priv to PRIVMSG and NOTICE to a server mask (e.g. NOTICE $*) - # - users/samode-usermodes: allows opers with this priv to change the user modes of any other user using /SAMODE + # - users/mass-message: allows opers with this priv to PRIVMSG and NOTICE to a server mask (e.g. NOTICE $*). + # - users/samode-usermodes: allows opers with this priv to change the user modes of any other user using /SAMODE. # PERMISSIONS: - #. - channels/ignore-nonicks: allows opers with this priv to change their nick when on a +N channel. - # - users/flood/no-fakelag: prevents opers from being penalized with fake lag for flooding (*NOTE) - # - users/flood/no-throttle: allows opers with this priv to send commands without being throttled (*NOTE) - # - users/flood/increased-buffers: allows opers with this priv to send and receive data without worrying about being disconnected for exceeding limits (*NOTE) - #. - users/callerid-override: allows opers with this priv to message people using callerid without being on their callerid list. + # - channels/ignore-nonicks: allows opers with this priv to change their nick when on a +N channel. + # - channels/restricted-create: allows opers with this priv to create channels if the restrictchans module is loaded. + # - users/flood/no-fakelag: prevents opers from being penalized with fake lag for flooding (*NOTE). + # - users/flood/no-throttle: allows opers with this priv to send commands without being throttled (*NOTE). + # - users/flood/increased-buffers: allows opers with this priv to send and receive data without worrying about being disconnected for exceeding limits (*NOTE). + # - users/callerid-override: allows opers with this priv to message people using callerid without being on their callerid list. + # - users/sajoin-others: allows opers with this priv to /SAJOIN users other than themselves. + # - servers/use-disabled-commands: allows opers with this priv to use disabled commands. + # - servers/use-disabled-modes: allows opers with this priv to use disabled modes. # # *NOTE: These privs are potentially dangerous, as they grant users with them the ability to hammer your server's CPU/RAM as much as they want, essentially. privs="users/auspex channels/auspex servers/auspex users/mass-message users/flood/no-throttle users/flood/increased-buffers" @@ -57,13 +61,13 @@ # # <type - # name: Name of type. Used in actual server operator accounts below. + # name: Name of the type. Used in actual server operator accounts below. name="NetAdmin" # classes: Classes (blocks above) that this type belongs to. classes="SACommands OperChat BanControl HostCloak Shutdown ServerLink" - # vhost: Host opers of this type get when they log in (oper up). This is optional. + # vhost: Host that opers of this type get when they log in (oper up). This is optional. vhost="netadmin.omega.example.org" # maxchans: Maximum number of channels opers of this type can be in at once. @@ -71,7 +75,7 @@ # modes: User modes besides +o that are set on an oper of this type # when they oper up. Used for snomasks and other things. - # Requires the opermodes module be loaded. + # Requires the opermodes module to be loaded. modes="+s +cCqQ"> <type name="GlobalOp" classes="SACommands OperChat BanControl HostCloak ServerLink" vhost="ircop.omega.example.org"> @@ -84,9 +88,9 @@ # Remember to only make operators out of trustworthy people. # # # -# Operator account with a plain-text password. +# Operator account with a plaintext password. <oper - # name: Oper login that is used to oper up (/oper name password). + # name: Oper login that is used to oper up (/OPER <username> <password>). # Remember: This is case sensitive. name="Attila" @@ -101,7 +105,7 @@ # ** ADVANCED ** This option is disabled by default. # fingerprint: When using the sslinfo module, you may specify - # a key fingerprint here. This can be obtained by using the /sslinfo + # a key fingerprint here. This can be obtained by using the /SSLINFO # command while the module is loaded, and is also noticed on connect. # This enhances security by verifying that the person opering up has # a matching SSL client certificate, which is very difficult to @@ -115,7 +119,7 @@ # that the private key is well-protected! Requires the sslinfo module. #autologin="on" - # sslonly: If on, this oper can only oper up if they're using a SSL connection. + # sslonly: If on, this oper can only oper up if they're using an SSL connection. # Setting this option adds a decent bit of security. Highly recommended # if the oper is on wifi, or specifically, unsecured wifi. Note that it # is redundant to specify this option if you specify a fingerprint. @@ -140,21 +144,21 @@ # Operator with a hashed password. It is highly recommended to use hashed passwords. <oper - # name: Oper login that is used to oper up (/oper name password). + # name: Oper login that is used to oper up (/OPER <username> <password>). # Remember: This is case sensitive. name="Adam" - # hash: the hash function this password is hashed with. Requires the + # hash: The hash function this password is hashed with. Requires the # module for the selected function (bcrypt, md5, sha1, or sha256) and # the password hashing module (password_hash) to be loaded. # # You may also use any of the above other than bcrypt prefixed with # either "hmac-" or "pbkdf2-hmac-" (requires the pbkdf2 module). - # Create hashed passwords with: /mkpasswd <hash> <password> + # Create hashed passwords with: /MKPASSWD <hashtype> <plaintext>. hash="bcrypt" # password: A hash of the password (see above option) hashed - # with /mkpasswd <hash> <password>. See the password_hash module + # with /MKPASSWD <hashtype> <plaintext>. See the password_hash module # in modules.conf for more information about password hashing. password="qQmv3LcF$Qh63wzmtUqWp9OXnLwe7yv1GcBwHpq59k2a0UrY8xe0" diff --git a/include/iohook.h b/include/iohook.h index 9ca17d77e..85404b09c 100644 --- a/include/iohook.h +++ b/include/iohook.h @@ -49,7 +49,7 @@ class IOHookProvider : public refcountbase, public ServiceProvider */ bool IsMiddle() const { return middlehook; } - /** Called when the provider should hook an incoming connection and act as being on the server side of the connection. + /** Called when the provider should hook an incoming connection and act as being on the server-side of the connection. * This occurs when a bind block has a hook configured and the listener accepts a connection. * @param sock Socket to hook * @param client Client IP address and port diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp index c26318337..732894aa5 100644 --- a/src/coremods/core_channel/cmd_invite.cpp +++ b/src/coremods/core_channel/cmd_invite.cpp @@ -29,7 +29,7 @@ CommandInvite::CommandInvite(Module* parent, Invite::APIImpl& invapiimpl) , invapi(invapiimpl) { Penalty = 4; - syntax = "[<nick> <channel>]"; + syntax = "[<nick> <channel> [<time>]]"; } /** Handle /INVITE diff --git a/src/coremods/core_channel/cmd_join.cpp b/src/coremods/core_channel/cmd_join.cpp index 2caed9dc6..0e783d2b3 100644 --- a/src/coremods/core_channel/cmd_join.cpp +++ b/src/coremods/core_channel/cmd_join.cpp @@ -24,7 +24,7 @@ CommandJoin::CommandJoin(Module* parent) : SplitCommand(parent, "JOIN", 1, 2) { - syntax = "<channel>{,<channel>} {<key>{,<key>}}"; + syntax = "<channel>[,<channel>]+ [<key>[,<key>]+]"; Penalty = 2; } diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp index 755c6613b..77ac36a66 100644 --- a/src/coremods/core_channel/cmd_kick.cpp +++ b/src/coremods/core_channel/cmd_kick.cpp @@ -24,7 +24,7 @@ CommandKick::CommandKick(Module* parent) : Command(parent, "KICK", 2, 3) { - syntax = "<channel> <nick>{,<nick>} [<reason>]"; + syntax = "<channel> <nick>[,<nick>]+ [:<reason>]"; } /** Handle /KICK @@ -65,7 +65,7 @@ CmdResult CommandKick::Handle(User* user, const Params& parameters) if (u->server->IsULine()) { - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, "You may not kick a u-lined client"); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, "You may not kick a U-lined client"); return CMD_FAILURE; } } diff --git a/src/coremods/core_channel/cmd_names.cpp b/src/coremods/core_channel/cmd_names.cpp index 28273c903..a179cf9dc 100644 --- a/src/coremods/core_channel/cmd_names.cpp +++ b/src/coremods/core_channel/cmd_names.cpp @@ -27,7 +27,7 @@ CommandNames::CommandNames(Module* parent) , privatemode(parent, "private") , invisiblemode(parent, "invisible") { - syntax = "{<channel>{,<channel>}}"; + syntax = "<channel>[,<channel>]+"; } /** Handle /NAMES diff --git a/src/coremods/core_channel/cmd_topic.cpp b/src/coremods/core_channel/cmd_topic.cpp index 0417f1a0c..f0af2a0ad 100644 --- a/src/coremods/core_channel/cmd_topic.cpp +++ b/src/coremods/core_channel/cmd_topic.cpp @@ -29,7 +29,7 @@ CommandTopic::CommandTopic(Module* parent) , secretmode(parent, "secret") , topiclockmode(parent, "topiclock") { - syntax = "<channel> [<topic>]"; + syntax = "<channel> [:<topic>]"; Penalty = 2; } diff --git a/src/coremods/core_ison.cpp b/src/coremods/core_ison.cpp index 3f6b1ac74..ec097f1c6 100644 --- a/src/coremods/core_ison.cpp +++ b/src/coremods/core_ison.cpp @@ -30,7 +30,7 @@ class CommandIson : public SplitCommand CommandIson(Module* parent) : SplitCommand(parent, "ISON", 1) { - syntax = "<nick> {nick}"; + syntax = "<nick> [<nick>]+"; } /** Handle command. * @param parameters The parameters to the command diff --git a/src/coremods/core_message.cpp b/src/coremods/core_message.cpp index 8a7499f1d..65eaa1bb7 100644 --- a/src/coremods/core_message.cpp +++ b/src/coremods/core_message.cpp @@ -303,7 +303,7 @@ class CommandMessage : public Command , moderatedmode(parent, "moderated") , noextmsgmode(parent, "noextmsg") { - syntax = "<target>{,<target>} <message>"; + syntax = "<target>[,<target>]+ :<message>"; } /** Handle command. @@ -357,7 +357,7 @@ class CommandSQuery : public SplitCommand CommandSQuery(Module* Creator) : SplitCommand(Creator, "SQUERY", 2, 2) { - syntax = "<service> <message>"; + syntax = "<service> :<message>"; } CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE @@ -398,7 +398,7 @@ class CommandSQuery : public SplitCommand if (!FirePreEvents(user, msgtarget, msgdetails)) return CMD_FAILURE; - // The SQUERY command targets a service on a u-lined server. This can never + // The SQUERY command targets a service on a U-lined server. This can never // be on the server local to the source so we don't need to do any routing // logic and can forward it as a PRIVMSG. diff --git a/src/coremods/core_oper/cmd_die.cpp b/src/coremods/core_oper/cmd_die.cpp index 724db2f32..73c590711 100644 --- a/src/coremods/core_oper/cmd_die.cpp +++ b/src/coremods/core_oper/cmd_die.cpp @@ -27,7 +27,7 @@ CommandDie::CommandDie(Module* parent, std::string& hashref) , hash(hashref) { flags_needed = 'o'; - syntax = "<server>"; + syntax = "<servername>"; } void DieRestart::SendError(const std::string& message) diff --git a/src/coremods/core_oper/cmd_kill.cpp b/src/coremods/core_oper/cmd_kill.cpp index bdf08f194..01179d61d 100644 --- a/src/coremods/core_oper/cmd_kill.cpp +++ b/src/coremods/core_oper/cmd_kill.cpp @@ -27,7 +27,7 @@ CommandKill::CommandKill(Module* parent) , protoev(parent, name) { flags_needed = 'o'; - syntax = "<nickname> <reason>"; + syntax = "<nick>[,<nick>]+ :<reason>"; TRANSLATE2(TR_CUSTOM, TR_CUSTOM); } diff --git a/src/coremods/core_oper/cmd_restart.cpp b/src/coremods/core_oper/cmd_restart.cpp index afadb911a..a96993e7e 100644 --- a/src/coremods/core_oper/cmd_restart.cpp +++ b/src/coremods/core_oper/cmd_restart.cpp @@ -26,7 +26,7 @@ CommandRestart::CommandRestart(Module* parent, std::string& hashref) , hash(hashref) { flags_needed = 'o'; - syntax = "<server>"; + syntax = "<servername>"; } CmdResult CommandRestart::Handle(User* user, const Params& parameters) diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp index 6576aa514..918d59ab7 100644 --- a/src/coremods/core_stats.cpp +++ b/src/coremods/core_stats.cpp @@ -44,7 +44,7 @@ class CommandStats : public Command , statsevprov(Creator, "event/stats") { allow_empty_last_param = false; - syntax = "<stats-symbol> [<servername>]"; + syntax = "<symbol> [<servername>]"; } /** Handle command. diff --git a/src/coremods/core_stub.cpp b/src/coremods/core_stub.cpp index e4f18cb22..06e033f15 100644 --- a/src/coremods/core_stub.cpp +++ b/src/coremods/core_stub.cpp @@ -40,7 +40,7 @@ class CommandConnect : public Command : Command(parent, "CONNECT", 1) { flags_needed = 'o'; - syntax = "<servername>"; + syntax = "<servermask>"; } /** Handle command. @@ -126,7 +126,7 @@ class CommandSquit : public Command : Command(parent, "SQUIT", 1, 2) { flags_needed = 'o'; - syntax = "<servername>"; + syntax = "<servermask>"; } /** Handle command. diff --git a/src/coremods/core_user/cmd_away.cpp b/src/coremods/core_user/cmd_away.cpp index 50a586392..834e8711d 100644 --- a/src/coremods/core_user/cmd_away.cpp +++ b/src/coremods/core_user/cmd_away.cpp @@ -33,7 +33,7 @@ CommandAway::CommandAway(Module* parent) , awayevprov(parent) { allow_empty_last_param = false; - syntax = "[<message>]"; + syntax = "[:<message>]"; } /** Handle /AWAY diff --git a/src/coremods/core_user/cmd_mode.cpp b/src/coremods/core_user/cmd_mode.cpp index ffeb9a2e3..f58a41aa4 100644 --- a/src/coremods/core_user/cmd_mode.cpp +++ b/src/coremods/core_user/cmd_mode.cpp @@ -26,7 +26,7 @@ CommandMode::CommandMode(Module* parent) : Command(parent, "MODE", 1) , seq(0) { - syntax = "<target> <modes> {<mode-parameters>}"; + syntax = "<target> [[(+|-)]<modes> [<mode-parameters>]]"; memset(&sent, 0, sizeof(sent)); } diff --git a/src/coremods/core_user/cmd_part.cpp b/src/coremods/core_user/cmd_part.cpp index 2bc431ab3..9400eed93 100644 --- a/src/coremods/core_user/cmd_part.cpp +++ b/src/coremods/core_user/cmd_part.cpp @@ -25,7 +25,7 @@ CommandPart::CommandPart(Module* parent) : Command(parent, "PART", 1, 2) { Penalty = 5; - syntax = "<channel>{,<channel>} [<reason>]"; + syntax = "<channel>[,<channel>]+ [:<reason>]"; } CmdResult CommandPart::Handle(User* user, const Params& parameters) diff --git a/src/coremods/core_user/cmd_quit.cpp b/src/coremods/core_user/cmd_quit.cpp index d919a5761..74781a98e 100644 --- a/src/coremods/core_user/cmd_quit.cpp +++ b/src/coremods/core_user/cmd_quit.cpp @@ -26,7 +26,7 @@ CommandQuit::CommandQuit(Module* parent) , operquit("operquit", ExtensionItem::EXT_USER, parent) { works_before_reg = true; - syntax = "[<message>]"; + syntax = "[:<message>]"; } CmdResult CommandQuit::Handle(User* user, const Params& parameters) diff --git a/src/coremods/core_user/cmd_user.cpp b/src/coremods/core_user/cmd_user.cpp index 1a8b091f3..89b173909 100644 --- a/src/coremods/core_user/cmd_user.cpp +++ b/src/coremods/core_user/cmd_user.cpp @@ -33,7 +33,7 @@ CommandUser::CommandUser(Module* parent) allow_empty_last_param = false; works_before_reg = true; Penalty = 0; - syntax = "<username> <localhost> <remotehost> <realname>"; + syntax = "<username> <unused> <unused> :<realname>"; } CmdResult CommandUser::HandleLocal(LocalUser* user, const Params& parameters) diff --git a/src/coremods/core_userhost.cpp b/src/coremods/core_userhost.cpp index 542c1831d..e21e7d95b 100644 --- a/src/coremods/core_userhost.cpp +++ b/src/coremods/core_userhost.cpp @@ -33,7 +33,7 @@ class CommandUserhost : public Command : Command(parent,"USERHOST", 1) , hideopermode(parent, "hideoper") { - syntax = "<nick> [<nick> ...]"; + syntax = "<nick> [<nick>]+"; } /** Handle command. * @param parameters The parameters to the command diff --git a/src/coremods/core_wallops.cpp b/src/coremods/core_wallops.cpp index 6b055f874..09fafd244 100644 --- a/src/coremods/core_wallops.cpp +++ b/src/coremods/core_wallops.cpp @@ -36,7 +36,7 @@ class CommandWallops : public Command , protoevprov(parent, name) { flags_needed = 'o'; - syntax = "<any-text>"; + syntax = ":<message>"; } /** Handle command. diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index b5f9163e1..bf00b741f 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -143,7 +143,7 @@ class CommandWho : public SplitCommand , whoevprov(parent, "event/who") { allow_empty_last_param = false; - syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [[Aafhilmnoprstux][%acdfhilnorstu] <server>|<nickname>|<channel>|<realname>|<host>|0]"; + syntax = "<server>|<nick>|<channel>|<realname>|<host>|0 [[Aafhilmnoprstux][%acdfhilnorstu] <server>|<nick>|<channel>|<realname>|<host>|0]"; } /** Sends a WHO reply to a user. */ diff --git a/src/coremods/core_whois.cpp b/src/coremods/core_whois.cpp index 880e5a533..199c9e2ac 100644 --- a/src/coremods/core_whois.cpp +++ b/src/coremods/core_whois.cpp @@ -107,7 +107,7 @@ class CommandWhois : public SplitCommand , lineevprov(parent, "event/whoisline") { Penalty = 2; - syntax = "<nick>{,<nick>}"; + syntax = "[<servername>] <nick>[,<nick>]+"; } /** Handle command. diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp index 65c83e08b..80c87357c 100644 --- a/src/coremods/core_whowas.cpp +++ b/src/coremods/core_whowas.cpp @@ -37,7 +37,7 @@ enum CommandWhowas::CommandWhowas( Module* parent) : Command(parent, "WHOWAS", 1) { - syntax = "<nick>{,<nick>}"; + syntax = "<nick>"; Penalty = 2; } diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp index 4700e9fd2..99794be3e 100644 --- a/src/coremods/core_xline/cmd_eline.cpp +++ b/src/coremods/core_xline/cmd_eline.cpp @@ -26,7 +26,7 @@ CommandEline::CommandEline(Module* parent) : Command(parent, "ELINE", 1, 3) { flags_needed = 'o'; - syntax = "<ident@host> [<duration> :<reason>]"; + syntax = "<user@host> [<duration> :<reason>]"; } /** Handle /ELINE diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp index 413da97b1..ae1ea5d6e 100644 --- a/src/coremods/core_xline/cmd_gline.cpp +++ b/src/coremods/core_xline/cmd_gline.cpp @@ -26,7 +26,7 @@ CommandGline::CommandGline(Module* parent) : Command(parent, "GLINE", 1, 3) { flags_needed = 'o'; - syntax = "<ident@host> [<duration> :<reason>]"; + syntax = "<user@host> [<duration> :<reason>]"; } /** Handle /GLINE diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp index 6499b6b00..ad7511d56 100644 --- a/src/coremods/core_xline/cmd_kline.cpp +++ b/src/coremods/core_xline/cmd_kline.cpp @@ -26,7 +26,7 @@ CommandKline::CommandKline(Module* parent) : Command(parent, "KLINE", 1, 3) { flags_needed = 'o'; - syntax = "<ident@host> [<duration> :<reason>]"; + syntax = "<user@host> [<duration> :<reason>]"; } /** Handle /KLINE diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp index 0b2ef99bb..51f5bec16 100644 --- a/src/coremods/core_xline/cmd_qline.cpp +++ b/src/coremods/core_xline/cmd_qline.cpp @@ -27,7 +27,7 @@ CommandQline::CommandQline(Module* parent) : Command(parent, "QLINE", 1, 3) { flags_needed = 'o'; - syntax = "<nick> [<duration> :<reason>]"; + syntax = "<nickmask> [<duration> :<reason>]"; } CmdResult CommandQline::Handle(User* user, const Params& parameters) diff --git a/src/mode.cpp b/src/mode.cpp index 50dd05d2d..6f17d3896 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -592,13 +592,13 @@ void ModeParser::AddMode(ModeHandler* mh) PrefixMode* otherpm = FindPrefix(pm->GetPrefix()); if (otherpm) - throw ModuleException(InspIRCd::Format("Mode prefix for %s already by used by %s from %s: %c", + throw ModuleException(InspIRCd::Format("Mode prefix for %s already used by %s from %s: %c", mh->name.c_str(), otherpm->name.c_str(), otherpm->creator->ModuleSourceFile.c_str(), pm->GetPrefix())); } ModeHandler*& slot = modehandlers[mh->GetModeType()][mh->GetModeChar()-65]; if (slot) - throw ModuleException(InspIRCd::Format("Mode letter for %s already by used by %s from %s: %c", + throw ModuleException(InspIRCd::Format("Mode letter for %s already used by %s from %s: %c", mh->name.c_str(), slot->name.c_str(), slot->creator->ModuleSourceFile.c_str(), mh->GetModeChar())); // The mode needs an id if it is either a user mode, a simple mode (flag) or a parameter mode. diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 3810fcf32..49143034f 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -179,7 +179,7 @@ public: extInfo(Creator) { allow_empty_last_param = false; - syntax = "*|(+|-)<nick>[,(+|-)<nick> ...]"; + syntax = "*|(+|-)<nick>[,(+|-)<nick>]+"; TRANSLATE1(TR_CUSTOM); } @@ -189,7 +189,7 @@ public: if (parameter.find(',') != std::string::npos) return; - // Convert a [+|-]<nick> into a [-]<uuid> + // Convert a (+|-)<nick> into a [-]<uuid> ACCEPTAction action = GetTargetAndAction(parameter); if (!action.first) return; diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 8d08de9d9..ae49dbc05 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -88,7 +88,7 @@ class CommandCBan : public Command public: CommandCBan(Module* Creator) : Command(Creator, "CBAN", 1, 3) { - flags_needed = 'o'; this->syntax = "<channel> [<duration> :<reason>]"; + flags_needed = 'o'; this->syntax = "<channel> [<duration> [:<reason>]]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 4c89ad894..d80719c17 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -132,7 +132,7 @@ class CommandWebIRC : public SplitCommand { allow_empty_last_param = false; works_before_reg = true; - this->syntax = "<password> <gateway> <hostname> <ip> [flags]"; + this->syntax = "<password> <gateway> <hostname> <ip> [<flags>]"; } CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 58e71aadc..6447ef9e3 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -146,7 +146,7 @@ class CommandCheck : public Command : Command(parent,"CHECK", 1) , snomaskmode(parent, "snomask") { - flags_needed = 'o'; syntax = "<nickname>|<ip>|<hostmask>|<channel> <server>"; + flags_needed = 'o'; syntax = "<nick>|<ipmask>|<hostmask>|<channel> [<servername>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 6e498a8be..af6e09aaf 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -33,7 +33,7 @@ class CommandChghost : public Command { allow_empty_last_param = false; flags_needed = 'o'; - syntax = "<nick> <newhost>"; + syntax = "<nick> <host>"; TRANSLATE2(TR_NICK, TR_TEXT); } diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 9a2d3b2ea..6ddda7ea1 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -31,7 +31,7 @@ class CommandChgident : public Command { allow_empty_last_param = false; flags_needed = 'o'; - syntax = "<nick> <newident>"; + syntax = "<nick> <ident>"; TRANSLATE2(TR_NICK, TR_TEXT); } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index aedd75d94..108c988cc 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -29,7 +29,7 @@ class CommandChgname : public Command { allow_empty_last_param = false; flags_needed = 'o'; - syntax = "<nick> <new real name>"; + syntax = "<nick> :<realname>"; TRANSLATE2(TR_NICK, TR_TEXT); } diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp index dec49866c..096ce6022 100644 --- a/src/modules/m_clearchan.cpp +++ b/src/modules/m_clearchan.cpp @@ -28,7 +28,7 @@ class CommandClearChan : public Command CommandClearChan(Module* Creator) : Command(Creator, "CLEARCHAN", 1, 3) { - syntax = "<channel> [<KILL|KICK|G|Z>] [<reason>]"; + syntax = "<channel> [KILL|KICK|G|Z] [:<reason>]"; flags_needed = 'o'; // Stop the linking mod from forwarding ENCAP'd CLEARCHAN commands, see below why diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 2dd378062..da88d1759 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -74,7 +74,7 @@ class CommandTitle : public Command CommandTitle(Module* Creator) : Command(Creator,"TITLE", 2), ctitle("ctitle", ExtensionItem::EXT_USER, Creator) { - syntax = "<user> <password>"; + syntax = "<username> <password>"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 3ead72a45..57c8ea3b2 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -28,7 +28,7 @@ class CommandCycle : public SplitCommand CommandCycle(Module* Creator) : SplitCommand(Creator, "CYCLE", 1) { - Penalty = 3; syntax = "<channel> :[reason]"; + Penalty = 3; syntax = "<channel> [:<reason>]"; } CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index d9e26d28f..f0a88022c 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -54,7 +54,7 @@ static const char* const helptext[] = "Brain would then be able to send you files. They would have to", "resend the file again if the server gave them an error message", "before you added them to your DCCALLOW list.", - "DCCALLOW entries will be temporary by default, if you want to add", + "DCCALLOW entries will be temporary. If you want to add", "them to your DCCALLOW list until you leave IRC, type:", "/DCCALLOW +Brain 0", "To remove the user from your DCCALLOW list, type:", @@ -63,7 +63,7 @@ static const char* const helptext[] = "/DCCALLOW LIST", "NOTE: If the user leaves IRC or changes their nickname", " they will be removed from your DCCALLOW list.", - " your DCCALLOW list will be deleted when you leave IRC." + " Your DCCALLOW list will be deleted when you leave IRC." }; class BannedFileList @@ -117,7 +117,7 @@ class CommandDccallow : public Command CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE { - /* syntax: DCCALLOW [+|-]<nick> (<time>) */ + /* syntax: DCCALLOW [(+|-)<nick> [<time>]]|[LIST|HELP] */ if (!parameters.size()) { // display current DCCALLOW list diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index c0ce025bd..adc1b59ff 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -32,7 +32,7 @@ class CommandGloadmodule : public Command CommandGloadmodule(Module* Creator) : Command(Creator,"GLOADMODULE", 1) { flags_needed = 'o'; - syntax = "<modulename> [servermask]"; + syntax = "<modulename> [<servermask>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE @@ -71,7 +71,7 @@ class CommandGunloadmodule : public Command CommandGunloadmodule(Module* Creator) : Command(Creator,"GUNLOADMODULE", 1) { flags_needed = 'o'; - syntax = "<modulename> [servermask]"; + syntax = "<modulename> [<servermask>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE @@ -122,7 +122,7 @@ class CommandGreloadmodule : public Command public: CommandGreloadmodule(Module* Creator) : Command(Creator, "GRELOADMODULE", 1) { - flags_needed = 'o'; syntax = "<modulename> [servermask]"; + flags_needed = 'o'; syntax = "<modulename> [<servermask>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index b98adce35..0102b3b57 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -30,7 +30,7 @@ class CommandGlobops : public Command public: CommandGlobops(Module* Creator) : Command(Creator,"GLOBOPS", 1,1) { - flags_needed = 'o'; syntax = "<any-text>"; + flags_needed = 'o'; syntax = ":<message>"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 1b66e01a4..435f30d59 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -46,7 +46,7 @@ class CommandKnock : public Command , noknockmode(Noknockmode) , inviteonlymode(Creator, "inviteonly") { - syntax = "<channel> <reason>"; + syntax = "<channel> :<reason>"; Penalty = 5; } diff --git a/src/modules/m_modenotice.cpp b/src/modules/m_modenotice.cpp index 5311015b7..59e0e8dc1 100644 --- a/src/modules/m_modenotice.cpp +++ b/src/modules/m_modenotice.cpp @@ -24,7 +24,7 @@ class CommandModeNotice : public Command public: CommandModeNotice(Module* parent) : Command(parent,"MODENOTICE",2,2) { - syntax = "<modes> <message>"; + syntax = "<modeletters> :<message>"; flags_needed = 'o'; } diff --git a/src/modules/m_monitor.cpp b/src/modules/m_monitor.cpp index fd72c7320..b82dbcc7d 100644 --- a/src/modules/m_monitor.cpp +++ b/src/modules/m_monitor.cpp @@ -316,7 +316,7 @@ class CommandMonitor : public SplitCommand { Penalty = 2; allow_empty_last_param = false; - syntax = "[C|L|S|+ <nick1>[,<nick2>]|- <nick1>[,<nick2>]"; + syntax = "C|L|S|(+|-) <nick>[,<nick>]+"; } CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp index 8872ba629..3c8452e7b 100644 --- a/src/modules/m_namedmodes.cpp +++ b/src/modules/m_namedmodes.cpp @@ -56,7 +56,7 @@ class CommandProp : public SplitCommand CommandProp(Module* parent) : SplitCommand(parent, "PROP", 1) { - syntax = "<user|channel> {[+-]<mode> [<value>]}*"; + syntax = "<channel> [[(+|-)]<mode> [<value>]]"; } CmdResult HandleLocal(LocalUser* src, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 964ed9780..86cf6245a 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -40,7 +40,7 @@ class CommandNicklock : public Command locked(ext) { flags_needed = 'o'; - syntax = "<oldnick> <newnick>"; + syntax = "<nick> <newnick>"; TRANSLATE2(TR_NICK, TR_TEXT); } @@ -100,7 +100,7 @@ class CommandNickunlock : public Command locked(ext) { flags_needed = 'o'; - syntax = "<locked-nick>"; + syntax = "<nick>"; TRANSLATE1(TR_NICK); } diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 137ddb96c..696c4fe6d 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -28,7 +28,7 @@ class CommandMkpasswd : public Command public: CommandMkpasswd(Module* Creator) : Command(Creator, "MKPASSWD", 2) { - syntax = "<hashtype> <any-text>"; + syntax = "<hashtype> <plaintext>"; Penalty = 5; } diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 8d60ff8c6..357b2ea41 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -165,7 +165,7 @@ class CommandRemove : public RemoveBase CommandRemove(Module* Creator, bool& snk, ChanModeReference& nkm) : RemoveBase(Creator, snk, nkm, "REMOVE") { - syntax = "<channel> <nick> [<reason>]"; + syntax = "<channel> <nick> [:<reason>]"; TRANSLATE3(TR_NICK, TR_TEXT, TR_TEXT); } @@ -183,7 +183,7 @@ class CommandFpart : public RemoveBase CommandFpart(Module* Creator, bool& snk, ChanModeReference& nkm) : RemoveBase(Creator, snk, nkm, "FPART") { - syntax = "<channel> <nick> [<reason>]"; + syntax = "<channel> <nick> [:<reason>]"; TRANSLATE3(TR_TEXT, TR_NICK, TR_TEXT); } diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index a8dd49e2d..89df1814c 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -141,14 +141,14 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> > if (!ParseSettings(source, parameter, settings)) { source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, - "Invalid repeat syntax. Syntax is {[~*]}[lines]:[time]{:[difference]}{:[backlog]}.")); + "Invalid repeat syntax. Syntax is: [~|*]<lines>:<sec>[:<difference>][:<backlog>]")); return MODEACTION_DENY; } if ((settings.Backlog > 0) && (settings.Lines > settings.Backlog)) { source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, - "Invalid repeat syntax. You can't set needed lines higher than backlog.")); + "Invalid repeat syntax. You can't set lines higher than backlog.")); return MODEACTION_DENY; } @@ -319,7 +319,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> > if (ms.MaxSecs && settings.Seconds > ms.MaxSecs) { source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format( - "Invalid repeat parameter. The seconds you specified is too great. Maximum allowed is %u.", ms.MaxSecs))); + "Invalid repeat parameter. The seconds you specified are too great. Maximum allowed is %u.", ms.MaxSecs))); return false; } diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 1eb2d8ac3..353a184aa 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -137,7 +137,7 @@ class CommandRLine : public Command public: CommandRLine(Module* Creator, RLineFactory& rlf) : Command(Creator,"RLINE", 1, 3), factory(rlf) { - flags_needed = 'o'; this->syntax = "<regex> [<rline-duration>] :<reason>"; + flags_needed = 'o'; this->syntax = "<regex> [<duration> :<reason>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp index ce28630b4..7db988b60 100644 --- a/src/modules/m_rmode.cpp +++ b/src/modules/m_rmode.cpp @@ -28,7 +28,7 @@ class CommandRMode : public Command CommandRMode(Module* Creator) : Command(Creator,"RMODE", 2, 3) { allow_empty_last_param = false; - syntax = "<channel> <mode> [pattern]"; + syntax = "<channel> <mode> [<pattern>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 9aa8837e0..f506a2e1c 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -29,7 +29,7 @@ class CommandSajoin : public Command CommandSajoin(Module* Creator) : Command(Creator,"SAJOIN", 1) { allow_empty_last_param = false; - flags_needed = 'o'; syntax = "[<nick>] <channel>[,<channel>]"; + flags_needed = 'o'; syntax = "[<nick>] <channel>[,<channel>]+"; TRANSLATE2(TR_NICK, TR_TEXT); } @@ -53,7 +53,7 @@ class CommandSajoin : public Command if (dest->server->IsULine()) { - user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client"); + user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a U-lined client"); return CMD_FAILURE; } if (IS_LOCAL(user) && !ServerInstance->IsChannel(channel)) diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index 6a9e11fe7..2970596af 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -27,7 +27,7 @@ class CommandSakick : public Command public: CommandSakick(Module* Creator) : Command(Creator,"SAKICK", 2, 3) { - flags_needed = 'o'; syntax = "<channel> <nick> [reason]"; + flags_needed = 'o'; syntax = "<channel> <nick> [:<reason>]"; TRANSLATE3(TR_TEXT, TR_NICK, TR_TEXT); } @@ -42,7 +42,7 @@ class CommandSakick : public Command if (dest->server->IsULine()) { - user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client"); + user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a U-lined client"); return CMD_FAILURE; } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 634464ac2..322ee91b8 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -33,7 +33,7 @@ class CommandSamode : public Command CommandSamode(Module* Creator) : Command(Creator,"SAMODE", 2) { allow_empty_last_param = false; - flags_needed = 'o'; syntax = "<target> <modes> {<mode-parameters>}"; + flags_needed = 'o'; syntax = "<target> (+|-)<modes> [<mode-parameters>]"; active = false; } diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 4744ca1de..e814e2c4e 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -29,7 +29,7 @@ class CommandSanick : public Command CommandSanick(Module* Creator) : Command(Creator,"SANICK", 2) { allow_empty_last_param = false; - flags_needed = 'o'; syntax = "<nick> <new-nick>"; + flags_needed = 'o'; syntax = "<nick> <newnick>"; TRANSLATE2(TR_NICK, TR_TEXT); } @@ -42,7 +42,7 @@ class CommandSanick : public Command { if (target && target->server->IsULine()) { - user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client"); + user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a U-lined client"); return CMD_FAILURE; } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 0cd82fa15..4f7bfdb1f 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -28,7 +28,7 @@ class CommandSapart : public Command public: CommandSapart(Module* Creator) : Command(Creator,"SAPART", 2, 3) { - flags_needed = 'o'; syntax = "<nick> <channel>[,<channel>] [reason]"; + flags_needed = 'o'; syntax = "<nick> <channel>[,<channel>]+ [:<reason>]"; TRANSLATE3(TR_NICK, TR_TEXT, TR_TEXT); } @@ -48,7 +48,7 @@ class CommandSapart : public Command if (dest->server->IsULine()) { - user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client"); + user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a U-lined client"); return CMD_FAILURE; } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 9034016d2..648528876 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -28,7 +28,7 @@ class CommandSaquit : public Command public: CommandSaquit(Module* Creator) : Command(Creator, "SAQUIT", 2, 2) { - flags_needed = 'o'; syntax = "<nick> <reason>"; + flags_needed = 'o'; syntax = "<nick> :<reason>"; TRANSLATE2(TR_NICK, TR_TEXT); } @@ -39,7 +39,7 @@ class CommandSaquit : public Command { if (dest->server->IsULine()) { - user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client"); + user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a U-lined client"); return CMD_FAILURE; } diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 8c8629221..b3aec8592 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -26,7 +26,7 @@ class CommandSATopic : public Command public: CommandSATopic(Module* Creator) : Command(Creator,"SATOPIC", 2, 2) { - flags_needed = 'o'; syntax = "<target> <topic>"; + flags_needed = 'o'; syntax = "<channel> :<topic>"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 87eed4022..bb8514add 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -32,7 +32,7 @@ class CommandSethost : public Command : Command(Creator,"SETHOST", 1) { allow_empty_last_param = false; - flags_needed = 'o'; syntax = "<new-hostname>"; + flags_needed = 'o'; syntax = "<host>"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 11ce8f015..79e168332 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -30,7 +30,7 @@ class CommandSetident : public Command CommandSetident(Module* Creator) : Command(Creator,"SETIDENT", 1) { allow_empty_last_param = false; - flags_needed = 'o'; syntax = "<new-ident>"; + flags_needed = 'o'; syntax = "<ident>"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 5c27a655e..b0e76f587 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -30,7 +30,7 @@ class CommandSetname : public Command CommandSetname(Module* Creator) : Command(Creator,"SETNAME", 1, 1) { allow_empty_last_param = false; - syntax = "<new real name>"; + syntax = ":<realname>"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index cd2743ab0..e54156da6 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -53,7 +53,7 @@ class CommandShun : public Command public: CommandShun(Module* Creator) : Command(Creator, "SHUN", 1, 3) { - flags_needed = 'o'; this->syntax = "<nick!user@hostmask> [<shun-duration>] :<reason>"; + flags_needed = 'o'; this->syntax = "<nick!user@host> [<duration> :<reason>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 165e083bb..dc703f9b0 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -24,7 +24,7 @@ #include "inspircd.h" /* Improved drop-in replacement for the /SILENCE command - * syntax: /SILENCE [+|-]<mask> <p|c|i|n|t|a|x> as in <privatemessage|channelmessage|invites|privatenotice|channelnotice|all|exclude> + * syntax: /SILENCE [(+|-)<mask> [p|c|i|n|t|a|x]] as in [privatemessages|channelmessages|invites|privatenotices|channelnotices|all|exclude] * * example that blocks all except private messages * /SILENCE +*!*@* a @@ -74,7 +74,7 @@ class CommandSVSSilence : public Command public: CommandSVSSilence(Module* Creator) : Command(Creator,"SVSSILENCE", 2) { - syntax = "<target> {[+|-]<mask> <p|c|i|n|t|a|x>}"; + syntax = "<target> (+|-)<mask> [p|c|i|n|t|a|x]"; TRANSLATE3(TR_NICK, TR_TEXT, TR_TEXT); } @@ -119,7 +119,7 @@ class CommandSilence : public Command , ext("silence_list", ExtensionItem::EXT_USER, Creator) { allow_empty_last_param = false; - syntax = "{[+|-]<mask> <p|c|i|n|t|a|x>}"; + syntax = "[(+|-)<mask> [p|c|i|n|t|a|x]]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp index 7ede80b4c..7edb9501a 100644 --- a/src/modules/m_spanningtree/rsquit.cpp +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -29,7 +29,7 @@ CommandRSQuit::CommandRSQuit(Module* Creator) : Command(Creator, "RSQUIT", 1) { flags_needed = 'o'; - syntax = "<target-server-mask> [reason]"; + syntax = "<target-server-mask> [:<reason>]"; } CmdResult CommandRSQuit::Handle(User* user, const Params& parameters) diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index 73fde6582..daffdf7d9 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -96,7 +96,7 @@ class CommandSvshold : public Command public: CommandSvshold(Module* Creator) : Command(Creator, "SVSHOLD", 1) { - flags_needed = 'o'; this->syntax = "<nickname> [<duration> :<reason>]"; + flags_needed = 'o'; this->syntax = "<nick> [<duration> :<reason>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index c64f53684..54b2808b9 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -28,7 +28,7 @@ class CommandUserip : public Command public: CommandUserip(Module* Creator) : Command(Creator,"USERIP", 1) { - syntax = "<nick> [<nick> ...]"; + syntax = "<nick> [<nick>]+"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 8b84132b2..385ec9e02 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -133,7 +133,7 @@ class CommandWatch : public SplitCommand , manager(managerref) { allow_empty_last_param = false; - syntax = "[<C|L|S|l|+<nick1>|-<nick>>]"; + syntax = "C|L|l|S|(+|-)<nick> [(+|-)<nick>]+"; } CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE -- cgit v1.3.1-10-gc9f91 From e02c22ff165c7b0dbe39343066a4167e94f5618e Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Sun, 17 Feb 2019 02:10:26 -0700 Subject: Add a function for displaying human-readable durations. Add InspIRCd::DurationString() to take a time_t and return a string with the duration in a human-readable format (ex: 1y20w2d3h5m9s). --- include/inspircd.h | 6 ++++++ src/helperfuncs.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/inspircd.h b/include/inspircd.h index f5c7dbafb..0de64b103 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -516,6 +516,12 @@ class CoreExport InspIRCd */ static bool IsValidDuration(const std::string& str); + /** Return a duration in seconds as a human-readable string. + * @param duration The duration in seconds to convert to a human-readable string. + * @return A string representing the given duration. + */ + static std::string DurationString(time_t duration); + /** Attempt to compare a password to a string from the config file. * This will be passed to handling modules which will compare the data * against possible hashed equivalents in the input string. diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 94a5240c9..846feab50 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -7,6 +7,7 @@ * Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org> * Copyright (C) 2006-2007 Oliver Lupton <oliverlupton@gmail.com> * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org> + * Copyright (C) 2003-2019 Anope Team <team@anope.org> * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -429,6 +430,33 @@ bool InspIRCd::IsValidDuration(const std::string& duration) return true; } +std::string InspIRCd::DurationString(time_t duration) +{ + time_t years = duration / 31536000; + time_t weeks = (duration / 604800) % 52; + time_t days = (duration / 86400) % 7; + time_t hours = (duration / 3600) % 24; + time_t minutes = (duration / 60) % 60; + time_t seconds = duration % 60; + + std::string ret; + + if (years) + ret = ConvToStr(years) + "y"; + if (weeks) + ret += ConvToStr(weeks) + "w"; + if (days) + ret += ConvToStr(days) + "d"; + if (hours) + ret += ConvToStr(hours) + "h"; + if (minutes) + ret += ConvToStr(minutes) + "m"; + if (seconds) + ret += ConvToStr(seconds) + "s"; + + return ret; +} + std::string InspIRCd::Format(va_list& vaList, const char* formatString) { static std::vector<char> formatBuffer(1024); -- cgit v1.3.1-10-gc9f91 From ff7bebe90c6b348b0df28864e4954d04bd17256b Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Sun, 17 Feb 2019 02:20:56 -0700 Subject: X-line expiries: use the new DurationString() function. --- src/modules/m_svshold.cpp | 4 ++-- src/xline.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index daffdf7d9..dbf621932 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -58,8 +58,8 @@ public: { if (!silent) { - ServerInstance->SNO->WriteToSnoMask('x', "Removing expired SVSHOLD %s (set by %s %ld seconds ago): %s", - nickname.c_str(), source.c_str(), (long)(ServerInstance->Time() - set_time), reason.c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "Removing expired SVSHOLD %s (set by %s %s ago): %s", + nickname.c_str(), source.c_str(), InspIRCd::DurationString(ServerInstance->Time() - set_time).c_str(), reason.c_str()); } } diff --git a/src/xline.cpp b/src/xline.cpp index ccdc58dc2..c5b952087 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -682,8 +682,8 @@ void ELine::OnAdd() void XLine::DisplayExpiry() { bool onechar = (type.length() == 1); - ServerInstance->SNO->WriteToSnoMask('x', "Removing expired %s%s %s (set by %s %ld seconds ago): %s", - type.c_str(), (onechar ? "-line" : ""), Displayable().c_str(), source.c_str(), (long)(ServerInstance->Time() - set_time), reason.c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "Removing expired %s%s %s (set by %s %s ago): %s", + type.c_str(), (onechar ? "-line" : ""), Displayable().c_str(), source.c_str(), InspIRCd::DurationString(ServerInstance->Time() - set_time).c_str(), reason.c_str()); } const std::string& ELine::Displayable() -- cgit v1.3.1-10-gc9f91 From 755a32c75101c4df0e5699db558785fc0dbc1973 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Sun, 17 Feb 2019 02:23:32 -0700 Subject: Start using DurationString() in X-line additions and a few other modules where it fits better than just showing seconds. --- src/coremods/core_xline/cmd_eline.cpp | 9 ++++----- src/coremods/core_xline/cmd_gline.cpp | 9 ++++----- src/coremods/core_xline/cmd_kline.cpp | 9 ++++----- src/coremods/core_xline/cmd_qline.cpp | 9 ++++----- src/coremods/core_xline/cmd_zline.cpp | 9 ++++----- src/modules/m_cban.cpp | 6 +++--- src/modules/m_dccallow.cpp | 2 +- src/modules/m_dnsbl.cpp | 18 +++++++++--------- src/modules/m_rline.cpp | 12 ++++++------ src/modules/m_shun.cpp | 9 ++++----- src/modules/m_spanningtree/addline.cpp | 12 +++++++----- src/modules/m_timedbans.cpp | 2 +- 12 files changed, 51 insertions(+), 55 deletions(-) diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp index 99794be3e..4a56ba7ea 100644 --- a/src/coremods/core_xline/cmd_eline.cpp +++ b/src/coremods/core_xline/cmd_eline.cpp @@ -69,14 +69,13 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent E-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent E-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str()); } else { - time_t c_requires_crap = duration + ServerInstance->Time(); - std::string timestr = InspIRCd::TimeString(c_requires_crap); - ServerInstance->SNO->WriteToSnoMask('x',"%s added timed E-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(), - timestr.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added timed E-line for %s, expires in %s (on %s): %s", + user->nick.c_str(), target.c_str(), InspIRCd::DurationString(duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); } } else diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp index ae1ea5d6e..3e710978d 100644 --- a/src/coremods/core_xline/cmd_gline.cpp +++ b/src/coremods/core_xline/cmd_gline.cpp @@ -75,14 +75,13 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent G-line for %s: %s",user->nick.c_str(),target.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent G-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str()); } else { - time_t c_requires_crap = duration + ServerInstance->Time(); - std::string timestr = InspIRCd::TimeString(c_requires_crap); - ServerInstance->SNO->WriteToSnoMask('x',"%s added timed G-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(), - timestr.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added timed G-line for %s, expires in %s (on %s): %s", + user->nick.c_str(), target.c_str(), InspIRCd::DurationString(duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); } ServerInstance->XLines->ApplyLines(); diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp index ad7511d56..1ec10aebb 100644 --- a/src/coremods/core_xline/cmd_kline.cpp +++ b/src/coremods/core_xline/cmd_kline.cpp @@ -75,14 +75,13 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent K-line for %s: %s",user->nick.c_str(),target.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent K-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str()); } else { - time_t c_requires_crap = duration + ServerInstance->Time(); - std::string timestr = InspIRCd::TimeString(c_requires_crap); - ServerInstance->SNO->WriteToSnoMask('x',"%s added timed K-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(), - timestr.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added timed K-line for %s, expires in %s (on %s): %s", + user->nick.c_str(), target.c_str(), InspIRCd::DurationString(duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); } ServerInstance->XLines->ApplyLines(); diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp index 51f5bec16..afdc0431e 100644 --- a/src/coremods/core_xline/cmd_qline.cpp +++ b/src/coremods/core_xline/cmd_qline.cpp @@ -55,14 +55,13 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s: %s",user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent Q-line for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str()); } else { - time_t c_requires_crap = duration + ServerInstance->Time(); - std::string timestr = InspIRCd::TimeString(c_requires_crap); - ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires on %s: %s",user->nick.c_str(),parameters[0].c_str(), - timestr.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added timed Q-line for %s, expires in %s (on %s): %s", + user->nick.c_str(), parameters[0].c_str(), InspIRCd::DurationString(duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); } ServerInstance->XLines->ApplyLines(); } diff --git a/src/coremods/core_xline/cmd_zline.cpp b/src/coremods/core_xline/cmd_zline.cpp index 4aaa3061f..d32cde295 100644 --- a/src/coremods/core_xline/cmd_zline.cpp +++ b/src/coremods/core_xline/cmd_zline.cpp @@ -73,14 +73,13 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s: %s", user->nick.c_str(), ipaddr, parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent Z-line for %s: %s", user->nick.c_str(), ipaddr, parameters[2].c_str()); } else { - time_t c_requires_crap = duration + ServerInstance->Time(); - std::string timestr = InspIRCd::TimeString(c_requires_crap); - ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s: %s",user->nick.c_str(),ipaddr, - timestr.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added timed Z-line for %s, expires in %s (on %s): %s", + user->nick.c_str(), ipaddr, InspIRCd::DurationString(duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); } ServerInstance->XLines->ApplyLines(); } diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index ae49dbc05..32b45abfb 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -130,9 +130,9 @@ class CommandCBan : public Command } else { - time_t c_requires_crap = duration + ServerInstance->Time(); - std::string timestr = InspIRCd::TimeString(c_requires_crap); - ServerInstance->SNO->WriteGlobalSno('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), reason); + ServerInstance->SNO->WriteGlobalSno('x', "%s added timed CBan for %s, expires in %s (on %s): %s", + user->nick.c_str(), parameters[0].c_str(), InspIRCd::DurationString(duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), reason); } } else diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index f0a88022c..86fa50724 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -235,7 +235,7 @@ class CommandDccallow : public Command if (length > 0) { - user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for %ld seconds", target->nick.c_str(), length)); + user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for %s", target->nick.c_str(), InspIRCd::DurationString(length).c_str())); } else { diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index eade39bd7..91777637c 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -147,9 +147,9 @@ class DNSBLResolver : public DNS::Request "*", them->GetIPString()); if (ServerInstance->XLines->AddLine(kl,NULL)) { - std::string timestr = InspIRCd::TimeString(kl->expiry); - ServerInstance->SNO->WriteGlobalSno('x', "K-line added due to DNSBL match on *@%s to expire on %s: %s", - them->GetIPString().c_str(), timestr.c_str(), reason.c_str()); + ServerInstance->SNO->WriteGlobalSno('x', "K-line added due to DNSBL match on *@%s to expire in %s (on %s): %s", + them->GetIPString().c_str(), InspIRCd::DurationString(kl->duration).c_str(), + InspIRCd::TimeString(kl->expiry).c_str(), reason.c_str()); ServerInstance->XLines->ApplyLines(); } else @@ -165,9 +165,9 @@ class DNSBLResolver : public DNS::Request "*", them->GetIPString()); if (ServerInstance->XLines->AddLine(gl,NULL)) { - std::string timestr = InspIRCd::TimeString(gl->expiry); - ServerInstance->SNO->WriteGlobalSno('x', "G-line added due to DNSBL match on *@%s to expire on %s: %s", - them->GetIPString().c_str(), timestr.c_str(), reason.c_str()); + ServerInstance->SNO->WriteGlobalSno('x', "G-line added due to DNSBL match on *@%s to expire in %s (on %s): %s", + them->GetIPString().c_str(), InspIRCd::DurationString(gl->duration).c_str(), + InspIRCd::TimeString(gl->expiry).c_str(), reason.c_str()); ServerInstance->XLines->ApplyLines(); } else @@ -183,9 +183,9 @@ class DNSBLResolver : public DNS::Request them->GetIPString()); if (ServerInstance->XLines->AddLine(zl,NULL)) { - std::string timestr = InspIRCd::TimeString(zl->expiry); - ServerInstance->SNO->WriteGlobalSno('x', "Z-line added due to DNSBL match on %s to expire on %s: %s", - them->GetIPString().c_str(), timestr.c_str(), reason.c_str()); + ServerInstance->SNO->WriteGlobalSno('x', "Z-line added due to DNSBL match on %s to expire in %s (on %s): %s", + them->GetIPString().c_str(), InspIRCd::DurationString(zl->duration).c_str(), + InspIRCd::TimeString(zl->expiry).c_str(), reason.c_str()); ServerInstance->XLines->ApplyLines(); } else diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 353a184aa..c7088a855 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -80,9 +80,9 @@ class RLine : public XLine ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName.c_str(), reason.c_str(), u->GetIPString()); if (ServerInstance->XLines->AddLine(zl, NULL)) { - std::string timestr = InspIRCd::TimeString(zl->expiry); - ServerInstance->SNO->WriteToSnoMask('x', "Z-line added due to R-line match on %s%s%s: %s", - zl->ipaddr.c_str(), zl->duration ? " to expire on " : "", zl->duration ? timestr.c_str() : "", zl->reason.c_str()); + std::string expirystr = zl->duration ? InspIRCd::Format(" to expire in %s (on %s)", InspIRCd::DurationString(zl->duration).c_str(), InspIRCd::TimeString(zl->expiry).c_str()) : ""; + ServerInstance->SNO->WriteToSnoMask('x', "Z-line added due to R-line match on %s%s: %s", + zl->ipaddr.c_str(), expirystr.c_str(), zl->reason.c_str()); added_zline = true; } else @@ -174,9 +174,9 @@ class CommandRLine : public Command } else { - time_t c_requires_crap = duration + ServerInstance->Time(); - std::string timestr = InspIRCd::TimeString(c_requires_crap); - ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-line for %s to expire on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), parameters[2].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-line for %s to expire in %s (on %s): %s", + user->nick.c_str(), parameters[0].c_str(), InspIRCd::DurationString(duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); } ServerInstance->XLines->ApplyLines(); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index e54156da6..b4e538624 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -110,15 +110,14 @@ class CommandShun : public Command { if (!duration) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent SHUN for %s: %s", + ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent SHUN for %s: %s", user->nick.c_str(), target.c_str(), expr.c_str()); } else { - time_t c_requires_crap = duration + ServerInstance->Time(); - std::string timestr = InspIRCd::TimeString(c_requires_crap); - ServerInstance->SNO->WriteToSnoMask('x', "%s added timed SHUN for %s to expire on %s: %s", - user->nick.c_str(), target.c_str(), timestr.c_str(), expr.c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s added timed SHUN for %s to expire in %s (on %s): %s", + user->nick.c_str(), target.c_str(), InspIRCd::DurationString(duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), expr.c_str()); } } else diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index 5124339fb..a2c459f15 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -50,14 +50,16 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params) { if (xl->duration) { - std::string timestr = InspIRCd::TimeString(xl->expiry); - ServerInstance->SNO->WriteToSnoMask('X',"%s added %s%s on %s to expire on %s: %s",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "-line" : "", - params[1].c_str(), timestr.c_str(), params[5].c_str()); + ServerInstance->SNO->WriteToSnoMask('X', "%s added %s%s on %s to expire in %s (on %s): %s", + setter.c_str(), params[0].c_str(), params[0].length() == 1 ? "-line" : "", + params[1].c_str(), InspIRCd::DurationString(xl->duration).c_str(), + InspIRCd::TimeString(xl->expiry).c_str(), params[5].c_str()); } else { - ServerInstance->SNO->WriteToSnoMask('X',"%s added permanent %s%s on %s: %s",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "-line" : "", - params[1].c_str(),params[5].c_str()); + ServerInstance->SNO->WriteToSnoMask('X', "%s added permanent %s%s on %s: %s", + setter.c_str(), params[0].c_str(), params[0].length() == 1 ? "-line" : "", + params[1].c_str(), params[5].c_str()); } TreeServer* remoteserver = TreeServer::Get(usr); diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 32b376c79..83488a954 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -118,7 +118,7 @@ class CommandTban : public Command T.chan = channel; TimedBanList.push_back(T); - const std::string addban = user->nick + " added a timed ban on " + mask + " lasting for " + ConvToStr(duration) + " seconds."; + const std::string addban = user->nick + " added a timed ban on " + mask + " lasting for " + InspIRCd::DurationString(duration) + "."; // If halfop is loaded, send notice to halfops and above, otherwise send to ops and above PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h'); char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@'; -- cgit v1.3.1-10-gc9f91 From 8bc996bcc1444b33ccfde6ca3588deee0a0459d1 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 18 Feb 2019 15:43:22 +0000 Subject: Fix MatchCIDR matching UNIX socket hostnames. --- src/cidr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cidr.cpp b/src/cidr.cpp index 250ad9c69..377611437 100644 --- a/src/cidr.cpp +++ b/src/cidr.cpp @@ -73,7 +73,11 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr } irc::sockets::sockaddrs addr; - irc::sockets::aptosa(address_copy, 0, addr); + if (!irc::sockets::aptosa(address_copy, 0, addr)) + { + // The address could not be parsed. + return false; + } irc::sockets::cidr_mask mask(cidr_copy); irc::sockets::cidr_mask mask2(addr, mask.length); -- cgit v1.3.1-10-gc9f91 From 318d50bc868fb64a7d5e1edeff3ec23e38925638 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 18 Feb 2019 16:12:46 +0000 Subject: Improve support for wildcards in <link:name>. Closes #1569. --- src/modules/m_spanningtree/server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 07004a1e8..e724a644d 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -114,7 +114,7 @@ Link* TreeSocket::AuthRemote(const CommandBase::Params& params) for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++) { Link* x = *i; - if ((!stdalgo::string::equalsci(x->Name, sname)) && (x->Name != "*")) // open link allowance + if (!InspIRCd::Match(sname, x->Name)) continue; if (!ComparePass(*x, password)) -- cgit v1.3.1-10-gc9f91 From d2ed9f842f5c4d5d0ebb9230f920f7f2ac44fd5a Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Mon, 18 Feb 2019 04:53:14 -0700 Subject: Improve the messages in m_filter. * Deduplicate "FILTER" in some SNOTICES. * Add the filter reason to removals to match with X-line removals now. * Use the new DurationString() function for a standardized duration display when adding. * Add X-line mask, duration, and expiry date to the action messages. --- src/modules/m_filter.cpp | 74 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 849f99086..a0245b3eb 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -192,7 +192,7 @@ class ModuleFilter : public Module, public ServerEventListener, public Stats::Ev CullResult cull() CXX11_OVERRIDE; ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE; FilterResult* FilterMatch(User* user, const std::string &text, int flags); - bool DeleteFilter(const std::string &freeform); + bool DeleteFilter(const std::string& freeform, std::string& reason); std::pair<bool, std::string> AddFilter(const std::string& freeform, FilterAction type, const std::string& reason, unsigned long duration, const std::string& flags); void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE; Version GetVersion() CXX11_OVERRIDE; @@ -214,11 +214,14 @@ CmdResult CommandFilter::Handle(User* user, const Params& parameters) if (parameters.size() == 1) { /* Deleting a filter */ - Module *me = creator; - if (static_cast<ModuleFilter *>(me)->DeleteFilter(parameters[0])) + Module* me = creator; + std::string reason; + + if (static_cast<ModuleFilter*>(me)->DeleteFilter(parameters[0], reason)) { - user->WriteNotice("*** Removed filter '" + parameters[0] + "'"); - ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F', "FILTER: "+user->nick+" removed filter '"+parameters[0]+"'"); + user->WriteNotice("*** Removed filter '" + parameters[0] + "': " + reason); + ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F', "%s removed filter '%s': %s", + user->nick.c_str(), parameters[0].c_str(), reason.c_str()); return CMD_SUCCESS; } else @@ -269,15 +272,19 @@ CmdResult CommandFilter::Handle(User* user, const Params& parameters) reasonindex = 3; } - Module *me = creator; - std::pair<bool, std::string> result = static_cast<ModuleFilter *>(me)->AddFilter(freeform, type, parameters[reasonindex], duration, flags); + Module* me = creator; + std::pair<bool, std::string> result = static_cast<ModuleFilter*>(me)->AddFilter(freeform, type, parameters[reasonindex], duration, flags); if (result.first) { - user->WriteNotice("*** Added filter '" + freeform + "', type '" + parameters[1] + "'" + - (duration ? ", duration " + parameters[3] : "") + ", flags '" + flags + "', reason: '" + - parameters[reasonindex] + "'"); + const std::string message = InspIRCd::Format("'%s', type '%s'%s, flags '%s', reason: %s", + freeform.c_str(), parameters[1].c_str(), + (duration ? InspIRCd::Format(", duration '%s'", + InspIRCd::DurationString(duration).c_str()).c_str() + : ""), flags.c_str(), parameters[reasonindex].c_str()); - ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F', "FILTER: "+user->nick+" added filter '"+freeform+"', type '"+parameters[1]+"', "+(duration ? "duration "+parameters[3]+", " : "")+"flags '"+flags+"', reason: "+parameters[reasonindex]); + user->WriteNotice("*** Added filter " + message); + ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F', + "%s added filter %s", user->nick.c_str(), message.c_str()); return CMD_SUCCESS; } @@ -409,8 +416,10 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar else if (f->action == FA_SHUN && (ServerInstance->XLines->GetFactory("SHUN"))) { Shun* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), user->GetIPString()); - ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s was shunned because their message to %s matched %s (%s)", - user->nick.c_str(), target.c_str(), f->freeform.c_str(), f->reason.c_str())); + ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s (%s) was shunned for %s (expires on %s) because their message to %s matched %s (%s)", + user->nick.c_str(), sh->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), + target.c_str(), f->freeform.c_str(), f->reason.c_str())); if (ServerInstance->XLines->AddLine(sh, NULL)) { ServerInstance->XLines->ApplyLines(); @@ -421,8 +430,10 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar else if (f->action == FA_GLINE) { GLine* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), "*", user->GetIPString()); - ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s was G-lined because their message to %s matched %s (%s)", - user->nick.c_str(), target.c_str(), f->freeform.c_str(), f->reason.c_str())); + ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s (%s) was G-lined for %s (expires on %s) because their message to %s matched %s (%s)", + user->nick.c_str(), gl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), + target.c_str(), f->freeform.c_str(), f->reason.c_str())); if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); @@ -433,8 +444,10 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar else if (f->action == FA_ZLINE) { ZLine* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), user->GetIPString()); - ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s was Z-lined because their message to %s matched %s (%s)", - user->nick.c_str(), target.c_str(), f->freeform.c_str(), f->reason.c_str())); + ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s (%s) was Z-lined for %s (expires on %s) because their message to %s matched %s (%s)", + user->nick.c_str(), zl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), + target.c_str(), f->freeform.c_str(), f->reason.c_str())); if (ServerInstance->XLines->AddLine(zl,NULL)) { ServerInstance->XLines->ApplyLines(); @@ -508,8 +521,11 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& { /* Note: We G-line *@IP so that if their host doesn't resolve the G-line still applies. */ GLine* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), "*", user->GetIPString()); - ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s was G-lined because their %s message matched %s (%s)", - user->nick.c_str(), command.c_str(), f->freeform.c_str(), f->reason.c_str())); + ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s (%s) was G-lined for %s (expires on %s) because their %s message matched %s (%s)", + user->nick.c_str(), gl->Displayable().c_str(), + InspIRCd::DurationString(f->duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), + command.c_str(), f->freeform.c_str(), f->reason.c_str())); if (ServerInstance->XLines->AddLine(gl,NULL)) { @@ -521,8 +537,11 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& if (f->action == FA_ZLINE) { ZLine* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), user->GetIPString()); - ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s was Z-lined because their %s message matched %s (%s)", - user->nick.c_str(), command.c_str(), f->freeform.c_str(), f->reason.c_str())); + ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s (%s) was Z-lined for %s (expires on %s) because their %s message matched %s (%s)", + user->nick.c_str(), zl->Displayable().c_str(), + InspIRCd::DurationString(f->duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), + command.c_str(), f->freeform.c_str(), f->reason.c_str())); if (ServerInstance->XLines->AddLine(zl,NULL)) { @@ -535,8 +554,12 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& { /* Note: We shun *!*@IP so that if their host doesnt resolve the shun still applies. */ Shun* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), user->GetIPString()); - ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s was shunned because their %s message matched %s (%s)", - user->nick.c_str(), command.c_str(), f->freeform.c_str(), f->reason.c_str())); + ServerInstance->SNO->WriteGlobalSno('f', InspIRCd::Format("%s (%s) was shunned for %s (expires on %s) because their %s message matched %s (%s)", + user->nick.c_str(), sh->Displayable().c_str(), + InspIRCd::DurationString(f->duration).c_str(), + InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), + command.c_str(), f->freeform.c_str(), f->reason.c_str())); + if (ServerInstance->XLines->AddLine(sh, NULL)) { ServerInstance->XLines->ApplyLines(); @@ -706,12 +729,13 @@ FilterResult* ModuleFilter::FilterMatch(User* user, const std::string &text, int return NULL; } -bool ModuleFilter::DeleteFilter(const std::string &freeform) +bool ModuleFilter::DeleteFilter(const std::string& freeform, std::string& reason) { for (std::vector<FilterResult>::iterator i = filters.begin(); i != filters.end(); i++) { if (i->freeform == freeform) { + reason.assign(i->reason); delete i->regex; filters.erase(i); return true; @@ -787,7 +811,7 @@ void ModuleFilter::ReadFilters() { if (filter->from_config) { - ServerInstance->SNO->WriteGlobalSno('f', "FILTER: removing filter '" + filter->freeform + "' due to config rehash."); + ServerInstance->SNO->WriteGlobalSno('f', "Removing filter '" + filter->freeform + "' due to config rehash."); delete filter->regex; filter = filters.erase(filter); continue; -- cgit v1.3.1-10-gc9f91 From 7d84771f49973d7091789a8b5f0f6295d288a673 Mon Sep 17 00:00:00 2001 From: Robby Date: Tue, 19 Feb 2019 21:25:16 +0100 Subject: Minor text fixes for m_filter. --- docs/conf/helpop.conf.example | 8 ++++---- docs/conf/modules.conf.example | 2 +- src/modules/m_filter.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/conf/helpop.conf.example b/docs/conf/helpop.conf.example index 3fdff9bee..f8689c7b4 100644 --- a/docs/conf/helpop.conf.example +++ b/docs/conf/helpop.conf.example @@ -477,15 +477,15 @@ service is temporarily closed and to try again later."> Opens the server up again for new connections."> -<helpop key="filter" value="/FILTER <filter-definition> [<action> <flags> [<duration>] :<reason>] +<helpop key="filter" value="/FILTER <pattern> [<action> <flags> [<duration>] :<reason>] This command will add a global filter when more than one parameter is given, for messages of the types specified by the flags, with the given -filter definition, action, duration (when the action is 'gline', -'zline' or 'shun'), and reason. +filter pattern, action, duration (when the action is 'gline', 'zline' +or 'shun'), and reason. The filter will take effect when a message of any type specified by -the flags and matching the definition is sent to the server, and +the flags and matching the pattern is sent to the server, and perform the specified action. Valid FILTER Actions diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 964b57e71..2fa3b5042 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -851,7 +851,7 @@ # # # Optional - If you specify to use the filter module, then # # specify below the path to the filter.conf file, or define some # -# <filter> tags. # +# <keyword> tags. # # # #<include file="examples/filter.conf.example"> diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index a0245b3eb..f49694e81 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -155,7 +155,7 @@ class CommandFilter : public Command : Command(f, "FILTER", 1, 5) { flags_needed = 'o'; - this->syntax = "<filter-definition> <action> <flags> [<duration>] :<reason>"; + this->syntax = "<pattern> [<action> <flags> [<duration>] :<reason>]"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE; -- cgit v1.3.1-10-gc9f91 From f06502606e6e043487d9154ce4127e81e1181549 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 19 Feb 2019 18:22:00 +0000 Subject: Allow customising ElementComp in flat_{map,multimap,multiset,set}. --- include/flat_map.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/flat_map.h b/include/flat_map.h index bef1404e4..62815168b 100644 --- a/include/flat_map.h +++ b/include/flat_map.h @@ -200,10 +200,10 @@ class flat_map_base } // namespace detail -template <typename T, typename Comp = std::less<T> > -class flat_set : public detail::flat_map_base<T, Comp> +template <typename T, typename Comp = std::less<T>, typename ElementComp = Comp> +class flat_set : public detail::flat_map_base<T, Comp, T, ElementComp> { - typedef detail::flat_map_base<T, Comp> base_t; + typedef detail::flat_map_base<T, Comp, T, ElementComp> base_t; public: typedef typename base_t::iterator iterator; @@ -240,10 +240,10 @@ class flat_set : public detail::flat_map_base<T, Comp> } }; -template <typename T, typename Comp = std::less<T> > -class flat_multiset : public detail::flat_map_base<T, Comp> +template <typename T, typename Comp = std::less<T>, typename ElementComp = Comp> +class flat_multiset : public detail::flat_map_base<T, Comp, T, ElementComp> { - typedef detail::flat_map_base<T, Comp> base_t; + typedef detail::flat_map_base<T, Comp, T, ElementComp> base_t; public: typedef typename base_t::iterator iterator; @@ -280,10 +280,10 @@ class flat_multiset : public detail::flat_map_base<T, Comp> } }; -template <typename T, typename U, typename Comp = std::less<T> > -class flat_map : public detail::flat_map_base<std::pair<T, U>, Comp, T, detail::map_pair_compare<std::pair<T, U>, Comp> > +template <typename T, typename U, typename Comp = std::less<T>, typename ElementComp = Comp > +class flat_map : public detail::flat_map_base<std::pair<T, U>, Comp, T, detail::map_pair_compare<std::pair<T, U>, ElementComp> > { - typedef detail::flat_map_base<std::pair<T, U>, Comp, T, detail::map_pair_compare<std::pair<T, U>, Comp> > base_t; + typedef detail::flat_map_base<std::pair<T, U>, Comp, T, detail::map_pair_compare<std::pair<T, U>, ElementComp> > base_t; public: typedef typename base_t::iterator iterator; @@ -333,10 +333,10 @@ class flat_map : public detail::flat_map_base<std::pair<T, U>, Comp, T, detail:: } }; -template <typename T, typename U, typename Comp = std::less<T> > -class flat_multimap : public detail::flat_map_base<std::pair<T, U>, Comp, T, detail::map_pair_compare<std::pair<T, U>, Comp> > +template <typename T, typename U, typename Comp = std::less<T>, typename ElementComp = Comp > +class flat_multimap : public detail::flat_map_base<std::pair<T, U>, Comp, T, detail::map_pair_compare<std::pair<T, U>, ElementComp> > { - typedef detail::flat_map_base<std::pair<T, U>, Comp, T, detail::map_pair_compare<std::pair<T, U>, Comp> > base_t; + typedef detail::flat_map_base<std::pair<T, U>, Comp, T, detail::map_pair_compare<std::pair<T, U>, ElementComp> > base_t; public: typedef typename base_t::iterator iterator; -- cgit v1.3.1-10-gc9f91 From 74136695f88ded34f1413b546ad1b0699404bfe8 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 19 Feb 2019 18:32:49 +0000 Subject: Fix erasing event subscribers erasing all with the same priority. --- include/event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/event.h b/include/event.h index 1bcb0a5ed..92bb4ffec 100644 --- a/include/event.h +++ b/include/event.h @@ -39,7 +39,7 @@ class Events::ModuleEventProvider : public ServiceProvider, private dynamic_refe bool operator()(ModuleEventListener* one, ModuleEventListener* two) const; }; - typedef insp::flat_multiset<ModuleEventListener*, Comp> SubscriberList; + typedef insp::flat_multiset<ModuleEventListener*, Comp, std::less<ModuleEventListener*> > SubscriberList; /** Constructor * @param mod Module providing the event(s) -- cgit v1.3.1-10-gc9f91 From c495b5d9cf8bed4f07c0b77a1f9e98dcc1f62068 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Thu, 6 Sep 2018 10:09:09 +0100 Subject: Implement support for IRCv3 client-to-client tags. --- docs/conf/modules.conf.example | 6 + include/modules/ctctags.h | 135 +++++++++++++ src/coremods/core_serialize_rfc.cpp | 2 +- src/modules/m_delayjoin.cpp | 18 +- src/modules/m_ircv3_ctctags.cpp | 347 ++++++++++++++++++++++++++++++++++ src/modules/m_ircv3_echomessage.cpp | 47 ++++- src/modules/m_spanningtree/compat.cpp | 5 + 7 files changed, 555 insertions(+), 5 deletions(-) create mode 100644 include/modules/ctctags.h create mode 100644 src/modules/m_ircv3_ctctags.cpp diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 2fa3b5042..3f7e5a9f0 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -1112,6 +1112,12 @@ # extension will get the chghost message and won't see host cycling. #<module name="ircv3_chghost"> +#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# +# IRCv3 client-to-client tags module: Provides the message-tags IRCv3 +# extension which allows clients to add extra data to their messages. +# This is used to support new IRCv3 features such as replies and ids. +#<module name="ircv3_ctctags"> + #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # IRCv3 echo-message module: Provides the echo-message IRCv3 # extension which allows capable clients to get an acknowledgement when diff --git a/include/modules/ctctags.h b/include/modules/ctctags.h new file mode 100644 index 000000000..d8798de54 --- /dev/null +++ b/include/modules/ctctags.h @@ -0,0 +1,135 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2019 Peter Powell <petpow@saberuk.com> + * + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +#pragma once + +#include "event.h" + +namespace CTCTags +{ + class EventListener; + class TagMessage; + class TagMessageDetails; +} + +class CTCTags::TagMessage : public ClientProtocol::Message +{ + public: + TagMessage(User* source, const Channel* targetchan, const ClientProtocol::TagMap& Tags) + : ClientProtocol::Message("TAGMSG", source) + { + PushParamRef(targetchan->name); + AddTags(Tags); + SetSideEffect(true); + } + + TagMessage(User* source, const User* targetuser, const ClientProtocol::TagMap& Tags) + : ClientProtocol::Message("TAGMSG", source) + { + if (targetuser->registered & REG_NICK) + PushParamRef(targetuser->nick); + else + PushParam("*"); + AddTags(Tags); + SetSideEffect(true); + } + + TagMessage(User* source, const char* targetstr, const ClientProtocol::TagMap& Tags) + : ClientProtocol::Message("TAGMSG", source) + { + PushParam(targetstr); + AddTags(Tags); + SetSideEffect(true); + } +}; + +class CTCTags::TagMessageDetails +{ + public: + /** Whether to echo the tags at all. */ + bool echo; + + /* Whether to send the original tags back to clients with echo-message support. */ + bool echo_original; + + /** The users who are exempted from receiving this message. */ + CUList exemptions; + + /** IRCv3 message tags sent to the server by the user. */ + const ClientProtocol::TagMap tags_in; + + /** IRCv3 message tags sent out to users who get this message. */ + ClientProtocol::TagMap tags_out; + + TagMessageDetails(const ClientProtocol::TagMap& tags) + : echo(true) + , echo_original(false) + , tags_in(tags) + { + } +}; + +class CTCTags::EventListener + : public Events::ModuleEventListener +{ + protected: + EventListener(Module* mod, unsigned int eventprio = DefaultPriority) + : ModuleEventListener(mod, "event/tagmsg", eventprio) + { + } + + public: + /** Called before a user sends a tag message to a channel, a user, or a server glob mask. + * @param user The user sending the message. + * @param target The target of the message. This can either be a channel, a user, or a server + * glob mask. + * @param details Details about the message such as the message tags or whether to echo. See the + * TagMessageDetails class for more information. + * @return MOD_RES_ALLOW to explicitly allow the message, MOD_RES_DENY to explicitly deny the + * message, or MOD_RES_PASSTHRU to let another module handle the event. + */ + virtual ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, TagMessageDetails& details) { return MOD_RES_PASSTHRU; } + + /** Called immediately after a user sends a tag message to a channel, a user, or a server glob mask. + * @param user The user sending the message. + * @param target The target of the message. This can either be a channel, a user, or a server + * glob mask. + * @param details Details about the message such as the message tags or whether to echo. See the + * TagMessageDetails class for more information. + */ + virtual void OnUserPostTagMessage(User* user, const MessageTarget& target, const TagMessageDetails& details) { } + + /** Called immediately before a user sends a tag message to a channel, a user, or a server glob mask. + * @param user The user sending the message. + * @param target The target of the message. This can either be a channel, a user, or a server + * glob mask. + * @param details Details about the message such as the message tags or whether to echo. See the + * TagMessageDetails class for more information. + */ + virtual void OnUserTagMessage(User* user, const MessageTarget& target, const TagMessageDetails& details) { } + + /** Called when a tag message sent by a user to a channel, a user, or a server glob mask is blocked. + * @param user The user sending the message. + * @param target The target of the message. This can either be a channel, a user, or a server + * glob mask. + * @param details Details about the message such as the message tags or whether to echo. See the + * TagMessageDetails class for more information. + */ + virtual void OnUserTagMessageBlocked(User* user, const MessageTarget& target, const TagMessageDetails& details) { } +}; diff --git a/src/coremods/core_serialize_rfc.cpp b/src/coremods/core_serialize_rfc.cpp index 6b693bfb9..b8d075ab6 100644 --- a/src/coremods/core_serialize_rfc.cpp +++ b/src/coremods/core_serialize_rfc.cpp @@ -32,7 +32,7 @@ class RFCSerializer : public ClientProtocol::Serializer static const std::string::size_type MAX_CLIENT_MESSAGE_TAG_LENGTH = 4095; /** The maximum size of server-originated message tags in an outgoing message including the `@`. */ - static const std::string::size_type MAX_SERVER_MESSAGE_TAG_LENGTH = 511; + static const std::string::size_type MAX_SERVER_MESSAGE_TAG_LENGTH = 4095; static void SerializeTags(const ClientProtocol::TagMap& tags, const ClientProtocol::TagSelection& tagwl, std::string& line); diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 8b06f060a..469f33439 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -21,6 +21,7 @@ #include "inspircd.h" +#include "modules/ctctags.h" class DelayJoinMode : public ModeHandler { @@ -72,7 +73,9 @@ class JoinHook : public ClientProtocol::EventHook } -class ModuleDelayJoin : public Module +class ModuleDelayJoin + : public Module + , public CTCTags::EventListener { public: LocalIntExt unjoined; @@ -80,7 +83,8 @@ class ModuleDelayJoin : public Module DelayJoinMode djm; ModuleDelayJoin() - : unjoined("delayjoin", ExtensionItem::EXT_MEMBERSHIP, this) + : CTCTags::EventListener(this) + , unjoined("delayjoin", ExtensionItem::EXT_MEMBERSHIP, this) , joinhook(this, unjoined) , djm(this, unjoined) { @@ -94,6 +98,7 @@ class ModuleDelayJoin : public Module void OnUserKick(User* source, Membership*, const std::string &reason, CUList&) CXX11_OVERRIDE; void OnBuildNeighborList(User* source, IncludeChanList& include, std::map<User*, bool>& exception) CXX11_OVERRIDE; void OnUserMessage(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE; + void OnUserTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details) CXX11_OVERRIDE; ModResult OnRawMode(User* user, Channel* channel, ModeHandler* mh, const std::string& param, bool adding) CXX11_OVERRIDE; }; @@ -176,6 +181,15 @@ void ModuleDelayJoin::OnBuildNeighborList(User* source, IncludeChanList& include } } +void ModuleDelayJoin::OnUserTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details) +{ + if (target.type != MessageTarget::TYPE_CHANNEL) + return; + + Channel* channel = target.Get<Channel>(); + djm.RevealUser(user, channel); +} + void ModuleDelayJoin::OnUserMessage(User* user, const MessageTarget& target, const MessageDetails& details) { if (target.type != MessageTarget::TYPE_CHANNEL) diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp new file mode 100644 index 000000000..8684642c6 --- /dev/null +++ b/src/modules/m_ircv3_ctctags.cpp @@ -0,0 +1,347 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2019 Peter Powell <petpow@saberuk.com> + * Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com> + * + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "inspircd.h" +#include "modules/cap.h" +#include "modules/ctctags.h" + +class CommandTagMsg : public Command +{ + private: + Cap::Capability& cap; + ChanModeReference moderatedmode; + ChanModeReference noextmsgmode; + Events::ModuleEventProvider tagevprov; + ClientProtocol::EventProvider msgevprov; + + bool FirePreEvents(User* source, MessageTarget& msgtarget, CTCTags::TagMessageDetails& msgdetails) + { + // Inform modules that a TAGMSG wants to be sent. + ModResult modres; + FIRST_MOD_RESULT_CUSTOM(tagevprov, CTCTags::EventListener, OnUserPreTagMessage, modres, (source, msgtarget, msgdetails)); + if (modres == MOD_RES_DENY) + { + // Inform modules that a module blocked the TAGMSG. + FOREACH_MOD_CUSTOM(tagevprov, CTCTags::EventListener, OnUserTagMessageBlocked, (source, msgtarget, msgdetails)); + return false; + } + + // Inform modules that a TAGMSG is about to be sent. + FOREACH_MOD_CUSTOM(tagevprov, CTCTags::EventListener, OnUserTagMessage, (source, msgtarget, msgdetails)); + return true; + } + + CmdResult FirePostEvent(User* source, const MessageTarget& msgtarget, const CTCTags::TagMessageDetails& msgdetails) + { + // If the source is local then update its idle time. + LocalUser* lsource = IS_LOCAL(source); + if (lsource) + lsource->idle_lastmsg = ServerInstance->Time(); + + // Inform modules that a TAGMSG was sent. + FOREACH_MOD_CUSTOM(tagevprov, CTCTags::EventListener, OnUserPostTagMessage, (source, msgtarget, msgdetails)); + return CMD_SUCCESS; + } + + CmdResult HandleChannelTarget(User* source, const Params& parameters, const char* target, PrefixMode* pm) + { + Channel* chan = ServerInstance->FindChan(target); + if (!chan) + { + // The target channel does not exist. + source->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); + return CMD_FAILURE; + } + + if (IS_LOCAL(source)) + { + if (chan->IsModeSet(noextmsgmode) && !chan->HasUser(source)) + { + // The noextmsg mode is set and the source is not in the channel. + source->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (no external messages)"); + return CMD_FAILURE; + } + + bool no_chan_priv = chan->GetPrefixValue(source) < VOICE_VALUE; + if (no_chan_priv && chan->IsModeSet(moderatedmode)) + { + // The moderated mode is set and the source has no status rank. + source->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (+m)"); + return CMD_FAILURE; + } + + if (no_chan_priv && ServerInstance->Config->RestrictBannedUsers != ServerConfig::BUT_NORMAL && chan->IsBanned(source)) + { + // The source is banned in the channel and restrictbannedusers is enabled. + if (ServerInstance->Config->RestrictBannedUsers == ServerConfig::BUT_RESTRICT_NOTIFY) + source->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (you're banned)"); + return CMD_FAILURE; + } + } + + // Fire the pre-message events. + MessageTarget msgtarget(chan, pm ? pm->GetPrefix() : 0); + CTCTags::TagMessageDetails msgdetails(parameters.GetTags()); + if (!FirePreEvents(source, msgtarget, msgdetails)) + return CMD_FAILURE; + + unsigned int minrank = pm ? pm->GetPrefixRank() : 0; + CTCTags::TagMessage message(source, chan, parameters.GetTags()); + const Channel::MemberMap& userlist = chan->GetUsers(); + for (Channel::MemberMap::const_iterator iter = userlist.begin(); iter != userlist.end(); ++iter) + { + LocalUser* luser = IS_LOCAL(iter->first); + + // Don't send to remote users or the user who is the source. + if (!luser || luser == source) + continue; + + // Don't send to unprivileged or exempt users. + if (iter->second->getRank() < minrank || msgdetails.exemptions.count(luser)) + continue; + + // Send to users if they have the capability. + if (cap.get(luser)) + luser->Send(msgevprov, message); + } + return FirePostEvent(source, msgtarget, msgdetails); + } + + CmdResult HandleServerTarget(User* source, const Params& parameters) + { + // If the source isn't allowed to mass message users then reject + // the attempt to mass-message users. + if (!source->HasPrivPermission("users/mass-message")) + return CMD_FAILURE; + + // Extract the server glob match from the target parameter. + std::string servername(parameters[0], 1); + + // Fire the pre-message events. + MessageTarget msgtarget(&servername); + CTCTags::TagMessageDetails msgdetails(parameters.GetTags()); + if (!FirePreEvents(source, msgtarget, msgdetails)) + return CMD_FAILURE; + + // If the current server name matches the server name glob then send + // the message out to the local users. + if (InspIRCd::Match(ServerInstance->Config->ServerName, servername)) + { + CTCTags::TagMessage message(source, "$*", parameters.GetTags()); + const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers(); + for (UserManager::LocalList::const_iterator iter = list.begin(); iter != list.end(); ++iter) + { + LocalUser* luser = IS_LOCAL(*iter); + + // Don't send to unregistered users or the user who is the source. + if (luser->registered != REG_ALL || luser == source) + continue; + + // Don't send to exempt users. + if (msgdetails.exemptions.count(luser)) + continue; + + // Send to users if they have the capability. + if (cap.get(luser)) + luser->Send(msgevprov, message); + } + } + + // Fire the post-message event. + return FirePostEvent(source, msgtarget, msgdetails); + } + + CmdResult HandleUserTarget(User* source, const Params& parameters) + { + User* target; + if (IS_LOCAL(source)) + { + // Local sources can specify either a nick or a nick@server mask as the target. + const char* targetserver = strchr(parameters[0].c_str(), '@'); + if (targetserver) + { + // The target is a user on a specific server (e.g. jto@tolsun.oulu.fi). + target = ServerInstance->FindNickOnly(parameters[0].substr(0, targetserver - parameters[0].c_str())); + if (target && strcasecmp(target->server->GetName().c_str(), targetserver + 1)) + target = NULL; + } + else + { + // If the source is a local user then we only look up the target by nick. + target = ServerInstance->FindNickOnly(parameters[0]); + } + } + else + { + // Remote users can only specify a nick or UUID as the target. + target = ServerInstance->FindNick(parameters[0]); + } + + if (!target || target->registered != REG_ALL) + { + // The target user does not exist or is not fully registered. + source->WriteNumeric(Numerics::NoSuchNick(parameters[0])); + return CMD_FAILURE; + } + + // Fire the pre-message events. + MessageTarget msgtarget(target); + CTCTags::TagMessageDetails msgdetails(parameters.GetTags()); + if (!FirePreEvents(source, msgtarget, msgdetails)) + return CMD_FAILURE; + + LocalUser* const localtarget = IS_LOCAL(target); + if (localtarget && cap.get(localtarget)) + { + // Send to the target if they have the capability and are a local user. + CTCTags::TagMessage message(source, localtarget, parameters.GetTags()); + localtarget->Send(msgevprov, message); + } + + // Fire the post-message event. + return FirePostEvent(source, msgtarget, msgdetails); + } + + public: + CommandTagMsg(Module* Creator, Cap::Capability& Cap) + : Command(Creator, "TAGMSG", 1) + , cap(Cap) + , moderatedmode(Creator, "moderated") + , noextmsgmode(Creator, "noextmsg") + , tagevprov(Creator, "event/tagmsg") + , msgevprov(Creator, "TAGMSG") + { + allow_empty_last_param = false; + } + + CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE + { + if (CommandParser::LoopCall(user, this, parameters, 0)) + return CMD_SUCCESS; + + // Check that the source has the message tags capability. + if (IS_LOCAL(user) && !cap.get(user)) + return CMD_FAILURE; + + // The target is a server glob. + if (parameters[0][0] == '$') + return HandleServerTarget(user, parameters); + + // If the message begins with a status character then look it up. + const char* target = parameters[0].c_str(); + PrefixMode* pmh = ServerInstance->Modes->FindPrefix(target[0]); + if (pmh) + target++; + + // The target is a channel name. + if (*target == '#') + return HandleChannelTarget(user, parameters, target, pmh); + + // The target is a nickname. + return HandleUserTarget(user, parameters); + } + + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE + { + return ROUTE_MESSAGE(parameters[0]); + } +}; + +class C2CTags : public ClientProtocol::MessageTagProvider +{ + private: + Cap::Capability& cap; + + public: + C2CTags(Module* Creator, Cap::Capability& Cap) + : ClientProtocol::MessageTagProvider(Creator) + , cap(Cap) + { + } + + ModResult OnProcessTag(User* user, const std::string& tagname, std::string& tagvalue) CXX11_OVERRIDE + { + // A client-only tag is prefixed with a plus sign (+) and otherwise conforms + // to the format specified in IRCv3.2 tags. + if (tagname[0] != '+') + return MOD_RES_PASSTHRU; + + // If the user is local then we check whether they have the message-tags cap + // enabled. If not then we reject all client-only tags originating from them. + LocalUser* lu = IS_LOCAL(user); + if (lu && !cap.get(lu)) + return MOD_RES_DENY; + + // Remote users have their client-only tags checked by their local server. + return MOD_RES_ALLOW; + } + + bool ShouldSendTag(LocalUser* user, const ClientProtocol::MessageTagData& tagdata) CXX11_OVERRIDE + { + return cap.get(user); + } +}; + +class ModuleIRCv3CTCTags + : public Module + , public CTCTags::EventListener +{ + private: + Cap::Capability cap; + CommandTagMsg cmd; + C2CTags c2ctags; + + ModResult CopyClientTags(const ClientProtocol::TagMap& tags_in, ClientProtocol::TagMap& tags_out) + { + for (ClientProtocol::TagMap::const_iterator i = tags_in.begin(); i != tags_in.end(); ++i) + { + const ClientProtocol::MessageTagData& tagdata = i->second; + if (tagdata.tagprov == &c2ctags) + tags_out.insert(*i); + } + return MOD_RES_PASSTHRU; + } + + public: + ModuleIRCv3CTCTags() + : CTCTags::EventListener(this) + , cap(this, "message-tags") + , cmd(this, cap) + , c2ctags(this, cap) + { + } + + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + { + return CopyClientTags(details.tags_in, details.tags_out); + } + + ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + return CopyClientTags(details.tags_in, details.tags_out); + } + + Version GetVersion() CXX11_OVERRIDE + { + return Version("Provides the DRAFT message-tags IRCv3 extension", VF_VENDOR | VF_COMMON); + } +}; + +MODULE_INIT(ModuleIRCv3CTCTags) diff --git a/src/modules/m_ircv3_echomessage.cpp b/src/modules/m_ircv3_echomessage.cpp index b407aece4..3ec534e91 100644 --- a/src/modules/m_ircv3_echomessage.cpp +++ b/src/modules/m_ircv3_echomessage.cpp @@ -20,14 +20,21 @@ #include "inspircd.h" #include "modules/cap.h" +#include "modules/ctctags.h" -class ModuleIRCv3EchoMessage : public Module +class ModuleIRCv3EchoMessage + : public Module + , public CTCTags::EventListener { + private: Cap::Capability cap; + ClientProtocol::EventProvider tagmsgprov; public: ModuleIRCv3EchoMessage() - : cap(this, "echo-message") + : CTCTags::EventListener(this) + , cap(this, "echo-message") + , tagmsgprov(this, "TAGMSG") { } @@ -64,6 +71,35 @@ class ModuleIRCv3EchoMessage : public Module } } + void OnUserPostTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + if (!cap.get(user) || !details.echo) + return; + + // Caps are only set on local users + LocalUser* const localuser = static_cast<LocalUser*>(user); + + const ClientProtocol::TagMap& tags = details.echo_original ? details.tags_in : details.tags_out; + if (target.type == MessageTarget::TYPE_USER) + { + User* destuser = target.Get<User>(); + CTCTags::TagMessage message(user, destuser, tags); + localuser->Send(tagmsgprov, message); + } + else if (target.type == MessageTarget::TYPE_CHANNEL) + { + Channel* chan = target.Get<Channel>(); + CTCTags::TagMessage message(user, chan, tags); + localuser->Send(tagmsgprov, message); + } + else + { + const std::string* servername = target.Get<std::string>(); + CTCTags::TagMessage message(user, servername->c_str(), tags); + localuser->Send(tagmsgprov, message); + } + } + void OnUserMessageBlocked(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE { // Prevent spammers from knowing that their spam was blocked. @@ -71,6 +107,13 @@ class ModuleIRCv3EchoMessage : public Module OnUserPostMessage(user, target, details); } + void OnUserTagMessageBlocked(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + // Prevent spammers from knowing that their spam was blocked. + if (details.echo_original) + OnUserPostTagMessage(user, target, details); + } + Version GetVersion() CXX11_OVERRIDE { return Version("Provides the echo-message IRCv3 extension", VF_VENDOR); diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 17bc7cbc6..17b44f896 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -309,6 +309,11 @@ void TreeSocket::WriteLine(const std::string& original_line) push.append(line, 26, std::string::npos); push.swap(line); } + else if (command == "TAGMSG") + { + // Drop IRCv3 tag messages as v2 has no message tag support. + return; + } } WriteLineNoCompat(line); return; -- cgit v1.3.1-10-gc9f91 From 20ef7d19f7b684ea34ff1cd96450744920ab4a65 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Wed, 20 Feb 2019 01:29:15 -0600 Subject: Fix not showing all modes on a channel Whenever a mode has a parameter, no modes past that mode will be shown in RPL_CHANNELMODEIS. References to items in a vector break when the vector's size is changed. --- src/coremods/core_user/cmd_mode.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coremods/core_user/cmd_mode.cpp b/src/coremods/core_user/cmd_mode.cpp index f58a41aa4..228c352c0 100644 --- a/src/coremods/core_user/cmd_mode.cpp +++ b/src/coremods/core_user/cmd_mode.cpp @@ -152,7 +152,8 @@ namespace // the user is a member of the channel. bool show_secret = chan->HasUser(user); - std::string& modes = num.push("+").GetParams().back(); + size_t modepos = num.push("+").GetParams().size() - 1; + std::string modes; std::string param; for (unsigned char chr = 65; chr < 123; ++chr) { @@ -182,6 +183,7 @@ namespace num.push(param); param.clear(); } + num.GetParams()[modepos].append(modes); } } -- cgit v1.3.1-10-gc9f91 From fa83fac94ab7cb5e18a546858054f3910ef24235 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 20 Feb 2019 17:34:11 +0000 Subject: Split reading module initialisation and configuration reading. This allows modules to register services that other modules may require to be available when reading the configuration. --- src/modules.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/modules.cpp b/src/modules.cpp index 8538d086e..66f424dcb 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -467,6 +467,7 @@ void ModuleManager::LoadAll() std::map<std::string, ServiceList> servicemap; LoadCoreModules(servicemap); + // Step 1: load all of the modules. ConfigTagList tags = ServerInstance->Config->ConfTags("module"); for (ConfigIter i = tags.first; i != tags.second; ++i) { @@ -487,8 +488,7 @@ void ModuleManager::LoadAll() } } - ConfigStatus confstatus; - + // Step 2: initialize the modules and register their services. for (ModuleMap::const_iterator i = Modules.begin(); i != Modules.end(); ++i) { Module* mod = i->second; @@ -498,7 +498,6 @@ void ModuleManager::LoadAll() AttachAll(mod); AddServices(servicemap[i->first]); mod->init(); - mod->ReadConfig(confstatus); } catch (CoreException& modexcept) { @@ -510,6 +509,27 @@ void ModuleManager::LoadAll() } this->NewServices = NULL; + ConfigStatus confstatus; + + // Step 3: Read the configuration for the modules. This must be done as part of + // its own step so that services provided by modules can be registered before + // the configuration is read. + for (ModuleMap::const_iterator i = Modules.begin(); i != Modules.end(); ++i) + { + Module* mod = i->second; + try + { + ServerInstance->Logs->Log("MODULE", LOG_DEBUG, "Reading configuration for %s", i->first.c_str()); + mod->ReadConfig(confstatus); + } + catch (CoreException& modexcept) + { + LastModuleError = "Unable to read the configuration for " + mod->ModuleSourceFile + ": " + modexcept.GetReason(); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); + std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << LastModuleError << std::endl << std::endl; + ServerInstance->Exit(EXIT_STATUS_CONFIG); + } + } if (!PrioritizeHooks()) ServerInstance->Exit(EXIT_STATUS_MODULE); -- cgit v1.3.1-10-gc9f91 From 9b25df31096f889e3653ab100493133014d4fe73 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Fri, 22 Feb 2019 06:44:57 -0700 Subject: Improve the handling of config X-lines and filters. (#1583) --- include/xline.h | 7 +++--- src/configreader.cpp | 6 ++++- src/modules/m_filter.cpp | 30 +++++++++++++---------- src/modules/m_xline_db.cpp | 9 +++++-- src/xline.cpp | 59 +++++++++++++++++++++++++++++++--------------- 5 files changed, 73 insertions(+), 38 deletions(-) diff --git a/include/xline.h b/include/xline.h index f593c1c97..bc9739f21 100644 --- a/include/xline.h +++ b/include/xline.h @@ -515,8 +515,9 @@ class CoreExport XLineManager /** Expire a line given two iterators which identify it in the main map. * @param container Iterator to the first level of entries the map * @param item Iterator to the second level of entries in the map + * @param silent If true, doesn't send an expiry SNOTICE. */ - void ExpireLine(ContainerIter container, LookupIter item); + void ExpireLine(ContainerIter container, LookupIter item, bool silent = false); /** Apply any new lines that are pending to be applied. * This will only apply lines in the pending_lines list, to save on @@ -533,6 +534,6 @@ class CoreExport XLineManager */ void InvokeStats(const std::string& type, unsigned int numeric, Stats::Context& stats); - /** Clears any XLines which were added by the server configuration. */ - void ClearConfigLines(); + /** Expire X-lines which were added by the server configuration and have been removed. */ + void ExpireRemovedConfigLines(const std::string& type, const insp::flat_set<std::string>& configlines); }; diff --git a/src/configreader.cpp b/src/configreader.cpp index 00880cfff..0318dd602 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -74,6 +74,8 @@ ServerConfig::~ServerConfig() static void ReadXLine(ServerConfig* conf, const std::string& tag, const std::string& key, XLineFactory* make) { + insp::flat_set<std::string> configlines; + ConfigTagList tags = conf->ConfTags(tag); for(ConfigIter i = tags.first; i != tags.second; ++i) { @@ -84,9 +86,12 @@ static void ReadXLine(ServerConfig* conf, const std::string& tag, const std::str std::string reason = ctag->getString("reason", "<Config>"); XLine* xl = make->Generate(ServerInstance->Time(), 0, "<Config>", reason, mask); xl->from_config = true; + configlines.insert(xl->Displayable()); if (!ServerInstance->XLines->AddLine(xl, NULL)) delete xl; } + + ServerInstance->XLines->ExpireRemovedConfigLines(make->GetType(), configlines); } typedef std::map<std::string, ConfigTag*> LocalIndex; @@ -405,7 +410,6 @@ void ServerConfig::Fill() SocketEngine::Close(socktest); } - ServerInstance->XLines->ClearConfigLines(); ReadXLine(this, "badip", "ipmask", ServerInstance->XLines->GetFactory("Z")); ReadXLine(this, "badnick", "nick", ServerInstance->XLines->GetFactory("Q")); ReadXLine(this, "badhost", "host", ServerInstance->XLines->GetFactory("K")); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index f49694e81..7a7497d1a 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -193,7 +193,7 @@ class ModuleFilter : public Module, public ServerEventListener, public Stats::Ev ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE; FilterResult* FilterMatch(User* user, const std::string &text, int flags); bool DeleteFilter(const std::string& freeform, std::string& reason); - std::pair<bool, std::string> AddFilter(const std::string& freeform, FilterAction type, const std::string& reason, unsigned long duration, const std::string& flags); + std::pair<bool, std::string> AddFilter(const std::string& freeform, FilterAction type, const std::string& reason, unsigned long duration, const std::string& flags, bool config = false); void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE; Version GetVersion() CXX11_OVERRIDE; std::string EncodeFilter(FilterResult* filter); @@ -744,7 +744,7 @@ bool ModuleFilter::DeleteFilter(const std::string& freeform, std::string& reason return false; } -std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string& freeform, FilterAction type, const std::string& reason, unsigned long duration, const std::string& flgs) +std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string& freeform, FilterAction type, const std::string& reason, unsigned long duration, const std::string& flgs, bool config) { for (std::vector<FilterResult>::iterator i = filters.begin(); i != filters.end(); i++) { @@ -756,7 +756,7 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string& freeform try { - filters.push_back(FilterResult(RegexEngine, freeform, reason, type, duration, flgs, false)); + filters.push_back(FilterResult(RegexEngine, freeform, reason, type, duration, flgs, config)); } catch (ModuleException &e) { @@ -807,11 +807,13 @@ std::string ModuleFilter::FilterActionToString(FilterAction fa) void ModuleFilter::ReadFilters() { + insp::flat_set<std::string> removedfilters; + for (std::vector<FilterResult>::iterator filter = filters.begin(); filter != filters.end(); ) { if (filter->from_config) { - ServerInstance->SNO->WriteGlobalSno('f', "Removing filter '" + filter->freeform + "' due to config rehash."); + removedfilters.insert(filter->freeform); delete filter->regex; filter = filters.erase(filter); continue; @@ -836,15 +838,17 @@ void ModuleFilter::ReadFilters() if (!StringToFilterAction(action, fa)) fa = FA_NONE; - try - { - filters.push_back(FilterResult(RegexEngine, pattern, reason, fa, duration, flgs, true)); - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Regular expression %s loaded.", pattern.c_str()); - } - catch (ModuleException &e) - { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason().c_str()); - } + std::pair<bool, std::string> result = static_cast<ModuleFilter*>(this)->AddFilter(pattern, fa, reason, duration, flgs, true); + if (result.first) + removedfilters.erase(pattern); + else + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Filter '%s' could not be added: %s", pattern.c_str(), result.second.c_str()); + } + + if (!removedfilters.empty()) + { + for (insp::flat_set<std::string>::const_iterator it = removedfilters.begin(); it != removedfilters.end(); ++it) + ServerInstance->SNO->WriteGlobalSno('f', "Removing filter '" + *(it) + "' due to config rehash."); } } diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index 90f9de9d2..a64dc7071 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -51,7 +51,8 @@ class ModuleXLineDB : public Module */ void OnAddLine(User* source, XLine* line) CXX11_OVERRIDE { - dirty = true; + if (!line->from_config) + dirty = true; } /** Called whenever an xline is deleted. @@ -61,7 +62,8 @@ class ModuleXLineDB : public Module */ void OnDelLine(User* source, XLine* line) CXX11_OVERRIDE { - dirty = true; + if (!line->from_config) + dirty = true; } void OnBackgroundTimer(time_t now) CXX11_OVERRIDE @@ -113,6 +115,9 @@ class ModuleXLineDB : public Module for (LookupIter i = lookup->begin(); i != lookup->end(); ++i) { XLine* line = i->second; + if (line->from_config) + continue; + stream << "LINE " << line->type << " " << line->Displayable() << " " << line->source << " " << line->set_time << " " << line->duration << " :" << line->reason << std::endl; diff --git a/src/xline.cpp b/src/xline.cpp index c5b952087..fbb4f0c8b 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -265,12 +265,31 @@ bool XLineManager::AddLine(XLine* line, User* user) LookupIter i = x->second.find(line->Displayable()); if (i != x->second.end()) { - // XLine propagation bug was here, if the line to be added already exists and - // it's expired then expire it and add the new one instead of returning false - if ((!i->second->duration) || (ServerInstance->Time() < i->second->expiry)) - return false; + bool silent = false; - ExpireLine(x, i); + // Allow replacing a config line for an updated config line. + if (i->second->from_config && line->from_config) + { + // Nothing changed, skip adding this one. + if (i->second->reason == line->reason) + return false; + + silent = true; + } + // Allow replacing a non-config line for a new config line. + else if (!line->from_config) + { + // X-line propagation bug was here, if the line to be added already exists and + // it's expired then expire it and add the new one instead of returning false + if ((!i->second->duration) || (ServerInstance->Time() < i->second->expiry)) + return false; + } + else + { + silent = true; + } + + ExpireLine(x, i, silent); } } @@ -403,11 +422,13 @@ XLine* XLineManager::MatchesLine(const std::string &type, const std::string &pat } // removes lines that have expired -void XLineManager::ExpireLine(ContainerIter container, LookupIter item) +void XLineManager::ExpireLine(ContainerIter container, LookupIter item, bool silent) { FOREACH_MOD(OnExpireLine, (item->second)); - item->second->DisplayExpiry(); + if (!silent) + item->second->DisplayExpiry(); + item->second->Unset(); /* TODO: Can we skip this loop by having a 'pending' field in the XLine class, which is set when a line @@ -750,23 +771,23 @@ XLineFactory* XLineManager::GetFactory(const std::string &type) return n->second; } -void XLineManager::ClearConfigLines() +void XLineManager::ExpireRemovedConfigLines(const std::string& type, const insp::flat_set<std::string>& configlines) { // Nothing to do. if (lookup_lines.empty()) return; - ServerInstance->SNO->WriteToSnoMask('x', "Server rehashing; expiring lines defined in the server config ..."); - for (ContainerIter type = lookup_lines.begin(); type != lookup_lines.end(); ++type) + ContainerIter xlines = lookup_lines.find(type); + if (xlines == lookup_lines.end()) + return; + + for (LookupIter xline = xlines->second.begin(); xline != xlines->second.end(); ) { - for (LookupIter xline = type->second.begin(); xline != type->second.end(); ) - { - // We cache this to avoid iterator invalidation. - LookupIter cachedxline = xline++; - if (cachedxline->second->from_config) - { - ExpireLine(type, cachedxline); - } - } + LookupIter cachedxline = xline++; + if (!cachedxline->second->from_config) + continue; + + if (!configlines.count(cachedxline->second->Displayable())) + ExpireLine(xlines, cachedxline); } } -- cgit v1.3.1-10-gc9f91 From 3a68e05d9a30ed18cebf80f81258a9fb0ba67a0c Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 2 Mar 2019 10:40:48 +0000 Subject: Reject client-to-client tags with no name. --- src/modules/m_ircv3_ctctags.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp index 8684642c6..5a88e68a0 100644 --- a/src/modules/m_ircv3_ctctags.cpp +++ b/src/modules/m_ircv3_ctctags.cpp @@ -280,7 +280,7 @@ class C2CTags : public ClientProtocol::MessageTagProvider { // A client-only tag is prefixed with a plus sign (+) and otherwise conforms // to the format specified in IRCv3.2 tags. - if (tagname[0] != '+') + if (tagname[0] != '+' || tagname.length() < 2) return MOD_RES_PASSTHRU; // If the user is local then we check whether they have the message-tags cap -- cgit v1.3.1-10-gc9f91 From 4be144252bf894e6a964a12d7dbc12f91ced908b Mon Sep 17 00:00:00 2001 From: Robby Date: Thu, 7 Mar 2019 06:20:19 +0100 Subject: Add missing '>' to an example connect tag. --- docs/conf/inspircd.conf.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index 7a4148413..e3f3185d5 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -216,7 +216,7 @@ # -- It is important to note that connect tags are read from the -- # # TOP DOWN. This means that you should have more specific deny # # and allow tags at the top, progressively more general, followed # -# by a <connect allow="*" (should you wish to have one). # +# by a <connect allow="*"> (should you wish to have one). # # # # Connect blocks are searched twice for each user - once when the TCP # # connection is accepted, and once when the user completes their # -- cgit v1.3.1-10-gc9f91 From 83d2331a032b18346b967a6bdf6f336c0e2a26ef Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 8 Mar 2019 10:50:08 +0000 Subject: Fix an "unknown pragma" warning on Windows. --- src/modules/m_httpd.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 168e09bb8..e5d0a08e4 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -40,7 +40,9 @@ #endif // Fix warnings about shadowing in http_parser. -#pragma GCC diagnostic ignored "-Wshadow" +#ifdef _GNUC +# pragma GCC diagnostic ignored "-Wshadow" +#endif #include <http_parser.c> -- cgit v1.3.1-10-gc9f91 From f97c88f6f64e66fe2abb38860ab1e3f8c0702439 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 8 Mar 2019 10:50:53 +0000 Subject: m_httpd: use http_response_str() instead of Response(). Lets not reinvent the wheel pointlessly. --- src/modules/m_httpd.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index e5d0a08e4..78c25f6d9 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -224,24 +224,12 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru AddToCull(); } - const char* Response(unsigned int response) - { - switch (response) - { -#define HTTP_STATUS_CASE(n, m, s) case n: return #s; - HTTP_STATUS_MAP(HTTP_STATUS_CASE) - default: - return "WTF"; - break; - } - } - void SendHTTPError(unsigned int response) { HTTPHeaders empty; std::string data = InspIRCd::Format( "<html><head></head><body>Server error %u: %s<br>" - "<small>Powered by <a href='http://www.inspircd.org'>InspIRCd</a></small></body></html>", response, Response(response)); + "<small>Powered by <a href='http://www.inspircd.org'>InspIRCd</a></small></body></html>", response, http_status_str((http_status)response)); SendHeaders(data.length(), response, empty); WriteData(data); @@ -250,7 +238,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru void SendHeaders(unsigned long size, unsigned int response, HTTPHeaders &rheaders) { - WriteData(InspIRCd::Format("HTTP/%u.%u %u %s\r\n", parser.http_major ? parser.http_major : 1, parser.http_major ? parser.http_minor : 1, response, Response(response))); + WriteData(InspIRCd::Format("HTTP/%u.%u %u %s\r\n", parser.http_major ? parser.http_major : 1, parser.http_major ? parser.http_minor : 1, response, http_status_str((http_status)response))); rheaders.CreateHeader("Date", InspIRCd::TimeString(ServerInstance->Time(), "%a, %d %b %Y %H:%M:%S GMT", true)); rheaders.CreateHeader("Server", INSPIRCD_BRANCH); -- cgit v1.3.1-10-gc9f91 From 42c7f479b2aebdec4fd190ba06097b7c5bca42a9 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 9 Mar 2019 09:54:48 +0000 Subject: m_httpd: GCC is __GNUC__ not _GNUC. --- src/modules/m_httpd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 78c25f6d9..2e67b1551 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -40,7 +40,7 @@ #endif // Fix warnings about shadowing in http_parser. -#ifdef _GNUC +#ifdef __GNUC__ # pragma GCC diagnostic ignored "-Wshadow" #endif -- cgit v1.3.1-10-gc9f91 From f87b72b76f9ef198bdbbb01f9ca409501666c6a2 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Sun, 10 Mar 2019 01:22:00 -0700 Subject: Fix BanCache entries existing after X-line expiry. When DefaultApply() adds a hit to the BanCache it uses the X-line duration to set a duration on the entry. This can result in an entry lasting longer than the X-line itself. Fix this by setting the entry duration to the time left on the X-line. --- src/xline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xline.cpp b/src/xline.cpp index fbb4f0c8b..bf61d76ea 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -560,7 +560,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache) if (bancache) { ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString()); - ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, this->duration); + ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, (this->duration > 0 ? (this->expiry - ServerInstance->Time()) : 0)); } } -- cgit v1.3.1-10-gc9f91 From dfb1e0da7823641ad648f9fbd19b43d2e6b0d7ad Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Tue, 12 Mar 2019 09:48:28 -0500 Subject: Add Who::Request::GetFlagIndex to get field index Replaces the dirty logic in m_hideoper and m_namesx --- include/modules/who.h | 11 +++++++++++ src/coremods/core_who.cpp | 22 ++++++++++++++++++++++ src/modules/m_hideoper.cpp | 19 +++---------------- src/modules/m_namesx.cpp | 19 +++---------------- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/include/modules/who.h b/include/modules/who.h index 4fcbe5f91..8fd2dab08 100644 --- a/include/modules/who.h +++ b/include/modules/who.h @@ -71,6 +71,17 @@ class Who::Request /** A user specified label for the WHOX response. */ std::string whox_querytype; + /** Get the index in the response parameters for the different data fields + * + * The fields 'r' (realname) and 'd' (hops) will always be missing in a non-WHOX + * query, because WHOX splits them to 2 fields, where old WHO has them as one. + * + * @param flag The field name to look for + * @param out The index will be stored in this value + * @return True if the field is available, false otherwise + */ + virtual bool GetFlagIndex(char flag, size_t& out) const = 0; + protected: Request() : fuzzy_match(false) diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index bf00b741f..f32ef77b3 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -34,8 +34,19 @@ enum RPL_WHOSPCRPL = 354 }; +static const char whox_field_order[] = "tcuihsnfdlaor"; +static const char who_field_order[] = "cuhsnf"; + struct WhoData : public Who::Request { + std::string query_flag_order; + + bool GetFlagIndex(char flag, size_t& out) const CXX11_OVERRIDE + { + out = query_flag_order.find(flag); + return out != std::string::npos; + } + WhoData(const CommandBase::Params& parameters) { // Find the matchtext and swap the 0 for a * so we can use InspIRCd::Match on it. @@ -74,6 +85,17 @@ struct WhoData : public Who::Request current_bitset->set(chr); } } + + if (whox) + { + for (const char *c = whox_field_order; c; c++) + { + if (whox_fields[*c]) + query_flag_order.push_back(*c); + } + } + else + query_flag_order = who_field_order; } }; diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index f04d88809..8feb1a852 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -123,22 +123,9 @@ class ModuleHideOper if (request.flags['o']) return MOD_RES_DENY; - size_t flag_index = 5; - if (request.whox) - { - // We only need to fiddle with the flags if they are present. - if (!request.whox_fields['f']) - return MOD_RES_PASSTHRU; - - // WHOX makes this a bit tricky as we need to work out the parameter which the flags are in. - flag_index = 0; - static const char* flags = "tcuihsn"; - for (size_t i = 0; i < strlen(flags); ++i) - { - if (request.whox_fields[flags[i]]) - flag_index += 1; - } - } + size_t flag_index; + if (!request.GetFlagIndex('f', flag_index)) + return MOD_RES_PASSTHRU; // hide the "*" that marks the user as an oper from the /WHO line // #chan ident localhost insp22.test nick H@ :0 Attila diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index defb66b78..1e051e75c 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -84,22 +84,9 @@ class ModuleNamesX if (prefixes.length() <= 1) return MOD_RES_PASSTHRU; - size_t flag_index = 5; - if (request.whox) - { - // We only need to fiddle with the flags if they are present. - if (!request.whox_fields['f']) - return MOD_RES_PASSTHRU; - - // WHOX makes this a bit tricky as we need to work out the parameter which the flags are in. - flag_index = 0; - static const char* flags = "tcuihsn"; - for (size_t i = 0; i < strlen(flags); ++i) - { - if (request.whox_fields[flags[i]]) - flag_index += 1; - } - } + size_t flag_index; + if (!request.GetFlagIndex('f', flag_index)) + return MOD_RES_PASSTHRU; // #chan ident localhost insp22.test nick H@ :0 Attila if (numeric.GetParams().size() <= flag_index) -- cgit v1.3.1-10-gc9f91 From c02b30b96e48fb4b01c275c1b8b49d69ad2ebd4a Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Tue, 12 Mar 2019 10:30:47 -0500 Subject: Move field lookup logic out of WhoData constructor --- src/coremods/core_who.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index f32ef77b3..52af2d2ce 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -39,12 +39,29 @@ static const char who_field_order[] = "cuhsnf"; struct WhoData : public Who::Request { - std::string query_flag_order; - bool GetFlagIndex(char flag, size_t& out) const CXX11_OVERRIDE { - out = query_flag_order.find(flag); - return out != std::string::npos; + if (!whox) + { + const char* pos = strchr(who_field_order, flag); + if (pos == NULL) + return false; + + out = pos - who_field_order; + return true; + } + + if (!whox_fields[flag]) + return false; + + out = 0; + for (const char* c = whox_field_order; *c && *c != flag; ++c) + { + if (whox_fields[*c]) + ++out; + } + + return whox_field_order[out]; } WhoData(const CommandBase::Params& parameters) @@ -85,17 +102,6 @@ struct WhoData : public Who::Request current_bitset->set(chr); } } - - if (whox) - { - for (const char *c = whox_field_order; c; c++) - { - if (whox_fields[*c]) - query_flag_order.push_back(*c); - } - } - else - query_flag_order = who_field_order; } }; -- cgit v1.3.1-10-gc9f91 From 1003c593bfd455734a8f39f137d4ce68e7e87ca8 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Tue, 12 Mar 2019 12:04:01 -0500 Subject: Rename GetFlagIndex -> GetFieldIndex --- include/modules/who.h | 2 +- src/coremods/core_who.cpp | 2 +- src/modules/m_hideoper.cpp | 2 +- src/modules/m_namesx.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/modules/who.h b/include/modules/who.h index 8fd2dab08..983cece46 100644 --- a/include/modules/who.h +++ b/include/modules/who.h @@ -80,7 +80,7 @@ class Who::Request * @param out The index will be stored in this value * @return True if the field is available, false otherwise */ - virtual bool GetFlagIndex(char flag, size_t& out) const = 0; + virtual bool GetFieldIndex(char flag, size_t& out) const = 0; protected: Request() diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index 52af2d2ce..d6df6de20 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -39,7 +39,7 @@ static const char who_field_order[] = "cuhsnf"; struct WhoData : public Who::Request { - bool GetFlagIndex(char flag, size_t& out) const CXX11_OVERRIDE + bool GetFieldIndex(char flag, size_t& out) const CXX11_OVERRIDE { if (!whox) { diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 8feb1a852..d78ed538b 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -124,7 +124,7 @@ class ModuleHideOper return MOD_RES_DENY; size_t flag_index; - if (!request.GetFlagIndex('f', flag_index)) + if (!request.GetFieldIndex('f', flag_index)) return MOD_RES_PASSTHRU; // hide the "*" that marks the user as an oper from the /WHO line diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 1e051e75c..ac15c9723 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -85,7 +85,7 @@ class ModuleNamesX return MOD_RES_PASSTHRU; size_t flag_index; - if (!request.GetFlagIndex('f', flag_index)) + if (!request.GetFieldIndex('f', flag_index)) return MOD_RES_PASSTHRU; // #chan ident localhost insp22.test nick H@ :0 Attila -- cgit v1.3.1-10-gc9f91 From f808b2db7515f735e61267ffdf25c17c03eb8521 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Tue, 12 Mar 2019 12:43:34 -0500 Subject: Add SSL flag to WHO response --- src/modules/m_sslinfo.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 21857b3d9..1b1ce9eaa 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -21,6 +21,7 @@ #include "modules/ssl.h" #include "modules/webirc.h" #include "modules/whois.h" +#include "modules/who.h" enum { @@ -184,6 +185,7 @@ class ModuleSSLInfo : public Module , public WebIRC::EventListener , public Whois::EventListener + , public Who::EventListener { private: CommandSSLInfo cmd; @@ -197,6 +199,7 @@ class ModuleSSLInfo ModuleSSLInfo() : WebIRC::EventListener(this) , Whois::EventListener(this) + , Who::EventListener(this) , cmd(this) { } @@ -218,6 +221,19 @@ class ModuleSSLInfo } } + ModResult OnWhoLine(const Who::Request& request, LocalUser* source, User* user, Membership* memb, Numeric::Numeric& numeric) CXX11_OVERRIDE + { + size_t flag_index; + if (!request.GetFieldIndex('f', flag_index)) + return MOD_RES_PASSTHRU; + + ssl_cert* cert = cmd.sslapi.GetCertificate(user); + if (cert) + numeric.GetParams()[flag_index].push_back('s'); + + return MOD_RES_PASSTHRU; + } + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { if ((command == "OPER") && (validated)) -- cgit v1.3.1-10-gc9f91 From d57cad7896a4e9f78565d998e3fbd98b0b32c94e Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Wed, 13 Mar 2019 18:33:23 -0600 Subject: Fix incorrect ModResult for noctcp user target. --- src/modules/m_noctcp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index af14c73ec..3a57dc184 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -80,7 +80,7 @@ class ModuleNoCTCP : public Module if (u->IsModeSet(ncu)) { user->WriteNumeric(ERR_CANTSENDTOUSER, u->nick, "Can't send CTCP to user (+T set)"); - return MOD_RES_PASSTHRU; + return MOD_RES_DENY; } } return MOD_RES_PASSTHRU; -- cgit v1.3.1-10-gc9f91 From 5f2ecf00132433c875c78b475ea46c8b73bf5f57 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Wed, 13 Mar 2019 03:04:13 -0600 Subject: Add oper privs to allow overriding noctcp. --- docs/conf/opers.conf.example | 2 ++ src/modules/m_noctcp.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/docs/conf/opers.conf.example b/docs/conf/opers.conf.example index c5edb9cb2..f9f6a75d4 100644 --- a/docs/conf/opers.conf.example +++ b/docs/conf/opers.conf.example @@ -27,12 +27,14 @@ # - users/mass-message: allows opers with this priv to PRIVMSG and NOTICE to a server mask (e.g. NOTICE $*). # - users/samode-usermodes: allows opers with this priv to change the user modes of any other user using /SAMODE. # PERMISSIONS: + # - channels/ignore-noctcp: allows opers with this priv to send a CTCP to a +C channel. # - channels/ignore-nonicks: allows opers with this priv to change their nick when on a +N channel. # - channels/restricted-create: allows opers with this priv to create channels if the restrictchans module is loaded. # - users/flood/no-fakelag: prevents opers from being penalized with fake lag for flooding (*NOTE). # - users/flood/no-throttle: allows opers with this priv to send commands without being throttled (*NOTE). # - users/flood/increased-buffers: allows opers with this priv to send and receive data without worrying about being disconnected for exceeding limits (*NOTE). # - users/callerid-override: allows opers with this priv to message people using callerid without being on their callerid list. + # - users/ignore-noctcp: allows opers with this priv to send a CTCP to a +T user. # - users/sajoin-others: allows opers with this priv to /SAJOIN users other than themselves. # - servers/use-disabled-commands: allows opers with this priv to use disabled commands. # - servers/use-disabled-modes: allows opers with this priv to use disabled modes. diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 3a57dc184..13b132eb3 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -63,6 +63,9 @@ class ModuleNoCTCP : public Module if (target.type == MessageTarget::TYPE_CHANNEL) { + if (user->HasPrivPermission("channels/ignore-noctcp")) + return MOD_RES_PASSTHRU; + Channel* c = target.Get<Channel>(); ModResult res = CheckExemption::Call(exemptionprov, user, c, "noctcp"); if (res == MOD_RES_ALLOW) @@ -76,6 +79,9 @@ class ModuleNoCTCP : public Module } else if (target.type == MessageTarget::TYPE_USER) { + if (user->HasPrivPermission("users/ignore-noctcp")) + return MOD_RES_PASSTHRU; + User* u = target.Get<User>(); if (u->IsModeSet(ncu)) { -- cgit v1.3.1-10-gc9f91 From b518f45d72e2c7bd38d4ecf155efbf4046c3f57c Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Thu, 14 Mar 2019 02:07:20 -0600 Subject: Check perms for removal of oper-only channel modes. Oper-only channel modes are currently unsettable by any channel op, oper or not. Correct this by checking both directions of an oper-only channel mode and continue only checking the setting of an oper-only user mode. As anyone should be able to unset their own user modes and UnOper() removes all oper-only user modes automatically. --- src/mode.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mode.cpp b/src/mode.cpp index 6f17d3896..7a0afdd03 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -312,18 +312,18 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Mode } } - if ((adding) && (IS_LOCAL(user)) && (mh->NeedsOper()) && (!user->HasModePermission(mh))) + if ((chan || (!chan && adding)) && IS_LOCAL(user) && mh->NeedsOper() && !user->HasModePermission(mh)) { /* It's an oper only mode, and they don't have access to it. */ if (user->IsOper()) { - user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper type %s does not have access to set %s mode %c", - user->oper->name.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user", modechar)); + user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper type %s does not have access to %sset %s mode %c", + user->oper->name.c_str(), adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user", modechar)); } else { - user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Only operators may set %s mode %c", - type == MODETYPE_CHANNEL ? "channel" : "user", modechar)); + user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Only operators may %sset %s mode %c", + adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user", modechar)); } return MODEACTION_DENY; } -- cgit v1.3.1-10-gc9f91 From 62ba7c3917955b27b7967ccde0dc55b947e04782 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Thu, 14 Mar 2019 10:49:19 +0000 Subject: Generate the ssl_cert metadata before bursting a connecting user. --- src/modules/m_spanningtree/main.cpp | 5 +++++ src/modules/m_spanningtree/main.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index de1e8eb19..920840f9b 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -45,6 +45,7 @@ ModuleSpanningTree::ModuleSpanningTree() , commands(this) , currmembid(0) , eventprov(this, "event/server") + , sslapi(this) , DNS(this, "DNS") , tagevprov(this, "event/messagetag") , loopCall(false) @@ -447,6 +448,10 @@ void ModuleSpanningTree::OnUserConnect(LocalUser* user) if (user->quitting) return; + // Create the lazy ssl_cert metadata for this user if not already created. + if (sslapi) + sslapi->GetCertificate(user); + CommandUID::Builder(user).Broadcast(); if (user->IsOper()) diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index fa2928687..ec97e73be 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -26,6 +26,7 @@ #include "inspircd.h" #include "event.h" #include "modules/dns.h" +#include "modules/ssl.h" #include "modules/stats.h" #include "servercommand.h" #include "commands.h" @@ -80,6 +81,9 @@ class ModuleSpanningTree */ Events::ModuleEventProvider eventprov; + /** API for accessing user SSL certificates. */ + UserCertificateAPI sslapi; + public: dynamic_reference<DNS::Manager> DNS; -- cgit v1.3.1-10-gc9f91 From ac0d5abaace6521643b213423bf57625abe9dd41 Mon Sep 17 00:00:00 2001 From: Robby Date: Tue, 12 Mar 2019 15:37:18 +0100 Subject: Update most URLs to use HTTPS and fix some dead links. --- .github/ISSUE_TEMPLATE.md | 2 +- configure | 2 +- docs/conf/modules.conf.example | 6 +++--- docs/conf/services/anope.conf.example | 2 +- docs/conf/services/atheme.conf.example | 3 ++- locales/readme.txt | 2 +- make/template/main.mk | 2 +- src/modules/extra/README | 2 +- src/modules/m_httpd.cpp | 2 +- src/modules/m_nationalchars.cpp | 4 ++-- vendor/README.md | 2 +- win/CMakeLists.txt | 2 +- win/NSIS.template.in | 2 +- win/README.txt | 8 ++++---- 14 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 6fdf33bba..ea6121d99 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -14,7 +14,7 @@ Example configs: 3.0 (alpha) - https://github.com/inspircd/inspircd/tree/master/docs/conf Wiki: -https://wiki.inspircd.org/ +https://wiki.inspircd.org --> **Description** diff --git a/configure b/configure index 81e742b09..048975f41 100755 --- a/configure +++ b/configure @@ -268,7 +268,7 @@ not been tested as heavily and may contain various faults which could seriously affect the running of your server. It is recommended that you use a stable version instead. -You can obtain the latest stable version from http://www.inspircd.org/ or by +You can obtain the latest stable version from https://www.inspircd.org or by running `<|GREEN git checkout $(git describe --abbrev=0 --tags insp3)|>` if you are installing from Git. EOW diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 3f7e5a9f0..bfad0cc17 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -342,7 +342,7 @@ # The webirc method is the recommended way to allow gateways to forward # IP/host information. When using this method the gateway sends a WEBIRC # message to the server on connection. For more details please read the -# IRCv3 WebIRC specification at http://ircv3.net/specs/extensions/webirc.html. +# IRCv3 WebIRC specification at: https://ircv3.net/specs/extensions/webirc.html # # When using this method you must specify a wildcard mask or CIDR range # to allow gateway connections from and at least one of either a SSL @@ -1080,7 +1080,7 @@ # # Further information on these extensions can be found at the IRCv3 # working group website: -# http://ircv3.net/irc/ +# https://ircv3.net/irc/ # #<module name="ircv3"> # The following block can be used to control which extensions are @@ -1292,7 +1292,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Map hiding module: replaces /MAP and /LINKS output to users with a # -# message to see a website, set by maphide="http://test.org/map" in # +# message to see a website, set by maphide="https://test.org/map" in # # the <security> tag, instead. # #<module name="maphide"> diff --git a/docs/conf/services/anope.conf.example b/docs/conf/services/anope.conf.example index 603bb538d..4068871c8 100644 --- a/docs/conf/services/anope.conf.example +++ b/docs/conf/services/anope.conf.example @@ -1,5 +1,5 @@ # This file contains aliases and nickname reservations which are used -# by Anope. See https://www.anope.org/ for more information on Anope. +# by Anope. See https://www.anope.org for more information on Anope. # This file inherits from the generic config to avoid repetition. <include file="examples/services/generic.conf.example"> diff --git a/docs/conf/services/atheme.conf.example b/docs/conf/services/atheme.conf.example index 037087998..ac87399c2 100644 --- a/docs/conf/services/atheme.conf.example +++ b/docs/conf/services/atheme.conf.example @@ -1,5 +1,6 @@ # This file contains aliases and nickname reservations which are used -# by Atheme. See http://atheme.net for more information on Atheme. +# by Atheme. See https://atheme.github.io/atheme.html for more +# information on Atheme. # This file inherits from the generic config to avoid repetition. <include file="examples/services/generic.conf.example"> diff --git a/locales/readme.txt b/locales/readme.txt index 069e664b5..5e366d606 100755 --- a/locales/readme.txt +++ b/locales/readme.txt @@ -1,6 +1,6 @@ Here you can find locales configuration files. -(!) The idea and several locale files are derived from Bynets UnrealIRCd distribution (See http://www.bynets.org/) +(!) The idea and several locale files are derived from Bynets UnrealIRCd distribution (See https://bynets.org) *** File structure *** diff --git a/make/template/main.mk b/make/template/main.mk index d33627519..9c7ee9449 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -184,7 +184,7 @@ std-header: @echo "* *" @echo "* This will take a *long* time. *" @echo "* Why not read our wiki at *" - @echo "* http://wiki.inspircd.org *" + @echo "* https://wiki.inspircd.org *" @echo "* while you wait for Make to run? *" @echo "*************************************" diff --git a/src/modules/extra/README b/src/modules/extra/README index b59494df9..630ab3e85 100644 --- a/src/modules/extra/README +++ b/src/modules/extra/README @@ -2,7 +2,7 @@ This directory stores modules which require external libraries to compile. For example, m_filter_pcre requires the PCRE libraries. To compile any of these modules first ensure you have the required dependencies -(read the online documentation at https://wiki.inspircd.org/) and then symlink +(read the online documentation at https://wiki.inspircd.org) and then symlink the .cpp file from this directory into the parent directory (src/modules/). Alternatively, use the command: ./configure --enable-extras=m_extra.cpp, which will diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 2e67b1551..f9e5bc0fd 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -229,7 +229,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru HTTPHeaders empty; std::string data = InspIRCd::Format( "<html><head></head><body>Server error %u: %s<br>" - "<small>Powered by <a href='http://www.inspircd.org'>InspIRCd</a></small></body></html>", response, http_status_str((http_status)response)); + "<small>Powered by <a href='https://www.inspircd.org'>InspIRCd</a></small></body></html>", response, http_status_str((http_status)response)); SendHeaders(data.length(), response, empty); WriteData(data); diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index 81c2d2959..2b7e66a50 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -20,8 +20,8 @@ */ -/* Contains a code of Unreal IRCd + Bynets patch ( http://www.unrealircd.com/ and http://www.bynets.org/ ) - Original patch is made by Dmitry "Killer{R}" Kononko. ( http://killprog.com/ ) +/* Contains a code of Unreal IRCd + Bynets patch (https://www.unrealircd.org and https://bynets.org) + Original patch is made by Dmitry "Killer{R}" Kononko. (http://killprog.com) Changed at 2008-06-15 - 2009-02-11 by Chernov-Phoenix Alexey (Phoenix@RusNet) mailto:phoenix /email address separator/ pravmail.ru */ diff --git a/vendor/README.md b/vendor/README.md index c233d6dae..0eb3961db 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -10,7 +10,7 @@ This directory contains vendored dependencies that are shipped with InspIRCd to **License** &mdash; Public Domain -**Website** &mdash; [http://openwall.com/crypt/](http://openwall.com/crypt/) +**Website** &mdash; [https://www.openwall.com/crypt/](https://www.openwall.com/crypt/) ## http_parser diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt index 107102281..be6617b8b 100644 --- a/win/CMakeLists.txt +++ b/win/CMakeLists.txt @@ -104,7 +104,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CPACK_NSIS_MUI_ICON "${INSPIRCD_BASE}/win\\\\inspircd.ico") set(CPACK_NSIS_MUI_UNIICON "${INSPIRCD_BASE}/win\\\\inspircd.ico") set(CPACK_NSIS_INSTALLED_ICON_NAME "inspircd.exe") - set(CPACK_NSIS_URL_INFO_ABOUT "http://www.inspircd.org/") + set(CPACK_NSIS_URL_INFO_ABOUT "https://www.inspircd.org") set(CPACK_NSIS_COMPRESSOR "/SOLID zlib") include(CPack) diff --git a/win/NSIS.template.in b/win/NSIS.template.in index 0b74cc98f..2e6abd784 100644 --- a/win/NSIS.template.in +++ b/win/NSIS.template.in @@ -43,7 +43,7 @@ ;--- Component support macros: --- ; The code for the add/remove functionality is from: -; http://nsis.sourceforge.net/Add/Remove_Functionality +; https://nsis.sourceforge.io/Add/Remove_Functionality ; It has been modified slightly and extended to provide ; inter-component dependencies. Var AR_SecFlags diff --git a/win/README.txt b/win/README.txt index f5b2d8c83..437ff7e4f 100644 --- a/win/README.txt +++ b/win/README.txt @@ -1,9 +1,9 @@ Building InspIRCd for Windows: Prerequisites: - Visual Studio 2015 or newer (https://www.visualstudio.com/) - CMake 2.8 or newer (http://www.cmake.org/) - If building the installer, NSIS http://nsis.sourceforge.net/ + Visual Studio 2015 or newer (https://www.visualstudio.com) + CMake 2.8 or newer (https://cmake.org) + If building the installer, NSIS (https://nsis.sourceforge.io) Configuring: First copy any extra modules from extras (such as m_mysql) to the modules directory that you want to build. @@ -53,4 +53,4 @@ Building the installer: Locate the PACKAGE project on Visual Studio's Solution Explorer and build it. This will generate an InspIRCd-x.x.x.exe installer in the build directory which is ready to be distributed. - If you are building using NMake Makefiles or do not want to build the installer in Visual Studio, simply use "cpack". \ No newline at end of file + If you are building using NMake Makefiles or do not want to build the installer in Visual Studio, simply use "cpack". -- cgit v1.3.1-10-gc9f91 From 1645bbc231814dfa5311efb340c7a0cf6271d103 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Thu, 14 Mar 2019 11:36:24 +0000 Subject: Fix the link to the http_parser vendor page. --- vendor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/README.md b/vendor/README.md index 0eb3961db..b52166464 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -20,7 +20,7 @@ This directory contains vendored dependencies that are shipped with InspIRCd to **License** &mdash; MIT License -**Website** &mdash; (https://github.com/nodejs/http-parser)[https://github.com/nodejs/http-parser] +**Website** &mdash; [https://github.com/nodejs/http-parser](https://github.com/nodejs/http-parser) ## sha256 -- cgit v1.3.1-10-gc9f91 From 9b732cb49dcd1b8d28881236f5afb93e47f19b94 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 20 Mar 2019 18:25:17 +0000 Subject: Strip message tags correctly in the 1202 spanningtree compat layer. --- src/modules/m_spanningtree/compat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 17b44f896..694b28d87 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -42,7 +42,7 @@ void TreeSocket::WriteLine(const std::string& original_line) if (line[0] == '@') { // The line contains tags which the 1202 protocol can't handle. - line.erase(0, a); + line.erase(0, a + 1); a = line.find(' '); } std::string::size_type b = line.find(' ', a + 1); -- cgit v1.3.1-10-gc9f91 From 94ce90c588b7d919102a91d3e0f6df4188ae417b Mon Sep 17 00:00:00 2001 From: Robby Date: Sat, 23 Mar 2019 23:14:45 +0100 Subject: Add the User and Group options to the systemd service unit template file. --- make/template/inspircd.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/make/template/inspircd.service b/make/template/inspircd.service index c05e61822..e29aa593f 100644 --- a/make/template/inspircd.service +++ b/make/template/inspircd.service @@ -30,6 +30,8 @@ ExecStop=@SCRIPT_DIR@/inspircd stop PIDFile=@DATA_DIR@/inspircd.pid Restart=on-failure Type=forking +User=@USER@ +Group=@GROUP@ [Install] WantedBy=multi-user.target -- cgit v1.3.1-10-gc9f91 From 0b66cad1b04c104f3afb75cafd23faf4cb527a49 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 25 Mar 2019 13:23:50 +0000 Subject: m_permchannels: validate channel names properly. --- src/modules/m_permchannels.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index a7be6df08..dc250e0d8 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -193,9 +193,9 @@ public: std::string channel = tag->getString("channel"); std::string modes = tag->getString("modes"); - if ((channel.empty()) || (channel.length() > ServerInstance->Config->Limits.ChanMax)) + if (!ServerInstance->IsChannel(channel)) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring permchannels tag with empty or too long channel name (\"" + channel + "\")"); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring permchannels tag with invalid channel name (\"" + channel + "\")"); continue; } -- cgit v1.3.1-10-gc9f91 From 180b8b6ab194fd74cb5c64fc3ec0775eb542451a Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 30 Mar 2019 11:52:36 +0000 Subject: Mark messages with inspircd.org/bot if the user has +B set. --- src/modules/m_botmode.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 1931666d1..1007f7ca1 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" +#include "modules/cap.h" #include "modules/whois.h" enum @@ -28,13 +29,44 @@ enum RPL_WHOISBOT = 335 }; +class BotTag : public ClientProtocol::MessageTagProvider +{ + private: + SimpleUserModeHandler& botmode; + Cap::Reference ctctagcap; + + public: + BotTag(Module* mod, SimpleUserModeHandler& bm) + : ClientProtocol::MessageTagProvider(mod) + , botmode(bm) + , ctctagcap(mod, "message-tags") + { + } + + void OnClientProtocolPopulateTags(ClientProtocol::Message& msg) CXX11_OVERRIDE + { + User* const user = msg.GetSourceUser(); + if (user && user->IsModeSet(botmode)) + msg.AddTag("inspircd.org/bot", this, ""); + } + + bool ShouldSendTag(LocalUser* user, const ClientProtocol::MessageTagData& tagdata) CXX11_OVERRIDE + { + return ctctagcap.get(user); + } +}; + class ModuleBotMode : public Module, public Whois::EventListener { + private: SimpleUserModeHandler bm; + BotTag tag; + public: ModuleBotMode() : Whois::EventListener(this) , bm(this, "bot", 'B') + , tag(this, bm) { } -- cgit v1.3.1-10-gc9f91 From bdded70ac222c997aea8e8fefb029571398c611e Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 30 Mar 2019 11:53:51 +0000 Subject: Rename OnClientProtocolPopulateTags to OnPopulateTags. --- include/clientprotocol.h | 2 +- include/modules/ircv3.h | 2 +- src/clientprotocol.cpp | 2 +- src/modules/m_botmode.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/clientprotocol.h b/include/clientprotocol.h index ec033e166..44896a3a3 100644 --- a/include/clientprotocol.h +++ b/include/clientprotocol.h @@ -537,7 +537,7 @@ class ClientProtocol::MessageTagProvider : public Events::ModuleEventListener * The default implementation does nothing. * @param msg Message to be populated with tags. */ - virtual void OnClientProtocolPopulateTags(ClientProtocol::Message& msg) + virtual void OnPopulateTags(ClientProtocol::Message& msg) { } diff --git a/include/modules/ircv3.h b/include/modules/ircv3.h index 9729e8ed5..ce2b70da7 100644 --- a/include/modules/ircv3.h +++ b/include/modules/ircv3.h @@ -75,7 +75,7 @@ class IRCv3::CapTag : public ClientProtocol::MessageTagProvider return cap.get(user); } - void OnClientProtocolPopulateTags(ClientProtocol::Message& msg) CXX11_OVERRIDE + void OnPopulateTags(ClientProtocol::Message& msg) CXX11_OVERRIDE { T& tag = static_cast<T&>(*this); const std::string* const val = tag.GetValue(msg); diff --git a/src/clientprotocol.cpp b/src/clientprotocol.cpp index 212d65d6b..ee3909fbf 100644 --- a/src/clientprotocol.cpp +++ b/src/clientprotocol.cpp @@ -63,7 +63,7 @@ const ClientProtocol::SerializedMessage& ClientProtocol::Serializer::SerializeFo if (!msg.msginit_done) { msg.msginit_done = true; - FOREACH_MOD_CUSTOM(evprov, MessageTagProvider, OnClientProtocolPopulateTags, (msg)); + FOREACH_MOD_CUSTOM(evprov, MessageTagProvider, OnPopulateTags, (msg)); } return msg.GetSerialized(Message::SerializedInfo(this, MakeTagWhitelist(user, msg.GetTags()))); } diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 1007f7ca1..44241e82c 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -43,7 +43,7 @@ class BotTag : public ClientProtocol::MessageTagProvider { } - void OnClientProtocolPopulateTags(ClientProtocol::Message& msg) CXX11_OVERRIDE + void OnPopulateTags(ClientProtocol::Message& msg) CXX11_OVERRIDE { User* const user = msg.GetSourceUser(); if (user && user->IsModeSet(botmode)) -- cgit v1.3.1-10-gc9f91