mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-23 14:41:04 -04:00
Imported chat lobby function from branch v0.5-ChatLobby (merged commits 4682-4739)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4740 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
60bb76e3df
26 changed files with 2445 additions and 188 deletions
|
@ -57,7 +57,54 @@ std::ostream& RsChatMsgItem::print(std::ostream &out, uint16_t indent)
|
|||
printRsItemEnd(out, "RsChatMsgItem", indent);
|
||||
return out;
|
||||
}
|
||||
std::ostream& RsChatLobbyUnsubscribeItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsChatLobbyUnsubscribeItem", indent);
|
||||
printIndent(out, indent);
|
||||
out << "Lobby id: " << std::hex << lobby_id << std::endl;
|
||||
printRsItemEnd(out, "RsChatLobbyUnsubscribeItem", indent);
|
||||
return out;
|
||||
}
|
||||
std::ostream& RsChatLobbyConnectChallengeItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsChatLobbyConnectChallengeItem", indent);
|
||||
printIndent(out, indent);
|
||||
out << "Challenge Code: " << std::hex << challenge_code << std::endl;
|
||||
printRsItemEnd(out, "RsChatLobbyConnectChallengeItem", indent);
|
||||
return out;
|
||||
}
|
||||
std::ostream& RsChatLobbyMsgItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
RsChatMsgItem::print(out,indent) ;
|
||||
|
||||
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;
|
||||
|
||||
printRsItemEnd(out, "RsChatLobbyMsgItem", indent);
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& RsChatLobbyInviteItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsChatLobbyInviteItem", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "peerId: " << PeerId() << std::endl;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "lobby id: " << std::hex << lobby_id << std::dec << std::endl;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "lobby name: " << lobby_name << std::endl;
|
||||
|
||||
printRsItemEnd(out, "RsChatLobbyInviteItem", indent);
|
||||
return out;
|
||||
}
|
||||
std::ostream& RsPrivateChatMsgConfigItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsPrivateChatMsgConfigItem", indent);
|
||||
|
@ -137,10 +184,14 @@ 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_CHAT_STATUS: return new RsChatStatusItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_AVATAR: return new RsChatAvatarItem(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_LOBBY_UNSUBSCRIBE: return new RsChatLobbyUnsubscribeItem(data,*pktsize) ;
|
||||
default:
|
||||
std::cerr << "Unknown packet type in chat!" << std::endl ;
|
||||
return NULL ;
|
||||
|
@ -157,6 +208,38 @@ uint32_t RsChatMsgItem::serial_size()
|
|||
return s;
|
||||
}
|
||||
|
||||
uint32_t RsChatLobbyUnsubscribeItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8; /* header */
|
||||
s += 8; // challenge code
|
||||
return s ;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsChatLobbyConnectChallengeItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8; /* header */
|
||||
s += 8; // challenge code
|
||||
return s ;
|
||||
}
|
||||
|
||||
uint32_t RsChatLobbyMsgItem::serial_size()
|
||||
{
|
||||
uint32_t s = RsChatMsgItem::serial_size() ; // parent
|
||||
s += 8; // lobby_id
|
||||
s += 8; // msg_id
|
||||
s += GetTlvStringSize(nick) ; // nick
|
||||
|
||||
return s;
|
||||
}
|
||||
uint32_t RsChatLobbyInviteItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8; /* header */
|
||||
s += 8; // lobby_id
|
||||
s += GetTlvStringSize(lobby_name) ; // lobby name
|
||||
|
||||
return s;
|
||||
}
|
||||
uint32_t RsPrivateChatMsgConfigItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8; /* header */
|
||||
|
@ -201,7 +284,7 @@ RsChatAvatarItem::~RsChatAvatarItem()
|
|||
/* serialise the data to the buffer */
|
||||
bool RsChatMsgItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = serial_size() ;
|
||||
uint32_t tlvsize = RsChatMsgItem::serial_size() ;
|
||||
uint32_t offset = 0;
|
||||
|
||||
if (pktsize < tlvsize)
|
||||
|
@ -228,7 +311,7 @@ bool RsChatMsgItem::serialise(void *data, uint32_t& pktsize)
|
|||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Serialized the following message:" << std::endl;
|
||||
std::cerr << "========== BEGIN MESSAGE =========" << std::endl;
|
||||
for(int i=0;i<message.length();++i)
|
||||
for(uint32_t i=0;i<message.length();++i)
|
||||
std::cerr << (char)message[i] ;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "=========== END MESSAGE ==========" << std::endl;
|
||||
|
@ -244,12 +327,121 @@ bool RsChatMsgItem::serialise(void *data, uint32_t& pktsize)
|
|||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||
#endif
|
||||
return ok ;
|
||||
}
|
||||
|
||||
std::cerr << "Serialization result: " ;
|
||||
for(int i=0;i<20;++i)
|
||||
std::cerr << (int)((uint8_t*)data)[i] << " " ;
|
||||
std::cerr << std::endl ;
|
||||
return ok;
|
||||
/* serialise the data to the buffer */
|
||||
bool RsChatLobbyMsgItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = 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;
|
||||
|
||||
/* add mandatory parts first */
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_id);
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, msg_id);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, nick);
|
||||
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||
#endif
|
||||
}
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||
#endif
|
||||
return ok ;
|
||||
}
|
||||
|
||||
bool RsChatLobbyUnsubscribeItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = serial_size() ;
|
||||
|
||||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
bool ok = true ;
|
||||
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); // correct header!
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_id);
|
||||
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||
#endif
|
||||
}
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||
#endif
|
||||
pktsize = tlvsize ;
|
||||
return ok ;
|
||||
}
|
||||
bool RsChatLobbyConnectChallengeItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = serial_size() ;
|
||||
|
||||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
bool ok = true ;
|
||||
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); // correct header!
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, challenge_code);
|
||||
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||
#endif
|
||||
}
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||
#endif
|
||||
pktsize = tlvsize ;
|
||||
return ok ;
|
||||
}
|
||||
|
||||
bool RsChatLobbyInviteItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = serial_size() ;
|
||||
|
||||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
bool ok = true ;
|
||||
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); // correct header!
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_id);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobby_name);
|
||||
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||
#endif
|
||||
}
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||
#endif
|
||||
pktsize = tlvsize ;
|
||||
return ok ;
|
||||
}
|
||||
|
||||
bool RsPrivateChatMsgConfigItem::serialise(void *data, uint32_t& pktsize)
|
||||
|
@ -377,8 +569,8 @@ bool RsChatAvatarItem::serialise(void *data, uint32_t& pktsize)
|
|||
|
||||
return ok;
|
||||
}
|
||||
RsChatMsgItem::RsChatMsgItem(void *data,uint32_t /*size*/)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_DEFAULT)
|
||||
RsChatMsgItem::RsChatMsgItem(void *data,uint32_t /*size*/,uint8_t subtype)
|
||||
: RsChatItem(subtype)
|
||||
{
|
||||
uint32_t offset = 8; // skip the header
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
@ -403,6 +595,83 @@ RsChatMsgItem::RsChatMsgItem(void *data,uint32_t /*size*/)
|
|||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
|
||||
RsChatLobbyMsgItem::RsChatLobbyMsgItem(void *data,uint32_t /*size*/)
|
||||
: RsChatMsgItem(data,0,RS_PKT_SUBTYPE_CHAT_LOBBY_MSG)
|
||||
{
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
bool ok = true ;
|
||||
|
||||
uint32_t offset = RsChatMsgItem::serial_size() ;
|
||||
|
||||
/* get mandatory parts first */
|
||||
ok &= getRawUInt64(data, rssize, &offset, &lobby_id);
|
||||
ok &= getRawUInt64(data, rssize, &offset, &msg_id);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, nick);
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Building new chat msg item." << std::endl ;
|
||||
#endif
|
||||
if (offset != rssize)
|
||||
std::cerr << "Size error while deserializing." << std::endl ;
|
||||
if (!ok)
|
||||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
RsChatLobbyUnsubscribeItem::RsChatLobbyUnsubscribeItem(void *data,uint32_t /*size*/)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE)
|
||||
{
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
bool ok = true ;
|
||||
|
||||
std::cerr << "RsChatLobbyUnsubscribeItem: rsitem size is " << rssize << std::endl;
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
/* get mandatory parts first */
|
||||
ok &= getRawUInt64(data, rssize, &offset, &lobby_id);
|
||||
|
||||
if (offset != rssize)
|
||||
std::cerr << "Size error while deserializing." << std::endl ;
|
||||
if (!ok)
|
||||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
RsChatLobbyConnectChallengeItem::RsChatLobbyConnectChallengeItem(void *data,uint32_t /*size*/)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE)
|
||||
{
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
bool ok = true ;
|
||||
|
||||
std::cerr << "RsChatLobbyConnectChallengeItem: rsitem size is " << rssize << std::endl;
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
/* get mandatory parts first */
|
||||
ok &= getRawUInt64(data, rssize, &offset, &challenge_code);
|
||||
|
||||
if (offset != rssize)
|
||||
std::cerr << "Size error while deserializing." << std::endl ;
|
||||
if (!ok)
|
||||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
RsChatLobbyInviteItem::RsChatLobbyInviteItem(void *data,uint32_t /*size*/)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE)
|
||||
{
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
bool ok = true ;
|
||||
|
||||
std::cerr << "RsChatLobbyInviteItem: rsitem size is " << rssize << std::endl;
|
||||
uint32_t offset = 8 ;
|
||||
|
||||
/* get mandatory parts first */
|
||||
ok &= getRawUInt64(data, rssize, &offset, &lobby_id);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobby_name);
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Building new chat msg item." << std::endl ;
|
||||
#endif
|
||||
if (offset != rssize)
|
||||
std::cerr << "Size error while deserializing." << std::endl ;
|
||||
if (!ok)
|
||||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
|
||||
RsPrivateChatMsgConfigItem::RsPrivateChatMsgConfigItem(void *data,uint32_t /*size*/)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG)
|
||||
{
|
||||
|
|
|
@ -44,19 +44,28 @@ const uint32_t RS_CHAT_FLAG_PUBLIC = 0x0020;
|
|||
const uint32_t RS_CHAT_FLAG_REQUEST_CUSTOM_STATE = 0x0040;
|
||||
const uint32_t RS_CHAT_FLAG_CUSTOM_STATE_AVAILABLE = 0x0080;
|
||||
const uint32_t RS_CHAT_FLAG_PARTIAL_MESSAGE = 0x0100;
|
||||
const uint32_t RS_CHAT_FLAG_LOBBY = 0x0200;
|
||||
|
||||
const uint32_t RS_CHATMSG_CONFIGFLAG_INCOMING = 0x0001;
|
||||
const uint32_t RS_CHATMSG_CONFIGFLAG_INCOMING = 0x0001;
|
||||
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_AVATAR = 0x03 ; // default is 0x01
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_STATUS = 0x04 ; // default is 0x01
|
||||
const uint8_t RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG = 0x05 ; // default is 0x01
|
||||
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 = 0x06 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x07 ;
|
||||
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 ;
|
||||
|
||||
// for defining tags themselves and msg tags
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_TAG_TYPE = 0x03;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_TAGS = 0x04;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_SRC_TAG = 0x05;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_PARENT_TAG = 0x06;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_TAG_TYPE = 0x03;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_TAGS = 0x04;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_SRC_TAG = 0x05;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_PARENT_TAG = 0x06;
|
||||
|
||||
typedef uint64_t ChatLobbyId ;
|
||||
typedef uint64_t ChatLobbyMsgId ;
|
||||
typedef std::string ChatLobbyNickName ;
|
||||
|
||||
class RsChatItem: public RsItem
|
||||
{
|
||||
|
@ -81,15 +90,17 @@ class RsChatItem: public RsItem
|
|||
class RsChatMsgItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
RsChatMsgItem() :RsChatItem(RS_PKT_SUBTYPE_DEFAULT)
|
||||
{
|
||||
}
|
||||
RsChatMsgItem(void *data,uint32_t size) ; // deserialization
|
||||
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
|
||||
|
||||
virtual ~RsChatMsgItem() {}
|
||||
virtual void clear() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
virtual RsChatMsgItem *duplicate() const { return new RsChatMsgItem(*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
|
||||
|
||||
|
@ -100,6 +111,72 @@ class RsChatMsgItem: public RsChatItem
|
|||
uint32_t recvTime;
|
||||
};
|
||||
|
||||
class RsChatLobbyMsgItem: public RsChatMsgItem
|
||||
{
|
||||
public:
|
||||
RsChatLobbyMsgItem() :RsChatMsgItem(RS_PKT_SUBTYPE_CHAT_LOBBY_MSG) {}
|
||||
|
||||
RsChatLobbyMsgItem(void *data,uint32_t size) ; // deserialization /// TODO!!!
|
||||
|
||||
virtual ~RsChatLobbyMsgItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
virtual RsChatMsgItem *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
|
||||
|
||||
ChatLobbyId lobby_id ;
|
||||
ChatLobbyMsgId msg_id ;
|
||||
ChatLobbyNickName nick ;
|
||||
};
|
||||
|
||||
class RsChatLobbyUnsubscribeItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
RsChatLobbyUnsubscribeItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE) {}
|
||||
RsChatLobbyUnsubscribeItem(void *data,uint32_t size) ; // deserialization
|
||||
|
||||
virtual ~RsChatLobbyUnsubscribeItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
uint64_t lobby_id ;
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
class RsChatLobbyConnectChallengeItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
RsChatLobbyConnectChallengeItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE) {}
|
||||
RsChatLobbyConnectChallengeItem(void *data,uint32_t size) ; // deserialization
|
||||
|
||||
virtual ~RsChatLobbyConnectChallengeItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
uint64_t challenge_code ;
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class RsChatLobbyInviteItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
RsChatLobbyInviteItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE) {}
|
||||
RsChatLobbyInviteItem(void *data,uint32_t size) ; // deserialization
|
||||
|
||||
virtual ~RsChatLobbyInviteItem() {}
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
ChatLobbyId lobby_id ;
|
||||
std::string lobby_name ;
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
/*!
|
||||
* For saving incoming and outgoing chat msgs
|
||||
* @see p3ChatService
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue