forked from yydcaib/TCPServer
做了一些改动
This commit is contained in:
parent
86be79c73d
commit
f599b7d1ac
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 6.0.2, 2023-01-08T00:28:02. -->
|
<!-- Written by QtCreator 6.0.2, 2023-01-08T11:38:39. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
|
|
@ -153,7 +153,6 @@ void DataManager::recv_from_cln(QByteArray &data, QTcpSocket *sock)
|
||||||
{
|
{
|
||||||
if (p_this->online_name_list.at(i) == username)
|
if (p_this->online_name_list.at(i) == username)
|
||||||
{
|
{
|
||||||
qDebug() << i;
|
|
||||||
p_this->online_name_list.removeAt(i);
|
p_this->online_name_list.removeAt(i);
|
||||||
p_this->online_socket_list.removeAt(i);
|
p_this->online_socket_list.removeAt(i);
|
||||||
break;
|
break;
|
||||||
|
@ -164,10 +163,23 @@ void DataManager::recv_from_cln(QByteArray &data, QTcpSocket *sock)
|
||||||
}
|
}
|
||||||
else if (json_data["action"] == "update_namelist")
|
else if (json_data["action"] == "update_namelist")
|
||||||
{
|
{
|
||||||
QByteArray data_build, data_encrypt;
|
qDebug() << "接收到更新用户列表的请求";
|
||||||
|
QJsonObject json = json_data["content"].toObject();
|
||||||
|
QString username = json["name"].toString();
|
||||||
|
for (int i = 0; i < p_this->online_name_list.length(); i++)
|
||||||
|
{
|
||||||
|
if (p_this->online_name_list.at(i) == username)
|
||||||
|
{
|
||||||
|
p_this->online_name_list.removeAt(i);
|
||||||
|
p_this->online_socket_list.removeAt(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p_this->update_namelist(sock);
|
||||||
|
/*QByteArray data_build, data_encrypt;
|
||||||
data_build = p_this->protocol->data_maker(Protocol::ONLINEUSERS, 4, p_this->online_name_list);
|
data_build = p_this->protocol->data_maker(Protocol::ONLINEUSERS, 4, p_this->online_name_list);
|
||||||
data_encrypt = p_this->protocol->data_encrypt(data_build);
|
data_encrypt = p_this->protocol->data_encrypt(data_build);
|
||||||
p_this->server->sendToclient(sock, data_encrypt);
|
p_this->server->sendToclient(sock, data_encrypt);*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue