mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
feat: add chatting by ID
This commit is contained in:
@@ -43,19 +43,19 @@ QByteArray ClientAnswerParser::deAuthorization(bool result, QString login)
|
||||
return dataParser->xmlAnswer(listTag);
|
||||
}
|
||||
|
||||
QByteArray ClientAnswerParser::message(QString text, QString login)
|
||||
QByteArray ClientAnswerParser::message(QString loginFrom,QString loginTo,QString text)
|
||||
{
|
||||
QList<SXmlAnswerTag> listTag;
|
||||
SAttribute attribute2;
|
||||
QList<SAttribute> listAttr;
|
||||
SAttribute attribute1;
|
||||
attribute1 = {"From",loginFrom};
|
||||
listAttr.append(attribute1);
|
||||
attribute1 = {"To",loginTo};
|
||||
listAttr.append(attribute1);
|
||||
attribute1 = {"Text",text};
|
||||
listAttr.append(attribute1);
|
||||
|
||||
SAttribute attribute1 = {"Text", text};
|
||||
QList<SAttribute> listAttr = {attribute1};
|
||||
if(login != "")
|
||||
{
|
||||
attribute2 = {"Login", login};
|
||||
listAttr.append(attribute2);
|
||||
}
|
||||
SXmlAnswerTag tag = {"ServerMessage", listAttr};
|
||||
SXmlAnswerTag tag = {"ClientMessage", listAttr};
|
||||
|
||||
listTag.append(tag);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
|
||||
QByteArray authorization(bool result, QString instructorName, QString clientName, QString accessType, QString login, int id);
|
||||
QByteArray deAuthorization(bool result, QString login);
|
||||
QByteArray message(QString text, QString login = "");
|
||||
QByteArray message(QString loginFrom,QString loginTo,QString text);
|
||||
QByteArray task(QString text);
|
||||
QByteArray notify(QString code);
|
||||
QByteArray tasks(QStringList listTasks);
|
||||
|
||||
@@ -34,11 +34,6 @@ void ProcessParser::read(ClientHandler *client, QByteArray array)
|
||||
|
||||
clientDeAuth(xmlReader,client);
|
||||
}
|
||||
else if(xmlReader.name() == "ToClientMessage")
|
||||
{//Отправка сообщения Клиенту
|
||||
|
||||
toClientMessage(xmlReader,client);
|
||||
}
|
||||
else if(xmlReader.name() == "QueryToDB")
|
||||
{//Запрос к базе данных от клиента
|
||||
|
||||
@@ -339,28 +334,6 @@ void ProcessParser::clientDeAuth(QXmlStreamReader &xmlReader,ClientHandler *clie
|
||||
processingSystem->processingClientDeAutorization(client, clientDeAutorization);
|
||||
}
|
||||
|
||||
void ProcessParser::toClientMessage(QXmlStreamReader &xmlReader,ClientHandler *client)
|
||||
{
|
||||
ToClientMessage toClientMessage;
|
||||
|
||||
/*Перебираем все атрибуты тега*/
|
||||
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
|
||||
{
|
||||
QString name = attr.name().toString();
|
||||
QString value = attr.value().toString();
|
||||
//addTextToLogger(name + ": " + value);
|
||||
|
||||
if(name == "id")
|
||||
toClientMessage.id = value.toInt();
|
||||
else if(name == "Text")
|
||||
toClientMessage.Text = value;
|
||||
else if(name == "Login")
|
||||
toClientMessage.Login = value;
|
||||
}
|
||||
|
||||
processingSystem->processingToClientMessage(client, toClientMessage);
|
||||
}
|
||||
|
||||
void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array)
|
||||
{
|
||||
ClientQueryToDB queryToDB;
|
||||
@@ -519,11 +492,15 @@ void ProcessParser::clientMessage(QXmlStreamReader &xmlReader,ClientHandler *cli
|
||||
QString value = attr.value().toString();
|
||||
//addTextToLogger(name + ": " + value);
|
||||
|
||||
if(name == "Text")
|
||||
if (name == "Text")
|
||||
clientMessage.Text = value;
|
||||
if (name == "From")
|
||||
clientMessage.From = value;
|
||||
if (name == "To")
|
||||
clientMessage.To = value;
|
||||
}
|
||||
|
||||
processingSystem->processingFromClientMessage(client, clientMessage);
|
||||
processingSystem->processingSendMessage(client, clientMessage);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user