Merge pull request #26 from Salanto/motd
motd. Can't get simpler than that.
This commit is contained in:
commit
ed784ec74d
@ -9,6 +9,7 @@ ms_port=27016
|
|||||||
port=27016
|
port=27016
|
||||||
server_description=This is a placeholder server description. Tell the world of AO who you are here!
|
server_description=This is a placeholder server description. Tell the world of AO who you are here!
|
||||||
server_name=An Unnamed Server
|
server_name=An Unnamed Server
|
||||||
|
motd=MOTD is not set.
|
||||||
webao_enable=true
|
webao_enable=true
|
||||||
webao_port=27017
|
webao_port=27017
|
||||||
auth=simple
|
auth=simple
|
||||||
|
@ -76,6 +76,7 @@ class AOClient : public QObject {
|
|||||||
{"CM", 1ULL << 4},
|
{"CM", 1ULL << 4},
|
||||||
{"GLOBAL_TIMER", 1ULL << 5},
|
{"GLOBAL_TIMER", 1ULL << 5},
|
||||||
{"CHANGE_EVI_MOD", 1ULL << 6},
|
{"CHANGE_EVI_MOD", 1ULL << 6},
|
||||||
|
{"CHANGE_MOTD", 1ULL << 7},
|
||||||
{"SUPER", ~0ULL}
|
{"SUPER", ~0ULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -183,6 +184,7 @@ class AOClient : public QObject {
|
|||||||
//// Commands
|
//// Commands
|
||||||
void cmdDefault(int argc, QStringList argv);
|
void cmdDefault(int argc, QStringList argv);
|
||||||
void cmdHelp(int argc, QStringList argv);
|
void cmdHelp(int argc, QStringList argv);
|
||||||
|
void cmdMOTD(int argc, QStringList argv);
|
||||||
// Authentication
|
// Authentication
|
||||||
void cmdLogin(int argc, QStringList argv);
|
void cmdLogin(int argc, QStringList argv);
|
||||||
void cmdChangeAuth(int argc, QStringList argv);
|
void cmdChangeAuth(int argc, QStringList argv);
|
||||||
@ -298,7 +300,8 @@ class AOClient : public QObject {
|
|||||||
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
||||||
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
||||||
{"pm", {ACLFlags.value("NONE"), 2, &AOClient::cmdPM}},
|
{"pm", {ACLFlags.value("NONE"), 2, &AOClient::cmdPM}},
|
||||||
{"evidence_mod", {ACLFlags.value("CHANGE_EVI_MOD"), 1, &AOClient::cmdEvidenceMod}}
|
{"evidence_mod", {ACLFlags.value("CHANGE_EVI_MOD"), 1, &AOClient::cmdEvidenceMod}},
|
||||||
|
{"motd", {ACLFlags.value("NONE"), 0, &AOClient::cmdMOTD}}
|
||||||
};
|
};
|
||||||
|
|
||||||
QString partial_packet;
|
QString partial_packet;
|
||||||
|
@ -52,6 +52,7 @@ class Server : public QObject {
|
|||||||
void broadcast(AOPacket packet, int area_index);
|
void broadcast(AOPacket packet, int area_index);
|
||||||
void broadcast(AOPacket packet);
|
void broadcast(AOPacket packet);
|
||||||
QString getServerName();
|
QString getServerName();
|
||||||
|
QString getMOTD();
|
||||||
int getDiceValue(QString value_type);
|
int getDiceValue(QString value_type);
|
||||||
int getCharID(QString char_name);
|
int getCharID(QString char_name);
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ class Server : public QObject {
|
|||||||
QStringList backgrounds;
|
QStringList backgrounds;
|
||||||
DBManager* db_manager;
|
DBManager* db_manager;
|
||||||
QString server_name;
|
QString server_name;
|
||||||
|
QString MOTD;
|
||||||
|
|
||||||
QTimer* timer;
|
QTimer* timer;
|
||||||
|
|
||||||
|
@ -857,6 +857,23 @@ void AOClient::cmdPM(int arc, QStringList argv)
|
|||||||
target_client->sendServerMessage("Message from " + ooc_name + " (" + QString::number(id) + "): " + message);
|
target_client->sendServerMessage("Message from " + ooc_name + " (" + QString::number(id) + "): " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdMOTD(int argc, QStringList argv)
|
||||||
|
{
|
||||||
|
if (argc == 0) {
|
||||||
|
sendServerMessage("=== MOTD ===\r\n" + server->MOTD + "\r\n=============");
|
||||||
|
}
|
||||||
|
else if (argc > 0) {
|
||||||
|
if (checkAuth(ACLFlags.value("CHANGE_MOTD"))) {
|
||||||
|
QString MOTD = argv.join(" ");
|
||||||
|
server->MOTD = MOTD;
|
||||||
|
sendServerMessage("MOTD has been changed.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendServerMessage("You do not have permission to change the MOTD");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QStringList AOClient::buildAreaList(int area_idx)
|
QStringList AOClient::buildAreaList(int area_idx)
|
||||||
{
|
{
|
||||||
QStringList entries;
|
QStringList entries;
|
||||||
|
@ -113,6 +113,8 @@ void AOClient::pktLoadingDone(AreaData* area, int argc, QStringList argv, AOPack
|
|||||||
sendPacket("OPPASS", {"DEADBEEF"});
|
sendPacket("OPPASS", {"DEADBEEF"});
|
||||||
sendPacket("DONE");
|
sendPacket("DONE");
|
||||||
|
|
||||||
|
sendServerMessage("=== MOTD ===\r\n" + server->MOTD + "\r\n=============");
|
||||||
|
|
||||||
fullArup(); // Give client all the area data
|
fullArup(); // Give client all the area data
|
||||||
if (server->timer->isActive()) {
|
if (server->timer->isActive()) {
|
||||||
sendPacket("TI", {"0", "2"});
|
sendPacket("TI", {"0", "2"});
|
||||||
|
@ -51,6 +51,8 @@ void Server::start()
|
|||||||
qDebug() << "Server listening on" << port;
|
qDebug() << "Server listening on" << port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MOTD = config.value("motd","MOTD is not set.").toString();
|
||||||
|
|
||||||
proxy = new WSProxy(port, ws_port, this);
|
proxy = new WSProxy(port, ws_port, this);
|
||||||
if(ws_port != -1)
|
if(ws_port != -1)
|
||||||
proxy->start();
|
proxy->start();
|
||||||
|
Loading…
Reference in New Issue
Block a user