diff --git a/server/imserver/chatmgr.cc b/server/imserver/chatmgr.cc index 9d25694..6fbabf0 100644 --- a/server/imserver/chatmgr.cc +++ b/server/imserver/chatmgr.cc @@ -146,7 +146,29 @@ void ChatMgr::ProcGuildChat(Player* hum, const cs::CMSendChatMsg& msg) void ChatMgr::ProcTeamChat(Player* hum, const cs::CMSendChatMsg& msg) { + ++world_msg_id_; + cs::MFChatMsg* p = new cs::MFChatMsg(); + p->set_msg_uuid(world_msg_id_); + hum->FillMFUserInfo(p->mutable_sender()); + //p->set_receiver(world_msg_id_); + p->set_chat_channel(msg.chat_channel()); + p->set_msg_type(msg.msg_type()); + p->set_msg_body(msg.msg_body()); + p->set_send_time(time(nullptr)); + + world_msgrec_.curr_id = world_msg_id_; + cs::SMChatMsgNotify notifymsg; + *notifymsg.add_msg_list() = *p; + if (notifymsg.msg_list().size() > 0) { + for (auto& member_id : msg.members()) { + Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(member_id); + if (hum) { + hum->SendMsg(notifymsg); + } + } + } + delete p; } void ChatMgr::ProcBigHornChat(Player* hum, const cs::CMSendChatMsg& msg) diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index f13c671..6829f3f 100644 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -677,6 +677,7 @@ message CMSendChatMsg optional string target = 2; //目标 optional int32 msg_type = 3; ////消息类型 0:文本消息(json) 1:自定义协议 (json) 2:纯文本(但是任会做屏蔽字替换) optional string msg_body = 4; //消息内容 + repeated string members = 5; //小队成员列表(包含自己) } //读取聊天消息列表并且开启聊天通知