mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
merged in new lobbies with GXS ids. Old peers and new peers cannot see each others lobby lists. Invitations still work and can be used to transfer a lobby ID between versions. Messages of old and new peers will not be visible to each other
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7986 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2044575067
commit
f9c78ebd61
22 changed files with 1430 additions and 980 deletions
File diff suppressed because it is too large
Load diff
|
@ -32,6 +32,7 @@ typedef RsPeerId ChatLobbyVirtualPeerId ;
|
|||
|
||||
class RsItem ;
|
||||
class p3HistoryMgr ;
|
||||
class p3IdService ;
|
||||
class p3ServiceControl;
|
||||
class RsChatLobbyItem ;
|
||||
class RsChatLobbyListRequestItem ;
|
||||
|
@ -49,7 +50,7 @@ class RsChatMsgItem ;
|
|||
class DistributedChatService
|
||||
{
|
||||
public:
|
||||
DistributedChatService(uint32_t service_type,p3ServiceControl *sc,p3HistoryMgr *hm) ;
|
||||
DistributedChatService(uint32_t service_type,p3ServiceControl *sc,p3HistoryMgr *hm,p3IdService *is) ;
|
||||
|
||||
virtual ~DistributedChatService() {}
|
||||
|
||||
|
@ -59,24 +60,25 @@ class DistributedChatService
|
|||
//
|
||||
bool getVirtualPeerId(const ChatLobbyId& lobby_id, RsPeerId& virtual_peer_id) ;
|
||||
bool isLobbyId(const RsPeerId& virtual_peer_id, ChatLobbyId& lobby_id) ;
|
||||
void getChatLobbyList(std::list<ChatLobbyInfo, std::allocator<ChatLobbyInfo> >& cl_infos) ;
|
||||
bool acceptLobbyInvite(const ChatLobbyId& id) ;
|
||||
void getChatLobbyList(std::list<ChatLobbyId>& clids) ;
|
||||
bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& clinfo) ;
|
||||
bool acceptLobbyInvite(const ChatLobbyId& id,const RsGxsId& identity) ;
|
||||
void denyLobbyInvite(const ChatLobbyId& id) ;
|
||||
void getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) ;
|
||||
void invitePeerToLobby(const ChatLobbyId&, const RsPeerId& peer_id,bool connexion_challenge = false) ;
|
||||
void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ;
|
||||
bool setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::string& nick) ;
|
||||
bool getNickNameForChatLobby(const ChatLobbyId& lobby_id,std::string& nick) ;
|
||||
bool setDefaultNickNameForChatLobby(const std::string& nick) ;
|
||||
bool getDefaultNickNameForChatLobby(std::string& nick) ;
|
||||
bool setIdentityForChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& nick) ;
|
||||
bool getIdentityForChatLobby(const ChatLobbyId& lobby_id,RsGxsId& nick) ;
|
||||
bool setDefaultIdentityForChatLobby(const RsGxsId& nick) ;
|
||||
bool getDefaultIdentityForChatLobby(RsGxsId& nick) ;
|
||||
void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe);
|
||||
bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
||||
void sendLobbyStatusString(const ChatLobbyId& id,const std::string& status_string) ;
|
||||
|
||||
ChatLobbyId createChatLobby(const std::string& lobby_name,const std::string& lobby_topic, const std::list<RsPeerId>& invited_friends,uint32_t privacy_type) ;
|
||||
ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic, const std::list<RsPeerId>& invited_friends,ChatLobbyFlags flags) ;
|
||||
|
||||
void getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& public_lobbies) ;
|
||||
bool joinVisibleChatLobby(const ChatLobbyId& id) ;
|
||||
bool joinVisibleChatLobby(const ChatLobbyId& id, const RsGxsId &gxs_id) ;
|
||||
|
||||
protected:
|
||||
bool handleRecvItem(RsChatItem *) ;
|
||||
|
@ -89,11 +91,13 @@ class DistributedChatService
|
|||
bool processLoadListItem(const RsItem *item) ;
|
||||
|
||||
bool locked_checkAndRebuildPartialLobbyMessage(RsChatLobbyMsgItem *) ;
|
||||
void checkSizeAndSendLobbyMessage(RsChatLobbyMsgItem *) ;
|
||||
void checkSizeAndSendLobbyMessage(RsChatItem *) ;
|
||||
|
||||
bool sendLobbyChat(const ChatLobbyId &lobby_id, const std::string&) ;
|
||||
bool handleRecvChatLobbyMsgItem(RsChatMsgItem *item) ;
|
||||
|
||||
bool checkSignature(RsChatLobbyBouncingObject *obj,const RsPeerId& peer_id) ;
|
||||
|
||||
private:
|
||||
/// make some statistics about time shifts, to prevent various issues.
|
||||
void addTimeShiftStatistics(int shift) ;
|
||||
|
@ -138,7 +142,6 @@ class DistributedChatService
|
|||
time_t last_connexion_challenge_time ;
|
||||
time_t last_keep_alive_packet_time ;
|
||||
std::set<RsPeerId> previously_known_peers ;
|
||||
uint32_t flags ;
|
||||
};
|
||||
|
||||
std::map<ChatLobbyId,ChatLobbyEntry> _chat_lobbys ;
|
||||
|
@ -154,11 +157,12 @@ class DistributedChatService
|
|||
time_t last_lobby_challenge_time ; // prevents bruteforce attack
|
||||
time_t last_visible_lobby_info_request_time ; // allows to ask for updates
|
||||
bool _should_reset_lobby_counts ;
|
||||
std::string _default_nick_name ;
|
||||
RsGxsId _default_identity ;
|
||||
|
||||
uint32_t mServType ;
|
||||
RsMutex mDistributedChatMtx ;
|
||||
|
||||
p3ServiceControl *mServControl;
|
||||
p3HistoryMgr *mHistMgr;
|
||||
p3HistoryMgr *mHistMgr;
|
||||
p3IdService *mIdService ;
|
||||
};
|
||||
|
|
|
@ -54,7 +54,7 @@ static const uint32_t MAX_AVATAR_JPEG_SIZE = 32767; // Maximum size
|
|||
// Images are 96x96, which makes approx. 27000 bytes uncompressed.
|
||||
|
||||
p3ChatService::p3ChatService(p3ServiceControl *sc,p3IdService *pids, p3LinkMgr *lm, p3HistoryMgr *historyMgr)
|
||||
:DistantChatService(pids),DistributedChatService(getServiceInfo().mServiceType,sc,historyMgr), mChatMtx("p3ChatService"),mServiceCtrl(sc), mLinkMgr(lm) , mHistoryMgr(historyMgr)
|
||||
:DistantChatService(pids),DistributedChatService(getServiceInfo().mServiceType,sc,historyMgr,pids), mChatMtx("p3ChatService"),mServiceCtrl(sc), mLinkMgr(lm) , mHistoryMgr(historyMgr)
|
||||
{
|
||||
_serializer = new RsChatSerialiser() ;
|
||||
|
||||
|
@ -811,7 +811,7 @@ void p3ChatService::initChatMessage(RsChatMsgItem *c, ChatMessage &m)
|
|||
RsChatLobbyMsgItem *lobbyItem = dynamic_cast<RsChatLobbyMsgItem*>(c) ;
|
||||
if(lobbyItem != NULL)
|
||||
{
|
||||
m.lobby_peer_nickname = lobbyItem->nick;
|
||||
m.lobby_peer_gxs_id = lobbyItem->signature.keyId ;
|
||||
m.chat_id = ChatId(lobbyItem->lobby_id);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -68,10 +68,11 @@ std::ostream& RsChatLobbyListItem::print(std::ostream &out, uint16_t indent)
|
|||
{
|
||||
printRsItemBase(out, "RsChatLobbyListItem", indent);
|
||||
|
||||
for(uint32_t i=0;i<lobby_ids.size();++i)
|
||||
for(uint32_t i=0;i<lobbies.size();++i)
|
||||
{
|
||||
printIndent(out, indent+2);
|
||||
out << "lobby 0x" << std::hex << lobby_ids[i] << std::dec << " (name=\"" << lobby_names[i] << "\", topic="<< lobby_topics[i] << "\", count=" << lobby_counts[i] << ", privacy_level = " << lobby_privacy_levels[i] << std::endl ;
|
||||
out << "lobby 0x" << std::hex << lobbies[i].id << std::dec << " (name=\"" << lobbies[i].name << "\", topic="<< lobbies[i].topic
|
||||
<< "\", count=" << lobbies[i].count << ", flags = " << lobbies[i].flags << std::endl ;
|
||||
}
|
||||
|
||||
printRsItemEnd(out, "RsChatLobbyListItem", indent);
|
||||
|
@ -88,6 +89,7 @@ std::ostream& RsChatLobbyBouncingObject::print(std::ostream &out, uint16_t inden
|
|||
printIndent(out, indent); out << "Lobby ID: " << std::hex << lobby_id << std::endl;
|
||||
printIndent(out, indent); out << "Msg ID: " << std::hex << msg_id << std::dec << std::endl;
|
||||
printIndent(out, indent); out << "Nick: " << nick << std::dec << std::endl;
|
||||
printIndent(out, indent); out << "Sign: " << signature.keyId << std::dec << std::endl;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -262,20 +264,20 @@ RsItem *RsChatSerialiser::deserialise(void *data, uint32_t *pktsize)
|
|||
|
||||
switch(getRsItemSubType(rstype))
|
||||
{
|
||||
case RS_PKT_SUBTYPE_DEFAULT: return new RsChatMsgItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_DEFAULT: return new RsChatMsgItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG: return new RsPrivateChatMsgConfigItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_DISTANT_INVITE_CONFIG: return new RsPrivateChatDistantInviteConfigItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_STATUS: return new RsChatStatusItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_AVATAR: return new RsChatAvatarItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_MSG: return new RsChatLobbyMsgItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE: return new RsChatLobbyInviteItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: return new RsChatLobbyConnectChallengeItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_STATUS: return new RsChatStatusItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_AVATAR: return new RsChatAvatarItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG: return new RsChatLobbyMsgItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE: return new RsChatLobbyInviteItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: return new RsChatLobbyConnectChallengeItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: return new RsChatLobbyUnsubscribeItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT: return new RsChatLobbyEventItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT: return new RsChatLobbyEventItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_DISTANT_CHAT_DH_PUBLIC_KEY: return new RsChatDHPublicKeyItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_DISTANT_CHAT_DH_PUBLIC_KEY: return new RsChatDHPublicKeyItem(data,*pktsize) ;
|
||||
default:
|
||||
std::cerr << "Unknown packet type in chat!" << std::endl ;
|
||||
return NULL ;
|
||||
|
@ -306,28 +308,38 @@ uint32_t RsChatLobbyConnectChallengeItem::serial_size()
|
|||
s += 8; // challenge code
|
||||
return s ;
|
||||
}
|
||||
|
||||
uint32_t RsChatLobbyBouncingObject::serial_size()
|
||||
uint32_t RsChatLobbyBouncingObject::serialized_size(bool include_signature)
|
||||
{
|
||||
uint32_t s = 0 ; // no header!
|
||||
s += 8 ; // lobby_id
|
||||
s += 8 ; // msg_id
|
||||
s += GetTlvStringSize(nick) ; // nick
|
||||
uint32_t s = 0 ; // no header!
|
||||
s += 8 ; // lobby_id
|
||||
s += 8 ; // msg_id
|
||||
s += GetTlvStringSize(nick) ; // nick
|
||||
|
||||
if(include_signature)
|
||||
s += signature.TlvSize() ; // signature
|
||||
|
||||
return s ;
|
||||
}
|
||||
uint32_t RsChatLobbyEventItem::signed_serial_size()
|
||||
{
|
||||
uint32_t s = 8 ; // header
|
||||
s += 1 ; // event_type
|
||||
s += GetTlvStringSize(string1) ; // string1
|
||||
s += 4 ; // send time
|
||||
s += RsChatLobbyBouncingObject::serialized_size(false) ;
|
||||
|
||||
return s ;
|
||||
}
|
||||
uint32_t RsChatLobbyEventItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8 ; // header
|
||||
s += RsChatLobbyBouncingObject::serial_size() ;
|
||||
s += 1 ; // event_type
|
||||
s += GetTlvStringSize(string1) ; // string1
|
||||
s += 4 ; // send time
|
||||
s += RsChatLobbyBouncingObject::serialized_size(true) ;
|
||||
|
||||
return s ;
|
||||
}
|
||||
|
||||
uint32_t RsChatLobbyListRequestItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8 ; // header
|
||||
|
@ -335,29 +347,35 @@ uint32_t RsChatLobbyListRequestItem::serial_size()
|
|||
}
|
||||
uint32_t RsChatLobbyListItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8 ; // header
|
||||
s += 4 ; // number of elements in the vectors
|
||||
s += lobby_ids.size() * 8 ; // lobby_ids
|
||||
uint32_t s = 8 ; // header
|
||||
s += 4 ; // number of elements in the vectors
|
||||
|
||||
for(uint32_t i=0;i<lobby_names.size();++i)
|
||||
s += GetTlvStringSize(lobby_names[i]) ; // lobby_names
|
||||
|
||||
for(uint32_t i=0;i<lobby_topics.size();++i)
|
||||
s += GetTlvStringSize(lobby_topics[i]) ; // lobby_topics
|
||||
|
||||
s += lobby_counts.size() * 4 ; // lobby_counts
|
||||
s += lobby_privacy_levels.size() * 4 ; // lobby_privacy_levels
|
||||
return s ;
|
||||
for(uint32_t i=0;i<lobbies.size();++i)
|
||||
{
|
||||
s += 8 ; // id
|
||||
s += GetTlvStringSize(lobbies[i].name) ; // lobby_names
|
||||
s += GetTlvStringSize(lobbies[i].topic) ; // lobby_topics
|
||||
s += 4 ; // lobby_counts
|
||||
s += 4 ; // lobby_flags
|
||||
}
|
||||
return s ;
|
||||
}
|
||||
uint32_t RsChatLobbyMsgItem::serial_size()
|
||||
{
|
||||
uint32_t s = RsChatMsgItem::serial_size() ; // parent
|
||||
s += RsChatLobbyBouncingObject::serial_size() ;
|
||||
s += 1; // subpacket id
|
||||
s += 8; // parent_msg_id
|
||||
uint32_t s = RsChatMsgItem::serial_size() ; // parent
|
||||
s += 8; // parent_msg_id
|
||||
s += RsChatLobbyBouncingObject::serialized_size(true) ;
|
||||
|
||||
return s;
|
||||
}
|
||||
uint32_t RsChatLobbyMsgItem::signed_serial_size()
|
||||
{
|
||||
uint32_t s = RsChatMsgItem::serial_size() ; // parent
|
||||
s += 8; // parent_msg_id
|
||||
s += RsChatLobbyBouncingObject::serialized_size(false) ;
|
||||
|
||||
return s;
|
||||
}
|
||||
uint32_t RsChatLobbyInviteItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8; /* header */
|
||||
|
@ -523,15 +541,18 @@ bool RsChatMsgItem::serialise(void *data, uint32_t& pktsize)
|
|||
return ok ;
|
||||
}
|
||||
|
||||
bool RsChatLobbyBouncingObject::serialise(void *data,uint32_t tlvsize,uint32_t& offset)
|
||||
bool RsChatLobbyBouncingObject::serialise_to_memory(void *data,uint32_t tlvsize,uint32_t& offset,bool include_signature)
|
||||
{
|
||||
bool ok = true ;
|
||||
bool ok = true ;
|
||||
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_id);
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, msg_id);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, nick);
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_id);
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, msg_id);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, nick);
|
||||
|
||||
return ok ;
|
||||
if(include_signature)
|
||||
ok &= signature.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
return ok ;
|
||||
}
|
||||
|
||||
/* serialise the data to the buffer */
|
||||
|
@ -549,11 +570,13 @@ bool RsChatLobbyMsgItem::serialise(void *data, uint32_t& pktsize)
|
|||
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); // correct header!
|
||||
pktsize = tlvsize;
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::serialise(data,tlvsize,offset) ;
|
||||
ok &= setRawUInt8(data, tlvsize, &offset, subpacket_id);
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, parent_msg_id);
|
||||
|
||||
/* add mandatory parts first */
|
||||
// The signature is at the end of the serialised data, so that the signed data is *before* the signature.
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::serialise_to_memory(data,tlvsize,offset,true) ;
|
||||
|
||||
/* add mandatory parts first */
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
|
@ -564,6 +587,40 @@ bool RsChatLobbyMsgItem::serialise(void *data, uint32_t& pktsize)
|
|||
#endif
|
||||
return ok ;
|
||||
}
|
||||
/* serialise the data to the buffer */
|
||||
bool RsChatLobbyMsgItem::serialise_signed_part(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = signed_serial_size() ;
|
||||
|
||||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
bool ok = true;
|
||||
ok &= RsChatMsgItem::serialise(data,pktsize) ; // first, serialize parent
|
||||
|
||||
uint32_t offset = pktsize;
|
||||
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); // correct header!
|
||||
pktsize = tlvsize;
|
||||
|
||||
//ok &= setRawUInt8(data, tlvsize, &offset, subpacket_id); // don't serialise sub-part id.
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, parent_msg_id);
|
||||
|
||||
// The signature is at the end of the serialised data, so that the signed data is *before* the signature.
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::serialise_to_memory(data,tlvsize,offset,false) ;
|
||||
|
||||
/* add mandatory parts first */
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||
}
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||
#endif
|
||||
return ok ;
|
||||
}
|
||||
|
||||
|
||||
bool RsChatLobbyListRequestItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
|
@ -586,26 +643,18 @@ bool RsChatLobbyListItem::serialise(void *data, uint32_t& pktsize)
|
|||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
if((lobby_ids.size() != lobby_names.size()) ||
|
||||
(lobby_ids.size() != lobby_topics.size()) ||
|
||||
(lobby_ids.size() != lobby_counts.size()) ||
|
||||
(lobby_ids.size() != lobby_privacy_levels.size()))
|
||||
{
|
||||
std::cerr << "Consistency error in RsChatLobbyListItem!! Sizes don't match!" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
pktsize = tlvsize ;
|
||||
|
||||
uint32_t offset = 8 ;
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobby_ids.size());
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobbies.size());
|
||||
|
||||
for(uint32_t i=0;i<lobby_ids.size();++i)
|
||||
for(uint32_t i=0;i<lobbies.size();++i)
|
||||
{
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_ids[i]);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobby_names[i]);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobby_topics[i]);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobby_counts[i]);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobby_privacy_levels[i]);
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobbies[i].id);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobbies[i].name);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobbies[i].topic);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobbies[i].count);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobbies[i].flags.toUInt32());
|
||||
}
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
|
@ -616,7 +665,37 @@ bool RsChatLobbyListItem::serialise(void *data, uint32_t& pktsize)
|
|||
}
|
||||
bool RsChatLobbyEventItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = serial_size() ;
|
||||
uint32_t tlvsize = serial_size() ;
|
||||
bool ok = true ;
|
||||
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); // correct header!
|
||||
|
||||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
ok &= setRawUInt8(data, tlvsize, &offset, event_type);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, string1);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, sendTime);
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::serialise_to_memory(data,tlvsize,offset,true) ; // at the end, serialize parent
|
||||
|
||||
pktsize = tlvsize ;
|
||||
|
||||
/* add mandatory parts first */
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||
}
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||
#endif
|
||||
return ok ;
|
||||
}
|
||||
bool RsChatLobbyEventItem::serialise_signed_part(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = signed_serial_size() ;
|
||||
bool ok = true ;
|
||||
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); // correct header!
|
||||
|
||||
|
@ -625,12 +704,13 @@ bool RsChatLobbyEventItem::serialise(void *data, uint32_t& pktsize)
|
|||
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::serialise(data,tlvsize,offset) ; // first, serialize parent
|
||||
ok &= setRawUInt8(data, tlvsize, &offset, event_type);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, string1);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, sendTime);
|
||||
|
||||
pktsize = tlvsize ;
|
||||
ok &= RsChatLobbyBouncingObject::serialise_to_memory(data,tlvsize,offset,false) ; // at the end, serialize parent
|
||||
|
||||
pktsize = tlvsize ;
|
||||
|
||||
/* add mandatory parts first */
|
||||
if (offset != tlvsize)
|
||||
|
@ -706,7 +786,7 @@ bool RsChatLobbyInviteItem::serialise(void *data, uint32_t& pktsize)
|
|||
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_id);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobby_name);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobby_privacy_level);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobby_flags.toUInt32());
|
||||
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
|
@ -966,17 +1046,17 @@ RsChatMsgItem::RsChatMsgItem(void *data,uint32_t /*size*/,uint8_t subtype)
|
|||
}
|
||||
|
||||
RsChatLobbyMsgItem::RsChatLobbyMsgItem(void *data,uint32_t /*size*/)
|
||||
: RsChatMsgItem(data,0,RS_PKT_SUBTYPE_CHAT_LOBBY_MSG)
|
||||
: RsChatMsgItem(data,0,RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG)
|
||||
{
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
bool ok = true ;
|
||||
|
||||
uint32_t offset = RsChatMsgItem::serial_size() ;
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::deserialise(data,rssize,offset) ;
|
||||
ok &= getRawUInt8(data, rssize, &offset, &subpacket_id);
|
||||
ok &= getRawUInt64(data, rssize, &offset, &parent_msg_id);
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::deserialise_from_memory(data,rssize,offset) ;
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Building new chat lobby msg item." << std::endl ;
|
||||
#endif
|
||||
|
@ -1007,20 +1087,20 @@ RsChatLobbyListItem::RsChatLobbyListItem(void *data,uint32_t)
|
|||
uint32_t n=0 ;
|
||||
ok &= getRawUInt32(data, rssize, &offset, &n);
|
||||
|
||||
lobby_ids.resize(n) ;
|
||||
lobby_names.resize(n) ;
|
||||
lobby_topics.resize(n) ;
|
||||
lobby_counts.resize(n) ;
|
||||
lobby_privacy_levels.resize(n) ;
|
||||
lobbies.resize(n) ;
|
||||
|
||||
for(uint32_t i=0;i<n;++i)
|
||||
{
|
||||
ok &= getRawUInt64(data, rssize, &offset, &lobby_ids[i]);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobby_names[i]);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobby_topics[i]);
|
||||
ok &= getRawUInt32(data, rssize, &offset, &lobby_counts[i]);
|
||||
ok &= getRawUInt32(data, rssize, &offset, &lobby_privacy_levels[i]);
|
||||
}
|
||||
{
|
||||
ok &= getRawUInt64(data, rssize, &offset, &lobbies[i].id);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobbies[i].name);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobbies[i].topic);
|
||||
ok &= getRawUInt32(data, rssize, &offset, &lobbies[i].count);
|
||||
|
||||
uint32_t fl=0 ;
|
||||
ok &= getRawUInt32(data, rssize, &offset, &fl);
|
||||
|
||||
lobbies[i].flags = ChatLobbyFlags(fl) ;
|
||||
}
|
||||
|
||||
if (offset != rssize)
|
||||
std::cerr << "Size error while deserializing." << std::endl ;
|
||||
|
@ -1028,7 +1108,7 @@ RsChatLobbyListItem::RsChatLobbyListItem(void *data,uint32_t)
|
|||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
|
||||
bool RsChatLobbyBouncingObject::deserialise(void *data,uint32_t rssize,uint32_t& offset)
|
||||
bool RsChatLobbyBouncingObject::deserialise_from_memory(void *data,uint32_t rssize,uint32_t& offset)
|
||||
{
|
||||
bool ok = true ;
|
||||
/* get mandatory parts first */
|
||||
|
@ -1036,23 +1116,25 @@ bool RsChatLobbyBouncingObject::deserialise(void *data,uint32_t rssize,uint32_t&
|
|||
ok &= getRawUInt64(data, rssize, &offset, &msg_id);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, nick);
|
||||
|
||||
return ok ;
|
||||
ok &= signature.GetTlv(data, rssize, &offset);
|
||||
|
||||
return ok ;
|
||||
}
|
||||
|
||||
RsChatLobbyEventItem::RsChatLobbyEventItem(void *data,uint32_t /*size*/)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT)
|
||||
{
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
bool ok = true ;
|
||||
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::deserialise(data,rssize,offset) ;
|
||||
|
||||
ok &= getRawUInt8(data, rssize, &offset, &event_type);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, string1);
|
||||
ok &= getRawUInt32(data, rssize, &offset, &sendTime);
|
||||
|
||||
ok &= RsChatLobbyBouncingObject::deserialise_from_memory(data,rssize,offset) ;
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Building new chat lobby status item." << std::endl ;
|
||||
#endif
|
||||
|
@ -1112,8 +1194,12 @@ RsChatLobbyInviteItem::RsChatLobbyInviteItem(void *data,uint32_t /*size*/)
|
|||
|
||||
/* get mandatory parts first */
|
||||
ok &= getRawUInt64(data, rssize, &offset, &lobby_id);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobby_name);
|
||||
ok &= getRawUInt32(data, rssize, &offset, &lobby_privacy_level);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobby_name);
|
||||
|
||||
uint32_t fl ;
|
||||
ok &= getRawUInt32(data, rssize, &offset, &fl) ;
|
||||
|
||||
lobby_flags = ChatLobbyFlags(fl) ;
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Building new chat msg item." << std::endl ;
|
||||
|
|
|
@ -54,26 +54,29 @@ const uint32_t RS_CHATMSG_CONFIGFLAG_INCOMING = 0x0001;
|
|||
const uint8_t RS_PKT_SUBTYPE_CHAT_AVATAR = 0x03 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_STATUS = 0x04 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG = 0x05 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG_DEPRECATED = 0x06 ; // don't use ! Deprecated
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPREC = 0x07 ; // don't use ! Deprecated
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG_DEPRECATED = 0x06 ; // don't use ! Deprecated
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPREC = 0x07 ; // don't use ! Deprecated
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_ACCEPT = 0x08 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE = 0x09 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE = 0x0A ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT_DEPREC = 0x0B ; // don't use ! Deprecated
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG = 0x0C ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT_DEPREC = 0x0B ; // don't use ! Deprecated
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG = 0x0C ; // will be deprecated when only signed messages are accepted (02/2015)
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST = 0x0D ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated = 0x0E ; // to be removed
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated = 0x0E ; // to be removed
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x0F ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT = 0x10 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated2 = 0x11 ; // to be removed (deprecated since 02 Dec. 2012)
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST = 0x12 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated2 = 0x11 ; // to be removed (deprecated since 02 Dec. 2012)
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated3 = 0x12 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISTANT_INVITE_CONFIG = 0x13 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG = 0x15 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISTANT_CHAT_DH_PUBLIC_KEY = 0x16 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISTANT_CHAT_DH_PUBLIC_KEY = 0x16 ;
|
||||
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_LIST = 0x19 ;
|
||||
|
||||
typedef uint64_t ChatLobbyId ;
|
||||
typedef uint64_t ChatLobbyMsgId ;
|
||||
typedef std::string ChatLobbyNickName ;
|
||||
typedef std::string ChatLobbyNickName ;
|
||||
typedef uint64_t DistantChatDHSessionId ;
|
||||
|
||||
class RsChatItem: public RsItem
|
||||
|
@ -98,24 +101,25 @@ class RsChatItem: public RsItem
|
|||
*/
|
||||
class RsChatMsgItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
RsChatMsgItem() :RsChatItem(RS_PKT_SUBTYPE_DEFAULT) {}
|
||||
RsChatMsgItem(uint8_t subtype) :RsChatItem(subtype) {}
|
||||
public:
|
||||
RsChatMsgItem() :RsChatItem(RS_PKT_SUBTYPE_DEFAULT) {}
|
||||
RsChatMsgItem(uint8_t subtype) :RsChatItem(subtype) {}
|
||||
|
||||
RsChatMsgItem(void *data,uint32_t size,uint8_t subtype = RS_PKT_SUBTYPE_DEFAULT) ; // deserialization
|
||||
RsChatMsgItem(void *data,uint32_t size,uint8_t subtype = RS_PKT_SUBTYPE_DEFAULT) ; // deserialization
|
||||
|
||||
virtual ~RsChatMsgItem() {}
|
||||
virtual void clear() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
virtual ~RsChatMsgItem() {}
|
||||
virtual void clear() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
|
||||
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
|
||||
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
|
||||
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
|
||||
|
||||
uint32_t chatFlags;
|
||||
uint32_t sendTime;
|
||||
std::string message;
|
||||
/* not serialised */
|
||||
uint32_t recvTime;
|
||||
uint32_t chatFlags;
|
||||
uint32_t sendTime;
|
||||
std::string message;
|
||||
|
||||
/* not serialised */
|
||||
uint32_t recvTime;
|
||||
};
|
||||
|
||||
// This class contains the info to bounce an object throughout a lobby, while
|
||||
|
@ -123,55 +127,72 @@ class RsChatMsgItem: public RsChatItem
|
|||
//
|
||||
class RsChatLobbyBouncingObject
|
||||
{
|
||||
public:
|
||||
ChatLobbyId lobby_id ;
|
||||
ChatLobbyMsgId msg_id ;
|
||||
ChatLobbyNickName nick ; // Nickname of sender
|
||||
public:
|
||||
ChatLobbyId lobby_id ;
|
||||
ChatLobbyMsgId msg_id ;
|
||||
ChatLobbyNickName nick ; // Nickname of sender
|
||||
|
||||
virtual RsChatLobbyBouncingObject *duplicate() const = 0 ;
|
||||
virtual uint32_t serial_size() ;
|
||||
virtual bool serialise(void *data,uint32_t tlvsize,uint32_t& offset) ;
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
RsTlvKeySignature signature ;
|
||||
|
||||
bool deserialise(void *data,uint32_t rssize,uint32_t& offset) ;
|
||||
virtual RsChatLobbyBouncingObject *duplicate() const = 0 ;
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
// returns the size in bytes of the data chunk to sign.
|
||||
|
||||
virtual uint32_t signed_serial_size() =0;
|
||||
virtual bool serialise_signed_part(void *data,uint32_t& size) = 0;
|
||||
|
||||
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.
|
||||
|
||||
uint32_t serialized_size(bool include_signature) ;
|
||||
bool serialise_to_memory(void *data,uint32_t tlvsize,uint32_t& offset,bool include_signature) ;
|
||||
bool deserialise_from_memory(void *data,uint32_t rssize,uint32_t& offset) ;
|
||||
};
|
||||
|
||||
class RsChatLobbyMsgItem: public RsChatMsgItem, public RsChatLobbyBouncingObject
|
||||
{
|
||||
public:
|
||||
RsChatLobbyMsgItem() :RsChatMsgItem(RS_PKT_SUBTYPE_CHAT_LOBBY_MSG) {}
|
||||
public:
|
||||
RsChatLobbyMsgItem() :RsChatMsgItem(RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG) {}
|
||||
|
||||
RsChatLobbyMsgItem(void *data,uint32_t size) ; // deserialization /// TODO!!!
|
||||
RsChatLobbyMsgItem(void *data,uint32_t size) ; // deserialization /// TODO!!!
|
||||
|
||||
virtual ~RsChatLobbyMsgItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
virtual RsChatLobbyBouncingObject *duplicate() const { return new RsChatLobbyMsgItem(*this) ; }
|
||||
virtual ~RsChatLobbyMsgItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
virtual RsChatLobbyBouncingObject *duplicate() const { return new RsChatLobbyMsgItem(*this) ; }
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
|
||||
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
|
||||
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
|
||||
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
|
||||
|
||||
uint8_t subpacket_id ; // this is for proper handling of split packets.
|
||||
ChatLobbyMsgId parent_msg_id ; // Used for threaded chat.
|
||||
virtual uint32_t signed_serial_size() ;
|
||||
virtual bool serialise_signed_part(void *data,uint32_t& size) ;// Isn't it better that items can serialize themselves ?
|
||||
|
||||
ChatLobbyMsgId parent_msg_id ; // Used for threaded chat.
|
||||
};
|
||||
|
||||
class RsChatLobbyEventItem: public RsChatItem, public RsChatLobbyBouncingObject
|
||||
{
|
||||
public:
|
||||
RsChatLobbyEventItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT) {}
|
||||
RsChatLobbyEventItem(void *data,uint32_t size) ; // deserialization /// TODO!!!
|
||||
public:
|
||||
RsChatLobbyEventItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT) {}
|
||||
RsChatLobbyEventItem(void *data,uint32_t size) ; // deserialization /// TODO!!!
|
||||
|
||||
virtual ~RsChatLobbyEventItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
virtual RsChatLobbyBouncingObject *duplicate() const { return new RsChatLobbyEventItem(*this) ; }
|
||||
//
|
||||
virtual bool serialise(void *data,uint32_t& size) ;
|
||||
virtual uint32_t serial_size() ;
|
||||
virtual ~RsChatLobbyEventItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
virtual RsChatLobbyBouncingObject *duplicate() const { return new RsChatLobbyEventItem(*this) ; }
|
||||
//
|
||||
virtual bool serialise(void *data,uint32_t& size) ;
|
||||
virtual uint32_t serial_size() ;
|
||||
|
||||
// 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
|
||||
virtual uint32_t signed_serial_size() ;
|
||||
virtual bool serialise_signed_part(void *data,uint32_t& size) ;
|
||||
|
||||
// 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
|
||||
};
|
||||
|
||||
class RsChatLobbyListRequestItem: public RsChatItem
|
||||
|
@ -184,8 +205,18 @@ class RsChatLobbyListRequestItem: public RsChatItem
|
|||
virtual bool serialise(void *data,uint32_t& size) ;
|
||||
virtual uint32_t serial_size() ;
|
||||
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
};
|
||||
|
||||
struct VisibleChatLobbyInfo
|
||||
{
|
||||
ChatLobbyId id ;
|
||||
std::string name ;
|
||||
std::string topic ;
|
||||
uint32_t count ;
|
||||
ChatLobbyFlags flags ;
|
||||
};
|
||||
|
||||
class RsChatLobbyListItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
|
@ -198,12 +229,9 @@ class RsChatLobbyListItem: public RsChatItem
|
|||
virtual bool serialise(void *data,uint32_t& size) ;
|
||||
virtual uint32_t serial_size() ;
|
||||
|
||||
std::vector<ChatLobbyId> lobby_ids ;
|
||||
std::vector<std::string> lobby_names ;
|
||||
std::vector<std::string> lobby_topics ;
|
||||
std::vector<uint32_t> lobby_counts ;
|
||||
std::vector<uint32_t> lobby_privacy_levels ;
|
||||
std::vector<VisibleChatLobbyInfo> lobbies ;
|
||||
};
|
||||
|
||||
class RsChatLobbyUnsubscribeItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
|
@ -219,7 +247,6 @@ class RsChatLobbyUnsubscribeItem: public RsChatItem
|
|||
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
|
||||
};
|
||||
|
||||
|
||||
class RsChatLobbyConnectChallengeItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
|
@ -247,7 +274,7 @@ class RsChatLobbyInviteItem: public RsChatItem
|
|||
ChatLobbyId lobby_id ;
|
||||
std::string lobby_name ;
|
||||
std::string lobby_topic ;
|
||||
uint32_t lobby_privacy_level ;
|
||||
ChatLobbyFlags lobby_flags ;
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
|
||||
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue