mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05: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
@ -1421,7 +1421,7 @@ bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,co
|
|||||||
return true ;
|
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
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
std::cerr << "Creating a new Chat lobby !!" << std::endl;
|
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 ;
|
_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) ;
|
invitePeerToLobby(lobby_id,*it) ;
|
||||||
|
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||||
|
@ -76,7 +76,7 @@ class DistributedChatService
|
|||||||
bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
||||||
void sendLobbyStatusString(const ChatLobbyId& id,const std::string& status_string) ;
|
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) ;
|
void getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& public_lobbies) ;
|
||||||
bool joinVisibleChatLobby(const ChatLobbyId& id, const RsGxsId &gxs_id) ;
|
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)
|
for(std::list<RsPeerId>::const_iterator it(lst.begin());it!=lst.end();++it)
|
||||||
if(!mTurtle->isTurtlePeer(*it))
|
if(!mTurtle->isTurtlePeer(*it))
|
||||||
rft->allPeerIds.ids.push_back(*it) ;
|
rft->allPeerIds.ids.insert(*it) ;
|
||||||
|
|
||||||
rft->transferred = fit->second->mCreator->getRecvd();
|
rft->transferred = fit->second->mCreator->getRecvd();
|
||||||
fit->second->mCreator->getAvailabilityMap(rft->compressed_chunk_map) ;
|
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() ;
|
rft->allPeerIds.ids.clear() ;
|
||||||
for(std::list<RsPeerId>::const_iterator it(pit->mSrcIds.begin());it!=pit->mSrcIds.end();++it)
|
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.
|
// 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
|
// 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
|
// 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)))
|
if(mTurtle->isTurtlePeer(RsPeerId(*sit)))
|
||||||
{
|
{
|
||||||
std::list<RsPeerId>::iterator sittmp(sit) ;
|
std::set<RsPeerId>::iterator sittmp(sit) ;
|
||||||
++sittmp ;
|
++sittmp ;
|
||||||
rft->allPeerIds.ids.erase(sit) ;
|
rft->allPeerIds.ids.erase(sit) ;
|
||||||
sit = sittmp ;
|
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 ;
|
std::cerr << "ftController::loadList(): requesting " << rsft->file.name << ", " << rsft->file.hash << ", " << rsft->file.filesize << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
std::list<RsPeerId> src_lst ;
|
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) ;
|
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);
|
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;
|
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())
|
if(grpId.isNull())
|
||||||
return ;
|
return ;
|
||||||
|
@ -604,7 +604,7 @@ public:
|
|||||||
* sets the message service string
|
* 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:
|
protected:
|
||||||
|
|
||||||
|
@ -3239,7 +3239,7 @@ void RsGxsNetService::processExplicitGroupRequests()
|
|||||||
mExplicitRequest.clear();
|
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) ;
|
RS_STACK_MUTEX(mNxsMutex) ;
|
||||||
|
|
||||||
@ -3264,7 +3264,7 @@ void RsGxsNetService::sharePublishKeysPending()
|
|||||||
|
|
||||||
std::set<RsPeerId> peersOnline;
|
std::set<RsPeerId> peersOnline;
|
||||||
std::list<RsGxsGroupId> toDelete;
|
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);
|
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.
|
// 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> 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())
|
if(peersOnline.find(*it) != peersOnline.end())
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG
|
#ifdef NXS_NET_DEBUG
|
||||||
@ -3293,7 +3293,7 @@ void RsGxsNetService::sharePublishKeysPending()
|
|||||||
#ifdef NXS_NET_DEBUG
|
#ifdef NXS_NET_DEBUG
|
||||||
std::cerr << " " << *it << ": offline. Keeping for next try." << std::endl;
|
std::cerr << " " << *it << ": offline. Keeping for next try." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
offline_recipients.push_back(*it) ;
|
offline_recipients.insert(*it) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If empty, skip
|
// If empty, skip
|
||||||
|
@ -135,7 +135,7 @@ public:
|
|||||||
* share publish keys for the specified group with the peers in the specified list.
|
* 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,
|
* 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
|
// need to be verfied
|
||||||
std::vector<AuthorPending*> mPendingResp;
|
std::vector<AuthorPending*> mPendingResp;
|
||||||
std::vector<GrpCircleVetting*> mPendingCircleVets;
|
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::list<RsGxsGroupId> > mExplicitRequest;
|
||||||
std::map<RsPeerId, std::set<RsGxsGroupId> > mPartialMsgUpdates ;
|
std::map<RsPeerId, std::set<RsGxsGroupId> > mPartialMsgUpdates ;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public:
|
|||||||
* Request for this group is sent through to peers on your network
|
* Request for this group is sent through to peers on your network
|
||||||
* and how many hops from them you've indicated
|
* 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) ;
|
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.
|
// 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 ;
|
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)
|
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;
|
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.
|
// 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)
|
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
|
// 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.
|
// 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 ;
|
//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) ;
|
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)
|
return PGPHandler::removeKeysFromPGPKeyring(pgp_ids,backup_file,error_code) ;
|
||||||
pids.push_back(RsPgpId(*it)) ;
|
|
||||||
|
|
||||||
return PGPHandler::removeKeysFromPGPKeyring(pids,backup_file,error_code) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool AuthGPG::decryptTextFromString(std::string& encrypted_text,std::string& output)
|
// 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 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 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 ***********************************************/
|
/************************* STAGE 4 ***********************************************/
|
||||||
|
@ -2089,10 +2089,10 @@ bool p3PeerMgrIMPL::assignPeersToGroup(const std::string &groupId, const std::li
|
|||||||
|
|
||||||
std::list<RsPgpId>::const_iterator peerIt;
|
std::list<RsPgpId>::const_iterator peerIt;
|
||||||
for (peerIt = peerIds.begin(); peerIt != peerIds.end(); ++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 (assign) {
|
||||||
if (peerIt1 == groupItem->pgpList.ids.end()) {
|
if (peerIt1 == groupItem->pgpList.ids.end()) {
|
||||||
groupItem->pgpList.ids.push_back(*peerIt);
|
groupItem->pgpList.ids.insert(*peerIt);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
} else {
|
} 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 setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
|
||||||
|
|
||||||
//virtual bool groupRestoreKeys(const std::string &groupId);
|
//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.
|
// Overloaded subscribe fn.
|
||||||
virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) = 0;
|
virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) = 0;
|
||||||
|
@ -78,9 +78,9 @@ class RsGxsCircleGroup
|
|||||||
public:
|
public:
|
||||||
RsGroupMetaData mMeta; // includes GxsPermissions, for control of group distribution.
|
RsGroupMetaData mMeta; // includes GxsPermissions, for control of group distribution.
|
||||||
|
|
||||||
std::list<RsPgpId> mLocalFriends;
|
std::set<RsPgpId> mLocalFriends;
|
||||||
std::list<RsGxsId> mInvitedMembers;
|
std::set<RsGxsId> mInvitedMembers;
|
||||||
std::list<RsGxsCircleId> mSubCircles;
|
std::set<RsGxsCircleId> mSubCircles;
|
||||||
|
|
||||||
// Not Serialised.
|
// Not Serialised.
|
||||||
// Internally inside rsCircles, this will be turned into:
|
// Internally inside rsCircles, this will be turned into:
|
||||||
|
@ -185,15 +185,15 @@ public:
|
|||||||
|
|
||||||
// friend destinations
|
// friend destinations
|
||||||
//
|
//
|
||||||
std::list<RsPeerId> rspeerid_msgto; // RsPeerId is used here for various purposes:
|
std::set<RsPeerId> rspeerid_msgto; // RsPeerId is used here for various purposes:
|
||||||
std::list<RsPeerId> rspeerid_msgcc; // - real peer ids which are actual friend locations
|
std::set<RsPeerId> rspeerid_msgcc; // - real peer ids which are actual friend locations
|
||||||
std::list<RsPeerId> rspeerid_msgbcc; // -
|
std::set<RsPeerId> rspeerid_msgbcc; // -
|
||||||
|
|
||||||
// distant peers
|
// distant peers
|
||||||
//
|
//
|
||||||
std::list<RsGxsId> rsgxsid_msgto; // RsPeerId is used here for various purposes:
|
std::set<RsGxsId> rsgxsid_msgto; // RsPeerId is used here for various purposes:
|
||||||
std::list<RsGxsId> rsgxsid_msgcc; // - real peer ids which are actual friend locations
|
std::set<RsGxsId> rsgxsid_msgcc; // - real peer ids which are actual friend locations
|
||||||
std::list<RsGxsId> rsgxsid_msgbcc; // -
|
std::set<RsGxsId> rsgxsid_msgbcc; // -
|
||||||
|
|
||||||
std::string title;
|
std::string title;
|
||||||
std::string msg;
|
std::string msg;
|
||||||
@ -474,7 +474,7 @@ virtual bool setDefaultIdentityForChatLobby(const RsGxsId& nick) = 0;
|
|||||||
virtual bool getDefaultIdentityForChatLobby(RsGxsId& id) = 0 ;
|
virtual bool getDefaultIdentityForChatLobby(RsGxsId& id) = 0 ;
|
||||||
virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe) = 0 ;
|
virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe) = 0 ;
|
||||||
virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id) = 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 */
|
/* Distant chat */
|
||||||
|
@ -277,7 +277,7 @@ public:
|
|||||||
std::string name;
|
std::string name;
|
||||||
uint32_t flag;
|
uint32_t flag;
|
||||||
|
|
||||||
std::list<RsPgpId> peerIds;
|
std::set<RsPgpId> peerIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail);
|
std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail);
|
||||||
@ -328,7 +328,7 @@ class RsPeers
|
|||||||
virtual bool removeFriendLocation(const RsPeerId& sslId) = 0;
|
virtual bool removeFriendLocation(const RsPeerId& sslId) = 0;
|
||||||
|
|
||||||
/* keyring management */
|
/* 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 */
|
/* Network Stuff */
|
||||||
virtual bool connectAttempt(const RsPeerId& ssl_id) = 0;
|
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 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) ;
|
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) ;
|
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 bool getDefaultIdentityForChatLobby(RsGxsId& nick) ;
|
||||||
virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe);
|
virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe);
|
||||||
virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
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 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) ;
|
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);
|
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) ;
|
return AuthGPG::getAuthGPG()->removeKeysFromPGPKeyring(pgp_ids,backup_file,error_code) ;
|
||||||
}
|
}
|
||||||
@ -1279,9 +1279,11 @@ FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
|||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::list<RsPgpId>::const_iterator it2(info.peerIds.begin());it2!=info.peerIds.end() && !found;++it2)
|
found = found || (info.peerIds.find(pgp_id) != info.peerIds.end()) ;
|
||||||
if(*it2 == pgp_id)
|
|
||||||
found = true ;
|
//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) ;
|
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);
|
virtual bool removeFriendLocation(const RsPeerId& sslId);
|
||||||
|
|
||||||
/* keyring management */
|
/* 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 */
|
/* Network Stuff */
|
||||||
virtual bool connectAttempt(const RsPeerId &id);
|
virtual bool connectAttempt(const RsPeerId &id);
|
||||||
|
@ -1178,7 +1178,7 @@ std::ostream &RsPeerGroupItem::print(std::ostream &out, uint16_t indent)
|
|||||||
printIndent(out, int_Indent);
|
printIndent(out, int_Indent);
|
||||||
out << "groupFlag: " << flag << std::endl;
|
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) {
|
for (it = pgpList.ids.begin(); it != pgpList.ids.end(); ++it) {
|
||||||
printIndent(out, int_Indent);
|
printIndent(out, int_Indent);
|
||||||
out << "peerId: " << it->toStdString() << std::endl;
|
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 << "Item type: RsPluginHashSetItem" << std::endl;
|
||||||
o << " Hash list: " << 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;
|
o << " " << *it << std::endl;
|
||||||
|
|
||||||
return o ;
|
return o ;
|
||||||
|
@ -59,7 +59,7 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
|||||||
/* start at data[offset] */
|
/* start at data[offset] */
|
||||||
ok = ok && SetTlvBase(data, tlvend, offset, TLV_TYPE, tlvsize);
|
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) ;
|
ok = ok && (*it).serialise(data,tlvend,*offset) ;
|
||||||
|
|
||||||
return ok ;
|
return ok ;
|
||||||
@ -91,7 +91,7 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
|||||||
{
|
{
|
||||||
ID_CLASS id ;
|
ID_CLASS id ;
|
||||||
ok = ok && id.deserialise(data,tlvend,*offset) ;
|
ok = ok && id.deserialise(data,tlvend,*offset) ;
|
||||||
ids.push_back(id) ;
|
ids.insert(id) ;
|
||||||
}
|
}
|
||||||
if(*offset != tlvend)
|
if(*offset != tlvend)
|
||||||
std::cerr << "(EE) deserialisaiton error in " << __PRETTY_FUNCTION__ << std::endl;
|
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
|
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() << ", " ;
|
out << (*it).toStdString() << ", " ;
|
||||||
|
|
||||||
return out ;
|
return out ;
|
||||||
}
|
}
|
||||||
virtual std::ostream &printHex(std::ostream &out, uint16_t /* indent */) const /* SPECIAL One */
|
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() << ", " ;
|
out << (*it).toStdString() << ", " ;
|
||||||
|
|
||||||
return out ;
|
return out ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<ID_CLASS> ids ;
|
std::set<ID_CLASS> ids ;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef t_RsTlvIdSet<RsPeerId,TLV_TYPE_PEERSET> RsTlvPeerIdSet ;
|
typedef t_RsTlvIdSet<RsPeerId,TLV_TYPE_PEERSET> RsTlvPeerIdSet ;
|
||||||
|
@ -74,9 +74,9 @@ bool populateContactInfo(const peerState &detail, RsDiscContactItem *pkt)
|
|||||||
return true;
|
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)
|
for(it = friends.begin(); it != friends.end(); ++it)
|
||||||
{
|
{
|
||||||
mFriendSet.insert(*it);
|
mFriendSet.insert(*it);
|
||||||
@ -481,7 +481,7 @@ void p3discovery2::sendPGPList(const SSLID &toId)
|
|||||||
std::map<PGPID, DiscPgpInfo>::const_iterator it;
|
std::map<PGPID, DiscPgpInfo>::const_iterator it;
|
||||||
for(it = mFriendList.begin(); it != mFriendList.end(); ++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);
|
pkt->PeerId(toId);
|
||||||
@ -597,7 +597,7 @@ void p3discovery2::updatePgpFriendList()
|
|||||||
|
|
||||||
/* finally install the pgpList on our own entry */
|
/* finally install the pgpList on our own entry */
|
||||||
DiscPgpInfo &ownInfo = mFriendList[ownPgpId];
|
DiscPgpInfo &ownInfo = mFriendList[ownPgpId];
|
||||||
ownInfo.mergeFriendList(pgpList);
|
ownInfo.mergeFriendList(pgpSet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,7 +647,7 @@ void p3discovery2::processPGPList(const SSLID &fromId, const RsDiscPgpListItem *
|
|||||||
|
|
||||||
if (requestUnknownPgpCerts)
|
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)
|
for(fit = item->pgpIdSet.ids.begin(); fit != item->pgpIdSet.ids.end(); ++fit)
|
||||||
{
|
{
|
||||||
if (!AuthGPG::getAuthGPG()->isGPGId(*fit))
|
if (!AuthGPG::getAuthGPG()->isGPGId(*fit))
|
||||||
@ -946,7 +946,7 @@ void p3discovery2::requestPGPCertificate(const PGPID &aboutId, const SSLID &toId
|
|||||||
RsDiscPgpListItem *pkt = new RsDiscPgpListItem();
|
RsDiscPgpListItem *pkt = new RsDiscPgpListItem();
|
||||||
|
|
||||||
pkt->mode = DISC_PGP_LIST_MODE_GETCERT;
|
pkt->mode = DISC_PGP_LIST_MODE_GETCERT;
|
||||||
pkt->pgpIdSet.ids.push_back(aboutId);
|
pkt->pgpIdSet.ids.insert(aboutId);
|
||||||
pkt->PeerId(toId);
|
pkt->PeerId(toId);
|
||||||
|
|
||||||
#ifdef P3DISC_DEBUG
|
#ifdef P3DISC_DEBUG
|
||||||
@ -966,7 +966,7 @@ void p3discovery2::recvPGPCertificateRequest(const SSLID &fromId, const RsDiscPg
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#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)
|
for(it = item->pgpIdSet.ids.begin(); it != item->pgpIdSet.ids.end(); ++it)
|
||||||
{
|
{
|
||||||
// NB: This doesn't include own certificates? why not.
|
// NB: This doesn't include own certificates? why not.
|
||||||
|
@ -66,7 +66,7 @@ class DiscPgpInfo
|
|||||||
public:
|
public:
|
||||||
DiscPgpInfo() {}
|
DiscPgpInfo() {}
|
||||||
|
|
||||||
void mergeFriendList(const std::list<PGPID> &friends);
|
void mergeFriendList(const std::set<PGPID> &friends);
|
||||||
|
|
||||||
//PGPID mPgpId;
|
//PGPID mPgpId;
|
||||||
std::set<PGPID> mFriendSet;
|
std::set<PGPID> mFriendSet;
|
||||||
|
@ -302,7 +302,7 @@ bool p3GxsChannels::getGroupData(const uint32_t &token, std::vector<RsGxsChannel
|
|||||||
return ok;
|
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) ;
|
RsGenExchange::shareGroupPublishKey(groupId,peers) ;
|
||||||
return true ;
|
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 setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
|
||||||
|
|
||||||
//virtual bool groupRestoreKeys(const std::string &groupId);
|
//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 createGroup(uint32_t &token, RsGxsChannelGroup &group);
|
||||||
virtual bool createPost(uint32_t &token, RsGxsChannelPost &post);
|
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;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::list<RsGxsId> &peers = group.mInvitedMembers;
|
std::set<RsGxsId> &peers = group.mInvitedMembers;
|
||||||
std::list<RsGxsId>::const_iterator pit;
|
std::set<RsGxsId>::const_iterator pit;
|
||||||
|
|
||||||
// need to trigger the searches.
|
// need to trigger the searches.
|
||||||
for(pit = peers.begin(); pit != peers.end(); ++pit)
|
for(pit = peers.begin(); pit != peers.end(); ++pit)
|
||||||
@ -1018,8 +1018,8 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// LOCAL Load.
|
// LOCAL Load.
|
||||||
std::list<RsPgpId> &peers = group.mLocalFriends;
|
std::set<RsPgpId> &peers = group.mLocalFriends;
|
||||||
std::list<RsPgpId>::const_iterator pit;
|
std::set<RsPgpId>::const_iterator pit;
|
||||||
|
|
||||||
// need to trigger the searches.
|
// need to trigger the searches.
|
||||||
for(pit = peers.begin(); pit != peers.end(); ++pit)
|
for(pit = peers.begin(); pit != peers.end(); ++pit)
|
||||||
@ -1610,7 +1610,7 @@ void p3GxsCircles::generateDummyCircle()
|
|||||||
std::set<RsGxsId>::iterator it;
|
std::set<RsGxsId>::iterator it;
|
||||||
for(it = idset.begin(); it != idset.end(); ++it)
|
for(it = idset.begin(); it != idset.end(); ++it)
|
||||||
{
|
{
|
||||||
group.mInvitedMembers.push_back(*it);
|
group.mInvitedMembers.insert(*it);
|
||||||
#ifdef DEBUG_CIRCLES
|
#ifdef DEBUG_CIRCLES
|
||||||
std::cerr << "p3GxsCircles::generateDummyCircle() Adding: " << *it;
|
std::cerr << "p3GxsCircles::generateDummyCircle() Adding: " << *it;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -1634,8 +1634,8 @@ std::ostream &operator<<(std::ostream &out, const RsGxsCircleGroup &grp)
|
|||||||
out << "InvitedMembers: ";
|
out << "InvitedMembers: ";
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
|
|
||||||
std::list<RsGxsId>::const_iterator it;
|
std::set<RsGxsId>::const_iterator it;
|
||||||
std::list<RsGxsCircleId>::const_iterator sit;
|
std::set<RsGxsCircleId>::const_iterator sit;
|
||||||
for(it = grp.mInvitedMembers.begin();
|
for(it = grp.mInvitedMembers.begin();
|
||||||
it != grp.mInvitedMembers.begin(); ++it)
|
it != grp.mInvitedMembers.begin(); ++it)
|
||||||
{
|
{
|
||||||
|
@ -1036,13 +1036,13 @@ uint32_t p3MsgService::sendDistantMessage(RsMsgItem *item,const RsGxsId& fro
|
|||||||
|
|
||||||
bool p3MsgService::MessageSend(MessageInfo &info)
|
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::set<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::set<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_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::set<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::set<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_msgbcc.begin(); pit != info.rsgxsid_msgbcc.end(); ++pit) sendDistantMessage(initMIRsMsg(info, *pit),info.rsgxsid_srcId);
|
||||||
|
|
||||||
/* send to ourselves as well */
|
/* send to ourselves as well */
|
||||||
RsMsgItem *msg = initMIRsMsg(info, mServiceCtrl->getOwnId());
|
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->subject = title;
|
||||||
msg->message = message;
|
msg->message = message;
|
||||||
|
|
||||||
msg->rspeerid_msgto.ids.push_back(ownId);
|
msg->rspeerid_msgto.ids.insert(ownId);
|
||||||
|
|
||||||
processMsg(msg, true);
|
processMsg(msg, true);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ RsServiceInfo p3Posted::getServiceInfo()
|
|||||||
GXS_POSTED_MIN_MINOR_VERSION);
|
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) ;
|
RsGenExchange::shareGroupPublishKey(groupId,peers) ;
|
||||||
return true ;
|
return true ;
|
||||||
|
@ -70,7 +70,7 @@ virtual bool createGroup(uint32_t &token, RsPostedGroup &group);
|
|||||||
virtual bool createPost(uint32_t &token, RsPostedPost &post);
|
virtual bool createPost(uint32_t &token, RsPostedPost &post);
|
||||||
|
|
||||||
virtual bool updateGroup(uint32_t &token, RsPostedGroup &group);
|
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.
|
// WRAPPERS due to the separate Interface.
|
||||||
|
@ -618,7 +618,7 @@ void ChatLobbyWidget::createChatLobby()
|
|||||||
privacyLevel = action->data().toInt();
|
privacyLevel = action->data().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsPeerId> friends;
|
std::set<RsPeerId> friends;
|
||||||
CreateLobbyDialog(friends, privacyLevel).exec();
|
CreateLobbyDialog(friends, privacyLevel).exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1125,7 +1125,7 @@ void MessagesDialog::insertMessages()
|
|||||||
|
|
||||||
text.clear();
|
text.clear();
|
||||||
|
|
||||||
for(std::list<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgto.begin(); pit != msgInfo.rspeerid_msgto.end(); ++pit)
|
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgto.begin(); pit != msgInfo.rspeerid_msgto.end(); ++pit)
|
||||||
{
|
{
|
||||||
if (!text.isEmpty())
|
if (!text.isEmpty())
|
||||||
text += ", ";
|
text += ", ";
|
||||||
@ -1136,7 +1136,7 @@ void MessagesDialog::insertMessages()
|
|||||||
else
|
else
|
||||||
text += QString::fromUtf8(peerName.c_str());
|
text += QString::fromUtf8(peerName.c_str());
|
||||||
}
|
}
|
||||||
for(std::list<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgto.begin(); pit != msgInfo.rsgxsid_msgto.end(); ++pit)
|
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgto.begin(); pit != msgInfo.rsgxsid_msgto.end(); ++pit)
|
||||||
{
|
{
|
||||||
if (!text.isEmpty())
|
if (!text.isEmpty())
|
||||||
text += ", ";
|
text += ", ";
|
||||||
|
@ -225,7 +225,7 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
|
|||||||
|
|
||||||
void NetworkDialog::removeUnusedKeys()
|
void NetworkDialog::removeUnusedKeys()
|
||||||
{
|
{
|
||||||
std::list<RsPgpId> pre_selected ;
|
std::set<RsPgpId> pre_selected ;
|
||||||
std::list<RsPgpId> ids ;
|
std::list<RsPgpId> ids ;
|
||||||
|
|
||||||
rsPeers->getGPGAllList(ids) ;
|
rsPeers->getGPGAllList(ids) ;
|
||||||
@ -245,17 +245,17 @@ void NetworkDialog::removeUnusedKeys()
|
|||||||
if(now > (time_t) (THREE_MONTHS + details.lastUsed))
|
if(now > (time_t) (THREE_MONTHS + details.lastUsed))
|
||||||
{
|
{
|
||||||
std::cerr << "Adding " << *it << " to pre-selection." << std::endl;
|
std::cerr << "Adding " << *it << " to pre-selection." << std::endl;
|
||||||
pre_selected.push_back(*it) ;
|
pre_selected.insert(*it) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsPgpId> selected = FriendSelectionDialog::selectFriends_PGP(NULL,
|
std::set<RsPgpId> selected = FriendSelectionDialog::selectFriends_PGP(NULL,
|
||||||
tr("Clean keyring"),
|
tr("Clean keyring"),
|
||||||
tr("The selected keys below haven't been used in the last 3 months. \nDo you want to delete them permanently ? \n\nNotes: Your old keyring will be backed up.\n The removal may fail when running multiple Retroshare instances on the same machine."),FriendSelectionWidget::MODUS_CHECK,FriendSelectionWidget::SHOW_GPG | FriendSelectionWidget::SHOW_NON_FRIEND_GPG,
|
tr("The selected keys below haven't been used in the last 3 months. \nDo you want to delete them permanently ? \n\nNotes: Your old keyring will be backed up.\n The removal may fail when running multiple Retroshare instances on the same machine."),FriendSelectionWidget::MODUS_CHECK,FriendSelectionWidget::SHOW_GPG | FriendSelectionWidget::SHOW_NON_FRIEND_GPG,
|
||||||
pre_selected) ;
|
pre_selected) ;
|
||||||
|
|
||||||
std::cerr << "Removing these keys from the keyring: " << std::endl;
|
std::cerr << "Removing these keys from the keyring: " << std::endl;
|
||||||
for(std::list<RsPgpId>::const_iterator it(selected.begin());it!=selected.end();++it)
|
for(std::set<RsPgpId>::const_iterator it(selected.begin());it!=selected.end();++it)
|
||||||
std::cerr << " " << *it << std::endl;
|
std::cerr << " " << *it << std::endl;
|
||||||
|
|
||||||
std::string backup_file ;
|
std::string backup_file ;
|
||||||
|
@ -136,14 +136,14 @@ void ChatLobbyDialog::inviteFriends()
|
|||||||
{
|
{
|
||||||
std::cerr << "Inviting friends" << std::endl;
|
std::cerr << "Inviting friends" << std::endl;
|
||||||
|
|
||||||
std::list<RsPeerId> ids = FriendSelectionDialog::selectFriends_SSL(NULL,tr("Invite friends"),tr("Select friends to invite:")) ;
|
std::set<RsPeerId> ids = FriendSelectionDialog::selectFriends_SSL(NULL,tr("Invite friends"),tr("Select friends to invite:")) ;
|
||||||
|
|
||||||
std::cerr << "Inviting these friends:" << std::endl;
|
std::cerr << "Inviting these friends:" << std::endl;
|
||||||
|
|
||||||
if (!mChatId.isLobbyId())
|
if (!mChatId.isLobbyId())
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
for(std::list<RsPeerId>::const_iterator it(ids.begin());it!=ids.end();++it)
|
for(std::set<RsPeerId>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||||
{
|
{
|
||||||
std::cerr << " " << *it << std::endl;
|
std::cerr << " " << *it << std::endl;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "ChatDialog.h"
|
#include "ChatDialog.h"
|
||||||
#include "gui/ChatLobbyWidget.h"
|
#include "gui/ChatLobbyWidget.h"
|
||||||
|
|
||||||
CreateLobbyDialog::CreateLobbyDialog(const std::list<RsPeerId>& peer_list, int privacyLevel, QWidget *parent) :
|
CreateLobbyDialog::CreateLobbyDialog(const std::set<RsPeerId>& peer_list, int privacyLevel, QWidget *parent) :
|
||||||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||||
{
|
{
|
||||||
ui = new Ui::CreateLobbyDialog() ;
|
ui = new Ui::CreateLobbyDialog() ;
|
||||||
@ -109,7 +109,7 @@ void CreateLobbyDialog::checkTextFields()
|
|||||||
|
|
||||||
void CreateLobbyDialog::createLobby()
|
void CreateLobbyDialog::createLobby()
|
||||||
{
|
{
|
||||||
std::list<RsPeerId> shareList;
|
std::set<RsPeerId> shareList;
|
||||||
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
|
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
|
||||||
|
|
||||||
// if (shareList.empty()) {
|
// if (shareList.empty()) {
|
||||||
|
@ -13,7 +13,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
*@param chanId The channel id to send request for
|
*@param chanId The channel id to send request for
|
||||||
*/
|
*/
|
||||||
CreateLobbyDialog(const std::list<RsPeerId>& friends_list, int privacyLevel = 0, QWidget *parent = 0);
|
CreateLobbyDialog(const std::set<RsPeerId>& friends_list, int privacyLevel = 0, QWidget *parent = 0);
|
||||||
~CreateLobbyDialog();
|
~CreateLobbyDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1343,8 +1343,11 @@ void FriendList::recommendfriend()
|
|||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::set<RsPeerId> sids ;
|
||||||
|
for(std::list<RsPeerId>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||||
|
sids.insert(*it) ;
|
||||||
|
|
||||||
MessageComposer::recommendFriend(ids);
|
MessageComposer::recommendFriend(sids);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendList::pastePerson()
|
void FriendList::pastePerson()
|
||||||
@ -1596,7 +1599,7 @@ void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &s
|
|||||||
{
|
{
|
||||||
RsGroupInfo groupInfo;
|
RsGroupInfo groupInfo;
|
||||||
if (rsPeers->getGroupInfo(peerId, groupInfo)) {
|
if (rsPeers->getGroupInfo(peerId, groupInfo)) {
|
||||||
std::list<RsPgpId>::iterator gpgIt;
|
std::set<RsPgpId>::iterator gpgIt;
|
||||||
for (gpgIt = groupInfo.peerIds.begin(); gpgIt != groupInfo.peerIds.end(); ++gpgIt) {
|
for (gpgIt = groupInfo.peerIds.begin(); gpgIt != groupInfo.peerIds.end(); ++gpgIt) {
|
||||||
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
||||||
}
|
}
|
||||||
|
@ -4,65 +4,65 @@
|
|||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include "FriendSelectionDialog.h"
|
#include "FriendSelectionDialog.h"
|
||||||
|
|
||||||
std::list<RsPgpId> FriendSelectionDialog::selectFriends_PGP(QWidget *parent,const QString& caption,const QString& header_text,
|
std::set<RsPgpId> FriendSelectionDialog::selectFriends_PGP(QWidget *parent,const QString& caption,const QString& header_text,
|
||||||
FriendSelectionWidget::Modus modus,
|
FriendSelectionWidget::Modus modus,
|
||||||
FriendSelectionWidget::ShowTypes show_type,
|
FriendSelectionWidget::ShowTypes show_type,
|
||||||
const std::list<RsPgpId>& pre_selected_ids)
|
const std::set<RsPgpId>& pre_selected_ids)
|
||||||
{
|
{
|
||||||
std::list<std::string> psids ;
|
std::set<std::string> psids ;
|
||||||
for(std::list<RsPgpId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
for(std::set<RsPgpId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
||||||
psids.push_back( (*it).toStdString() ) ;
|
psids.insert( (*it).toStdString() ) ;
|
||||||
|
|
||||||
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_GPG,psids) ;
|
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_GPG,psids) ;
|
||||||
|
|
||||||
dialog.setWindowTitle(caption) ;
|
dialog.setWindowTitle(caption) ;
|
||||||
|
|
||||||
if(QDialog::Rejected == dialog.exec())
|
if(QDialog::Rejected == dialog.exec())
|
||||||
return std::list<RsPgpId>() ;
|
return std::set<RsPgpId>() ;
|
||||||
|
|
||||||
std::list<RsPgpId> sids ;
|
std::set<RsPgpId> sids ;
|
||||||
dialog.friends_widget->selectedIds<RsPgpId,FriendSelectionWidget::IDTYPE_GPG>(sids,false) ;
|
dialog.friends_widget->selectedIds<RsPgpId,FriendSelectionWidget::IDTYPE_GPG>(sids,false) ;
|
||||||
|
|
||||||
return sids ;
|
return sids ;
|
||||||
}
|
}
|
||||||
std::list<RsPeerId> FriendSelectionDialog::selectFriends_SSL(QWidget *parent,const QString& caption,const QString& header_text,
|
std::set<RsPeerId> FriendSelectionDialog::selectFriends_SSL(QWidget *parent,const QString& caption,const QString& header_text,
|
||||||
FriendSelectionWidget::Modus modus,
|
FriendSelectionWidget::Modus modus,
|
||||||
FriendSelectionWidget::ShowTypes show_type,
|
FriendSelectionWidget::ShowTypes show_type,
|
||||||
const std::list<RsPeerId>& pre_selected_ids)
|
const std::set<RsPeerId>& pre_selected_ids)
|
||||||
{
|
{
|
||||||
std::list<std::string> psids ;
|
std::set<std::string> psids ;
|
||||||
for(std::list<RsPeerId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
for(std::set<RsPeerId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
||||||
psids.push_back( (*it).toStdString() ) ;
|
psids.insert( (*it).toStdString() ) ;
|
||||||
|
|
||||||
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_SSL,psids) ;
|
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_SSL,psids) ;
|
||||||
|
|
||||||
dialog.setWindowTitle(caption) ;
|
dialog.setWindowTitle(caption) ;
|
||||||
|
|
||||||
if(QDialog::Rejected == dialog.exec())
|
if(QDialog::Rejected == dialog.exec())
|
||||||
return std::list<RsPeerId>() ;
|
return std::set<RsPeerId>() ;
|
||||||
|
|
||||||
std::list<RsPeerId> sids ;
|
std::set<RsPeerId> sids ;
|
||||||
dialog.friends_widget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(sids,false) ;
|
dialog.friends_widget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(sids,false) ;
|
||||||
|
|
||||||
return sids ;
|
return sids ;
|
||||||
}
|
}
|
||||||
std::list<RsGxsId> FriendSelectionDialog::selectFriends_GXS(QWidget *parent,const QString& caption,const QString& header_text,
|
std::set<RsGxsId> FriendSelectionDialog::selectFriends_GXS(QWidget *parent,const QString& caption,const QString& header_text,
|
||||||
FriendSelectionWidget::Modus modus,
|
FriendSelectionWidget::Modus modus,
|
||||||
FriendSelectionWidget::ShowTypes show_type,
|
FriendSelectionWidget::ShowTypes show_type,
|
||||||
const std::list<RsGxsId>& pre_selected_ids)
|
const std::set<RsGxsId>& pre_selected_ids)
|
||||||
{
|
{
|
||||||
std::list<std::string> psids ;
|
std::set<std::string> psids ;
|
||||||
for(std::list<RsGxsId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
for(std::set<RsGxsId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
||||||
psids.push_back( (*it).toStdString() ) ;
|
psids.insert( (*it).toStdString() ) ;
|
||||||
|
|
||||||
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_SSL,psids) ;
|
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_SSL,psids) ;
|
||||||
|
|
||||||
dialog.setWindowTitle(caption) ;
|
dialog.setWindowTitle(caption) ;
|
||||||
|
|
||||||
if(QDialog::Rejected == dialog.exec())
|
if(QDialog::Rejected == dialog.exec())
|
||||||
return std::list<RsGxsId>() ;
|
return std::set<RsGxsId>() ;
|
||||||
|
|
||||||
std::list<RsGxsId> sids ;
|
std::set<RsGxsId> sids ;
|
||||||
dialog.friends_widget->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(sids,false) ;
|
dialog.friends_widget->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(sids,false) ;
|
||||||
|
|
||||||
return sids ;
|
return sids ;
|
||||||
@ -71,7 +71,7 @@ FriendSelectionDialog::FriendSelectionDialog(QWidget *parent,const QString& head
|
|||||||
FriendSelectionWidget::Modus modus,
|
FriendSelectionWidget::Modus modus,
|
||||||
FriendSelectionWidget::ShowTypes show_type,
|
FriendSelectionWidget::ShowTypes show_type,
|
||||||
FriendSelectionWidget::IdType pre_selected_id_type,
|
FriendSelectionWidget::IdType pre_selected_id_type,
|
||||||
const std::list<std::string>& pre_selected_ids)
|
const std::set<std::string>& pre_selected_ids)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
friends_widget = new FriendSelectionWidget(this) ;
|
friends_widget = new FriendSelectionWidget(this) ;
|
||||||
|
@ -8,26 +8,26 @@
|
|||||||
class FriendSelectionDialog : public QDialog
|
class FriendSelectionDialog : public QDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::list<RsPgpId> selectFriends_PGP(QWidget *parent,const QString& caption,const QString& header_string,
|
static std::set<RsPgpId> selectFriends_PGP(QWidget *parent,const QString& caption,const QString& header_string,
|
||||||
FriendSelectionWidget::Modus modus = FriendSelectionWidget::MODUS_MULTI,
|
FriendSelectionWidget::Modus modus = FriendSelectionWidget::MODUS_MULTI,
|
||||||
FriendSelectionWidget::ShowTypes = FriendSelectionWidget::SHOW_GROUP,
|
FriendSelectionWidget::ShowTypes = FriendSelectionWidget::SHOW_GROUP,
|
||||||
const std::list<RsPgpId>& pre_selected_ids = std::list<RsPgpId>()) ;
|
const std::set<RsPgpId>& pre_selected_ids = std::set<RsPgpId>()) ;
|
||||||
|
|
||||||
static std::list<RsPeerId> selectFriends_SSL(QWidget *parent,const QString& caption,const QString& header_string,
|
static std::set<RsPeerId> selectFriends_SSL(QWidget *parent,const QString& caption,const QString& header_string,
|
||||||
FriendSelectionWidget::Modus modus = FriendSelectionWidget::MODUS_MULTI,
|
FriendSelectionWidget::Modus modus = FriendSelectionWidget::MODUS_MULTI,
|
||||||
FriendSelectionWidget::ShowTypes = FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL,
|
FriendSelectionWidget::ShowTypes = FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL,
|
||||||
const std::list<RsPeerId>& pre_selected_ids = std::list<RsPeerId>()) ;
|
const std::set<RsPeerId>& pre_selected_ids = std::set<RsPeerId>()) ;
|
||||||
|
|
||||||
static std::list<RsGxsId> selectFriends_GXS(QWidget *parent,const QString& caption,const QString& header_string,
|
static std::set<RsGxsId> selectFriends_GXS(QWidget *parent,const QString& caption,const QString& header_string,
|
||||||
FriendSelectionWidget::Modus modus = FriendSelectionWidget::MODUS_MULTI,
|
FriendSelectionWidget::Modus modus = FriendSelectionWidget::MODUS_MULTI,
|
||||||
FriendSelectionWidget::ShowTypes = FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_GXS,
|
FriendSelectionWidget::ShowTypes = FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_GXS,
|
||||||
const std::list<RsGxsId>& pre_selected_ids = std::list<RsGxsId>()) ;
|
const std::set<RsGxsId>& pre_selected_ids = std::set<RsGxsId>()) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~FriendSelectionDialog() ;
|
virtual ~FriendSelectionDialog() ;
|
||||||
FriendSelectionDialog(QWidget *parent,const QString& header_string,FriendSelectionWidget::Modus modus,FriendSelectionWidget::ShowTypes show_type,
|
FriendSelectionDialog(QWidget *parent,const QString& header_string,FriendSelectionWidget::Modus modus,FriendSelectionWidget::ShowTypes show_type,
|
||||||
FriendSelectionWidget::IdType pre_selected_id_type,
|
FriendSelectionWidget::IdType pre_selected_id_type,
|
||||||
const std::list<std::string>& pre_selected_ids) ;
|
const std::set<std::string>& pre_selected_ids) ;
|
||||||
|
|
||||||
FriendSelectionWidget *friends_widget ;
|
FriendSelectionWidget *friends_widget ;
|
||||||
};
|
};
|
||||||
|
@ -266,22 +266,22 @@ void FriendSelectionWidget::secured_fillList()
|
|||||||
mInFillList = true;
|
mInFillList = true;
|
||||||
|
|
||||||
// get selected items
|
// get selected items
|
||||||
std::list<RsPeerId> sslIdsSelected;
|
std::set<RsPeerId> sslIdsSelected;
|
||||||
if (mShowTypes & SHOW_SSL) {
|
if (mShowTypes & SHOW_SSL) {
|
||||||
selectedIds<RsPeerId,IDTYPE_SSL>(sslIdsSelected,true);
|
selectedIds<RsPeerId,IDTYPE_SSL>(sslIdsSelected,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> groupIdsSelected;
|
std::set<std::string> groupIdsSelected;
|
||||||
if (mShowTypes & SHOW_GROUP) {
|
if (mShowTypes & SHOW_GROUP) {
|
||||||
selectedIds<std::string,IDTYPE_GROUP>(groupIdsSelected,true);
|
selectedIds<std::string,IDTYPE_GROUP>(groupIdsSelected,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsPgpId> gpgIdsSelected;
|
std::set<RsPgpId> gpgIdsSelected;
|
||||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||||
selectedIds<RsPgpId,IDTYPE_GPG>(gpgIdsSelected,true);
|
selectedIds<RsPgpId,IDTYPE_GPG>(gpgIdsSelected,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsGxsId> gxsIdsSelected;
|
std::set<RsGxsId> gxsIdsSelected;
|
||||||
if (mShowTypes & SHOW_GXS)
|
if (mShowTypes & SHOW_GXS)
|
||||||
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
|
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
|
||||||
|
|
||||||
@ -881,7 +881,7 @@ std::string FriendSelectionWidget::selectedId(IdType &idType)
|
|||||||
return idFromItem(item);
|
return idFromItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::selectedIds(IdType idType, std::list<std::string> &ids, bool onlyDirectSelected)
|
void FriendSelectionWidget::selectedIds(IdType idType, std::set<std::string> &ids, bool onlyDirectSelected)
|
||||||
{
|
{
|
||||||
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
||||||
QTreeWidgetItem *item;
|
QTreeWidgetItem *item;
|
||||||
@ -938,7 +938,7 @@ void FriendSelectionWidget::selectedIds(IdType idType, std::list<std::string> &i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!id.empty() && std::find(ids.begin(), ids.end(), id) == ids.end()) {
|
if (!id.empty() && std::find(ids.begin(), ids.end(), id) == ids.end()) {
|
||||||
ids.push_back(id);
|
ids.insert(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -955,7 +955,7 @@ void FriendSelectionWidget::selectAll()
|
|||||||
setSelected(mListModus, *itemIterator, true);
|
setSelected(mListModus, *itemIterator, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::setSelectedIds(IdType idType, const std::list<std::string> &ids, bool add)
|
void FriendSelectionWidget::setSelectedIds(IdType idType, const std::set<std::string> &ids, bool add)
|
||||||
{
|
{
|
||||||
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
||||||
QTreeWidgetItem *item;
|
QTreeWidgetItem *item;
|
||||||
@ -973,7 +973,7 @@ void FriendSelectionWidget::setSelectedIds(IdType idType, const std::list<std::s
|
|||||||
case IDTYPE_SSL:
|
case IDTYPE_SSL:
|
||||||
case IDTYPE_GXS:
|
case IDTYPE_GXS:
|
||||||
if (idType == itemType) {
|
if (idType == itemType) {
|
||||||
if (std::find(ids.begin(), ids.end(), id) != ids.end()) {
|
if (ids.find(id) != ids.end()) {
|
||||||
setSelected(mListModus, item, true);
|
setSelected(mListModus, item, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -83,19 +83,19 @@ public:
|
|||||||
int selectedItemCount();
|
int selectedItemCount();
|
||||||
std::string selectedId(IdType &idType);
|
std::string selectedId(IdType &idType);
|
||||||
|
|
||||||
template<class ID_CLASS,FriendSelectionWidget::IdType TYPE> void selectedIds(std::list<ID_CLASS>& ids, bool onlyDirectSelected)
|
template<class ID_CLASS,FriendSelectionWidget::IdType TYPE> void selectedIds(std::set<ID_CLASS>& ids, bool onlyDirectSelected)
|
||||||
{
|
{
|
||||||
std::list<std::string> tmpids ;
|
std::set<std::string> tmpids ;
|
||||||
selectedIds(TYPE, tmpids, onlyDirectSelected);
|
selectedIds(TYPE, tmpids, onlyDirectSelected);
|
||||||
ids.clear() ;
|
ids.clear() ;
|
||||||
for(std::list<std::string>::const_iterator it(tmpids.begin());it!=tmpids.end();++it)
|
for(std::set<std::string>::const_iterator it(tmpids.begin());it!=tmpids.end();++it)
|
||||||
ids.push_back(ID_CLASS(*it)) ;
|
ids.insert(ID_CLASS(*it)) ;
|
||||||
}
|
}
|
||||||
template<class ID_CLASS,FriendSelectionWidget::IdType TYPE> void setSelectedIds(const std::list<ID_CLASS>& ids, bool add)
|
template<class ID_CLASS,FriendSelectionWidget::IdType TYPE> void setSelectedIds(const std::set<ID_CLASS>& ids, bool add)
|
||||||
{
|
{
|
||||||
std::list<std::string> tmpids ;
|
std::set<std::string> tmpids ;
|
||||||
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)
|
||||||
tmpids.push_back((*it).toStdString()) ;
|
tmpids.insert((*it).toStdString()) ;
|
||||||
setSelectedIds(TYPE, tmpids, add);
|
setSelectedIds(TYPE, tmpids, add);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,8 +137,8 @@ private:
|
|||||||
void secured_fillList();
|
void secured_fillList();
|
||||||
bool filterItem(QTreeWidgetItem *item, const QString &text);
|
bool filterItem(QTreeWidgetItem *item, const QString &text);
|
||||||
|
|
||||||
void selectedIds(IdType idType, std::list<std::string> &ids, bool onlyDirectSelected);
|
void selectedIds(IdType idType, std::set<std::string> &ids, bool onlyDirectSelected);
|
||||||
void setSelectedIds(IdType idType, const std::list<std::string> &ids, bool add);
|
void setSelectedIds(IdType idType, const std::set<std::string> &ids, bool add);
|
||||||
|
|
||||||
void requestGXSIdList() ;
|
void requestGXSIdList() ;
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ bool ConnectFriendWizard::validateCurrentPage()
|
|||||||
break;
|
break;
|
||||||
case Page_FriendRecommendations:
|
case Page_FriendRecommendations:
|
||||||
{
|
{
|
||||||
std::list<RsPeerId> recommendIds;
|
std::set<RsPeerId> recommendIds;
|
||||||
ui->frec_recommendList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(recommendIds, false);
|
ui->frec_recommendList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(recommendIds, false);
|
||||||
|
|
||||||
if (recommendIds.empty()) {
|
if (recommendIds.empty()) {
|
||||||
@ -570,7 +570,7 @@ bool ConnectFriendWizard::validateCurrentPage()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsPeerId> toIds;
|
std::set<RsPeerId> toIds;
|
||||||
ui->frec_toList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(toIds, false);
|
ui->frec_toList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(toIds, false);
|
||||||
|
|
||||||
if (toIds.empty()) {
|
if (toIds.empty()) {
|
||||||
@ -578,7 +578,7 @@ bool ConnectFriendWizard::validateCurrentPage()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsPeerId>::iterator toId;
|
std::set<RsPeerId>::iterator toId;
|
||||||
for (toId = toIds.begin(); toId != toIds.end(); ++toId) {
|
for (toId = toIds.begin(); toId != toIds.end(); ++toId) {
|
||||||
MessageComposer::recommendFriend(recommendIds, *toId, ui->frec_messageEdit->toHtml(), true);
|
MessageComposer::recommendFriend(recommendIds, *toId, ui->frec_messageEdit->toHtml(), true);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ void ChatMsgItem::sendMessage()
|
|||||||
|
|
||||||
mi.title = tr("Quick Message").toUtf8().constData();
|
mi.title = tr("Quick Message").toUtf8().constData();
|
||||||
mi.msg = quickmsgText->toHtml().toUtf8().constData();
|
mi.msg = quickmsgText->toHtml().toUtf8().constData();
|
||||||
mi.rspeerid_msgto.push_back(mPeerId);
|
mi.rspeerid_msgto.insert(mPeerId);
|
||||||
|
|
||||||
rsMail->MessageSend(mi);
|
rsMail->MessageSend(mi);
|
||||||
|
|
||||||
|
@ -131,12 +131,12 @@ void CreateGroup::changeGroup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsPgpId> gpgIds;
|
std::set<RsPgpId> gpgIds;
|
||||||
ui.friendList->selectedIds<RsPgpId,FriendSelectionWidget::IDTYPE_GPG>(gpgIds, true);
|
ui.friendList->selectedIds<RsPgpId,FriendSelectionWidget::IDTYPE_GPG>(gpgIds, true);
|
||||||
|
|
||||||
std::list<RsPgpId>::iterator it;
|
std::set<RsPgpId>::iterator it;
|
||||||
for (it = groupInfo.peerIds.begin(); it != groupInfo.peerIds.end(); ++it) {
|
for (it = groupInfo.peerIds.begin(); it != groupInfo.peerIds.end(); ++it) {
|
||||||
std::list<RsPgpId>::iterator gpgIt = std::find(gpgIds.begin(), gpgIds.end(), *it);
|
std::set<RsPgpId>::iterator gpgIt = std::find(gpgIds.begin(), gpgIds.end(), *it);
|
||||||
if (gpgIt == gpgIds.end()) {
|
if (gpgIt == gpgIds.end()) {
|
||||||
rsPeers->assignPeerToGroup(groupInfo.id, *it, false);
|
rsPeers->assignPeerToGroup(groupInfo.id, *it, false);
|
||||||
continue;
|
continue;
|
||||||
|
@ -110,7 +110,7 @@ void GroupShareKey::setTyp()
|
|||||||
|
|
||||||
void GroupShareKey::shareKey()
|
void GroupShareKey::shareKey()
|
||||||
{
|
{
|
||||||
std::list<RsPeerId> shareList;
|
std::set<RsPeerId> shareList;
|
||||||
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
|
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
|
||||||
|
|
||||||
if (shareList.empty()) {
|
if (shareList.empty()) {
|
||||||
|
@ -451,12 +451,12 @@ void MessageComposer::processSettings(bool bLoad)
|
|||||||
/* window will destroy itself! */
|
/* window will destroy itself! */
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString buildRecommendHtml(const std::list<RsPeerId> &sslIds, const RsPeerId& excludeId = RsPeerId())
|
static QString buildRecommendHtml(const std::set<RsPeerId> &sslIds, const RsPeerId& excludeId = RsPeerId())
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
/* process ssl ids */
|
/* process ssl ids */
|
||||||
std::list <RsPeerId>::const_iterator sslIt;
|
std::set <RsPeerId>::const_iterator sslIt;
|
||||||
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); ++sslIt) {
|
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); ++sslIt) {
|
||||||
if (*sslIt == excludeId) {
|
if (*sslIt == excludeId) {
|
||||||
continue;
|
continue;
|
||||||
@ -475,7 +475,7 @@ QString MessageComposer::recommendMessage()
|
|||||||
return tr("Hello,<br>I recommend a good friend of mine; you can trust them too when you trust me. <br>");
|
return tr("Hello,<br>I recommend a good friend of mine; you can trust them too when you trust me. <br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::recommendFriend(const std::list <RsPeerId> &sslIds, const RsPeerId &to, const QString &msg, bool autoSend)
|
void MessageComposer::recommendFriend(const std::set <RsPeerId> &sslIds, const RsPeerId &to, const QString &msg, bool autoSend)
|
||||||
{
|
{
|
||||||
// std::cerr << "MessageComposer::recommendFriend()" << std::endl;
|
// std::cerr << "MessageComposer::recommendFriend()" << std::endl;
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ void MessageComposer::recommendFriend(const std::list <RsPeerId> &sslIds, const
|
|||||||
sMsgText += tr("Thanks, <br>") + QString::fromUtf8(rsPeers->getGPGName(rsPeers->getGPGOwnId()).c_str());
|
sMsgText += tr("Thanks, <br>") + QString::fromUtf8(rsPeers->getGPGName(rsPeers->getGPGOwnId()).c_str());
|
||||||
composer->setMsgText(sMsgText);
|
composer->setMsgText(sMsgText);
|
||||||
|
|
||||||
std::list <RsPeerId>::const_iterator peerIt;
|
std::set <RsPeerId>::const_iterator peerIt;
|
||||||
for (peerIt = sslIds.begin(); peerIt != sslIds.end(); ++peerIt) {
|
for (peerIt = sslIds.begin(); peerIt != sslIds.end(); ++peerIt) {
|
||||||
if (*peerIt == to) {
|
if (*peerIt == to) {
|
||||||
continue;
|
continue;
|
||||||
@ -876,7 +876,7 @@ static void calculateGroupsOfSslIds(const std::list<RsGroupInfo> &existingGroupI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// iterate all assigned peers (gpg id's)
|
// iterate all assigned peers (gpg id's)
|
||||||
std::list<RsPgpId>::const_iterator peerIt;
|
std::set<RsPgpId>::const_iterator peerIt;
|
||||||
for (peerIt = groupInfoIt->peerIds.begin(); peerIt != groupInfoIt->peerIds.end(); ++peerIt) {
|
for (peerIt = groupInfoIt->peerIds.begin(); peerIt != groupInfoIt->peerIds.end(); ++peerIt) {
|
||||||
std::list<RsPeerId> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
|
|
||||||
@ -913,7 +913,7 @@ static void calculateGroupsOfSslIds(const std::list<RsGroupInfo> &existingGroupI
|
|||||||
// remove all ssl id's of all found groups from the list
|
// remove all ssl id's of all found groups from the list
|
||||||
for (groupInfoIt = groupInfos.begin(); groupInfoIt != groupInfos.end(); ++groupInfoIt) {
|
for (groupInfoIt = groupInfos.begin(); groupInfoIt != groupInfos.end(); ++groupInfoIt) {
|
||||||
// iterate all assigned peers (gpg id's)
|
// iterate all assigned peers (gpg id's)
|
||||||
std::list<RsPgpId>::const_iterator peerIt;
|
std::set<RsPgpId>::const_iterator peerIt;
|
||||||
for (peerIt = groupInfoIt->peerIds.begin(); peerIt != groupInfoIt->peerIds.end(); ++peerIt) {
|
for (peerIt = groupInfoIt->peerIds.begin(); peerIt != groupInfoIt->peerIds.end(); ++peerIt) {
|
||||||
std::list<RsPeerId> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
|
|
||||||
@ -997,12 +997,12 @@ MessageComposer *MessageComposer::newMsg(const std::string &msgId /* = ""*/)
|
|||||||
// msgComposer->addRecipient(MessageComposer::BCC, *groupIt, true) ;
|
// msgComposer->addRecipient(MessageComposer::BCC, *groupIt, true) ;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
for (std::list<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgto.begin(); it != msgInfo.rspeerid_msgto.end(); ++it ) msgComposer->addRecipient(MessageComposer::TO, *it) ;
|
for (std::set<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgto.begin(); it != msgInfo.rspeerid_msgto.end(); ++it ) msgComposer->addRecipient(MessageComposer::TO, *it) ;
|
||||||
for (std::list<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgcc.begin(); it != msgInfo.rspeerid_msgcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::CC, *it) ;
|
for (std::set<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgcc.begin(); it != msgInfo.rspeerid_msgcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::CC, *it) ;
|
||||||
for (std::list<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgbcc.begin(); it != msgInfo.rspeerid_msgbcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::BCC, *it) ;
|
for (std::set<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgbcc.begin(); it != msgInfo.rspeerid_msgbcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::BCC, *it) ;
|
||||||
for (std::list<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgto.begin(); it != msgInfo.rsgxsid_msgto.end(); ++it ) msgComposer->addRecipient(MessageComposer::TO, *it) ;
|
for (std::set<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgto.begin(); it != msgInfo.rsgxsid_msgto.end(); ++it ) msgComposer->addRecipient(MessageComposer::TO, *it) ;
|
||||||
for (std::list<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgcc.begin(); it != msgInfo.rsgxsid_msgcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::CC, *it) ;
|
for (std::set<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgcc.begin(); it != msgInfo.rsgxsid_msgcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::CC, *it) ;
|
||||||
for (std::list<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgbcc.begin(); it != msgInfo.rsgxsid_msgbcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::BCC, *it) ;
|
for (std::set<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgbcc.begin(); it != msgInfo.rsgxsid_msgbcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::BCC, *it) ;
|
||||||
|
|
||||||
MsgTagInfo tagInfo;
|
MsgTagInfo tagInfo;
|
||||||
rsMail->getMessageTag(msgId, tagInfo);
|
rsMail->getMessageTag(msgId, tagInfo);
|
||||||
@ -1024,7 +1024,7 @@ QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
|
|||||||
QString from = link.toHtml();
|
QString from = link.toHtml();
|
||||||
|
|
||||||
QString to;
|
QString to;
|
||||||
for ( std::list<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgto.begin(); it != msgInfo.rspeerid_msgto.end(); ++it)
|
for ( std::set<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgto.begin(); it != msgInfo.rspeerid_msgto.end(); ++it)
|
||||||
if (link.createMessage(*it, ""))
|
if (link.createMessage(*it, ""))
|
||||||
{
|
{
|
||||||
if (!to.isEmpty())
|
if (!to.isEmpty())
|
||||||
@ -1032,7 +1032,7 @@ QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
|
|||||||
|
|
||||||
to += link.toHtml();
|
to += link.toHtml();
|
||||||
}
|
}
|
||||||
for ( std::list<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgto.begin(); it != msgInfo.rsgxsid_msgto.end(); ++it)
|
for ( std::set<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgto.begin(); it != msgInfo.rsgxsid_msgto.end(); ++it)
|
||||||
if (link.createMessage(*it, ""))
|
if (link.createMessage(*it, ""))
|
||||||
{
|
{
|
||||||
if (!to.isEmpty())
|
if (!to.isEmpty())
|
||||||
@ -1043,14 +1043,14 @@ QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
|
|||||||
|
|
||||||
|
|
||||||
QString cc;
|
QString cc;
|
||||||
for (std::list<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgcc.begin(); it != msgInfo.rspeerid_msgcc.end(); ++it)
|
for (std::set<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgcc.begin(); it != msgInfo.rspeerid_msgcc.end(); ++it)
|
||||||
if (link.createMessage(*it, "")) {
|
if (link.createMessage(*it, "")) {
|
||||||
if (!cc.isEmpty()) {
|
if (!cc.isEmpty()) {
|
||||||
cc += ", ";
|
cc += ", ";
|
||||||
}
|
}
|
||||||
cc += link.toHtml();
|
cc += link.toHtml();
|
||||||
}
|
}
|
||||||
for (std::list<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgcc.begin(); it != msgInfo.rsgxsid_msgcc.end(); ++it)
|
for (std::set<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgcc.begin(); it != msgInfo.rsgxsid_msgcc.end(); ++it)
|
||||||
if (link.createMessage(*it, "")) {
|
if (link.createMessage(*it, "")) {
|
||||||
if (!cc.isEmpty()) {
|
if (!cc.isEmpty()) {
|
||||||
cc += ", ";
|
cc += ", ";
|
||||||
@ -1137,19 +1137,19 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
|
|||||||
{
|
{
|
||||||
RsPeerId ownId = rsPeers->getOwnId();
|
RsPeerId ownId = rsPeers->getOwnId();
|
||||||
|
|
||||||
for (std::list<RsPeerId>::iterator tli = msgInfo.rspeerid_msgto.begin(); tli != msgInfo.rspeerid_msgto.end(); ++tli)
|
for (std::set<RsPeerId>::iterator tli = msgInfo.rspeerid_msgto.begin(); tli != msgInfo.rspeerid_msgto.end(); ++tli)
|
||||||
if (ownId != *tli)
|
if (ownId != *tli)
|
||||||
msgComposer->addRecipient(MessageComposer::TO, *tli) ;
|
msgComposer->addRecipient(MessageComposer::TO, *tli) ;
|
||||||
|
|
||||||
for (std::list<RsPeerId>::iterator tli = msgInfo.rspeerid_msgcc.begin(); tli != msgInfo.rspeerid_msgcc.end(); ++tli)
|
for (std::set<RsPeerId>::iterator tli = msgInfo.rspeerid_msgcc.begin(); tli != msgInfo.rspeerid_msgcc.end(); ++tli)
|
||||||
if (ownId != *tli)
|
if (ownId != *tli)
|
||||||
msgComposer->addRecipient(MessageComposer::TO, *tli) ;
|
msgComposer->addRecipient(MessageComposer::TO, *tli) ;
|
||||||
|
|
||||||
for (std::list<RsGxsId>::iterator tli = msgInfo.rsgxsid_msgto.begin(); tli != msgInfo.rsgxsid_msgto.end(); ++tli)
|
for (std::set<RsGxsId>::iterator tli = msgInfo.rsgxsid_msgto.begin(); tli != msgInfo.rsgxsid_msgto.end(); ++tli)
|
||||||
//if (ownId != *tli)
|
//if (ownId != *tli)
|
||||||
msgComposer->addRecipient(MessageComposer::TO, *tli) ;
|
msgComposer->addRecipient(MessageComposer::TO, *tli) ;
|
||||||
|
|
||||||
for (std::list<RsGxsId>::iterator tli = msgInfo.rsgxsid_msgcc.begin(); tli != msgInfo.rsgxsid_msgcc.end(); ++tli)
|
for (std::set<RsGxsId>::iterator tli = msgInfo.rsgxsid_msgcc.begin(); tli != msgInfo.rsgxsid_msgcc.end(); ++tli)
|
||||||
//if (ownId != *tli)
|
//if (ownId != *tli)
|
||||||
msgComposer->addRecipient(MessageComposer::TO, *tli) ;
|
msgComposer->addRecipient(MessageComposer::TO, *tli) ;
|
||||||
}
|
}
|
||||||
@ -1245,8 +1245,6 @@ void MessageComposer::sendMessage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> void addUnique(std::list<T>& lst,const T& t) { if(std::find(lst.begin(),lst.end(),t) == lst.end()) lst.push_back(t) ; }
|
|
||||||
|
|
||||||
bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
||||||
{
|
{
|
||||||
/* construct a message */
|
/* construct a message */
|
||||||
@ -1316,7 +1314,7 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsPgpId>::const_iterator groupIt;
|
std::set<RsPgpId>::const_iterator groupIt;
|
||||||
for (groupIt = groupInfo.peerIds.begin(); groupIt != groupInfo.peerIds.end(); ++groupIt) {
|
for (groupIt = groupInfo.peerIds.begin(); groupIt != groupInfo.peerIds.end(); ++groupIt) {
|
||||||
std::list<RsPeerId> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
rsPeers->getAssociatedSSLIds(*groupIt, sslIds);
|
rsPeers->getAssociatedSSLIds(*groupIt, sslIds);
|
||||||
@ -1330,11 +1328,11 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case TO: addUnique(mi.rspeerid_msgto,*sslIt);
|
case TO: mi.rspeerid_msgto.insert(*sslIt);
|
||||||
break;
|
break;
|
||||||
case CC: addUnique(mi.rspeerid_msgcc,*sslIt);
|
case CC: mi.rspeerid_msgcc.insert(*sslIt);
|
||||||
break;
|
break;
|
||||||
case BCC:addUnique(mi.rspeerid_msgbcc,*sslIt);
|
case BCC:mi.rspeerid_msgbcc.insert(*sslIt);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1347,11 +1345,11 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case TO: addUnique(mi.rspeerid_msgto,pid);
|
case TO: mi.rspeerid_msgto.insert(pid);
|
||||||
break ;
|
break ;
|
||||||
case CC: addUnique(mi.rspeerid_msgcc,pid);
|
case CC: mi.rspeerid_msgcc.insert(pid);
|
||||||
break ;
|
break ;
|
||||||
case BCC:addUnique(mi.rspeerid_msgbcc,pid);
|
case BCC:mi.rspeerid_msgbcc.insert(pid);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1362,11 +1360,11 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case TO: addUnique(mi.rsgxsid_msgto,gid) ;
|
case TO: mi.rsgxsid_msgto.insert(gid) ;
|
||||||
break ;
|
break ;
|
||||||
case CC: addUnique(mi.rsgxsid_msgcc,gid) ;
|
case CC: mi.rsgxsid_msgcc.insert(gid) ;
|
||||||
break ;
|
break ;
|
||||||
case BCC:addUnique(mi.rsgxsid_msgbcc,gid) ;
|
case BCC:mi.rsgxsid_msgbcc.insert(gid) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2472,16 +2470,16 @@ void MessageComposer::fileHashingFinished(QList<HashedFile> hashedFiles)
|
|||||||
|
|
||||||
void MessageComposer::addContact(enumType type)
|
void MessageComposer::addContact(enumType type)
|
||||||
{
|
{
|
||||||
std::list<RsPeerId> peerIds ;
|
std::set<RsPeerId> peerIds ;
|
||||||
ui.friendSelectionWidget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(peerIds, false);
|
ui.friendSelectionWidget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(peerIds, false);
|
||||||
|
|
||||||
for (std::list<RsPeerId>::const_iterator idIt = peerIds.begin(); idIt != peerIds.end(); ++idIt)
|
for (std::set<RsPeerId>::const_iterator idIt = peerIds.begin(); idIt != peerIds.end(); ++idIt)
|
||||||
addRecipient(type, *idIt);
|
addRecipient(type, *idIt);
|
||||||
|
|
||||||
std::list<RsGxsId> gxsIds ;
|
std::set<RsGxsId> gxsIds ;
|
||||||
ui.friendSelectionWidget->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(gxsIds, false);
|
ui.friendSelectionWidget->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(gxsIds, false);
|
||||||
|
|
||||||
for (std::list<RsGxsId>::const_iterator idIt = gxsIds.begin(); idIt != gxsIds.end(); ++idIt)
|
for (std::set<RsGxsId>::const_iterator idIt = gxsIds.begin(); idIt != gxsIds.end(); ++idIt)
|
||||||
addRecipient(type, *idIt);
|
addRecipient(type, *idIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2522,18 +2520,18 @@ void MessageComposer::addBcc()
|
|||||||
|
|
||||||
void MessageComposer::addRecommend()
|
void MessageComposer::addRecommend()
|
||||||
{
|
{
|
||||||
std::list<RsPeerId> sslIds;
|
std::set<RsPeerId> sslIds;
|
||||||
ui.friendSelectionWidget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(sslIds, false);
|
ui.friendSelectionWidget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(sslIds, false);
|
||||||
|
|
||||||
std::list<RsGxsId> gxsIds ;
|
std::set<RsGxsId> gxsIds ;
|
||||||
ui.friendSelectionWidget->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(gxsIds, true);
|
ui.friendSelectionWidget->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(gxsIds, true);
|
||||||
|
|
||||||
if (sslIds.empty() && gxsIds.empty())
|
if (sslIds.empty() && gxsIds.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(std::list <RsPeerId>::iterator it = sslIds.begin(); it != sslIds.end(); ++it)
|
for(std::set <RsPeerId>::iterator it = sslIds.begin(); it != sslIds.end(); ++it)
|
||||||
addRecipient(CC, *it);
|
addRecipient(CC, *it);
|
||||||
for (std::list<RsGxsId>::const_iterator it = gxsIds.begin(); it != gxsIds.end(); ++it)
|
for (std::set<RsGxsId>::const_iterator it = gxsIds.begin(); it != gxsIds.end(); ++it)
|
||||||
addRecipient(TO, *it);
|
addRecipient(TO, *it);
|
||||||
|
|
||||||
QString text = buildRecommendHtml(sslIds);
|
QString text = buildRecommendHtml(sslIds);
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
static void msgGroup(const std::string& group_id) ;
|
static void msgGroup(const std::string& group_id) ;
|
||||||
|
|
||||||
static QString recommendMessage();
|
static QString recommendMessage();
|
||||||
static void recommendFriend(const std::list <RsPeerId> &sslIds, const RsPeerId &to = RsPeerId(), const QString &msg = "", bool autoSend = false);
|
static void recommendFriend(const std::set <RsPeerId> &sslIds, const RsPeerId &to = RsPeerId(), const QString &msg = "", bool autoSend = false);
|
||||||
static void sendConnectAttemptMsg(const RsPgpId &gpgId, const RsPeerId &sslId, const QString &sslName);
|
static void sendConnectAttemptMsg(const RsPgpId &gpgId, const RsPeerId &sslId, const QString &sslName);
|
||||||
static void sendChannelPublishKey(RsGxsChannelGroup &group);
|
static void sendChannelPublishKey(RsGxsChannelGroup &group);
|
||||||
static void sendForumPublishKey(RsGxsForumGroup &group);
|
static void sendForumPublishKey(RsGxsForumGroup &group);
|
||||||
|
@ -508,8 +508,8 @@ void MessageWidget::fill(const std::string &msgId)
|
|||||||
RetroShareLink link;
|
RetroShareLink link;
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
for(std::list<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgto.begin(); pit != msgInfo.rspeerid_msgto.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgto.begin(); pit != msgInfo.rspeerid_msgto.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
||||||
for(std::list<RsGxsId >::const_iterator pit = msgInfo.rsgxsid_msgto.begin(); pit != msgInfo.rsgxsid_msgto.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
for(std::set<RsGxsId >::const_iterator pit = msgInfo.rsgxsid_msgto.begin(); pit != msgInfo.rsgxsid_msgto.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
||||||
|
|
||||||
ui.toText->setText(text);
|
ui.toText->setText(text);
|
||||||
|
|
||||||
@ -519,8 +519,8 @@ void MessageWidget::fill(const std::string &msgId)
|
|||||||
ui.ccText->setVisible(true);
|
ui.ccText->setVisible(true);
|
||||||
|
|
||||||
text.clear();
|
text.clear();
|
||||||
for(std::list<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgcc.begin(); pit != msgInfo.rspeerid_msgcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgcc.begin(); pit != msgInfo.rspeerid_msgcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
||||||
for(std::list<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgcc.begin(); pit != msgInfo.rsgxsid_msgcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgcc.begin(); pit != msgInfo.rsgxsid_msgcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
||||||
|
|
||||||
ui.ccText->setText(text);
|
ui.ccText->setText(text);
|
||||||
} else {
|
} else {
|
||||||
@ -535,8 +535,8 @@ void MessageWidget::fill(const std::string &msgId)
|
|||||||
ui.bccText->setVisible(true);
|
ui.bccText->setVisible(true);
|
||||||
|
|
||||||
text.clear();
|
text.clear();
|
||||||
for(std::list<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgbcc.begin(); pit != msgInfo.rspeerid_msgbcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgbcc.begin(); pit != msgInfo.rspeerid_msgbcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
||||||
for(std::list<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgbcc.begin(); pit != msgInfo.rsgxsid_msgbcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgbcc.begin(); pit != msgInfo.rsgxsid_msgbcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
|
||||||
|
|
||||||
ui.bccText->setText(text);
|
ui.bccText->setText(text);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user