mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fix Lobby Topic not send on invite.
This commit is contained in:
parent
add529ffd3
commit
d02cba5a91
@ -428,14 +428,14 @@ bool DistributedChatService::handleRecvItem(RsChatItem *item)
|
|||||||
{
|
{
|
||||||
switch(item->PacketSubType())
|
switch(item->PacketSubType())
|
||||||
{
|
{
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT: handleRecvChatLobbyEventItem (dynamic_cast<RsChatLobbyEventItem *>(item)) ; break ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT: handleRecvChatLobbyEventItem (dynamic_cast<RsChatLobbyEventItem *>(item)) ; break ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE: handleRecvLobbyInvite (dynamic_cast<RsChatLobbyInviteItem *>(item)) ; break ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED: handleRecvLobbyInvite_Deprecated (dynamic_cast<RsChatLobbyInviteItem_Deprecated*>(item)) ; break ; // to be removed (deprecated since May 2017)
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: handleConnectionChallenge (dynamic_cast<RsChatLobbyConnectChallengeItem *>(item)) ; break ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE: handleRecvLobbyInvite (dynamic_cast<RsChatLobbyInviteItem *>(item)) ; break ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: handleFriendUnsubscribeLobby (dynamic_cast<RsChatLobbyUnsubscribeItem *>(item)) ; break ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: handleConnectionChallenge (dynamic_cast<RsChatLobbyConnectChallengeItem *>(item)) ; break ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: handleRecvChatLobbyListRequest (dynamic_cast<RsChatLobbyListRequestItem *>(item)) ; break ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: handleFriendUnsubscribeLobby (dynamic_cast<RsChatLobbyUnsubscribeItem *>(item)) ; break ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: handleRecvChatLobbyList (dynamic_cast<RsChatLobbyListItem *>(item)) ; break ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: handleRecvChatLobbyListRequest (dynamic_cast<RsChatLobbyListRequestItem *>(item)) ; break ;
|
||||||
default:
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: handleRecvChatLobbyList (dynamic_cast<RsChatLobbyListItem *>(item)) ; break ;
|
||||||
return false ;
|
default: return false ;
|
||||||
}
|
}
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@ -1233,14 +1233,45 @@ void DistributedChatService::invitePeerToLobby(const ChatLobbyId& lobby_id, cons
|
|||||||
|
|
||||||
RsChatLobbyInviteItem *item = new RsChatLobbyInviteItem ;
|
RsChatLobbyInviteItem *item = new RsChatLobbyInviteItem ;
|
||||||
|
|
||||||
item->lobby_id = lobby_id ;
|
item->lobby_id = lobby_id ;
|
||||||
item->lobby_name = it->second.lobby_name ;
|
item->lobby_name = it->second.lobby_name ;
|
||||||
item->lobby_topic = it->second.lobby_topic ;
|
item->lobby_topic = it->second.lobby_topic ;
|
||||||
item->lobby_flags = connexion_challenge?RS_CHAT_LOBBY_FLAGS_CHALLENGE:(it->second.lobby_flags) ;
|
item->lobby_flags = connexion_challenge?RS_CHAT_LOBBY_FLAGS_CHALLENGE:(it->second.lobby_flags) ;
|
||||||
item->PeerId(peer_id) ;
|
item->PeerId(peer_id) ;
|
||||||
|
|
||||||
sendChatItem(item) ;
|
sendChatItem(item) ;
|
||||||
|
|
||||||
|
//FOR BACKWARD COMPATIBILITY
|
||||||
|
{// to be removed (deprecated since May 2017)
|
||||||
|
RsChatLobbyInviteItem_Deprecated *item = new RsChatLobbyInviteItem_Deprecated ;
|
||||||
|
|
||||||
|
item->lobby_id = lobby_id ;
|
||||||
|
item->lobby_name = it->second.lobby_name ;
|
||||||
|
item->lobby_topic = it->second.lobby_topic ;
|
||||||
|
item->lobby_flags = connexion_challenge?RS_CHAT_LOBBY_FLAGS_CHALLENGE:(it->second.lobby_flags) ;
|
||||||
|
item->PeerId(peer_id) ;
|
||||||
|
|
||||||
|
sendChatItem(item) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to be removed (deprecated since May 2017)
|
||||||
|
void DistributedChatService::handleRecvLobbyInvite_Deprecated(RsChatLobbyInviteItem_Deprecated *item)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
|
std::cerr << "Received deprecated invite to lobby from " << item->PeerId() << " to lobby " << std::hex << item->lobby_id << std::dec << ", named " << item->lobby_name << item->lobby_topic << std::endl;
|
||||||
|
#endif
|
||||||
|
RsChatLobbyInviteItem* newItem = new RsChatLobbyInviteItem();
|
||||||
|
|
||||||
|
newItem->lobby_id = item->lobby_id ;
|
||||||
|
newItem->lobby_name = item->lobby_name ;
|
||||||
|
newItem->lobby_topic = item->lobby_topic ;
|
||||||
|
newItem->lobby_flags = item->lobby_flags ;
|
||||||
|
newItem->PeerId( item->PeerId() );
|
||||||
|
|
||||||
|
handleRecvLobbyInvite(newItem);
|
||||||
|
}
|
||||||
|
|
||||||
void DistributedChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
|
void DistributedChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CHAT_LOBBIES
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
@ -1259,10 +1290,10 @@ void DistributedChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
|
|||||||
{
|
{
|
||||||
#ifdef DEBUG_CHAT_LOBBIES
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
std::cerr << " Lobby already exists. " << std::endl;
|
std::cerr << " Lobby already exists. " << std::endl;
|
||||||
std::cerr << " privacy levels: " << item->lobby_flags << " vs. " << it->second.lobby_flags ;
|
std::cerr << " privacy levels: " << item->lobby_flags << " vs. " << it->second.lobby_flags ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if((!IS_CONNEXION_CHALLENGE(item->lobby_flags)) && EXTRACT_PRIVACY_FLAGS(item->lobby_flags) != EXTRACT_PRIVACY_FLAGS(it->second.lobby_flags))
|
if ((!IS_CONNEXION_CHALLENGE(item->lobby_flags)) && EXTRACT_PRIVACY_FLAGS(item->lobby_flags) != EXTRACT_PRIVACY_FLAGS(it->second.lobby_flags))
|
||||||
{
|
{
|
||||||
std::cerr << " : Don't match. Cancelling." << std::endl;
|
std::cerr << " : Don't match. Cancelling." << std::endl;
|
||||||
return ;
|
return ;
|
||||||
@ -1274,10 +1305,22 @@ void DistributedChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
|
|||||||
std::cerr << " Adding new friend " << item->PeerId() << " to lobby." << std::endl;
|
std::cerr << " Adding new friend " << item->PeerId() << " to lobby." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// to be removed (deprecated since May 2017)
|
||||||
|
{ //Update Topics if have received deprecated before (withou topic)
|
||||||
|
if(it->second.lobby_topic.empty() && !item->lobby_topic.empty())
|
||||||
|
it->second.lobby_topic = item->lobby_topic;
|
||||||
|
}
|
||||||
|
|
||||||
it->second.participating_friends.insert(item->PeerId()) ;
|
it->second.participating_friends.insert(item->PeerId()) ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to be removed (deprecated since May 2017)
|
||||||
|
{//check if invitation is already received by deprecated version
|
||||||
|
std::map<ChatLobbyId,ChatLobbyInvite>::const_iterator it(_lobby_invites_queue.find( item->lobby_id)) ;
|
||||||
|
if(it != _lobby_invites_queue.end())
|
||||||
|
return ;
|
||||||
|
}
|
||||||
// Don't record the invitation if it's a challenge response item or a lobby we don't have.
|
// Don't record the invitation if it's a challenge response item or a lobby we don't have.
|
||||||
//
|
//
|
||||||
if(IS_CONNEXION_CHALLENGE(item->lobby_flags))
|
if(IS_CONNEXION_CHALLENGE(item->lobby_flags))
|
||||||
@ -1290,7 +1333,7 @@ void DistributedChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
|
|||||||
invite.peer_id = item->PeerId() ;
|
invite.peer_id = item->PeerId() ;
|
||||||
invite.lobby_name = item->lobby_name ;
|
invite.lobby_name = item->lobby_name ;
|
||||||
invite.lobby_topic = item->lobby_topic ;
|
invite.lobby_topic = item->lobby_topic ;
|
||||||
invite.lobby_flags = item->lobby_flags ;
|
invite.lobby_flags = item->lobby_flags ;
|
||||||
|
|
||||||
_lobby_invites_queue[item->lobby_id] = invite ;
|
_lobby_invites_queue[item->lobby_id] = invite ;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ class RsChatLobbyListRequestItem ;
|
|||||||
class RsChatLobbyListItem ;
|
class RsChatLobbyListItem ;
|
||||||
class RsChatLobbyEventItem ;
|
class RsChatLobbyEventItem ;
|
||||||
class RsChatLobbyBouncingObject ;
|
class RsChatLobbyBouncingObject ;
|
||||||
|
class RsChatLobbyInviteItem_Deprecated ; // to be removed (deprecated since May 2017)
|
||||||
class RsChatLobbyInviteItem ;
|
class RsChatLobbyInviteItem ;
|
||||||
class RsChatLobbyMsgItem ;
|
class RsChatLobbyMsgItem ;
|
||||||
class RsChatLobbyConnectChallengeItem ;
|
class RsChatLobbyConnectChallengeItem ;
|
||||||
@ -111,6 +112,7 @@ class DistributedChatService
|
|||||||
|
|
||||||
/// receive and handle chat lobby item
|
/// receive and handle chat lobby item
|
||||||
bool recvLobbyChat(RsChatLobbyMsgItem*,const RsPeerId& src_peer_id) ;
|
bool recvLobbyChat(RsChatLobbyMsgItem*,const RsPeerId& src_peer_id) ;
|
||||||
|
void handleRecvLobbyInvite_Deprecated(RsChatLobbyInviteItem_Deprecated*) ; // to be removed (deprecated since May 2017)
|
||||||
void handleRecvLobbyInvite(RsChatLobbyInviteItem*) ;
|
void handleRecvLobbyInvite(RsChatLobbyInviteItem*) ;
|
||||||
void checkAndRedirectMsgToLobby(RsChatMsgItem*) ;
|
void checkAndRedirectMsgToLobby(RsChatMsgItem*) ;
|
||||||
void handleConnectionChallenge(RsChatLobbyConnectChallengeItem *item) ;
|
void handleConnectionChallenge(RsChatLobbyConnectChallengeItem *item) ;
|
||||||
|
@ -39,23 +39,24 @@ 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)
|
||||||
{
|
{
|
||||||
case RS_PKT_SUBTYPE_DEFAULT: return new RsChatMsgItem() ;
|
case RS_PKT_SUBTYPE_DEFAULT: return new RsChatMsgItem() ;
|
||||||
case RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG: return new RsPrivateChatMsgConfigItem() ;
|
case RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG: return new RsPrivateChatMsgConfigItem() ;
|
||||||
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: 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_INVITE: return new RsChatLobbyInviteItem() ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: return new RsChatLobbyUnsubscribeItem() ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: return new RsChatLobbyConnectChallengeItem() ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT:return new RsChatLobbyEventItem() ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: return new RsChatLobbyUnsubscribeItem() ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST:return new RsChatLobbyListRequestItem() ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT: return new RsChatLobbyEventItem() ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem() ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem() ;
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem() ;
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem() ;
|
||||||
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem() ;
|
||||||
default:
|
default:
|
||||||
std::cerr << "Unknown packet type in chat!" << std::endl ;
|
std::cerr << "Unknown packet type in chat!" << std::endl ;
|
||||||
return NULL ;
|
return NULL ;
|
||||||
@ -97,12 +98,12 @@ void RsChatLobbyMsgItem::serial_process(RsGenericSerializer::SerializeJob j,RsGe
|
|||||||
RsChatLobbyBouncingObject::serial_process(j,ctx) ;
|
RsChatLobbyBouncingObject::serial_process(j,ctx) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsChatLobbyListRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
void RsChatLobbyListRequestItem::serial_process(RsGenericSerializer::SerializeJob /*j*/,RsGenericSerializer::SerializeContext& /*ctx*/)
|
||||||
{
|
{
|
||||||
// nothing to do. This is an empty item.
|
// nothing to do. This is an empty item.
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> void RsTypeSerializer::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx,VisibleChatLobbyInfo& info,const std::string& name)
|
template<> void RsTypeSerializer::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx,VisibleChatLobbyInfo& info,const std::string& /*name*/)
|
||||||
{
|
{
|
||||||
RsTypeSerializer::serial_process<uint64_t>(j,ctx,info.id,"info.id") ;
|
RsTypeSerializer::serial_process<uint64_t>(j,ctx,info.id,"info.id") ;
|
||||||
|
|
||||||
@ -135,10 +136,19 @@ void RsChatLobbyConnectChallengeItem::serial_process(RsGenericSerializer::Serial
|
|||||||
RsTypeSerializer::serial_process<uint64_t>(j,ctx,challenge_code,"challenge_code") ;
|
RsTypeSerializer::serial_process<uint64_t>(j,ctx,challenge_code,"challenge_code") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to be removed (deprecated since May 2017)
|
||||||
|
void RsChatLobbyInviteItem_Deprecated::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||||
|
{
|
||||||
|
RsTypeSerializer::serial_process<uint64_t>(j,ctx, lobby_id, "lobby_id") ;
|
||||||
|
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,lobby_name, "lobby_name") ;
|
||||||
|
RsTypeSerializer::serial_process (j,ctx, lobby_flags,"lobby_flags") ;
|
||||||
|
}
|
||||||
|
|
||||||
void RsChatLobbyInviteItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
void RsChatLobbyInviteItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||||
{
|
{
|
||||||
RsTypeSerializer::serial_process<uint64_t>(j,ctx, lobby_id, "lobby_id") ;
|
RsTypeSerializer::serial_process<uint64_t>(j,ctx, lobby_id, "lobby_id") ;
|
||||||
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,lobby_name, "lobby_name") ;
|
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,lobby_name, "lobby_name") ;
|
||||||
|
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,lobby_topic,"lobby_topic") ;
|
||||||
RsTypeSerializer::serial_process (j,ctx, lobby_flags,"lobby_flags") ;
|
RsTypeSerializer::serial_process (j,ctx, lobby_flags,"lobby_flags") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,8 @@ 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_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 ;
|
||||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x1A ;
|
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 ;
|
||||||
|
|
||||||
typedef uint64_t ChatLobbyId ;
|
typedef uint64_t ChatLobbyId ;
|
||||||
typedef uint64_t ChatLobbyMsgId ;
|
typedef uint64_t ChatLobbyMsgId ;
|
||||||
@ -93,7 +94,7 @@ class RsChatItem: public RsItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual ~RsChatItem() {}
|
virtual ~RsChatItem() {}
|
||||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0) { return out; } // derived from RsItem, but should be removed
|
virtual std::ostream& print(std::ostream &out, uint16_t /*indent*/ = 0) { return out; } // derived from RsItem, but should be removed
|
||||||
|
|
||||||
virtual void clear() {}
|
virtual void clear() {}
|
||||||
};
|
};
|
||||||
@ -238,6 +239,21 @@ class RsChatLobbyConnectChallengeItem: public RsChatItem
|
|||||||
uint64_t challenge_code ;
|
uint64_t challenge_code ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// to be removed (deprecated since May 2017)
|
||||||
|
class RsChatLobbyInviteItem_Deprecated: public RsChatItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsChatLobbyInviteItem_Deprecated() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED) {}
|
||||||
|
virtual ~RsChatLobbyInviteItem_Deprecated() {}
|
||||||
|
|
||||||
|
void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
||||||
|
|
||||||
|
ChatLobbyId lobby_id ;
|
||||||
|
std::string lobby_name ;
|
||||||
|
std::string lobby_topic ;
|
||||||
|
ChatLobbyFlags lobby_flags ;
|
||||||
|
};
|
||||||
|
|
||||||
class RsChatLobbyInviteItem: public RsChatItem
|
class RsChatLobbyInviteItem: public RsChatItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -249,7 +265,7 @@ class RsChatLobbyInviteItem: public RsChatItem
|
|||||||
ChatLobbyId lobby_id ;
|
ChatLobbyId lobby_id ;
|
||||||
std::string lobby_name ;
|
std::string lobby_name ;
|
||||||
std::string lobby_topic ;
|
std::string lobby_topic ;
|
||||||
ChatLobbyFlags lobby_flags ;
|
ChatLobbyFlags lobby_flags ;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -52,12 +52,14 @@ RsSerialType* init_item(RsChatLobbyListItem& cmi)
|
|||||||
|
|
||||||
cmi.lobby_ids.resize(n) ;
|
cmi.lobby_ids.resize(n) ;
|
||||||
cmi.lobby_names.resize(n) ;
|
cmi.lobby_names.resize(n) ;
|
||||||
|
cmi.lobby_topics.resize(n) ;
|
||||||
cmi.lobby_counts.resize(n) ;
|
cmi.lobby_counts.resize(n) ;
|
||||||
|
|
||||||
for(int i=0;i<n;++i)
|
for(int i=0;i<n;++i)
|
||||||
{
|
{
|
||||||
cmi.lobby_ids[i] = RSRandom::random_u64() ;
|
cmi.lobby_ids[i] = RSRandom::random_u64() ;
|
||||||
randString(5+(rand()%10), cmi.lobby_names[i]);
|
randString(5+(rand()%10), cmi.lobby_names[i]);
|
||||||
|
randString(5+(rand()%10), cmi.lobby_topics[i]);
|
||||||
cmi.lobby_counts[i] = RSRandom::random_u32() ;
|
cmi.lobby_counts[i] = RSRandom::random_u32() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +89,7 @@ RsSerialType* init_item(RsChatLobbyInviteItem& cmi)
|
|||||||
{
|
{
|
||||||
cmi.lobby_id = RSRandom::random_u64() ;
|
cmi.lobby_id = RSRandom::random_u64() ;
|
||||||
cmi.lobby_name = "Name of the lobby" ;
|
cmi.lobby_name = "Name of the lobby" ;
|
||||||
|
cmi.lobby_topic = "Topic of the lobby" ;
|
||||||
|
|
||||||
return new RsChatSerialiser();
|
return new RsChatSerialiser();
|
||||||
}
|
}
|
||||||
@ -185,12 +188,14 @@ bool operator ==(const RsChatLobbyListItem& cmiLeft,const RsChatLobbyListItem&
|
|||||||
{
|
{
|
||||||
if(cmiLeft.lobby_ids.size() != cmiRight.lobby_ids.size()) return false;
|
if(cmiLeft.lobby_ids.size() != cmiRight.lobby_ids.size()) return false;
|
||||||
if(cmiLeft.lobby_names.size() != cmiRight.lobby_names.size()) return false;
|
if(cmiLeft.lobby_names.size() != cmiRight.lobby_names.size()) return false;
|
||||||
|
if(cmiLeft.lobby_topics.size() != cmiRight.lobby_topics.size()) return false;
|
||||||
if(cmiLeft.lobby_counts.size() != cmiRight.lobby_counts.size()) return false;
|
if(cmiLeft.lobby_counts.size() != cmiRight.lobby_counts.size()) return false;
|
||||||
|
|
||||||
for(uint32_t i=0;i<cmiLeft.lobby_ids.size();++i)
|
for(uint32_t i=0;i<cmiLeft.lobby_ids.size();++i)
|
||||||
{
|
{
|
||||||
if(cmiLeft.lobby_ids[i] != cmiRight.lobby_ids[i]) return false ;
|
if(cmiLeft.lobby_ids[i] != cmiRight.lobby_ids[i]) return false ;
|
||||||
if(cmiLeft.lobby_names[i] != cmiRight.lobby_names[i]) return false ;
|
if(cmiLeft.lobby_names[i] != cmiRight.lobby_names[i]) return false ;
|
||||||
|
if(cmiLeft.lobby_topics[i] != cmiRight.lobby_topics[i]) return false ;
|
||||||
if(cmiLeft.lobby_counts[i] != cmiRight.lobby_counts[i]) return false ;
|
if(cmiLeft.lobby_counts[i] != cmiRight.lobby_counts[i]) return false ;
|
||||||
}
|
}
|
||||||
return true ;
|
return true ;
|
||||||
@ -254,6 +259,7 @@ bool operator ==(const RsChatLobbyInviteItem& csiLeft, const RsChatLobbyInviteIt
|
|||||||
{
|
{
|
||||||
if(csiLeft.lobby_id != csiRight.lobby_id) return false ;
|
if(csiLeft.lobby_id != csiRight.lobby_id) return false ;
|
||||||
if(csiLeft.lobby_name != csiRight.lobby_name) return false ;
|
if(csiLeft.lobby_name != csiRight.lobby_name) return false ;
|
||||||
|
if(csiLeft.lobby_topic != csiRight.lobby_topic) return false ;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ RsSerialType* init_item(RsChatLobbyInviteItem& cmi)
|
|||||||
{
|
{
|
||||||
cmi.lobby_id = RSRandom::random_u64() ;
|
cmi.lobby_id = RSRandom::random_u64() ;
|
||||||
cmi.lobby_name = "Name of the lobby" ;
|
cmi.lobby_name = "Name of the lobby" ;
|
||||||
|
cmi.lobby_topic = "Topic of the lobby" ;
|
||||||
|
|
||||||
return new RsChatSerialiser();
|
return new RsChatSerialiser();
|
||||||
}
|
}
|
||||||
@ -254,6 +255,7 @@ bool operator ==(const RsChatLobbyInviteItem& csiLeft, const RsChatLobbyInviteIt
|
|||||||
{
|
{
|
||||||
if(csiLeft.lobby_id != csiRight.lobby_id) return false ;
|
if(csiLeft.lobby_id != csiRight.lobby_id) return false ;
|
||||||
if(csiLeft.lobby_name != csiRight.lobby_name) return false ;
|
if(csiLeft.lobby_name != csiRight.lobby_name) return false ;
|
||||||
|
if(csiLeft.lobby_topic != csiRight.lobby_topic) return false ;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user