diff options
33 files changed, 242 insertions, 155 deletions
diff --git a/data/anope.example.conf b/data/anope.example.conf index f365b744a..d9a35050f 100644 --- a/data/anope.example.conf +++ b/data/anope.example.conf @@ -430,13 +430,11 @@ options timeoutcheck = 3s /* - * If set, will force services to only respond to PRIVMSGs addresses to - * Nick@ServerName - e.g. NickServ@example.com. This should be used in - * conjunction with IRCd aliases. This directive is optional. - * - * This option will have no effect on some IRCds, such as TS6 IRCds. + * If set Anope will tell users to use a server-side alias for messaging + * services instead of /msg. The alias for each service defaults to the + * bot name but can be configured in the service block. */ - #usestrictprivmsg = yes + #servicealias = yes /* * If set, Anope will only show /stats o to IRC Operators. This directive diff --git a/data/botserv.example.conf b/data/botserv.example.conf index 2357c1e93..8e7346bd1 100644 --- a/data/botserv.example.conf +++ b/data/botserv.example.conf @@ -59,6 +59,17 @@ service * Prefixes may be given to the channels in the form of mode characters or prefix symbols. */ #channels = "@#services,#mychan" + + /* + * The server alias that can be used to securely message this service. If + * your IRC server does not have an alias for this service you can set this + * to an empty string to tell users to use /msg instead. + * + * This setting is ignored when options:servicealias is disabled. + * + * Defaults to the nick of the service if not set. + */ + #alias = "BS" } /* diff --git a/data/chanserv.example.conf b/data/chanserv.example.conf index 8858453e2..c7506b878 100644 --- a/data/chanserv.example.conf +++ b/data/chanserv.example.conf @@ -49,6 +49,17 @@ service * Prefixes may be given to the channels in the form of mode characters or prefix symbols. */ #channels = "@#services,#mychan" + + /* + * The server alias that can be used to securely message this service. If + * your IRC server does not have an alias for this service you can set this + * to an empty string to tell users to use /msg instead. + * + * This setting is ignored when options:servicealias is disabled. + * + * Defaults to the nick of the service if not set. + */ + #alias = "CS" } /* diff --git a/data/global.example.conf b/data/global.example.conf index 5b99f0178..15b6347e6 100644 --- a/data/global.example.conf +++ b/data/global.example.conf @@ -49,6 +49,17 @@ service * Prefixes may be given to the channels in the form of mode characters or prefix symbols. */ #channels = "@#services,#mychan" + + /* + * The server alias that can be used to securely message this service. If + * your IRC server does not have an alias for this service you can set this + * to an empty string to tell users to use /msg instead. + * + * This setting is ignored when options:servicealias is disabled. + * + * Defaults to the nick of the service if not set. + */ + #alias = "GL" } /* diff --git a/data/hostserv.example.conf b/data/hostserv.example.conf index 0f74ba467..e1275cc7a 100644 --- a/data/hostserv.example.conf +++ b/data/hostserv.example.conf @@ -49,6 +49,17 @@ service * Prefixes may be given to the channels in the form of mode characters or prefix symbols. */ #channels = "@#services,#mychan" + + /* + * The server alias that can be used to securely message this service. If + * your IRC server does not have an alias for this service you can set this + * to an empty string to tell users to use /msg instead. + * + * This setting is ignored when options:servicealias is disabled. + * + * Defaults to the nick of the service if not set. + */ + #alias = "HS" } /* diff --git a/data/memoserv.example.conf b/data/memoserv.example.conf index 0d1aebdb2..e05e1c14a 100644 --- a/data/memoserv.example.conf +++ b/data/memoserv.example.conf @@ -49,6 +49,17 @@ service * Prefixes may be given to the channels in the form of mode characters or prefix symbols. */ #channels = "@#services,#mychan" + + /* + * The server alias that can be used to securely message this service. If + * your IRC server does not have an alias for this service you can set this + * to an empty string to tell users to use /msg instead. + * + * This setting is ignored when options:servicealias is disabled. + * + * Defaults to the nick of the service if not set. + */ + #alias = "MS" } /* diff --git a/data/nickserv.example.conf b/data/nickserv.example.conf index dd84b7a5e..001137feb 100644 --- a/data/nickserv.example.conf +++ b/data/nickserv.example.conf @@ -49,6 +49,17 @@ service * Prefixes may be given to the channels in the form of mode characters or prefix symbols. */ #channels = "@#services,#mychan" + + /* + * The server alias that can be used to securely message this service. If + * your IRC server does not have an alias for this service you can set this + * to an empty string to tell users to use /msg instead. + * + * This setting is ignored when options:servicealias is disabled. + * + * Defaults to the nick of the service if not set. + */ + #alias = "NS" } /* diff --git a/data/operserv.example.conf b/data/operserv.example.conf index 77c969309..a320bd824 100644 --- a/data/operserv.example.conf +++ b/data/operserv.example.conf @@ -49,6 +49,17 @@ service * Prefixes may be given to the channels in the form of mode characters or prefix symbols. */ #channels = "@#services,#mychan" + + /* + * The server alias that can be used to securely message this service. If + * your IRC server does not have an alias for this service you can set this + * to an empty string to tell users to use /msg instead. + * + * This setting is ignored when options:servicealias is disabled. + * + * Defaults to the nick of the service if not set. + */ + #alias = "OS" } /* diff --git a/docs/Changes.conf b/docs/Changes.conf index 2b27f9cd7..2d7ef3aea 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -1,7 +1,9 @@ Anope Version 2.1.10-git ------------------------ +Added options:servicesalias. Moved nickserv/set/message and nickserv/saset/message to the ns_set_message module. Removed options:useprivmsg. +Removed options:usestrictprivmsg Anope Version 2.1.9 ------------------- diff --git a/include/bots.h b/include/bots.h index 711e306b5..e64c097df 100644 --- a/include/bots.h +++ b/include/bots.h @@ -31,6 +31,8 @@ public: time_t lastmsg; /* Map of actual command names -> service name/permission required */ CommandInfo::map commands; + /* The server-side alias used to message this bot. */ + Anope::string alias; /* Modes the bot should have as configured in service:modes */ Anope::string botmodes; /* Channels the bot should be in as configured in service:channels */ @@ -126,6 +128,9 @@ public: */ CommandInfo *GetCommand(const Anope::string &cname); + /** Get the command that users can use to send a message to this bot. */ + Anope::string GetQueryCommand() const; + /** Find a bot by nick * @param nick The nick * @param nick_only True to only look by nick, and not by UID diff --git a/include/config.h b/include/config.h index 42445637d..0a0a3103d 100644 --- a/include/config.h +++ b/include/config.h @@ -94,13 +94,11 @@ namespace Configuration Anope::string DefLanguage; /* options:timeoutcheck */ time_t TimeoutCheck; - /* options:usestrictprivmsg */ - bool UseStrictPrivmsg; + /* options:servicealias */ + bool ServiceAlias; /* networkinfo:nickchars */ Anope::string NickChars; - /* either "/msg " or "/" */ - Anope::string StrictPrivmsg; /* List of uplink servers to try and connect to */ std::vector<Uplink> Uplinks; /* A vector of our logfile options */ diff --git a/include/language.h b/include/language.h index 7c95611ca..5d2e28bb5 100644 --- a/include/language.h +++ b/include/language.h @@ -65,9 +65,9 @@ namespace Language } // namespace Language /* Commonly used language strings */ -#define CONFIRM_DROP _("Please confirm that you want to drop \002%s\002 with \002%s%s DROP %s %s\002") +#define CONFIRM_DROP _("Please confirm that you want to drop \002%s\002 with \002%s DROP %s %s\002") #define SERVICE_UNAVAILABLE _("Sorry, %s is temporarily unavailable.") -#define MORE_INFO _("\002%s%s HELP %s\002 for more information.") +#define MORE_INFO _("\002%s HELP %s\002 for more information.") #define BAD_USERHOST_MASK _("Mask must be in the form \037user\037@\037host\037.") #define BAD_EXPIRY_TIME _("Invalid expiry time.") #define USERHOST_MASK_TOO_WIDE _("%s coverage is too wide; Please use a more specific mask.") @@ -93,7 +93,7 @@ namespace Language #define NO_EXPIRE _("does not expire") #define LIST_INCORRECT_RANGE _("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.") #define NICK_IS_SECURE _("This nickname is registered and protected. If it is your\n" \ - "nick, type \002%s%s IDENTIFY \037password\037\002. Otherwise,\n" \ + "nick, type \002%s IDENTIFY \037password\037\002. Otherwise,\n" \ "please choose a different nick.") #define FORCENICKCHANGE_NOW _("This nickname has been registered; you may not use it.") #define NICK_CANNOT_BE_REGISTERED _("Nickname \002%s\002 may not be registered.") @@ -111,9 +111,9 @@ namespace Language #define CHAN_INFO_HEADER _("Information about channel \002%s\002:") #define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.") #define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \ - "Type \002%s%s READ %s %zu\002 to read it.") + "Type \002%s READ %s %zu\002 to read it.") #define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \ - "Type \002%s%s READ %zu\002 to read it.") + "Type \002%s READ %zu\002 to read it.") #define MEMO_HAVE_NO_MEMOS _("You have no memos.") #define MEMO_X_HAS_NO_MEMOS _("%s has no memos.") #define MEMO_HAVE_NO_NEW_MEMOS _("You have no new memos.") diff --git a/language/anope.en_US.po b/language/anope.en_US.po index 1ec3c030d..6b7b56577 100644 --- a/language/anope.en_US.po +++ b/language/anope.en_US.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 18:54+0100\n" -"PO-Revision-Date: 2024-10-11 18:54+0100\n" +"POT-Creation-Date: 2024-10-22 16:28+0100\n" +"PO-Revision-Date: 2024-10-22 16:29+0100\n" "Last-Translator: Sadie Powell <sadie@witchery.services>\n" "Language-Team: English\n" "Language: en_US\n" @@ -82,47 +82,47 @@ msgid "" "It has been created for users that can't host or\n" "configure a bot, or for use on networks that don't\n" "allow user bots. Available commands are listed\n" -"below; to use them, type %s%s command. For\n" +"below; to use them, type %s command. For\n" "more information on a specific command, type\n" -"%s%s %s command.\n" +"%s %s command.\n" msgstr "" "%s allows you to have a bot on your own channel.\n" "It has been created for users that can't host or\n" "configure a bot, or for use on networks that don't\n" "allow user bots. Available commands are listed\n" -"below; to use them, type %s%s command. For\n" +"below; to use them, type %s command. For\n" "more information on a specific command, type\n" -"%s%s %s command.\n" +"%s %s command.\n" #, c-format msgid "" "%s allows you to register a nickname and\n" "prevent others from using it. The following\n" "commands allow for registration and maintenance of\n" -"nicknames; to use them, type %s%s command.\n" +"nicknames; to use them, type %s command.\n" "For more information on a specific command, type\n" -"%s%s %s command.\n" +"%s %s command.\n" msgstr "" "%s allows you to register a nickname and\n" "prevent others from using it. The following\n" "commands allow for registration and maintenance of\n" -"nicknames; to use them, type %s%s command.\n" +"nicknames; to use them, type %s command.\n" "For more information on a specific command, type\n" -"%s%s %s command.\n" +"%s %s command.\n" #, c-format msgid "" "%s allows you to register an account.\n" "The following commands allow for registration and maintenance of\n" -"accounts; to use them, type %s%s command.\n" +"accounts; to use them, type %s command.\n" "For more information on a specific command, type\n" -"%s%s %s command.\n" +"%s %s command.\n" msgstr "" "%s allows you to register an account.\n" "The following commands allow for registration and maintenance of\n" -"accounts; to use them, type %s%s command.\n" +"accounts; to use them, type %s command.\n" "For more information on a specific command, type\n" -"%s%s %s command.\n" +"%s %s command.\n" #, c-format msgid "" @@ -131,16 +131,16 @@ msgid "" "malicious users from \"taking over\" channels by limiting\n" "who is allowed channel operator privileges. Available\n" "commands are listed below; to use them, type\n" -"%s%s command. For more information on a\n" -"specific command, type %s%s HELP command.\n" +"%s command. For more information on a\n" +"specific command, type %s HELP command.\n" msgstr "" "%s allows you to register and control various\n" "aspects of channels. %s can often prevent\n" "malicious users from \"taking over\" channels by limiting\n" "who is allowed channel operator privileges. Available\n" "commands are listed below; to use them, type\n" -"%s%s command. For more information on a\n" -"specific command, type %s%s HELP command.\n" +"%s command. For more information on a\n" +"specific command, type %s HELP command.\n" #, c-format msgid "%s already exists in %s bad words list." @@ -387,8 +387,8 @@ msgid "%s will now permanently be ignored." msgstr "%s will now permanently be ignored." #, c-format -msgid "%s%s HELP %s for more information." -msgstr "%s%s HELP %s for more information." +msgid "%s HELP %s for more information." +msgstr "%s HELP %s for more information." msgid "ADD nick user host real" msgstr "ADD nick user host real" @@ -458,11 +458,11 @@ msgstr "" #, c-format msgid "" "User access levels can be seen by using the\n" -"%s command; type %s%s HELP LEVELS for\n" +"%s command; type %s HELP LEVELS for\n" "information." msgstr "" "User access levels can be seen by using the\n" -"%s command; type %s%s HELP LEVELS for\n" +"%s command; type %s HELP LEVELS for\n" "information." #, c-format @@ -947,12 +947,12 @@ msgstr "" #, c-format msgid "" " \n" -"See the %s command (%s%s HELP ACCESS) for\n" +"See the %s command (%s HELP ACCESS) for\n" "information on giving a subset of these privileges to\n" "other channel users.\n" msgstr "" " \n" -"See the %s command (%s%s HELP ACCESS) for\n" +"See the %s command (%s HELP ACCESS) for\n" "information on giving a subset of these privileges to\n" "other channel users.\n" @@ -1219,11 +1219,11 @@ msgstr "" #, c-format msgid "" " \n" -"Type %s%s HELP command for help on any of the\n" +"Type %s HELP command for help on any of the\n" "above commands." msgstr "" " \n" -"Type %s%s HELP command for help on any of the\n" +"Type %s HELP command for help on any of the\n" "above commands." #, c-format @@ -1249,10 +1249,6 @@ msgstr " Loaded at: %p" msgid " but %s mysteriously dematerialized." msgstr " but %s mysteriously dematerialized." -#, c-format -msgid "\"/msg %s\" is no longer supported. Use \"/msg %s@%s\" or \"/%s\" instead." -msgstr "\"/msg %s\" is no longer supported. Use \"/msg %s@%s\" or \"/%s\" instead." - msgid "\"Jupiter\" a server" msgstr "\"Jupiter\" a server" @@ -4790,7 +4786,7 @@ msgid "" "Maintains the bad words list for a channel. The bad\n" "words list determines which words are to be kicked\n" "when the bad words kicker is enabled. For more information,\n" -"type %s%s HELP KICK %s.\n" +"type %s HELP KICK %s.\n" " \n" "The ADD command adds the given word to the\n" "bad words list. If SINGLE is specified, a kick will be\n" @@ -4805,7 +4801,7 @@ msgstr "" "Maintains the bad words list for a channel. The bad\n" "words list determines which words are to be kicked\n" "when the bad words kicker is enabled. For more information,\n" -"type %s%s HELP KICK %s.\n" +"type %s HELP KICK %s.\n" " \n" "The ADD command adds the given word to the\n" "bad words list. If SINGLE is specified, a kick will be\n" @@ -5414,8 +5410,8 @@ msgid "Persistent" msgstr "Persistent" #, c-format -msgid "Please confirm that you want to drop %s with %s%s DROP %s %s" -msgstr "Please confirm that you want to drop %s with %s%s DROP %s %s" +msgid "Please confirm that you want to drop %s with %s DROP %s %s" +msgstr "Please confirm that you want to drop %s with %s DROP %s %s" msgid "Please contact an Operator to get a vhost assigned to this nick." msgstr "Please contact an Operator to get a vhost assigned to this nick." @@ -5911,18 +5907,18 @@ msgstr "Secureops enforced on %s." #, c-format msgid "" -"See %s%s HELP %s for more information\n" +"See %s HELP %s for more information\n" "about the access list." msgstr "" -"See %s%s HELP %s for more information\n" +"See %s HELP %s for more information\n" "about the access list." #, c-format msgid "" -"See %s%s HELP %s for more information\n" +"See %s HELP %s for more information\n" "about the flags system." msgstr "" -"See %s%s HELP %s for more information\n" +"See %s HELP %s for more information\n" "about the flags system." msgid "Send a memo to a nick or channel" @@ -6236,7 +6232,7 @@ msgid "" "option tells the bot to kick users who say certain words\n" "on the channels.\n" "You can define bad words for your channel using the\n" -"BADWORDS command. Type %s%s HELP BADWORDS for\n" +"BADWORDS command. Type %s HELP BADWORDS for\n" "more information.\n" " \n" "ttb is the number of times a user can be kicked\n" @@ -6247,7 +6243,7 @@ msgstr "" "option tells the bot to kick users who say certain words\n" "on the channels.\n" "You can define bad words for your channel using the\n" -"BADWORDS command. Type %s%s HELP BADWORDS for\n" +"BADWORDS command. Type %s HELP BADWORDS for\n" "more information.\n" " \n" "ttb is the number of times a user can be kicked\n" @@ -6473,7 +6469,7 @@ msgid "" " LIMIT Sets the maximum number of memos you can\n" " receive\n" " \n" -"Type %s%s HELP %s option for more information\n" +"Type %s HELP %s option for more information\n" "on a specific option." msgstr "" "Sets various memo options. option can be one of:\n" @@ -6483,7 +6479,7 @@ msgstr "" " LIMIT Sets the maximum number of memos you can\n" " receive\n" " \n" -"Type %s%s HELP %s option for more information\n" +"Type %s HELP %s option for more information\n" "on a specific option." msgid "Sets various nickname options. option can be one of:" @@ -6539,8 +6535,8 @@ msgstr "" "may not get set automatically." #, c-format -msgid "Setting %s not known. Type %s%s HELP LEVELS for a list of valid settings." -msgstr "Setting %s not known. Type %s%s HELP LEVELS for a list of valid settings." +msgid "Setting %s not known. Type %s HELP LEVELS for a list of valid settings." +msgstr "Setting %s not known. Type %s HELP LEVELS for a list of valid settings." msgid "Setting for DEBUG must be ON, OFF, or a positive number." msgstr "Setting for DEBUG must be ON, OFF, or a positive number." @@ -7450,10 +7446,10 @@ msgstr "There is %zu memo on channel %s." #, c-format msgid "" "There is a new memo on channel %s.\n" -"Type %s%s READ %s %zu to read it." +"Type %s READ %s %zu to read it." msgstr "" "There is a new memo on channel %s.\n" -"Type %s%s READ %s %zu to read it." +"Type %s READ %s %zu to read it." #, c-format msgid "There is no bot assigned to %s anymore." @@ -7750,20 +7746,20 @@ msgstr "This nickname is suspended." #, c-format msgid "" "This nickname is registered and protected. If it is your\n" -"nick, type %s%s IDENTIFY password. Otherwise,\n" +"nick, type %s IDENTIFY password. Otherwise,\n" "please choose a different nick." msgstr "" "This nickname is registered and protected. If it is your\n" -"nick, type %s%s IDENTIFY password. Otherwise,\n" +"nick, type %s IDENTIFY password. Otherwise,\n" "please choose a different nick." #, c-format -msgid "To delete, type: %s%s %s %d" -msgstr "To delete, type: %s%s %s %d" +msgid "To delete, type: %s %s %d" +msgstr "To delete, type: %s %s %d" #, c-format -msgid "To delete, type: %s%s %s %s %d" -msgstr "To delete, type: %s%s %s %s %d" +msgid "To delete, type: %s %s %s %d" +msgstr "To delete, type: %s %s %s %d" msgid "To protect ops against bot kicks" msgstr "To protect ops against bot kicks" @@ -7918,21 +7914,21 @@ msgstr "Type" #, c-format msgid "" -"Type %s%s HELP %s option for more information\n" +"Type %s HELP %s option for more information\n" "on a specific option." msgstr "" -"Type %s%s HELP %s option for more information\n" +"Type %s HELP %s option for more information\n" "on a specific option." #, c-format msgid "" -"Type %s%s HELP %s option for more information\n" +"Type %s HELP %s option for more information\n" "on a specific option.\n" " \n" "Note: access to this command is controlled by the\n" "level SET." msgstr "" -"Type %s%s HELP %s option for more information\n" +"Type %s HELP %s option for more information\n" "on a specific option.\n" " \n" "Note: access to this command is controlled by the\n" @@ -7940,25 +7936,25 @@ msgstr "" #, c-format msgid "" -"Type %s%s HELP %s option for more information\n" +"Type %s HELP %s option for more information\n" "on a specific option. The options will be set on the given\n" "nickname." msgstr "" -"Type %s%s HELP %s option for more information\n" +"Type %s HELP %s option for more information\n" "on a specific option. The options will be set on the given\n" "nickname." #, c-format msgid "" -"Type %s%s HELP %s option for more information on a\n" +"Type %s HELP %s option for more information on a\n" "particular option." msgstr "" -"Type %s%s HELP %s option for more information on a\n" +"Type %s HELP %s option for more information on a\n" "particular option." #, c-format -msgid "Type %s%s SET EMAIL email in order to set your email." -msgstr "Type %s%s SET EMAIL email in order to set your email." +msgid "Type %s SET EMAIL email in order to set your email." +msgstr "Type %s SET EMAIL email in order to set your email." msgid "Un-Load a module" msgstr "Un-Load a module" @@ -8006,16 +8002,16 @@ msgid "Unknown command %s." msgstr "Unknown command %s." #, c-format -msgid "Unknown command %s. \"%s%s HELP\" for help." -msgstr "Unknown command %s. \"%s%s HELP\" for help." +msgid "Unknown command %s. \"%s HELP\" for help." +msgstr "Unknown command %s. \"%s HELP\" for help." #, c-format msgid "Unknown command %s. Did you mean %s?" msgstr "Unknown command %s. Did you mean %s?" #, c-format -msgid "Unknown command %s. Did you mean %s? \"%s%s HELP\" for help." -msgstr "Unknown command %s. Did you mean %s? \"%s%s HELP\" for help." +msgid "Unknown command %s. Did you mean %s? \"%s HELP\" for help." +msgstr "Unknown command %s. Did you mean %s? \"%s HELP\" for help." #, c-format msgid "Unknown mode character %c ignored." @@ -8361,10 +8357,6 @@ msgid "You can't logout %s, they are a Services Operator." msgstr "You can't logout %s, they are a Services Operator." #, c-format -msgid "You cannot %s on this network." -msgstr "You cannot %s on this network." - -#, c-format msgid "You cannot set the %c flag." msgstr "You cannot set the %c flag." @@ -8438,10 +8430,10 @@ msgstr "You have 1 new memo." #, c-format msgid "" "You have a new memo from %s.\n" -"Type %s%s READ %zu to read it." +"Type %s READ %zu to read it." msgstr "" "You have a new memo from %s.\n" -"Type %s%s READ %zu to read it." +"Type %s READ %zu to read it." #, c-format msgid "You have been invited to %s by %s." @@ -8913,3 +8905,15 @@ msgstr "{nick | channel}" msgid "{nick | channel} memo-text" msgstr "{nick | channel} memo-text" + +#, c-format +#~ msgid "\"/msg %s\" is no longer supported. Use \"/msg %s@%s\" or \"/%s\" instead." +#~ msgstr "\"/msg %s\" is no longer supported. Use \"/msg %s@%s\" or \"/%s\" instead." + +#, c-format +#~ msgid "To delete, type: %s%s %s %s %d" +#~ msgstr "To delete, type: %s%s %s %s %d" + +#, c-format +#~ msgid "You cannot %s on this network." +#~ msgstr "You cannot %s on this network." diff --git a/modules/botserv/botserv.cpp b/modules/botserv/botserv.cpp index 85db067d2..4d2ddb0ec 100644 --- a/modules/botserv/botserv.cpp +++ b/modules/botserv/botserv.cpp @@ -153,11 +153,11 @@ public: "It has been created for users that can't host or\n" "configure a bot, or for use on networks that don't\n" "allow user bots. Available commands are listed\n" - "below; to use them, type \002%s%s \037command\037\002. For\n" + "below; to use them, type \002%s \037command\037\002. For\n" "more information on a specific command, type\n" - "\002%s%s %s \037command\037\002.\n"), - BotServ->nick.c_str(), Config->StrictPrivmsg.c_str(), BotServ->nick.c_str(), - Config->StrictPrivmsg.c_str(), BotServ->nick.c_str(), source.command.c_str()); + "\002%s %s \037command\037\002.\n"), + BotServ->nick.c_str(), BotServ->GetQueryCommand().c_str(), + BotServ->GetQueryCommand().c_str(), source.command.c_str()); } return EVENT_CONTINUE; diff --git a/modules/botserv/bs_badwords.cpp b/modules/botserv/bs_badwords.cpp index 2396a91c6..95478a0df 100644 --- a/modules/botserv/bs_badwords.cpp +++ b/modules/botserv/bs_badwords.cpp @@ -430,7 +430,7 @@ public: source.Reply(_("Maintains the \002bad words list\002 for a channel. The bad\n" "words list determines which words are to be kicked\n" "when the bad words kicker is enabled. For more information,\n" - "type \002%s%s HELP KICK %s\002.\n" + "type \002%s HELP KICK %s\002.\n" " \n" "The \002ADD\002 command adds the given word to the\n" "bad words list. If SINGLE is specified, a kick will be\n" @@ -440,7 +440,7 @@ public: "will be done if a user says a word that ends with\n" "\037word\037. If you don't specify anything, a kick will\n" "be issued every time \037word\037 is said by a user.\n" - " \n"), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); + " \n"), source.service->GetQueryCommand().c_str(), source.command.c_str()); source.Reply(_("The \002DEL\002 command removes the given word from the\n" "bad words list. If a list of entry numbers is given, those\n" "entries are deleted. (See the example for LIST below.)\n" diff --git a/modules/botserv/bs_kick.cpp b/modules/botserv/bs_kick.cpp index ba2ace0dd..584f34f9d 100644 --- a/modules/botserv/bs_kick.cpp +++ b/modules/botserv/bs_kick.cpp @@ -153,11 +153,11 @@ public: } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n" + source.Reply(_("Type \002%s HELP %s \037option\037\002 for more information\n" "on a specific option.\n" " \n" "Note: access to this command is controlled by the\n" - "level SET."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + "level SET."), source.service->GetQueryCommand().c_str(), this_name.c_str()); return true; } @@ -308,12 +308,12 @@ public: "option tells the bot to kick users who say certain words\n" "on the channels.\n" "You can define bad words for your channel using the\n" - "\002BADWORDS\002 command. Type \002%s%s HELP BADWORDS\002 for\n" + "\002BADWORDS\002 command. Type \002%s HELP BADWORDS\002 for\n" "more information.\n" " \n" "\037ttb\037 is the number of times a user can be kicked\n" "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); + "the ban system once activated."), source.service->GetQueryCommand().c_str()); return true; } }; diff --git a/modules/botserv/bs_set.cpp b/modules/botserv/bs_set.cpp index dac0e4ed3..64b762d72 100644 --- a/modules/botserv/bs_set.cpp +++ b/modules/botserv/bs_set.cpp @@ -58,8 +58,8 @@ public: } } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information on a\n" - "particular option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + source.Reply(_("Type \002%s HELP %s \037option\037\002 for more information on a\n" + "particular option."), source.service->GetQueryCommand().c_str(), this_name.c_str()); return true; } diff --git a/modules/chanserv/chanserv.cpp b/modules/chanserv/chanserv.cpp index b517770b1..882845074 100644 --- a/modules/chanserv/chanserv.cpp +++ b/modules/chanserv/chanserv.cpp @@ -262,9 +262,9 @@ public: "malicious users from \"taking over\" channels by limiting\n" "who is allowed channel operator privileges. Available\n" "commands are listed below; to use them, type\n" - "\002%s%s \037command\037\002. For more information on a\n" - "specific command, type \002%s%s HELP \037command\037\002.\n"), - ChanServ->nick.c_str(), ChanServ->nick.c_str(), Config->StrictPrivmsg.c_str(), ChanServ->nick.c_str(), Config->StrictPrivmsg.c_str(), ChanServ->nick.c_str()); + "\002%s \037command\037\002. For more information on a\n" + "specific command, type \002%s HELP \037command\037\002.\n"), + ChanServ->nick.c_str(), ChanServ->nick.c_str(), ChanServ->GetQueryCommand().c_str(), ChanServ->GetQueryCommand().c_str()); return EVENT_CONTINUE; } diff --git a/modules/chanserv/cs_access.cpp b/modules/chanserv/cs_access.cpp index b7c39ac6d..5e4f0cffe 100644 --- a/modules/chanserv/cs_access.cpp +++ b/modules/chanserv/cs_access.cpp @@ -630,8 +630,8 @@ public: Anope::string cmd; if (Command::FindCommandFromService("chanserv/levels", bi, cmd)) source.Reply(_("\002User access levels\002 can be seen by using the\n" - "\002%s\002 command; type \002%s%s HELP LEVELS\002 for\n" - "information."), cmd.c_str(), Config->StrictPrivmsg.c_str(), bi->nick.c_str()); + "\002%s\002 command; type \002%s HELP LEVELS\002 for\n" + "information."), cmd.c_str(), bi->GetQueryCommand().c_str()); return true; } }; @@ -665,7 +665,10 @@ class CommandCSLevels final { Privilege *p = PrivilegeManager::FindPrivilege(what); if (p == NULL) - source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); + { + source.Reply(_("Setting \002%s\002 not known. Type \002%s HELP LEVELS\002 for a list of valid settings."), + what.c_str(), source.service->GetQueryCommand().c_str()); + } else { bool override = !source.AccessFor(ci).HasPriv("FOUNDER"); @@ -706,7 +709,8 @@ class CommandCSLevels final return; } - source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); + source.Reply(_("Setting \002%s\002 not known. Type \002%s HELP LEVELS\002 for a list of valid settings."), + what.c_str(), source.service->GetQueryCommand().c_str()); } static void DoList(CommandSource &source, ChannelInfo *ci) diff --git a/modules/chanserv/cs_drop.cpp b/modules/chanserv/cs_drop.cpp index 91032905f..ea7f07b50 100644 --- a/modules/chanserv/cs_drop.cpp +++ b/modules/chanserv/cs_drop.cpp @@ -58,8 +58,8 @@ public: *code = Anope::Random(15); } - source.Reply(CONFIRM_DROP, ci->name.c_str(), Config->StrictPrivmsg.c_str(), - source.service->nick.c_str(), ci->name.c_str(), code->c_str()); + source.Reply(CONFIRM_DROP, ci->name.c_str(), source.service->GetQueryCommand().c_str(), + ci->name.c_str(), code->c_str()); return; } diff --git a/modules/chanserv/cs_register.cpp b/modules/chanserv/cs_register.cpp index 1610a98ba..1a660efa9 100644 --- a/modules/chanserv/cs_register.cpp +++ b/modules/chanserv/cs_register.cpp @@ -100,9 +100,9 @@ public: Anope::string cmd; if (Command::FindCommandFromService("chanserv/access", bi, cmd)) source.Reply(_(" \n" - "See the \002%s\002 command (\002%s%s HELP ACCESS\002) for\n" + "See the \002%s\002 command (\002%s HELP ACCESS\002) for\n" "information on giving a subset of these privileges to\n" - "other channel users.\n"), cmd.c_str(), Config->StrictPrivmsg.c_str(), bi->nick.c_str()); + "other channel users.\n"), cmd.c_str(), bi->GetQueryCommand().c_str()); source.Reply(_(" \n" "NOTICE: In order to register a channel, you must have\n" "first registered your nickname.")); diff --git a/modules/chanserv/cs_set.cpp b/modules/chanserv/cs_set.cpp index a68aefa3c..93be5c8b4 100644 --- a/modules/chanserv/cs_set.cpp +++ b/modules/chanserv/cs_set.cpp @@ -59,8 +59,8 @@ public: c->OnServHelp(source); } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information on a\n" - "particular option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + source.Reply(_("Type \002%s HELP %s \037option\037\002 for more information on a\n" + "particular option."), source.service->GetQueryCommand().c_str(), this_name.c_str()); return true; } }; diff --git a/modules/chanserv/cs_xop.cpp b/modules/chanserv/cs_xop.cpp index db8456492..e9a4899d2 100644 --- a/modules/chanserv/cs_xop.cpp +++ b/modules/chanserv/cs_xop.cpp @@ -594,11 +594,11 @@ public: source.Reply(_("Alternative methods of modifying channel access lists are\n" "available.")); if (!access_cmd.empty()) - source.Reply(_("See \002%s%s HELP %s\002 for more information\n" - "about the access list."), Config->StrictPrivmsg.c_str(), access_bi->nick.c_str(), access_cmd.c_str()); + source.Reply(_("See \002%s HELP %s\002 for more information\n" + "about the access list."), access_bi->GetQueryCommand().c_str(), access_cmd.c_str()); if (!flags_cmd.empty()) - source.Reply(_("See \002%s%s HELP %s\002 for more information\n" - "about the flags system."), Config->StrictPrivmsg.c_str(), flags_bi->nick.c_str(), flags_cmd.c_str()); + source.Reply(_("See \002%s HELP %s\002 for more information\n" + "about the flags system."), flags_bi->GetQueryCommand().c_str(), flags_cmd.c_str()); } return true; } diff --git a/modules/memoserv/memoserv.cpp b/modules/memoserv/memoserv.cpp index 3b2a521c7..219d4b33e 100644 --- a/modules/memoserv/memoserv.cpp +++ b/modules/memoserv/memoserv.cpp @@ -101,7 +101,7 @@ public: if (ci->AccessFor(cu->user).HasPriv("MEMO")) { if (cu->user->Account() && cu->user->Account()->HasExt("MEMO_RECEIVE")) - cu->user->SendMessage(MemoServ, MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), Config->StrictPrivmsg.c_str(), MemoServ->nick.c_str(), ci->name.c_str(), mi->memos->size()); + cu->user->SendMessage(MemoServ, MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), MemoServ->GetQueryCommand().c_str(), ci->name.c_str(), mi->memos->size()); } } } @@ -116,7 +116,7 @@ public: { User *user = User::Find(na->nick, true); if (user && user->IsIdentified()) - user->SendMessage(MemoServ, MEMO_NEW_MEMO_ARRIVED, source.c_str(), Config->StrictPrivmsg.c_str(), MemoServ->nick.c_str(), mi->memos->size()); + user->SendMessage(MemoServ, MEMO_NEW_MEMO_ARRIVED, source.c_str(), MemoServ->GetQueryCommand().c_str(), mi->memos->size()); } } @@ -229,8 +229,8 @@ public: if (!params.empty() || source.c || source.service != *MemoServ) return; source.Reply(_(" \n" - "Type \002%s%s HELP \037command\037\002 for help on any of the\n" - "above commands."), Config->StrictPrivmsg.c_str(), MemoServ->nick.c_str()); + "Type \002%s HELP \037command\037\002 for help on any of the\n" + "above commands."), MemoServ->GetQueryCommand().c_str()); } }; diff --git a/modules/memoserv/ms_read.cpp b/modules/memoserv/ms_read.cpp index 5e9c8fd83..75d0fef11 100644 --- a/modules/memoserv/ms_read.cpp +++ b/modules/memoserv/ms_read.cpp @@ -91,9 +91,9 @@ public: if (Command::FindCommandFromService("memoserv/del", bi, cmd)) { if (ci) - source.Reply(_("To delete, type: \002%s%s %s %s %d\002"), Config->StrictPrivmsg.c_str(), bi->nick.c_str(), cmd.c_str(), ci->name.c_str(), index + 1); + source.Reply(_("To delete, type: \002%s %s %s %d\002"), bi->GetQueryCommand().c_str(), cmd.c_str(), ci->name.c_str(), index + 1); else - source.Reply(_("To delete, type: \002%s%s %s %d\002"), Config->StrictPrivmsg.c_str(), bi->nick.c_str(), cmd.c_str(), index + 1); + source.Reply(_("To delete, type: \002%s %s %d\002"), bi->GetQueryCommand().c_str(), cmd.c_str(), index + 1); } source.Reply("%s", m->text.c_str()); diff --git a/modules/memoserv/ms_set.cpp b/modules/memoserv/ms_set.cpp index e018baa1c..5e03562a6 100644 --- a/modules/memoserv/ms_set.cpp +++ b/modules/memoserv/ms_set.cpp @@ -232,8 +232,8 @@ public: " LIMIT Sets the maximum number of memos you can\n" " receive\n" " \n" - "Type \002%s%s HELP %s \037option\037\002 for more information\n" - "on a specific option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); + "Type \002%s HELP %s \037option\037\002 for more information\n" + "on a specific option."), source.service->GetQueryCommand().c_str(), source.command.c_str()); } else if (subcommand.equals_ci("NOTIFY")) source.Reply(_("Syntax: \002NOTIFY {ON | LOGON | NEW | MAIL | NOMAIL | OFF}\002\n" diff --git a/modules/nickserv/nickserv.cpp b/modules/nickserv/nickserv.cpp index 1718af690..d38119d69 100644 --- a/modules/nickserv/nickserv.cpp +++ b/modules/nickserv/nickserv.cpp @@ -195,7 +195,7 @@ public: if (!na->nc->HasExt("KILL_IMMED")) { - u->SendMessage(NickServ, NICK_IS_SECURE, Config->StrictPrivmsg.c_str(), NickServ->nick.c_str()); + u->SendMessage(NickServ, NICK_IS_SECURE, NickServ->GetQueryCommand().c_str()); } if (na->nc->HasExt("KILLPROTECT")) { @@ -362,8 +362,8 @@ public: u->SendMessage(NickServ, _("You must now supply an email for your nick.\n" "This email will allow you to retrieve your password in\n" "case you forget it.")); - u->SendMessage(NickServ, _("Type \002%s%s SET EMAIL \037email\037\002 in order to set your email."), - Config->StrictPrivmsg.c_str(), NickServ->nick.c_str()); + u->SendMessage(NickServ, _("Type \002%s SET EMAIL \037email\037\002 in order to set your email."), + NickServ->GetQueryCommand().c_str()); } for (auto *c : collides) @@ -465,15 +465,15 @@ public: source.Reply(_("\002%s\002 allows you to register a nickname and\n" "prevent others from using it. The following\n" "commands allow for registration and maintenance of\n" - "nicknames; to use them, type \002%s%s \037command\037\002.\n" + "nicknames; to use them, type \002%s \037command\037\002.\n" "For more information on a specific command, type\n" - "\002%s%s %s \037command\037\002.\n"), NickServ->nick.c_str(), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str(), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str(), source.command.c_str()); + "\002%s %s \037command\037\002.\n"), NickServ->nick.c_str(), NickServ->GetQueryCommand().c_str(), NickServ->GetQueryCommand().c_str(), source.command.c_str()); else source.Reply(_("\002%s\002 allows you to register an account.\n" "The following commands allow for registration and maintenance of\n" - "accounts; to use them, type \002%s%s \037command\037\002.\n" + "accounts; to use them, type \002%s \037command\037\002.\n" "For more information on a specific command, type\n" - "\002%s%s %s \037command\037\002.\n"), NickServ->nick.c_str(), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str(), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str(), source.command.c_str()); + "\002%s %s \037command\037\002.\n"), NickServ->nick.c_str(), NickServ->GetQueryCommand().c_str(), NickServ->GetQueryCommand().c_str(), source.command.c_str()); return EVENT_CONTINUE; } diff --git a/modules/nickserv/ns_drop.cpp b/modules/nickserv/ns_drop.cpp index 6042bf326..5a31d74f9 100644 --- a/modules/nickserv/ns_drop.cpp +++ b/modules/nickserv/ns_drop.cpp @@ -72,8 +72,8 @@ public: *code = Anope::Random(15); } - source.Reply(CONFIRM_DROP, na->nick.c_str(), Config->StrictPrivmsg.c_str(), - source.service->nick.c_str(), na->nick.c_str(), code->c_str()); + source.Reply(CONFIRM_DROP, na->nick.c_str(), source.service->GetQueryCommand().c_str(), + na->nick.c_str(), code->c_str()); return; } diff --git a/modules/nickserv/ns_set.cpp b/modules/nickserv/ns_set.cpp index 25c4e5a0d..f8391a519 100644 --- a/modules/nickserv/ns_set.cpp +++ b/modules/nickserv/ns_set.cpp @@ -57,8 +57,8 @@ public: } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n" - "on a specific option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + source.Reply(_("Type \002%s HELP %s \037option\037\002 for more information\n" + "on a specific option."), source.service->GetQueryCommand().c_str(), this_name.c_str()); return true; } @@ -100,9 +100,9 @@ public: } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n" + source.Reply(_("Type \002%s HELP %s \037option\037\002 for more information\n" "on a specific option. The options will be set on the given\n" - "\037nickname\037."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + "\037nickname\037."), source.service->GetQueryCommand().c_str(), this_name.c_str()); return true; } }; diff --git a/src/bots.cpp b/src/bots.cpp index b109f8680..323fbc29a 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -265,6 +265,13 @@ CommandInfo *BotInfo::GetCommand(const Anope::string &cname) return NULL; } +Anope::string BotInfo::GetQueryCommand() const +{ + if (Config->ServiceAlias && !this->alias.empty()) + return Anope::printf("/%s", this->alias.c_str()); + return Anope::printf("/msg %s", this->nick.c_str()); +} + BotInfo *BotInfo::Find(const Anope::string &nick, bool nick_only) { if (!nick_only && IRCD != NULL && IRCD->RequiresID) diff --git a/src/command.cpp b/src/command.cpp index e242b50fb..ae391b433 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -199,7 +199,7 @@ void Command::OnSyntaxError(CommandSource &source, const Anope::string &subcomma this->SendSyntax(source); bool has_help = source.service->commands.find("HELP") != source.service->commands.end(); if (has_help) - source.Reply(MORE_INFO, Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); + source.Reply(MORE_INFO, source.service->GetQueryCommand().c_str(), source.command.c_str()); } namespace @@ -226,13 +226,13 @@ namespace bool has_help = source.service->commands.find("HELP") != source.service->commands.end(); if (has_help && similar.empty()) { - source.Reply(_("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), - Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); + source.Reply(_("Unknown command \002%s\002. \"%s HELP\" for help."), message.c_str(), + source.service->GetQueryCommand().c_str()); } else if (has_help) { - source.Reply(_("Unknown command \002%s\002. Did you mean \002%s\002? \"%s%s HELP\" for help."), - message.c_str(), similar.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); + source.Reply(_("Unknown command \002%s\002. Did you mean \002%s\002? \"%s HELP\" for help."), + message.c_str(), similar.c_str(), source.service->GetQueryCommand().c_str()); } else if (similar.empty()) { diff --git a/src/config.cpp b/src/config.cpp index 28be07318..890cf57fe 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -195,8 +195,7 @@ Conf::Conf() : Block("") } this->ReadTimeout = options->Get<time_t>("readtimeout"); - this->UseStrictPrivmsg = options->Get<bool>("usestrictprivmsg"); - this->StrictPrivmsg = !UseStrictPrivmsg ? "/msg " : "/"; + this->ServiceAlias = options->Get<bool>("servicealias"); { std::vector<Anope::string> defaults; spacesepstream(this->GetModule("nickserv")->Get<const Anope::string>("defaults")).GetTokens(defaults); @@ -338,7 +337,8 @@ Conf::Conf() : Block("") &host = service->Get<const Anope::string>("host"), &gecos = service->Get<const Anope::string>("gecos"), &modes = service->Get<const Anope::string>("modes"), - &channels = service->Get<const Anope::string>("channels"); + &channels = service->Get<const Anope::string>("channels"), + &alias = service->Get<const Anope::string>("alias", nick.upper()); ValidateNotEmptyOrSpaces("service", "nick", nick); ValidateNotEmptyOrSpaces("service", "user", user); @@ -349,6 +349,8 @@ Conf::Conf() : Block("") BotInfo *bi = BotInfo::Find(nick, true); if (!bi) bi = new BotInfo(nick, user, host, gecos, modes); + + bi->alias = alias; bi->conf = true; std::vector<Anope::string> oldchannels = bi->botchannels; diff --git a/src/messages.cpp b/src/messages.cpp index b21a27f37..4c252f666 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -324,18 +324,8 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶m if (!servername.equals_ci(Me->GetName())) return; } - else if (!IRCD->RequiresID && Config->UseStrictPrivmsg) - { - BotInfo *bi = BotInfo::Find(receiver); - if (!bi) - return; - Log(LOG_DEBUG) << "Ignored PRIVMSG without @ from " << u->nick; - u->SendMessage(bi, _("\"/msg %s\" is no longer supported. Use \"/msg %s@%s\" or \"/%s\" instead."), bi->nick.c_str(), bi->nick.c_str(), Me->GetName().c_str(), bi->nick.c_str()); - return; - } BotInfo *bi = BotInfo::Find(botname, nick_only); - if (bi) { Anope::string ctcpname, ctcpbody; |