1
This commit is contained in:
parent
53a2339386
commit
025340b20a
@ -27,7 +27,7 @@ class IMListener : public a8::Singleton<IMListener>
|
||||
void UnInit();
|
||||
|
||||
template <typename T>
|
||||
void SendMsg(unsigned short socket_handle, T& msg)
|
||||
void SendMsg(int socket_handle, T& msg)
|
||||
{
|
||||
static int msgid = f8::Net_GetMessageId(msg);
|
||||
f8::Net_SendMsg(tcp_listener_, socket_handle, 0, msgid, msg);
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "IMConn.h"
|
||||
#include "IMConnMgr.h"
|
||||
#include "IMListener.h"
|
||||
#include "MSConn.h"
|
||||
#include "MSConnMgr.h"
|
||||
#include "handlermgr.h"
|
||||
@ -431,6 +432,15 @@ void Player::_CMGroupRename(f8::MsgHdr& hdr, const cs::CMGroupRename& msg)
|
||||
|
||||
void Player::_SS_IM_FriendAgreeRequest(f8::MsgHdr& hdr, const ss::SS_IM_FriendAgreeRequest& msg)
|
||||
{
|
||||
if (!GetFriendById(msg.context().user_info().base_data().account_id())) {
|
||||
Friend* friendobj = new Friend;
|
||||
TypeConvert::Convert(msg.context().user_info().base_data(), friendobj->base_data);
|
||||
TypeConvert::Convert(msg.context().user_info().temp_custom_data(), friendobj->temp_custom_data);
|
||||
if (!AddFriend(friendobj)) {
|
||||
delete friendobj;
|
||||
}
|
||||
}
|
||||
|
||||
f8::MsgHdr* hdr_copy = hdr.Clone();
|
||||
ss::SS_IM_FriendAgreeRequest* msg_copy = new ss::SS_IM_FriendAgreeRequest;
|
||||
*msg_copy = msg;
|
||||
@ -444,6 +454,11 @@ void Player::_SS_IM_FriendAgreeRequest(f8::MsgHdr& hdr, const ss::SS_IM_FriendAg
|
||||
f8::MsgHdr* hdr_copy = (f8::MsgHdr*)param.sender.GetUserData();
|
||||
ss::SS_IM_FriendAgreeRequest* msg_copy = (ss::SS_IM_FriendAgreeRequest*)param.param1.GetUserData();
|
||||
|
||||
ss::SS_IM_FriendAgreeResponse respmsg;
|
||||
*respmsg.mutable_context() = msg_copy->context();
|
||||
respmsg.set_target_id(msg_copy->target_id());
|
||||
IMListener::Instance()->SendMsg(hdr_copy->socket_handle, respmsg);
|
||||
|
||||
f8::MsgHdr::Destroy(hdr_copy);
|
||||
delete msg_copy;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user