mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
turned some std::list<PeerId> into std::set, as it automatically prevents duplicates
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8138 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f1309a8cbe
commit
c9d5c7b3cb
51 changed files with 269 additions and 266 deletions
|
@ -1421,7 +1421,7 @@ bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,co
|
|||
return true ;
|
||||
}
|
||||
|
||||
ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::list<RsPeerId>& invited_friends,ChatLobbyFlags lobby_flags)
|
||||
ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set<RsPeerId>& invited_friends,ChatLobbyFlags lobby_flags)
|
||||
{
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "Creating a new Chat lobby !!" << std::endl;
|
||||
|
@ -1456,7 +1456,7 @@ ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_nam
|
|||
_chat_lobbys[lobby_id] = entry ;
|
||||
}
|
||||
|
||||
for(std::list<RsPeerId>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
|
||||
for(std::set<RsPeerId>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
|
||||
invitePeerToLobby(lobby_id,*it) ;
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
|
|
|
@ -76,7 +76,7 @@ class DistributedChatService
|
|||
bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
||||
void sendLobbyStatusString(const ChatLobbyId& id,const std::string& status_string) ;
|
||||
|
||||
ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic, const std::list<RsPeerId>& invited_friends,ChatLobbyFlags flags) ;
|
||||
ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic, const std::set<RsPeerId>& invited_friends,ChatLobbyFlags flags) ;
|
||||
|
||||
void getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& public_lobbies) ;
|
||||
bool joinVisibleChatLobby(const ChatLobbyId& id, const RsGxsId &gxs_id) ;
|
||||
|
|
|
@ -2089,7 +2089,7 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||
//
|
||||
for(std::list<RsPeerId>::const_iterator it(lst.begin());it!=lst.end();++it)
|
||||
if(!mTurtle->isTurtlePeer(*it))
|
||||
rft->allPeerIds.ids.push_back(*it) ;
|
||||
rft->allPeerIds.ids.insert(*it) ;
|
||||
|
||||
rft->transferred = fit->second->mCreator->getRecvd();
|
||||
fit->second->mCreator->getAvailabilityMap(rft->compressed_chunk_map) ;
|
||||
|
@ -2126,17 +2126,17 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||
|
||||
rft->allPeerIds.ids.clear() ;
|
||||
for(std::list<RsPeerId>::const_iterator it(pit->mSrcIds.begin());it!=pit->mSrcIds.end();++it)
|
||||
rft->allPeerIds.ids.push_back( *it ) ;
|
||||
rft->allPeerIds.ids.insert( *it ) ;
|
||||
}
|
||||
|
||||
// Remove turtle peers from sources, as they are not supposed to survive a reboot of RS, since they are dynamic sources.
|
||||
// Otherwize, such sources are unknown from the turtle router, at restart, and never get removed. We do that in post
|
||||
// process since the rft object may have been created from mPendingChunkMaps
|
||||
//
|
||||
for(std::list<RsPeerId>::iterator sit(rft->allPeerIds.ids.begin());sit!=rft->allPeerIds.ids.end();)
|
||||
for(std::set<RsPeerId>::iterator sit(rft->allPeerIds.ids.begin());sit!=rft->allPeerIds.ids.end();)
|
||||
if(mTurtle->isTurtlePeer(RsPeerId(*sit)))
|
||||
{
|
||||
std::list<RsPeerId>::iterator sittmp(sit) ;
|
||||
std::set<RsPeerId>::iterator sittmp(sit) ;
|
||||
++sittmp ;
|
||||
rft->allPeerIds.ids.erase(sit) ;
|
||||
sit = sittmp ;
|
||||
|
@ -2199,7 +2199,7 @@ bool ftController::loadList(std::list<RsItem *>& load)
|
|||
std::cerr << "ftController::loadList(): requesting " << rsft->file.name << ", " << rsft->file.hash << ", " << rsft->file.filesize << std::endl ;
|
||||
#endif
|
||||
std::list<RsPeerId> src_lst ;
|
||||
for(std::list<RsPeerId>::const_iterator it(rsft->allPeerIds.ids.begin());it!=rsft->allPeerIds.ids.end();++it)
|
||||
for(std::set<RsPeerId>::const_iterator it(rsft->allPeerIds.ids.begin());it!=rsft->allPeerIds.ids.end();++it)
|
||||
src_lst.push_back(*it) ;
|
||||
|
||||
FileRequest(rsft->file.name, rsft->file.hash, rsft->file.filesize, rsft->file.path, TransferRequestFlags(rsft->flags), src_lst, rsft->state);
|
||||
|
|
|
@ -2391,7 +2391,7 @@ bool RsGenExchange::getGroupKeys(const RsGxsGroupId &grpId, RsTlvSecurityKeySet
|
|||
return true;
|
||||
}
|
||||
|
||||
void RsGenExchange::shareGroupPublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers)
|
||||
void RsGenExchange::shareGroupPublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers)
|
||||
{
|
||||
if(grpId.isNull())
|
||||
return ;
|
||||
|
|
|
@ -604,7 +604,7 @@ public:
|
|||
* sets the message service string
|
||||
*/
|
||||
|
||||
void shareGroupPublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers) ;
|
||||
void shareGroupPublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers) ;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -3239,7 +3239,7 @@ void RsGxsNetService::processExplicitGroupRequests()
|
|||
mExplicitRequest.clear();
|
||||
}
|
||||
|
||||
int RsGxsNetService::sharePublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers)
|
||||
int RsGxsNetService::sharePublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers)
|
||||
{
|
||||
RS_STACK_MUTEX(mNxsMutex) ;
|
||||
|
||||
|
@ -3264,7 +3264,7 @@ void RsGxsNetService::sharePublishKeysPending()
|
|||
|
||||
std::set<RsPeerId> peersOnline;
|
||||
std::list<RsGxsGroupId> toDelete;
|
||||
std::map<RsGxsGroupId,std::list<RsPeerId> >::iterator mit ;
|
||||
std::map<RsGxsGroupId,std::set<RsPeerId> >::iterator mit ;
|
||||
|
||||
mNetMgr->getOnlineList(mServiceInfo.mServiceType, peersOnline);
|
||||
|
||||
|
@ -3278,9 +3278,9 @@ void RsGxsNetService::sharePublishKeysPending()
|
|||
// Compute the set of peers to send to. We start with this, to avoid retrieving the data for nothing.
|
||||
|
||||
std::list<RsPeerId> recipients ;
|
||||
std::list<RsPeerId> offline_recipients ;
|
||||
std::set<RsPeerId> offline_recipients ;
|
||||
|
||||
for(std::list<RsPeerId>::const_iterator it(mit->second.begin());it!=mit->second.end();++it)
|
||||
for(std::set<RsPeerId>::const_iterator it(mit->second.begin());it!=mit->second.end();++it)
|
||||
if(peersOnline.find(*it) != peersOnline.end())
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
|
@ -3293,7 +3293,7 @@ void RsGxsNetService::sharePublishKeysPending()
|
|||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " " << *it << ": offline. Keeping for next try." << std::endl;
|
||||
#endif
|
||||
offline_recipients.push_back(*it) ;
|
||||
offline_recipients.insert(*it) ;
|
||||
}
|
||||
|
||||
// If empty, skip
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
* share publish keys for the specified group with the peers in the specified list.
|
||||
*/
|
||||
|
||||
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers) ;
|
||||
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers) ;
|
||||
|
||||
/*!
|
||||
* Returns statistics for the group networking activity: popularity (number of friends subscribers) and max_visible_msg_count,
|
||||
|
@ -484,7 +484,7 @@ private:
|
|||
// need to be verfied
|
||||
std::vector<AuthorPending*> mPendingResp;
|
||||
std::vector<GrpCircleVetting*> mPendingCircleVets;
|
||||
std::map<RsGxsGroupId,std::list<RsPeerId> > mPendingPublishKeyRecipients ;
|
||||
std::map<RsGxsGroupId,std::set<RsPeerId> > mPendingPublishKeyRecipients ;
|
||||
std::map<RsPeerId, std::list<RsGxsGroupId> > mExplicitRequest;
|
||||
std::map<RsPeerId, std::set<RsGxsGroupId> > mPartialMsgUpdates ;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
* Request for this group is sent through to peers on your network
|
||||
* and how many hops from them you've indicated
|
||||
*/
|
||||
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers)=0 ;
|
||||
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers)=0 ;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1867,7 +1867,7 @@ void PGPHandler::locked_mergeKeyringFromDisk( ops_keyring_t *keyring,
|
|||
ops_keyring_free(tmp_keyring) ;
|
||||
}
|
||||
|
||||
bool PGPHandler::removeKeysFromPGPKeyring(const std::list<RsPgpId>& keys_to_remove,std::string& backup_file,uint32_t& error_code)
|
||||
bool PGPHandler::removeKeysFromPGPKeyring(const std::set<RsPgpId>& keys_to_remove,std::string& backup_file,uint32_t& error_code)
|
||||
{
|
||||
// 1 - lock everything.
|
||||
//
|
||||
|
@ -1876,7 +1876,7 @@ bool PGPHandler::removeKeysFromPGPKeyring(const std::list<RsPgpId>& keys_to_remo
|
|||
|
||||
error_code = PGP_KEYRING_REMOVAL_ERROR_NO_ERROR ;
|
||||
|
||||
for(std::list<RsPgpId>::const_iterator it(keys_to_remove.begin());it!=keys_to_remove.end();++it)
|
||||
for(std::set<RsPgpId>::const_iterator it(keys_to_remove.begin());it!=keys_to_remove.end();++it)
|
||||
if(locked_getSecretKey(*it) != NULL)
|
||||
{
|
||||
std::cerr << "(EE) PGPHandler:: can't remove key " << (*it).toStdString() << " since its shared by a secret key! Operation cancelled." << std::endl;
|
||||
|
@ -1912,7 +1912,7 @@ bool PGPHandler::removeKeysFromPGPKeyring(const std::list<RsPgpId>& keys_to_remo
|
|||
|
||||
// Remove keys from the keyring, and update the keyring map.
|
||||
//
|
||||
for(std::list<RsPgpId>::const_iterator it(keys_to_remove.begin());it!=keys_to_remove.end();++it)
|
||||
for(std::set<RsPgpId>::const_iterator it(keys_to_remove.begin());it!=keys_to_remove.end();++it)
|
||||
{
|
||||
if(locked_getSecretKey(*it) != NULL)
|
||||
{
|
||||
|
|
|
@ -109,7 +109,7 @@ class PGPHandler
|
|||
// Removes the given keys from the keyring. Also backup the keyring to a file which name is automatically generated
|
||||
// and given pack for proper display.
|
||||
//
|
||||
bool removeKeysFromPGPKeyring(const std::list<RsPgpId>& key_ids,std::string& backup_file,uint32_t& error_code) ;
|
||||
bool removeKeysFromPGPKeyring(const std::set<RsPgpId>& key_ids,std::string& backup_file,uint32_t& error_code) ;
|
||||
|
||||
//bool isKeySupported(const RsPgpId& id) const ;
|
||||
|
||||
|
|
|
@ -61,14 +61,14 @@ bool AuthGPG::decryptTextFromFile(std::string& text,const std::string& inputfile
|
|||
return PGPHandler::decryptTextFromFile(mOwnGpgId,text,inputfile) ;
|
||||
}
|
||||
|
||||
bool AuthGPG::removeKeysFromPGPKeyring(const std::list<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code)
|
||||
bool AuthGPG::removeKeysFromPGPKeyring(const std::set<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code)
|
||||
{
|
||||
std::list<RsPgpId> pids ;
|
||||
// std::list<RsPgpId> pids ;
|
||||
//
|
||||
// for(std::list<RsPgpId>::const_iterator it(pgp_ids.begin());it!=pgp_ids.end();++it)
|
||||
// pids.push_back(RsPgpId(*it)) ;
|
||||
|
||||
for(std::list<RsPgpId>::const_iterator it(pgp_ids.begin());it!=pgp_ids.end();++it)
|
||||
pids.push_back(RsPgpId(*it)) ;
|
||||
|
||||
return PGPHandler::removeKeysFromPGPKeyring(pids,backup_file,error_code) ;
|
||||
return PGPHandler::removeKeysFromPGPKeyring(pgp_ids,backup_file,error_code) ;
|
||||
}
|
||||
|
||||
// bool AuthGPG::decryptTextFromString(std::string& encrypted_text,std::string& output)
|
||||
|
|
|
@ -166,7 +166,7 @@ class AuthGPG: public p3Config, public RsThread, public PGPHandler
|
|||
virtual bool importProfile(const std::string& filename,RsPgpId& gpg_id,std::string& import_error) ;
|
||||
virtual bool exportProfile(const std::string& filename,const RsPgpId& gpg_id) ;
|
||||
|
||||
virtual bool removeKeysFromPGPKeyring(const std::list<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code) ;
|
||||
virtual bool removeKeysFromPGPKeyring(const std::set<RsPgpId> &pgp_ids,std::string& backup_file,uint32_t& error_code) ;
|
||||
|
||||
/*********************************************************************************/
|
||||
/************************* STAGE 4 ***********************************************/
|
||||
|
|
|
@ -2089,10 +2089,10 @@ bool p3PeerMgrIMPL::assignPeersToGroup(const std::string &groupId, const std::li
|
|||
|
||||
std::list<RsPgpId>::const_iterator peerIt;
|
||||
for (peerIt = peerIds.begin(); peerIt != peerIds.end(); ++peerIt) {
|
||||
std::list<RsPgpId>::iterator peerIt1 = std::find(groupItem->pgpList.ids.begin(), groupItem->pgpList.ids.end(), *peerIt);
|
||||
std::set<RsPgpId>::iterator peerIt1 = std::find(groupItem->pgpList.ids.begin(), groupItem->pgpList.ids.end(), *peerIt);
|
||||
if (assign) {
|
||||
if (peerIt1 == groupItem->pgpList.ids.end()) {
|
||||
groupItem->pgpList.ids.push_back(*peerIt);
|
||||
groupItem->pgpList.ids.insert(*peerIt);
|
||||
changed = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -101,7 +101,7 @@ virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid) = 0;
|
|||
//virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
|
||||
|
||||
//virtual bool groupRestoreKeys(const std::string &groupId);
|
||||
virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::list<RsPeerId>& peers)=0;
|
||||
virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::set<RsPeerId>& peers)=0;
|
||||
|
||||
// Overloaded subscribe fn.
|
||||
virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) = 0;
|
||||
|
|
|
@ -78,9 +78,9 @@ class RsGxsCircleGroup
|
|||
public:
|
||||
RsGroupMetaData mMeta; // includes GxsPermissions, for control of group distribution.
|
||||
|
||||
std::list<RsPgpId> mLocalFriends;
|
||||
std::list<RsGxsId> mInvitedMembers;
|
||||
std::list<RsGxsCircleId> mSubCircles;
|
||||
std::set<RsPgpId> mLocalFriends;
|
||||
std::set<RsGxsId> mInvitedMembers;
|
||||
std::set<RsGxsCircleId> mSubCircles;
|
||||
|
||||
// Not Serialised.
|
||||
// Internally inside rsCircles, this will be turned into:
|
||||
|
|
|
@ -185,15 +185,15 @@ public:
|
|||
|
||||
// friend destinations
|
||||
//
|
||||
std::list<RsPeerId> rspeerid_msgto; // RsPeerId is used here for various purposes:
|
||||
std::list<RsPeerId> rspeerid_msgcc; // - real peer ids which are actual friend locations
|
||||
std::list<RsPeerId> rspeerid_msgbcc; // -
|
||||
std::set<RsPeerId> rspeerid_msgto; // RsPeerId is used here for various purposes:
|
||||
std::set<RsPeerId> rspeerid_msgcc; // - real peer ids which are actual friend locations
|
||||
std::set<RsPeerId> rspeerid_msgbcc; // -
|
||||
|
||||
// distant peers
|
||||
//
|
||||
std::list<RsGxsId> rsgxsid_msgto; // RsPeerId is used here for various purposes:
|
||||
std::list<RsGxsId> rsgxsid_msgcc; // - real peer ids which are actual friend locations
|
||||
std::list<RsGxsId> rsgxsid_msgbcc; // -
|
||||
std::set<RsGxsId> rsgxsid_msgto; // RsPeerId is used here for various purposes:
|
||||
std::set<RsGxsId> rsgxsid_msgcc; // - real peer ids which are actual friend locations
|
||||
std::set<RsGxsId> rsgxsid_msgbcc; // -
|
||||
|
||||
std::string title;
|
||||
std::string msg;
|
||||
|
@ -474,7 +474,7 @@ virtual bool setDefaultIdentityForChatLobby(const RsGxsId& nick) = 0;
|
|||
virtual bool getDefaultIdentityForChatLobby(RsGxsId& id) = 0 ;
|
||||
virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe) = 0 ;
|
||||
virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id) = 0 ;
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::list<RsPeerId>& invited_friends,ChatLobbyFlags lobby_privacy_type) = 0 ;
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set<RsPeerId>& invited_friends,ChatLobbyFlags lobby_privacy_type) = 0 ;
|
||||
|
||||
/****************************************/
|
||||
/* Distant chat */
|
||||
|
|
|
@ -277,7 +277,7 @@ public:
|
|||
std::string name;
|
||||
uint32_t flag;
|
||||
|
||||
std::list<RsPgpId> peerIds;
|
||||
std::set<RsPgpId> peerIds;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail);
|
||||
|
@ -319,7 +319,7 @@ class RsPeers
|
|||
virtual bool getGPGSignedList(std::list<RsPgpId> &gpg_ids) = 0;//friends that we accpet to connect with but we don't want to sign their gpg key
|
||||
virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0;
|
||||
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;
|
||||
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0;
|
||||
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0;
|
||||
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) = 0;
|
||||
|
||||
/* Add/Remove Friends */
|
||||
|
@ -328,7 +328,7 @@ class RsPeers
|
|||
virtual bool removeFriendLocation(const RsPeerId& sslId) = 0;
|
||||
|
||||
/* keyring management */
|
||||
virtual bool removeKeysFromPGPKeyring(const std::list<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code)=0 ;
|
||||
virtual bool removeKeysFromPGPKeyring(const std::set<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code)=0 ;
|
||||
|
||||
/* Network Stuff */
|
||||
virtual bool connectAttempt(const RsPeerId& ssl_id) = 0;
|
||||
|
|
|
@ -100,7 +100,7 @@ virtual bool createPost(uint32_t &token, RsPostedPost &post) = 0;
|
|||
|
||||
virtual bool updateGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
||||
|
||||
virtual bool groupShareKeys(const RsGxsGroupId& group,const std::list<RsPeerId>& peers) = 0 ;
|
||||
virtual bool groupShareKeys(const RsGxsGroupId& group,const std::set<RsPeerId>& peers) = 0 ;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -495,7 +495,7 @@ void p3Msgs::getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& pub
|
|||
mChatSrv->getListOfNearbyChatLobbies(public_lobbies) ;
|
||||
}
|
||||
|
||||
ChatLobbyId p3Msgs::createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::list<RsPeerId>& invited_friends,ChatLobbyFlags privacy_type)
|
||||
ChatLobbyId p3Msgs::createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set<RsPeerId>& invited_friends,ChatLobbyFlags privacy_type)
|
||||
{
|
||||
return mChatSrv->createChatLobby(lobby_name,lobby_identity,lobby_topic,invited_friends,privacy_type) ;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ class p3Msgs: public RsMsgs
|
|||
virtual bool getDefaultIdentityForChatLobby(RsGxsId& nick) ;
|
||||
virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe);
|
||||
virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::list<RsPeerId>& invited_friends,ChatLobbyFlags privacy_type) ;
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set<RsPeerId>& invited_friends,ChatLobbyFlags privacy_type) ;
|
||||
|
||||
virtual bool initiateDistantChatConnexion(const RsGxsId& to_gxs_id,const RsGxsId& from_gxs_id,uint32_t& error_code) ;
|
||||
virtual bool getDistantChatStatus(const RsGxsId& gxs_id,uint32_t& status, RsGxsId *from_gxs_id=NULL) ;
|
||||
|
|
|
@ -660,7 +660,7 @@ bool p3Peers::addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePe
|
|||
return mPeerMgr->addFriend(ssl_id, gpg_id, RS_NET_MODE_UDP, RS_VS_DISC_FULL, RS_VS_DHT_FULL, now, perm_flags);
|
||||
}
|
||||
|
||||
bool p3Peers::removeKeysFromPGPKeyring(const std::list<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code)
|
||||
bool p3Peers::removeKeysFromPGPKeyring(const std::set<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code)
|
||||
{
|
||||
return AuthGPG::getAuthGPG()->removeKeysFromPGPKeyring(pgp_ids,backup_file,error_code) ;
|
||||
}
|
||||
|
@ -1279,9 +1279,11 @@ FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
|||
continue ;
|
||||
}
|
||||
|
||||
for(std::list<RsPgpId>::const_iterator it2(info.peerIds.begin());it2!=info.peerIds.end() && !found;++it2)
|
||||
if(*it2 == pgp_id)
|
||||
found = true ;
|
||||
found = found || (info.peerIds.find(pgp_id) != info.peerIds.end()) ;
|
||||
|
||||
//for(std::set<RsPgpId>::const_iterator it2(info.peerIds.begin());it2!=info.peerIds.end() && !found;++it2)
|
||||
// if(*it2 == pgp_id)
|
||||
// found = true ;
|
||||
}
|
||||
|
||||
bool network_wide = (share_flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) ;//|| ( (share_flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) && found) ;
|
||||
|
|
|
@ -80,7 +80,7 @@ virtual bool removeFriend(const RsPgpId& gpgid);
|
|||
virtual bool removeFriendLocation(const RsPeerId& sslId);
|
||||
|
||||
/* keyring management */
|
||||
virtual bool removeKeysFromPGPKeyring(const std::list<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code);
|
||||
virtual bool removeKeysFromPGPKeyring(const std::set<RsPgpId> &pgp_ids,std::string& backup_file,uint32_t& error_code);
|
||||
|
||||
/* Network Stuff */
|
||||
virtual bool connectAttempt(const RsPeerId &id);
|
||||
|
|
|
@ -1178,7 +1178,7 @@ std::ostream &RsPeerGroupItem::print(std::ostream &out, uint16_t indent)
|
|||
printIndent(out, int_Indent);
|
||||
out << "groupFlag: " << flag << std::endl;
|
||||
|
||||
std::list<RsPgpId>::iterator it;
|
||||
std::set<RsPgpId>::iterator it;
|
||||
for (it = pgpList.ids.begin(); it != pgpList.ids.end(); ++it) {
|
||||
printIndent(out, int_Indent);
|
||||
out << "peerId: " << it->toStdString() << std::endl;
|
||||
|
|
|
@ -123,7 +123,7 @@ std::ostream& RsPluginHashSetItem::print(std::ostream& o, uint16_t)
|
|||
o << "Item type: RsPluginHashSetItem" << std::endl;
|
||||
o << " Hash list: " << std::endl;
|
||||
|
||||
for(std::list<Sha1CheckSum>::const_iterator it(hashes.ids.begin());it!=hashes.ids.end();++it)
|
||||
for(std::set<Sha1CheckSum>::const_iterator it(hashes.ids.begin());it!=hashes.ids.end();++it)
|
||||
o << " " << *it << std::endl;
|
||||
|
||||
return o ;
|
||||
|
|
|
@ -59,7 +59,7 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
|||
/* start at data[offset] */
|
||||
ok = ok && SetTlvBase(data, tlvend, offset, TLV_TYPE, tlvsize);
|
||||
|
||||
for(typename std::list<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
for(typename std::set<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
ok = ok && (*it).serialise(data,tlvend,*offset) ;
|
||||
|
||||
return ok ;
|
||||
|
@ -91,7 +91,7 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
|||
{
|
||||
ID_CLASS id ;
|
||||
ok = ok && id.deserialise(data,tlvend,*offset) ;
|
||||
ids.push_back(id) ;
|
||||
ids.insert(id) ;
|
||||
}
|
||||
if(*offset != tlvend)
|
||||
std::cerr << "(EE) deserialisaiton error in " << __PRETTY_FUNCTION__ << std::endl;
|
||||
|
@ -99,20 +99,20 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
|||
}
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t /* indent */) const
|
||||
{
|
||||
for(typename std::list<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
for(typename std::set<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
out << (*it).toStdString() << ", " ;
|
||||
|
||||
return out ;
|
||||
}
|
||||
virtual std::ostream &printHex(std::ostream &out, uint16_t /* indent */) const /* SPECIAL One */
|
||||
{
|
||||
for(typename std::list<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
for(typename std::set<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
out << (*it).toStdString() << ", " ;
|
||||
|
||||
return out ;
|
||||
}
|
||||
|
||||
std::list<ID_CLASS> ids ;
|
||||
std::set<ID_CLASS> ids ;
|
||||
};
|
||||
|
||||
typedef t_RsTlvIdSet<RsPeerId,TLV_TYPE_PEERSET> RsTlvPeerIdSet ;
|
||||
|
|
|
@ -74,9 +74,9 @@ bool populateContactInfo(const peerState &detail, RsDiscContactItem *pkt)
|
|||
return true;
|
||||
}
|
||||
|
||||
void DiscPgpInfo::mergeFriendList(const std::list<PGPID> &friends)
|
||||
void DiscPgpInfo::mergeFriendList(const std::set<PGPID> &friends)
|
||||
{
|
||||
std::list<PGPID>::const_iterator it;
|
||||
std::set<PGPID>::const_iterator it;
|
||||
for(it = friends.begin(); it != friends.end(); ++it)
|
||||
{
|
||||
mFriendSet.insert(*it);
|
||||
|
@ -481,7 +481,7 @@ void p3discovery2::sendPGPList(const SSLID &toId)
|
|||
std::map<PGPID, DiscPgpInfo>::const_iterator it;
|
||||
for(it = mFriendList.begin(); it != mFriendList.end(); ++it)
|
||||
{
|
||||
pkt->pgpIdSet.ids.push_back(it->first);
|
||||
pkt->pgpIdSet.ids.insert(it->first);
|
||||
}
|
||||
|
||||
pkt->PeerId(toId);
|
||||
|
@ -517,7 +517,7 @@ void p3discovery2::updatePgpFriendList()
|
|||
|
||||
mLastPgpUpdate = time(NULL);
|
||||
|
||||
std::list<PGPID> pgpList;
|
||||
std::list<PGPID> pgpList;
|
||||
std::set<PGPID> pgpSet;
|
||||
|
||||
std::set<PGPID>::iterator sit;
|
||||
|
@ -525,7 +525,7 @@ void p3discovery2::updatePgpFriendList()
|
|||
std::map<PGPID, DiscPgpInfo>::iterator it;
|
||||
|
||||
PGPID ownPgpId = AuthGPG::getAuthGPG()->getGPGOwnId();
|
||||
AuthGPG::getAuthGPG()->getGPGAcceptedList(pgpList);
|
||||
AuthGPG::getAuthGPG()->getGPGAcceptedList(pgpList);
|
||||
pgpList.push_back(ownPgpId);
|
||||
|
||||
// convert to set for ordering.
|
||||
|
@ -597,7 +597,7 @@ void p3discovery2::updatePgpFriendList()
|
|||
|
||||
/* finally install the pgpList on our own entry */
|
||||
DiscPgpInfo &ownInfo = mFriendList[ownPgpId];
|
||||
ownInfo.mergeFriendList(pgpList);
|
||||
ownInfo.mergeFriendList(pgpSet);
|
||||
|
||||
}
|
||||
|
||||
|
@ -647,7 +647,7 @@ void p3discovery2::processPGPList(const SSLID &fromId, const RsDiscPgpListItem *
|
|||
|
||||
if (requestUnknownPgpCerts)
|
||||
{
|
||||
std::list<PGPID>::const_iterator fit;
|
||||
std::set<PGPID>::const_iterator fit;
|
||||
for(fit = item->pgpIdSet.ids.begin(); fit != item->pgpIdSet.ids.end(); ++fit)
|
||||
{
|
||||
if (!AuthGPG::getAuthGPG()->isGPGId(*fit))
|
||||
|
@ -946,7 +946,7 @@ void p3discovery2::requestPGPCertificate(const PGPID &aboutId, const SSLID &toId
|
|||
RsDiscPgpListItem *pkt = new RsDiscPgpListItem();
|
||||
|
||||
pkt->mode = DISC_PGP_LIST_MODE_GETCERT;
|
||||
pkt->pgpIdSet.ids.push_back(aboutId);
|
||||
pkt->pgpIdSet.ids.insert(aboutId);
|
||||
pkt->PeerId(toId);
|
||||
|
||||
#ifdef P3DISC_DEBUG
|
||||
|
@ -966,7 +966,7 @@ void p3discovery2::recvPGPCertificateRequest(const SSLID &fromId, const RsDiscPg
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<RsPgpId>::const_iterator it;
|
||||
std::set<RsPgpId>::const_iterator it;
|
||||
for(it = item->pgpIdSet.ids.begin(); it != item->pgpIdSet.ids.end(); ++it)
|
||||
{
|
||||
// NB: This doesn't include own certificates? why not.
|
||||
|
|
|
@ -66,7 +66,7 @@ class DiscPgpInfo
|
|||
public:
|
||||
DiscPgpInfo() {}
|
||||
|
||||
void mergeFriendList(const std::list<PGPID> &friends);
|
||||
void mergeFriendList(const std::set<PGPID> &friends);
|
||||
|
||||
//PGPID mPgpId;
|
||||
std::set<PGPID> mFriendSet;
|
||||
|
|
|
@ -302,7 +302,7 @@ bool p3GxsChannels::getGroupData(const uint32_t &token, std::vector<RsGxsChannel
|
|||
return ok;
|
||||
}
|
||||
|
||||
bool p3GxsChannels::groupShareKeys(const RsGxsGroupId &groupId, std::list<RsPeerId>& peers)
|
||||
bool p3GxsChannels::groupShareKeys(const RsGxsGroupId &groupId, std::set<RsPeerId>& peers)
|
||||
{
|
||||
RsGenExchange::shareGroupPublishKey(groupId,peers) ;
|
||||
return true ;
|
||||
|
|
|
@ -88,7 +88,7 @@ virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost
|
|||
//virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
|
||||
|
||||
//virtual bool groupRestoreKeys(const std::string &groupId);
|
||||
virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::list<RsPeerId>& peers) ;
|
||||
virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::set<RsPeerId>& peers) ;
|
||||
|
||||
virtual bool createGroup(uint32_t &token, RsGxsChannelGroup &group);
|
||||
virtual bool createPost(uint32_t &token, RsGxsChannelPost &post);
|
||||
|
|
|
@ -913,8 +913,8 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<RsGxsId> &peers = group.mInvitedMembers;
|
||||
std::list<RsGxsId>::const_iterator pit;
|
||||
std::set<RsGxsId> &peers = group.mInvitedMembers;
|
||||
std::set<RsGxsId>::const_iterator pit;
|
||||
|
||||
// need to trigger the searches.
|
||||
for(pit = peers.begin(); pit != peers.end(); ++pit)
|
||||
|
@ -1018,8 +1018,8 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
|||
#endif
|
||||
|
||||
// LOCAL Load.
|
||||
std::list<RsPgpId> &peers = group.mLocalFriends;
|
||||
std::list<RsPgpId>::const_iterator pit;
|
||||
std::set<RsPgpId> &peers = group.mLocalFriends;
|
||||
std::set<RsPgpId>::const_iterator pit;
|
||||
|
||||
// need to trigger the searches.
|
||||
for(pit = peers.begin(); pit != peers.end(); ++pit)
|
||||
|
@ -1610,7 +1610,7 @@ void p3GxsCircles::generateDummyCircle()
|
|||
std::set<RsGxsId>::iterator it;
|
||||
for(it = idset.begin(); it != idset.end(); ++it)
|
||||
{
|
||||
group.mInvitedMembers.push_back(*it);
|
||||
group.mInvitedMembers.insert(*it);
|
||||
#ifdef DEBUG_CIRCLES
|
||||
std::cerr << "p3GxsCircles::generateDummyCircle() Adding: " << *it;
|
||||
std::cerr << std::endl;
|
||||
|
@ -1634,8 +1634,8 @@ std::ostream &operator<<(std::ostream &out, const RsGxsCircleGroup &grp)
|
|||
out << "InvitedMembers: ";
|
||||
out << std::endl;
|
||||
|
||||
std::list<RsGxsId>::const_iterator it;
|
||||
std::list<RsGxsCircleId>::const_iterator sit;
|
||||
std::set<RsGxsId>::const_iterator it;
|
||||
std::set<RsGxsCircleId>::const_iterator sit;
|
||||
for(it = grp.mInvitedMembers.begin();
|
||||
it != grp.mInvitedMembers.begin(); ++it)
|
||||
{
|
||||
|
|
|
@ -1036,13 +1036,13 @@ uint32_t p3MsgService::sendDistantMessage(RsMsgItem *item,const RsGxsId& fro
|
|||
|
||||
bool p3MsgService::MessageSend(MessageInfo &info)
|
||||
{
|
||||
for(std::list<RsPeerId>::const_iterator pit = info.rspeerid_msgto.begin(); pit != info.rspeerid_msgto.end(); ++pit) sendMessage(initMIRsMsg(info, *pit));
|
||||
for(std::list<RsPeerId>::const_iterator pit = info.rspeerid_msgcc.begin(); pit != info.rspeerid_msgcc.end(); ++pit) sendMessage(initMIRsMsg(info, *pit));
|
||||
for(std::list<RsPeerId>::const_iterator pit = info.rspeerid_msgbcc.begin(); pit != info.rspeerid_msgbcc.end(); ++pit) sendMessage(initMIRsMsg(info, *pit));
|
||||
for(std::set<RsPeerId>::const_iterator pit = info.rspeerid_msgto.begin(); pit != info.rspeerid_msgto.end(); ++pit) sendMessage(initMIRsMsg(info, *pit));
|
||||
for(std::set<RsPeerId>::const_iterator pit = info.rspeerid_msgcc.begin(); pit != info.rspeerid_msgcc.end(); ++pit) sendMessage(initMIRsMsg(info, *pit));
|
||||
for(std::set<RsPeerId>::const_iterator pit = info.rspeerid_msgbcc.begin(); pit != info.rspeerid_msgbcc.end(); ++pit) sendMessage(initMIRsMsg(info, *pit));
|
||||
|
||||
for(std::list<RsGxsId>::const_iterator pit = info.rsgxsid_msgto.begin(); pit != info.rsgxsid_msgto.end(); ++pit) sendDistantMessage(initMIRsMsg(info, *pit),info.rsgxsid_srcId);
|
||||
for(std::list<RsGxsId>::const_iterator pit = info.rsgxsid_msgcc.begin(); pit != info.rsgxsid_msgcc.end(); ++pit) sendDistantMessage(initMIRsMsg(info, *pit),info.rsgxsid_srcId);
|
||||
for(std::list<RsGxsId>::const_iterator pit = info.rsgxsid_msgbcc.begin(); pit != info.rsgxsid_msgbcc.end(); ++pit) sendDistantMessage(initMIRsMsg(info, *pit),info.rsgxsid_srcId);
|
||||
for(std::set<RsGxsId>::const_iterator pit = info.rsgxsid_msgto.begin(); pit != info.rsgxsid_msgto.end(); ++pit) sendDistantMessage(initMIRsMsg(info, *pit),info.rsgxsid_srcId);
|
||||
for(std::set<RsGxsId>::const_iterator pit = info.rsgxsid_msgcc.begin(); pit != info.rsgxsid_msgcc.end(); ++pit) sendDistantMessage(initMIRsMsg(info, *pit),info.rsgxsid_srcId);
|
||||
for(std::set<RsGxsId>::const_iterator pit = info.rsgxsid_msgbcc.begin(); pit != info.rsgxsid_msgbcc.end(); ++pit) sendDistantMessage(initMIRsMsg(info, *pit),info.rsgxsid_srcId);
|
||||
|
||||
/* send to ourselves as well */
|
||||
RsMsgItem *msg = initMIRsMsg(info, mServiceCtrl->getOwnId());
|
||||
|
@ -1096,7 +1096,7 @@ bool p3MsgService::SystemMessage(const std::string &title, const std::string &me
|
|||
msg->subject = title;
|
||||
msg->message = message;
|
||||
|
||||
msg->rspeerid_msgto.ids.push_back(ownId);
|
||||
msg->rspeerid_msgto.ids.insert(ownId);
|
||||
|
||||
processMsg(msg, true);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ RsServiceInfo p3Posted::getServiceInfo()
|
|||
GXS_POSTED_MIN_MINOR_VERSION);
|
||||
}
|
||||
|
||||
bool p3Posted::groupShareKeys(const RsGxsGroupId& groupId,const std::list<RsPeerId>& peers)
|
||||
bool p3Posted::groupShareKeys(const RsGxsGroupId& groupId,const std::set<RsPeerId>& peers)
|
||||
{
|
||||
RsGenExchange::shareGroupPublishKey(groupId,peers) ;
|
||||
return true ;
|
||||
|
|
|
@ -70,7 +70,7 @@ virtual bool createGroup(uint32_t &token, RsPostedGroup &group);
|
|||
virtual bool createPost(uint32_t &token, RsPostedPost &post);
|
||||
|
||||
virtual bool updateGroup(uint32_t &token, RsPostedGroup &group);
|
||||
virtual bool groupShareKeys(const RsGxsGroupId &group, const std::list<RsPeerId>& peers);
|
||||
virtual bool groupShareKeys(const RsGxsGroupId &group, const std::set<RsPeerId>& peers);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// WRAPPERS due to the separate Interface.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue