Merge pull request #86 from AttorneyOnline/messaging-commands
Add /mutepm and /toggleadverts
This commit is contained in:
commit
97b3ea24cd
@ -250,6 +250,16 @@ class AOClient : public QObject {
|
||||
*/
|
||||
bool is_afk = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client will not recieve PM messages.
|
||||
*/
|
||||
bool pm_mute = false;
|
||||
|
||||
/**
|
||||
* @brief If true, the client will recieve advertisements.
|
||||
*/
|
||||
bool advert_enabled = true;
|
||||
|
||||
/**
|
||||
* @brief Timer for tracking user interaction. Automatically restarted whenever a user interacts (i.e. sends any packet besides CH)
|
||||
*/
|
||||
@ -1437,6 +1447,20 @@ class AOClient : public QObject {
|
||||
*/
|
||||
void cmdUnShake(int argc, QStringList argv);
|
||||
|
||||
/**
|
||||
* @brief Toggles whether a client will recieve @ref cmdPM private messages or not.
|
||||
*
|
||||
* @details No arguments.
|
||||
*/
|
||||
void cmdMutePM(int argc, QStringList argv);
|
||||
|
||||
/**
|
||||
* @brief Toggles whether a client will recieve @ref cmdNeed "advertisement" messages.
|
||||
*
|
||||
* @details No arguments.
|
||||
*/
|
||||
void cmdToggleAdverts(int argc, QStringList argv);
|
||||
|
||||
/**
|
||||
* @brief Toggles whether this client is considered AFK.
|
||||
*
|
||||
@ -1848,6 +1872,8 @@ class AOClient : public QObject {
|
||||
{"allowiniswap", {ACLFlags.value("CM"), 0, &AOClient::cmdAllowIniswap}},
|
||||
{"allow_iniswap", {ACLFlags.value("CM"), 0, &AOClient::cmdAllowIniswap}},
|
||||
{"afk", {ACLFlags.value("NONE"), 0, &AOClient::cmdAfk}},
|
||||
{"mutepm", {ACLFlags.value("NONE"), 0, &AOClient::cmdMutePM}},
|
||||
{"toggleadverts", {ACLFlags.value("NONE"), 0, &AOClient::cmdToggleAdverts}},
|
||||
{"oocmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdOocMute}},
|
||||
{"ooc_mute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdOocMute}},
|
||||
{"oocunmute", {ACLFlags.value("MUTE"), 1, &AOClient::cmdOocUnMute}},
|
||||
|
@ -77,7 +77,11 @@ void AOClient::cmdNeed(int argc, QStringList argv)
|
||||
{
|
||||
QString sender_area = server->area_names.value(current_area);
|
||||
QString sender_message = argv.join(" ");
|
||||
sendServerBroadcast({"=== Advert ===\n[" + sender_area + "] needs " + sender_message+ "."});
|
||||
for (AOClient* client : server->clients) {
|
||||
if (client->advert_enabled) {
|
||||
client->sendServerMessage({"=== Advert ===\n[" + sender_area + "] needs " + sender_message+ "."});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AOClient::cmdSwitch(int argc, QStringList argv)
|
||||
@ -131,6 +135,10 @@ void AOClient::cmdPM(int arc, QStringList argv)
|
||||
sendServerMessage("No client with that ID found.");
|
||||
return;
|
||||
}
|
||||
if (target_client->pm_mute) {
|
||||
sendServerMessage("That user is not recieving PMs.");
|
||||
return;
|
||||
}
|
||||
QString message = argv.join(" "); //...which means it will not end up as part of the message
|
||||
target_client->sendServerMessage("Message from " + ooc_name + " (" + QString::number(id) + "): " + message);
|
||||
}
|
||||
@ -290,6 +298,20 @@ void AOClient::cmdUnShake(int argc, QStringList argv)
|
||||
target->is_shaken = false;
|
||||
}
|
||||
|
||||
void AOClient::cmdMutePM(int argc, QStringList argv)
|
||||
{
|
||||
pm_mute = !pm_mute;
|
||||
QString str_en = pm_mute ? "muted" : "unmuted";
|
||||
sendServerMessage("PM's are now " + str_en);
|
||||
}
|
||||
|
||||
void AOClient::cmdToggleAdverts(int argc, QStringList argv)
|
||||
{
|
||||
advert_enabled = !advert_enabled;
|
||||
QString str_en = advert_enabled ? "on" : "off";
|
||||
sendServerMessage("Advertisements turned " + str_en);
|
||||
}
|
||||
|
||||
void AOClient::cmdAfk(int argc, QStringList argv)
|
||||
{
|
||||
is_afk = true;
|
||||
|
Loading…
Reference in New Issue
Block a user