1
This commit is contained in:
parent
bef62ab97f
commit
bf4d78aeaa
@ -75,6 +75,13 @@ enum GuildMemberUpdateReason
|
||||
kGuildUpdateReasonUpdate = 4,
|
||||
};
|
||||
|
||||
enum ChatChannel_e
|
||||
{
|
||||
kCCWorld = 0,
|
||||
kCCFriend = 1,
|
||||
kCCGuild = 2
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "friend_imserver";
|
||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||
|
||||
|
@ -102,6 +102,8 @@ void HandlerMgr::RegisterNetMsgHandlers()
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMFriendIdList);
|
||||
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMSendChatMsg);
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMReadMsgAndOpenChatNotify);
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMCloseChatNotify);
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMSendCustomMsg);
|
||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMDirtyWordCheck);
|
||||
|
||||
|
@ -548,16 +548,33 @@ void Player::_CMFriendIdList(f8::MsgHdr& hdr, const cs::CMFriendIdList& msg)
|
||||
|
||||
void Player::_CMSendChatMsg(f8::MsgHdr& hdr, const cs::CMSendChatMsg& msg)
|
||||
{
|
||||
#if 0
|
||||
ss::SS_IM_SendChatMsg ss_msg;
|
||||
FillIMMsgConext(ss_msg.mutable_context());
|
||||
ss_msg.set_chat_channel(msg.chat_channel());
|
||||
ss_msg.set_msg(msg.msg());
|
||||
ss_msg.set_target(msg.target());
|
||||
ss_msg.set_msg_type(msg.msg_type());
|
||||
ss_msg.set_msg_body(msg.msg_body());
|
||||
Friend* friend_data = GetFriendById(msg.target());
|
||||
if (friend_data) {
|
||||
SendSSMsg(*friend_data, ss_msg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Player::_CMReadMsgAndOpenChatNotify(f8::MsgHdr& hdr, const cs::CMReadMsgAndOpenChatNotify& msg)
|
||||
{
|
||||
if (IsValidChatChannel(msg.curr_channel())) {
|
||||
chat_channel_ = msg.curr_channel();
|
||||
}
|
||||
for (auto& pair : msg.last_ids()) {
|
||||
if (IsValidChatChannel(pair.key())) {
|
||||
chat_last_ids_hash_[pair.key()] = pair.val();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_CMCloseChatNotify(f8::MsgHdr& hdr, const cs::CMCloseChatNotify& msg)
|
||||
{
|
||||
chat_channel_ = -1;
|
||||
}
|
||||
|
||||
void Player::_CMSendCustomMsg(f8::MsgHdr& hdr, const cs::CMSendCustomMsg& msg)
|
||||
@ -2252,3 +2269,12 @@ void Player::SyncGuildNewApply(long long guild_id)
|
||||
ss::SSMessageId_e::_SS_IM_GuildNewApply,
|
||||
msg);
|
||||
}
|
||||
|
||||
bool Player::IsValidChatChannel(int chat_channel)
|
||||
{
|
||||
if (chat_channel >= 0 && chat_channel < 2) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,8 @@ class Player
|
||||
void _CMFriendIdList(f8::MsgHdr& hdr, const cs::CMFriendIdList& msg);
|
||||
|
||||
void _CMSendChatMsg(f8::MsgHdr& hdr, const cs::CMSendChatMsg& msg);
|
||||
void _CMReadMsgAndOpenChatNotify(f8::MsgHdr& hdr, const cs::CMReadMsgAndOpenChatNotify& msg);
|
||||
void _CMCloseChatNotify(f8::MsgHdr& hdr, const cs::CMCloseChatNotify& msg);
|
||||
void _CMSendCustomMsg(f8::MsgHdr& hdr, const cs::CMSendCustomMsg& msg);
|
||||
void _CMDirtyWordCheck(f8::MsgHdr& hdr, const cs::CMDirtyWordCheck& msg);
|
||||
|
||||
@ -197,6 +199,7 @@ private:
|
||||
void SyncGuildMemberInfo();
|
||||
void SyncGuildRedPoint();
|
||||
void SyncGuildNewApply(long long guild_id);
|
||||
bool IsValidChatChannel(int chat_channel);
|
||||
|
||||
private:
|
||||
bool dirty_ = false;
|
||||
@ -212,6 +215,8 @@ private:
|
||||
std::set<std::string> exclude_account_ids_;
|
||||
std::string user_sign_;
|
||||
int last_create_guild_time_ = 0;
|
||||
int chat_channel_ = -1;
|
||||
std::map<int, long long> chat_last_ids_hash_;
|
||||
|
||||
std::map<std::string, Friend*> friend_hash_;
|
||||
std::map<std::string, Friend*> black_hash_;
|
||||
|
@ -11,6 +11,8 @@ namespace ss
|
||||
class SS_WSP_SocketDisconnect;
|
||||
class SS_MS_PushUserList;
|
||||
class SS_IM_SendChatMsg;
|
||||
class SS_IM_ReadMsgAndOpenChatNotify;
|
||||
class SS_IM_CloseChatNotify;
|
||||
class SS_IM_SendCustomMsg;
|
||||
class SS_IM_UpdateUserInfo;
|
||||
class SS_IM_FriendAgreeRequest;
|
||||
|
@ -238,9 +238,10 @@ message SS_MS_PushUserList
|
||||
message SS_IM_SendChatMsg
|
||||
{
|
||||
optional MFIMMsgConext context = 1;
|
||||
optional string target = 2;
|
||||
optional int32 chat_channel = 3;
|
||||
optional string msg = 4;
|
||||
optional int32 chat_channel = 2;
|
||||
optional string target = 3;
|
||||
optional int32 msg_type = 4;
|
||||
optional string msg_body = 5;
|
||||
}
|
||||
|
||||
message SS_IM_SendCustomMsg
|
||||
|
Loading…
x
Reference in New Issue
Block a user