Preparing "reportGameName" network message.
This commit is contained in:
@@ -84,6 +84,7 @@ public:
|
||||
void SendInvitePlayerToCurrentGame(unsigned playerId);
|
||||
void SendRejectGameInvitation(unsigned gameId, DenyGameInvitationReason reason);
|
||||
void SendReportAvatar(unsigned reportedPlayerId, const std::string &avatarHash);
|
||||
void SendReportGameName(unsigned reportedGameId);
|
||||
|
||||
void StartAsyncRead();
|
||||
virtual void CloseSession(boost::shared_ptr<SessionData> session);
|
||||
|
||||
@@ -753,11 +753,11 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
|
||||
} else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_reportAvatarAckMessage) {
|
||||
ReportAvatarAckMessage_t *netReportAck = &tmpPacket->GetMsg()->choice.reportAvatarAckMessage;
|
||||
unsigned msgCode;
|
||||
switch (netReportAck->reportResult) {
|
||||
case reportResult_avatarReportAccepted:
|
||||
switch (netReportAck->reportAvatarResult) {
|
||||
case reportAvatarResult_avatarReportAccepted:
|
||||
msgCode = MSG_NET_AVATAR_REPORT_ACCEPTED;
|
||||
break;
|
||||
case reportResult_avatarReportDuplicate:
|
||||
case reportAvatarResult_avatarReportDuplicate:
|
||||
msgCode = MSG_NET_AVATAR_REPORT_DUP;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -385,6 +385,16 @@ ClientThread::SendReportAvatar(unsigned reportedPlayerId, const std::string &ava
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::SendReportGameName(unsigned reportedGameId)
|
||||
{
|
||||
boost::shared_ptr<NetPacket> packet(new NetPacket(NetPacket::Alloc));
|
||||
packet->GetMsg()->present = PokerTHMessage_PR_reportGameMessage;
|
||||
ReportGameMessage_t *netReport = &packet->GetMsg()->choice.reportGameMessage;
|
||||
netReport->reportedGameId = reportedGameId;
|
||||
m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet));
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::StartAsyncRead()
|
||||
{
|
||||
|
||||
@@ -84,7 +84,7 @@ void
|
||||
SenderHelper::InternalStorePacket(SendBuffer &tmpBuffer, boost::shared_ptr<NetPacket> packet)
|
||||
{
|
||||
asn_enc_rval_t e = der_encode(&asn_DEF_PokerTHMessage, packet->GetMsg(), &SendBuffer::EncodeToBuf, &tmpBuffer);
|
||||
//cerr << "OUT:" << endl << packet->ToString() << endl;
|
||||
cerr << "OUT:" << endl << packet->ToString() << endl;
|
||||
if (e.encoded == -1)
|
||||
LOG_ERROR("Failed to encode NetPacket: " << packet->GetMsg()->present);
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
|
||||
packet->GetMsg()->present = PokerTHMessage_PR_reportAvatarAckMessage;
|
||||
ReportAvatarAckMessage_t *netReportAck = &packet->GetMsg()->choice.reportAvatarAckMessage;
|
||||
netReportAck->reportedPlayerId = netReport->reportedPlayerId;
|
||||
netReportAck->reportResult = reportResult_avatarReportDuplicate;
|
||||
netReportAck->reportAvatarResult = reportAvatarResult_avatarReportDuplicate;
|
||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
||||
}
|
||||
} else {
|
||||
@@ -355,7 +355,7 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
|
||||
packet->GetMsg()->present = PokerTHMessage_PR_reportAvatarAckMessage;
|
||||
ReportAvatarAckMessage_t *netReportAck = &packet->GetMsg()->choice.reportAvatarAckMessage;
|
||||
netReportAck->reportedPlayerId = netReport->reportedPlayerId;
|
||||
netReportAck->reportResult = reportResult_avatarReportInvalid;
|
||||
netReportAck->reportAvatarResult = reportAvatarResult_avatarReportInvalid;
|
||||
server->GetLobbyThread().GetSender().Send(session, packet);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1620,7 +1620,7 @@ ServerLobbyThread::SendReportAvatarResult(unsigned byPlayerId, unsigned reported
|
||||
packet->GetMsg()->present = PokerTHMessage_PR_reportAvatarAckMessage;
|
||||
ReportAvatarAckMessage_t *netReportAck = &packet->GetMsg()->choice.reportAvatarAckMessage;
|
||||
netReportAck->reportedPlayerId = reportedPlayerId;
|
||||
netReportAck->reportResult = success ? reportResult_avatarReportAccepted : reportResult_avatarReportInvalid;
|
||||
netReportAck->reportAvatarResult = success ? reportAvatarResult_avatarReportAccepted : reportAvatarResult_avatarReportInvalid;
|
||||
GetSender().Send(session, packet);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user