mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-07 08:35:16 -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
|
@ -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 ;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue