fixed a few bugs in chat serialization

This commit is contained in:
csoler 2017-04-05 20:49:32 +02:00
parent 03c31ceacc
commit ae9d0b2ab4
3 changed files with 43 additions and 28 deletions

View file

@ -137,15 +137,16 @@ public:
virtual RsChatLobbyBouncingObject *duplicate() const = 0 ;
uint32_t serial_size_no_signature() const ;
bool serialize_no_signature(uint8_t *data,uint32_t size) const ;
uint32_t serial_size_for_signature() const ;
bool serialize_for_signature(uint8_t *data,uint32_t size) const ;
protected:
// The functions below handle the serialisation of data that is specific to the bouncing object level.
// They are called by serial_size() and serialise() from children, but should not overload the serial_size() and
// serialise() methods, otherwise the wrong method will be called when serialising from this top level class.
void serial_process(RsItem::SerializeJob j,SerializeContext& ctx,bool include_signature);
virtual void serial_process(RsItem::SerializeJob j,SerializeContext& ctx,bool include_signature);
virtual void serial_process_for_signature(RsItem::SerializeJob j,SerializeContext& ctx)=0;
virtual uint32_t PacketId() const= 0;
};
@ -159,6 +160,7 @@ public:
virtual RsChatLobbyBouncingObject *duplicate() const { return new RsChatLobbyMsgItem(*this) ; }
void serial_process(RsItem::SerializeJob j,SerializeContext& ctx) ;
void serial_process_for_signature(RsItem::SerializeJob j,SerializeContext& ctx) ; // This one is new, and used to add/remove signature on demand
ChatLobbyMsgId parent_msg_id ; // Used for threaded chat.
@ -168,22 +170,23 @@ protected:
class RsChatLobbyEventItem: public RsChatItem, public RsChatLobbyBouncingObject
{
public:
RsChatLobbyEventItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT) {}
public:
RsChatLobbyEventItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT) {}
virtual ~RsChatLobbyEventItem() {}
virtual RsChatLobbyBouncingObject *duplicate() const { return new RsChatLobbyEventItem(*this) ; }
//
void serial_process(RsItem::SerializeJob j,SerializeContext& ctx);
virtual ~RsChatLobbyEventItem() {}
virtual RsChatLobbyBouncingObject *duplicate() const { return new RsChatLobbyEventItem(*this) ; }
//
void serial_process(RsItem::SerializeJob j,SerializeContext& ctx);
void serial_process_for_signature(RsItem::SerializeJob j,SerializeContext& ctx) ; // This one is new, and used to add/remove signature on demand
// members.
//
uint8_t event_type ; // used for defining the type of event.
std::string string1; // used for any string
uint32_t sendTime; // used to check for old looping messages
// members.
//
uint8_t event_type ; // used for defining the type of event.
std::string string1; // used for any string
uint32_t sendTime; // used to check for old looping messages
protected:
virtual uint32_t PacketId() const { return RsChatItem::PacketId() ; }
virtual uint32_t PacketId() const { return RsChatItem::PacketId() ; }
};
class RsChatLobbyListRequestItem: public RsChatItem