1
This commit is contained in:
parent
1694f84233
commit
a97a8a73b8
@ -285,6 +285,14 @@ void Player::_CMFriendAgree(f8::MsgHdr& hdr, const cs::CMFriendAgree& msg)
|
||||
PlayerMgr::Instance()->WatchPlayer(friendobj);
|
||||
SendMsg(respmsg);
|
||||
MarkDirty();
|
||||
#if 1
|
||||
{
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(friendobj->base_data.account_id);
|
||||
if (hum) {
|
||||
hum->AddFriend(&myself);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(myself.crc32_code);
|
||||
DBEngine::Instance()->ExecAsyncScript
|
||||
@ -354,6 +362,14 @@ void Player::_CMFriendDelete(f8::MsgHdr& hdr, const cs::CMFriendDelete& msg)
|
||||
if (p) {
|
||||
friend_hash_.erase(msg.friend_id());
|
||||
MarkDirty();
|
||||
#if 1
|
||||
{
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(p->base_data.account_id);
|
||||
if (hum) {
|
||||
hum->RemoveFriend(p->base_data.account_id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
respmsg.set_friend_id(msg.friend_id());
|
||||
SendMsg(respmsg);
|
||||
@ -711,6 +727,32 @@ void Player::InternalSendSSMsg(const Friend& friend_data,
|
||||
}
|
||||
}
|
||||
|
||||
void Player::AddFriend(Friend* p)
|
||||
{
|
||||
if (!GetFriendById(p->base_data.account_id)) {
|
||||
Friend* friendobj = new Friend;
|
||||
*friendobj = *p;
|
||||
friendobj->crc32_code = a8::openssl::Crc32
|
||||
(
|
||||
(unsigned char*)friendobj->base_data.account_id.data(),
|
||||
friendobj->base_data.account_id.size()
|
||||
);
|
||||
friendobj->hum = this;
|
||||
friend_hash_[friendobj->base_data.account_id] = friendobj;
|
||||
PlayerMgr::Instance()->WatchPlayer(friendobj);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::RemoveFriend(const std::string& account_id)
|
||||
{
|
||||
Friend* friendobj = GetFriendById(account_id);
|
||||
if (friendobj) {
|
||||
PlayerMgr::Instance()->UnWatchPlayer(friendobj);
|
||||
friend_hash_.erase(account_id);
|
||||
delete friendobj;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string Player::AccountId()
|
||||
{
|
||||
return myself.base_data.account_id;
|
||||
|
@ -95,6 +95,8 @@ class Player
|
||||
void NotifyOffline();
|
||||
void NotifyUserInfoUpdate(Friend* friend_data);
|
||||
void PushFriendList();
|
||||
void AddFriend(Friend* friendobj);
|
||||
void RemoveFriend(const std::string& account_id);
|
||||
|
||||
const std::string AccountId();
|
||||
|
||||
|
@ -64,4 +64,5 @@ enum SMMessageId_e
|
||||
_SMUserInfoUpdate = 502;
|
||||
_SMCustomMsgNotify = 503;
|
||||
_SMUserTempCustomDataUpdate = 504;
|
||||
_SMDeleteFriendNotify = 505;
|
||||
}
|
||||
|
@ -90,6 +90,9 @@ message CMUpdateUserInfo
|
||||
optional int64 user_value1 = 50; //用户字段1
|
||||
optional int64 user_value2 = 51; //用户字段2
|
||||
optional int64 user_value3 = 52; //用户字段3
|
||||
|
||||
optional int32 delay_time = 100; //延迟更新(单位毫秒)
|
||||
optional int32 delay_flag = 101; //延迟更新标志(只能为1-16),相同的flag定时器覆盖
|
||||
}
|
||||
|
||||
//获取好友列表
|
||||
@ -324,6 +327,9 @@ message CMUpdateTempCustomData
|
||||
*/
|
||||
optional int32 update_type = 1; //更新方式
|
||||
optional MFUserTempCustomData temp_custom_data = 2; //临时自定义数据
|
||||
|
||||
optional int32 delay_time = 100; //延迟更新(单位毫秒)
|
||||
optional int32 delay_flag = 101; //延迟更新标志(只能为1-16),相同的flag定时器覆盖
|
||||
}
|
||||
|
||||
//用户上/下线通知
|
||||
@ -357,6 +363,12 @@ message SMUserInfoUpdate
|
||||
repeated MFUserInfo user_infos = 1; //用户信息列表
|
||||
}
|
||||
|
||||
//删除好友通知a
|
||||
message SMDeleteFriendNotify
|
||||
{
|
||||
repeated string user_list = 1; //用户列表
|
||||
}
|
||||
|
||||
//更新用户临时自定义信息
|
||||
message SMUserTempCustomDataUpdate
|
||||
{
|
||||
|
@ -115,11 +115,14 @@ DROP TABLE IF EXISTS `event`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `event` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '事件接受方id',
|
||||
`sender_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '事件发送方id',
|
||||
`target_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '事件接受方id',
|
||||
`event_name` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '事件名',
|
||||
`param1` tinyblob COMMENT 'param1',
|
||||
`param2` tinyblob COMMENT 'param2',
|
||||
`param3` tinyblob COMMENT 'param3',
|
||||
`event_data` mediumblob COMMENT '事件数据',
|
||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT '0:未处理 1:已处理',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
KEY `account_id` (`account_id`)
|
||||
|
Loading…
x
Reference in New Issue
Block a user