Merge pull request #57 from Salanto/allow_blankposting-command
Add allow_blankposting-command
This commit is contained in:
commit
5f405c20bc
@ -3,9 +3,11 @@ background=gs4
|
||||
protected_area=true
|
||||
iniswap_allowed=false
|
||||
evidence_mod=cm
|
||||
blankposting_allowed=true
|
||||
|
||||
[1:Courtroom 1]
|
||||
background=gs4
|
||||
protected_area=false
|
||||
iniswap_allowed=true
|
||||
evidence_mod=ffa
|
||||
blankposting_allowed=true
|
@ -1134,6 +1134,16 @@ class AOClient : public QObject {
|
||||
*/
|
||||
void cmdBans(int argc, QStringList argv);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Toggle whether or not in-character messages purely consisting of spaces are allowed.
|
||||
*
|
||||
* @details Takes no arguments. Against all common sense this also allows you to disable blankposting.
|
||||
*
|
||||
* @iscommand
|
||||
*/
|
||||
void cmdAllow_Blankposting(int argc, QStringList argv);
|
||||
|
||||
///@}
|
||||
|
||||
/**
|
||||
@ -1582,6 +1592,7 @@ class AOClient : public QObject {
|
||||
{"notecard_clear", {ACLFlags.value("NONE"), 0, &AOClient::cmdNoteCardClear}},
|
||||
{"8ball", {ACLFlags.value("NONE"), 1, &AOClient::cmd8Ball}},
|
||||
{"lm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdLM}},
|
||||
{"allow_blankposting", {ACLFlags.value("MODCHAT"), 0, &AOClient::cmdAllow_Blankposting}},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -187,6 +187,11 @@ class AreaData : public QObject {
|
||||
*/
|
||||
bool iniswap_allowed;
|
||||
|
||||
/**
|
||||
* @brief If true, clients are allowed to send empty IC messages
|
||||
*/
|
||||
bool blankposting_allowed;
|
||||
|
||||
/**
|
||||
* @brief If true, the background of the area cannot be changed except by a moderator.
|
||||
*/
|
||||
|
@ -37,6 +37,7 @@ AreaData::AreaData(QString p_name, int p_index) :
|
||||
iniswap_allowed = areas_ini.value("iniswap_allowed", "true").toBool();
|
||||
bg_locked = areas_ini.value("bg_locked", "false").toBool();
|
||||
QString configured_evi_mod = areas_ini.value("evidence_mod", "FFA").toString().toLower();
|
||||
blankposting_allowed = areas_ini.value("blankposting_allowed","true").toBool();
|
||||
areas_ini.endGroup();
|
||||
QSettings config_ini("config/config.ini", QSettings::IniFormat);
|
||||
config_ini.beginGroup("Options");
|
||||
|
@ -1280,6 +1280,19 @@ void AOClient::cmd8Ball(int argc, QStringList argv)
|
||||
|
||||
}
|
||||
|
||||
void AOClient::cmdAllow_Blankposting(int argc, QStringList argv)
|
||||
{
|
||||
QString sender_name = ooc_name;
|
||||
AreaData* area = server->areas[current_area];
|
||||
area->blankposting_allowed = !area->blankposting_allowed;
|
||||
if (area->blankposting_allowed == false) {
|
||||
sendServerMessageArea(sender_name + " has set blankposting in the area to forbidden.");
|
||||
}
|
||||
else {
|
||||
sendServerMessageArea(sender_name + " has set blankposting in the area to allowed.");
|
||||
}
|
||||
}
|
||||
|
||||
QStringList AOClient::buildAreaList(int area_idx)
|
||||
{
|
||||
QStringList entries;
|
||||
|
@ -435,6 +435,11 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
||||
if (incoming_msg == last_message)
|
||||
return invalid;
|
||||
|
||||
if (incoming_msg == "" && area->blankposting_allowed == false) {
|
||||
sendServerMessage("Blankposting has been forbidden in this area.");
|
||||
return invalid;
|
||||
}
|
||||
|
||||
last_message = incoming_msg;
|
||||
args.append(incoming_msg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user