mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
initial commit
This commit is contained in:
commit
a11f93df4d
99 changed files with 7493 additions and 0 deletions
33
servatrice/src/returnmessage.cpp
Normal file
33
servatrice/src/returnmessage.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "returnmessage.h"
|
||||
#include "testserversocket.h"
|
||||
|
||||
void ReturnMessage::setMsgId(unsigned int _msg_id)
|
||||
{
|
||||
msg_id = _msg_id;
|
||||
}
|
||||
|
||||
bool ReturnMessage::send(const QString &args, bool success)
|
||||
{
|
||||
TestServerSocket *s = qobject_cast<TestServerSocket *>(parent());
|
||||
if (!s)
|
||||
return false;
|
||||
s->msg(QString("resp|%1|%2|%3").arg(msg_id)
|
||||
.arg(success ? "ok" : "err")
|
||||
.arg(args));
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ReturnMessage::sendList(const QStringList &args)
|
||||
{
|
||||
TestServerSocket *s = qobject_cast<TestServerSocket *>(parent());
|
||||
if (!s)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < args.size(); i++)
|
||||
s->msg(QString("%1|%2|%3").arg(cmd)
|
||||
.arg(msg_id)
|
||||
.arg(args[i]));
|
||||
s->msg(QString("%1|%2|.").arg(cmd).arg(msg_id));
|
||||
|
||||
return true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue