diff --git a/server/imserver/chatmgr.cc b/server/imserver/chatmgr.cc index 7b405bd..c230593 100644 --- a/server/imserver/chatmgr.cc +++ b/server/imserver/chatmgr.cc @@ -31,7 +31,7 @@ void ChatMgr::FillSMUpdateChatRedPointNotify(Player* hum, cs::SMUpdateChatRedPoi } ChatedUserRec* chated_user = GetChatedUser(hum->AccountId()); if (chated_user && chated_user->has_unread_msg) { - msg.add_has_unread_msg_channels(kCCFriend); + msg.add_has_unread_msg_channels(kCCPrivate); } } @@ -117,7 +117,9 @@ void ChatMgr::SyncWorldChatMsg(Player* hum) hum->world_channel_last_id = chat_msg->msg_uuid(); } } - hum->SendMsg(notifymsg); + if (!notifymsg.msg_list().size() > 0) { + hum->SendMsg(notifymsg); + } } else { hum->MarkNewMsg(); } @@ -137,7 +139,15 @@ void ChatMgr::SyncGuildChatMsg(Player* hum) auto itr = guild_msgrec_.find(hum->GuildId()); if (itr != guild_msgrec_.end()) { if (hum->chat_channel == kCCGuild) { - if (itr->second.curr_id > hum->guild_channel_last_id) { + cs::SMChatMsgNotify notifymsg; + for (cs::MFChatMsg* chat_msg : world_msgrec_.msg_list) { + if (chat_msg->msg_uuid() > hum->guild_channel_last_id) { + *notifymsg.add_msg_list() = *chat_msg; + hum->guild_channel_last_id = chat_msg->msg_uuid(); + } + } + if (!notifymsg.msg_list().size() > 0) { + hum->SendMsg(notifymsg); } } else { hum->MarkNewMsg(); diff --git a/server/imserver/constant.h b/server/imserver/constant.h index 45b74e5..db79099 100644 --- a/server/imserver/constant.h +++ b/server/imserver/constant.h @@ -78,7 +78,7 @@ enum GuildMemberUpdateReason enum ChatChannel_e { kCCWorld = 1, - kCCFriend = 2, + kCCPrivate = 2, kCCGuild = 3 }; diff --git a/server/imserver/player.cc b/server/imserver/player.cc index 1fa4c69..40e3b24 100644 --- a/server/imserver/player.cc +++ b/server/imserver/player.cc @@ -570,7 +570,7 @@ void Player::_CMSendChatMsg(f8::MsgHdr& hdr, const cs::CMSendChatMsg& msg) case kCCWorld: ChatMgr::Instance()->ProcWorldChat(this, msg); break; - case kCCFriend: + case kCCPrivate: ChatMgr::Instance()->ProcPrivateChat(this, msg); break; case kCCGuild: @@ -595,7 +595,7 @@ void Player::_CMReadMsgAndOpenChatNotify(f8::MsgHdr& hdr, const cs::CMReadMsgAnd { if (IsValidChatChannel(msg.curr_channel())) { chat_channel = msg.curr_channel(); - if (chat_channel == kCCFriend) { + if (chat_channel == kCCPrivate) { SyncPrivateChatRedPoint(); }