diff options
-rw-r--r-- | include/modules/pseudoclients/global.h | 3 | ||||
-rw-r--r-- | modules/commands/gl_global.cpp | 8 | ||||
-rw-r--r-- | modules/pseudoclients/global.cpp | 5 |
3 files changed, 15 insertions, 1 deletions
diff --git a/include/modules/pseudoclients/global.h b/include/modules/pseudoclients/global.h index 53e112468..88f878607 100644 --- a/include/modules/pseudoclients/global.h +++ b/include/modules/pseudoclients/global.h @@ -16,6 +16,9 @@ class GlobalService : public Service { } + /** Retrieves the bot which sends global messages unless otherwise specified. */ + virtual Reference<BotInfo> GetDefaultSender() = 0; + /** Send out a global message to all users * @param sender Our client which should send the global * @param source The sender of the global diff --git a/modules/commands/gl_global.cpp b/modules/commands/gl_global.cpp index 061649d32..a79caf730 100644 --- a/modules/commands/gl_global.cpp +++ b/modules/commands/gl_global.cpp @@ -37,10 +37,16 @@ class CommandGLGlobal : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override { + Reference<BotInfo> sender; + if (GService) + sender = GService->GetDefaultSender(); + if (!sender) + sender = source.service; + this->SendSyntax(source); source.Reply(" "); source.Reply(_("Allows Administrators to send messages to all users on the\n" - "network. The message will be sent from the nick \002%s\002."), source.service->nick.c_str()); + "network. The message will be sent from the nick \002%s\002."), sender->nick.c_str()); return true; } }; diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp index 6810e7ef1..495d31ba4 100644 --- a/modules/pseudoclients/global.cpp +++ b/modules/pseudoclients/global.cpp @@ -29,6 +29,11 @@ class GlobalCore : public Module, public GlobalService { } + Reference<BotInfo> GetDefaultSender() anope_override + { + return Global; + } + void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) anope_override { if (Me->GetLinks().empty()) |