This commit is contained in:
aozhiwei 2021-11-03 19:23:40 +08:00
commit 9f88d10a66
4 changed files with 18 additions and 7 deletions

View File

@ -35,7 +35,7 @@ struct AsyncTaskContext
struct QueryUserStatusTask struct QueryUserStatusTask
{ {
AsyncTaskContext context; AsyncTaskContext context;
std::map<std::string, bool> users; std::map<std::string, cs::MFUserStatus> users;
void Done() void Done()
{ {
@ -43,8 +43,12 @@ struct QueryUserStatusTask
cs::SMQueryUserStatus msg; cs::SMQueryUserStatus msg;
for (auto& pair : users) { for (auto& pair : users) {
cs::MFUserStatus* user = msg.add_status_list(); cs::MFUserStatus* user = msg.add_status_list();
#if 1
*user = pair.second;
#else
user->set_account_id(pair.first); user->set_account_id(pair.first);
user->set__online(pair.second ? 1 : 0); user->set__online(pair.second ? 1 : 0);
#endif
} }
context.hum->SendMsg(msg); context.hum->SendMsg(msg);
} }
@ -161,7 +165,10 @@ void AsyncTaskMgr::CreateQueryUserStatusTask(Player* hum, std::vector<std::strin
hum->SendSSMsg(hum->myself, msg); hum->SendSSMsg(hum->myself, msg);
for (auto& account_id : account_ids) { for (auto& account_id : account_ids) {
task->users[account_id] = false; cs::MFUserStatus status;
status.set_account_id(account_id);
status.set__online(0);
task->users[account_id] = status;
} }
FillAsyncTaskContext(hum, &task->context, msg.context().seqid()); FillAsyncTaskContext(hum, &task->context, msg.context().seqid());
query_user_status_tasks_[task->context.seqid] = task; query_user_status_tasks_[task->context.seqid] = task;
@ -221,9 +228,10 @@ void AsyncTaskMgr::_SS_IM_PushUserOnlineState(f8::MsgHdr& hdr, const ss::SS_IM_P
QueryUserStatusTask* task = GetQueryUserStatusTask(msg.context().seqid()); QueryUserStatusTask* task = GetQueryUserStatusTask(msg.context().seqid());
if (task) { if (task) {
for (auto& user : msg.user_infos()) { for (auto& user : msg.user_infos()) {
if (task->users.find(user.base_data().account_id()) != auto itr = task->users.find(user.base_data().account_id());
task->users.end()) { if (itr != task->users.end()) {
task->users[user.base_data().account_id()] = true; itr->second.set__online(1);
*itr->second.mutable_temp_custom_data() = user.temp_custom_data();
} }
} }
} }

View File

@ -575,7 +575,9 @@ void Player::_CMSendChatMsg(f8::MsgHdr& hdr, const cs::CMSendChatMsg& msg)
return; return;
} }
cs::CMSendChatMsg* mutable_msg = (cs::CMSendChatMsg*)&msg; cs::CMSendChatMsg* mutable_msg = (cs::CMSendChatMsg*)&msg;
mutable_msg->set_msg_body(MetaMgr::Instance()->ReplaceDirtyWord(msg.msg_body(), '*')); if (msg.msg_type() == 2) {
mutable_msg->set_msg_body(MetaMgr::Instance()->ReplaceDirtyWord(msg.msg_body(), '*'));
}
switch (msg.chat_channel()) { switch (msg.chat_channel()) {
case kCCWorld: case kCCWorld:
ChatMgr::Instance()->ProcWorldChat(this, msg); ChatMgr::Instance()->ProcWorldChat(this, msg);

View File

@ -94,6 +94,7 @@ message MFUserStatus
{ {
optional string account_id = 1; //id optional string account_id = 1; //id
optional int32 _online = 2; //线 optional int32 _online = 2; //线
optional MFUserTempCustomData temp_custom_data = 3; //
} }
// //

View File

@ -21,7 +21,7 @@ def main():
help = "account info") help = "account info")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
ws_url = args if args else 'wss://relation-dny.kingsome.cn/friend/websocket' ws_url = args if args else 'wss://relation-test.kingsome.cn/friend/websocket'
# ws_url = args if args else 'ws://192.168.100.21:8911/friend/websocket' # ws_url = args if args else 'ws://192.168.100.21:8911/friend/websocket'
accounts = options.accounts.split(',') accounts = options.accounts.split(',')
accounts = [] accounts = []