add global version of/notice

This commit is contained in:
in1tiate 2021-08-04 06:12:25 -05:00
parent e60f18554b
commit 7b1845aa8d
2 changed files with 18 additions and 1 deletions

View File

@ -1237,6 +1237,17 @@ class AOClient : public QObject {
*/
void cmdNotice(int argc, QStringList argv);
/**
* @brief Pops up a notice for all clients in the server with a given message.
*
* @details Unlike cmdNotice, this command will send its notice to every client connected to the server.
*
* @see #cmdNotice
*
* @iscommand
*/
void cmdNoticeGlobal(int argc, QStringList argv);
///@}
/**
@ -2090,6 +2101,7 @@ class AOClient : public QObject {
{"ignorebglist", {ACLFlags.value("IGNORE_BGLIST"),0, &AOClient::cmdIgnoreBgList}},
{"ignore_bglist", {ACLFlags.value("IGNORE_BGLIST"),0, &AOClient::cmdIgnoreBgList}},
{"notice", {ACLFlags.value("SEND_NOTICE"), 1, &AOClient::cmdNotice}},
{"noticeg", {ACLFlags.value("SEND_NOTICE"), 1, &AOClient::cmdNoticeGlobal}},
};
/**

View File

@ -520,5 +520,10 @@ void AOClient::cmdNotice(int argc, QStringList argv)
QString message = "A moderator sent this notice:\n\n" + argv.join(" ");
sendServerMessageArea(message);
server->broadcast(AOPacket("BB", {message}), current_area);
}
void AOClient::cmdNoticeGlobal(int argc, QStringList argv)
{
QString message = "A moderator sent this server-wide notice:\n\n" + argv.join(" ");
sendServerBroadcast(message);
server->broadcast(AOPacket("BB", {message}));
}