Fix serialization regression in async chat

This commit is contained in:
Gioacchino Mazzurco 2017-05-15 15:00:21 +02:00
parent 2f43927634
commit 93a6b7dcd4
2 changed files with 23 additions and 20 deletions

View File

@ -39,8 +39,7 @@ static const uint32_t RS_CHAT_SERIALIZER_FLAGS_NO_SIGNATURE = 0x0001;
RsItem *RsChatSerialiser::create_item(uint16_t service_id,uint8_t item_sub_id) const RsItem *RsChatSerialiser::create_item(uint16_t service_id,uint8_t item_sub_id) const
{ {
if (service_id != RS_SERVICE_TYPE_CHAT) if(service_id != RS_SERVICE_TYPE_CHAT) return NULL;
return NULL;
switch(item_sub_id) switch(item_sub_id)
{ {
@ -49,14 +48,15 @@ RsItem *RsChatSerialiser::create_item(uint16_t service_id,uint8_t item_sub_id) c
case RS_PKT_SUBTYPE_CHAT_STATUS: return new RsChatStatusItem(); case RS_PKT_SUBTYPE_CHAT_STATUS: return new RsChatStatusItem();
case RS_PKT_SUBTYPE_CHAT_AVATAR: return new RsChatAvatarItem(); case RS_PKT_SUBTYPE_CHAT_AVATAR: return new RsChatAvatarItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG: return new RsChatLobbyMsgItem(); case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG: return new RsChatLobbyMsgItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED: return new RsChatLobbyInviteItem_Deprecated() ; // to be removed (deprecated since May 2017)
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE: return new RsChatLobbyInviteItem(); case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE: return new RsChatLobbyInviteItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED: return new RsChatLobbyInviteItem_Deprecated(); // to be removed (deprecated since May 2017)
case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: return new RsChatLobbyConnectChallengeItem(); case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: return new RsChatLobbyConnectChallengeItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: return new RsChatLobbyUnsubscribeItem(); case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: return new RsChatLobbyUnsubscribeItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT: return new RsChatLobbyEventItem(); case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT: return new RsChatLobbyEventItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem(); case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem(); case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem(); case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem();
case RS_PKT_SUBTYPE_OUTGOING_MAP: return new PrivateOugoingMapItem();
default: default:
std::cerr << "Unknown packet type in chat!" << std::endl; std::cerr << "Unknown packet type in chat!" << std::endl;
return NULL; return NULL;

View File

@ -33,6 +33,7 @@
#include "rsitems/itempriorities.h" #include "rsitems/itempriorities.h"
#include "rsitems/rsitem.h" #include "rsitems/rsitem.h"
#include "serialiser/rsserial.h" #include "serialiser/rsserial.h"
#include "util/rsdeprecate.h"
#include "serialiser/rstlvidset.h" #include "serialiser/rstlvidset.h"
#include "serialiser/rstlvfileitem.h" #include "serialiser/rstlvfileitem.h"
@ -78,7 +79,9 @@ const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG = 0x17 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT = 0x18 ; const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT = 0x18 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST = 0x19 ; const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST = 0x19 ;
RS_DEPRECATED_FOR(RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE) \
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED = 0x1A ; // to be removed (deprecated since May 2017) const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED = 0x1A ; // to be removed (deprecated since May 2017)
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x1B ; const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x1B ;
const uint8_t RS_PKT_SUBTYPE_OUTGOING_MAP = 0x1C ; const uint8_t RS_PKT_SUBTYPE_OUTGOING_MAP = 0x1C ;
@ -241,7 +244,7 @@ class RsChatLobbyConnectChallengeItem: public RsChatItem
uint64_t challenge_code ; uint64_t challenge_code ;
}; };
// to be removed (deprecated since May 2017) /// @deprecated since May 2017, to be removed
class RsChatLobbyInviteItem_Deprecated : public RsChatItem class RsChatLobbyInviteItem_Deprecated : public RsChatItem
{ {
public: public: