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:
csoler 2015-04-17 21:36:22 +00:00
parent f1309a8cbe
commit c9d5c7b3cb
51 changed files with 269 additions and 266 deletions

View File

@ -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) ;

View File

@ -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) ;

View File

@ -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);

View File

@ -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 ;

View File

@ -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:

View File

@ -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

View File

@ -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 ;

View File

@ -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 ;
};

View File

@ -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)
{

View File

@ -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 ;

View File

@ -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)

View File

@ -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 ***********************************************/

View File

@ -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 {

View File

@ -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;

View File

@ -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:

View File

@ -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 */

View File

@ -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;

View File

@ -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 ;
};

View File

@ -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) ;
}

View File

@ -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) ;

View File

@ -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) ;

View File

@ -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);

View File

@ -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;

View File

@ -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 ;

View File

@ -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 ;

View File

@ -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.

View File

@ -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;

View File

@ -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 ;

View File

@ -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);

View File

@ -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)
{

View File

@ -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);

View File

@ -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 ;

View File

@ -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.

View File

@ -55,7 +55,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
ui.setupUi(this);
m_bProcessSettings = false;
myChatLobbyUserNotify = NULL;
myChatLobbyUserNotify = NULL;
QObject::connect( NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&)));
@ -195,29 +195,29 @@ ChatLobbyWidget::~ChatLobbyWidget()
UserNotify *ChatLobbyWidget::getUserNotify(QObject *parent)
{
if (!myChatLobbyUserNotify){
myChatLobbyUserNotify = new ChatLobbyUserNotify(parent);
connect(myChatLobbyUserNotify, SIGNAL(countChanged(ChatLobbyId, unsigned int)), this, SLOT(updateNotify(ChatLobbyId, unsigned int)));
}
return myChatLobbyUserNotify;
}
void ChatLobbyWidget::updateNotify(ChatLobbyId id, unsigned int count)
{
ChatLobbyDialog *dialog=NULL;
dialog=_lobby_infos[id].dialog;
if(!dialog) return;
QToolButton* notifyButton=dialog->getChatWidget()->getNotifyButton();
if (!notifyButton) return;
dialog->getChatWidget()->setNotify(myChatLobbyUserNotify);
if (count>0){
notifyButton->setVisible(true);
notifyButton->setIcon(_lobby_infos[id].default_icon);
notifyButton->setToolTip(QString("(%1)").arg(count));
} else {
notifyButton->setVisible(false);
}
if (!myChatLobbyUserNotify){
myChatLobbyUserNotify = new ChatLobbyUserNotify(parent);
connect(myChatLobbyUserNotify, SIGNAL(countChanged(ChatLobbyId, unsigned int)), this, SLOT(updateNotify(ChatLobbyId, unsigned int)));
}
return myChatLobbyUserNotify;
}
void ChatLobbyWidget::updateNotify(ChatLobbyId id, unsigned int count)
{
ChatLobbyDialog *dialog=NULL;
dialog=_lobby_infos[id].dialog;
if(!dialog) return;
QToolButton* notifyButton=dialog->getChatWidget()->getNotifyButton();
if (!notifyButton) return;
dialog->getChatWidget()->setNotify(myChatLobbyUserNotify);
if (count>0){
notifyButton->setVisible(true);
notifyButton->setIcon(_lobby_infos[id].default_icon);
notifyButton->setToolTip(QString("(%1)").arg(count));
} else {
notifyButton->setVisible(false);
}
}
void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint)
@ -350,7 +350,7 @@ void ChatLobbyWidget::addChatPage(ChatLobbyDialog *d)
connect(d,SIGNAL(lobbyLeave(ChatLobbyId)),this,SLOT(unsubscribeChatLobby(ChatLobbyId))) ;
connect(d,SIGNAL(typingEventReceived(ChatLobbyId)),this,SLOT(updateTypingStatus(ChatLobbyId))) ;
connect(d,SIGNAL(messageReceived(bool,ChatLobbyId,QDateTime,QString,QString)),this,SLOT(updateMessageChanged(bool,ChatLobbyId,QDateTime,QString,QString))) ;
connect(d,SIGNAL(messageReceived(bool,ChatLobbyId,QDateTime,QString,QString)),this,SLOT(updateMessageChanged(bool,ChatLobbyId,QDateTime,QString,QString))) ;
connect(d,SIGNAL(peerJoined(ChatLobbyId)),this,SLOT(updatePeerEntering(ChatLobbyId))) ;
connect(d,SIGNAL(peerLeft(ChatLobbyId)),this,SLOT(updatePeerLeaving(ChatLobbyId))) ;
@ -618,7 +618,7 @@ void ChatLobbyWidget::createChatLobby()
privacyLevel = action->data().toInt();
}
std::list<RsPeerId> friends;
std::set<RsPeerId> friends;
CreateLobbyDialog(friends, privacyLevel).exec();
}
@ -636,7 +636,7 @@ void ChatLobbyWidget::showLobby(QTreeWidgetItem *item)
else
ui.stackedWidget->setCurrentWidget(_lobby_infos[id].dialog) ;
}
void ChatLobbyWidget::subscribeChatLobbyAs()
{
QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem();
@ -656,31 +656,31 @@ void ChatLobbyWidget::subscribeChatLobbyAs()
if(rsMsgs->joinVisibleChatLobby(id,gxs_id))
ChatDialog::chatFriend(ChatId(id),true) ;
}
void ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
{
QTreeWidgetItem *item = getTreeWidgetItem(id) ;
if(item != NULL) {
if(item->type() == TYPE_LOBBY) {
if(_lobby_infos.find(id) == _lobby_infos.end()) {
showBlankPage(id) ;
} else {
//ChatLobbyDialog cldChatLobby =_lobby_infos[id].dialog;
ui.stackedWidget->setCurrentWidget(_lobby_infos[id].dialog) ;
ChatLobbyDialog *cldCW=NULL ;
if (NULL != (cldCW = dynamic_cast<ChatLobbyDialog *>(ui.stackedWidget->currentWidget())))
cldCW->getChatWidget()->scrollToAnchor(anchor);
ui.lobbyTreeWidget->setCurrentItem(item);
}
}
}
}
void ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
{
QTreeWidgetItem *item = getTreeWidgetItem(id) ;
if(item != NULL) {
if(item->type() == TYPE_LOBBY) {
if(_lobby_infos.find(id) == _lobby_infos.end()) {
showBlankPage(id) ;
} else {
//ChatLobbyDialog cldChatLobby =_lobby_infos[id].dialog;
ui.stackedWidget->setCurrentWidget(_lobby_infos[id].dialog) ;
ChatLobbyDialog *cldCW=NULL ;
if (NULL != (cldCW = dynamic_cast<ChatLobbyDialog *>(ui.stackedWidget->currentWidget())))
cldCW->getChatWidget()->scrollToAnchor(anchor);
ui.lobbyTreeWidget->setCurrentItem(item);
}
}
}
}
void ChatLobbyWidget::subscribeChatLobbyAtItem(QTreeWidgetItem *item)
{
if (item == NULL || item->type() != TYPE_LOBBY) {
@ -853,10 +853,10 @@ void ChatLobbyWidget::unsubscribeChatLobby(ChatLobbyId id)
if(it != _lobby_infos.end())
{
if (myChatLobbyUserNotify){
myChatLobbyUserNotify->chatLobbyCleared(id, "");
}
if (myChatLobbyUserNotify){
myChatLobbyUserNotify->chatLobbyCleared(id, "");
}
ui.stackedWidget->removeWidget(it->second.dialog) ;
_lobby_infos.erase(it) ;
}
@ -906,18 +906,18 @@ void ChatLobbyWidget::updateCurrentLobby()
filterItems(ui.filterLineEdit->text());
}
}
void ChatLobbyWidget::updateMessageChanged(bool incoming, ChatLobbyId id, QDateTime time, QString senderName, QString msg)
void ChatLobbyWidget::updateMessageChanged(bool incoming, ChatLobbyId id, QDateTime time, QString senderName, QString msg)
{
QTreeWidgetItem *current_item = ui.lobbyTreeWidget->currentItem();
bool bIsCurrentItem = (current_item != NULL && current_item->data(COLUMN_DATA, ROLE_ID).toULongLong() == id);
if (myChatLobbyUserNotify){
if (incoming) myChatLobbyUserNotify->chatLobbyNewMessage(id, time, senderName, msg);
}
bool bIsCurrentItem = (current_item != NULL && current_item->data(COLUMN_DATA, ROLE_ID).toULongLong() == id);
if (myChatLobbyUserNotify){
if (incoming) myChatLobbyUserNotify->chatLobbyNewMessage(id, time, senderName, msg);
}
// Don't show anything for current lobby.
//
if(bIsCurrentItem)
if(bIsCurrentItem)
return ;
_lobby_infos[id].default_icon = QIcon(IMAGE_MESSAGE) ;

View File

@ -1125,7 +1125,7 @@ void MessagesDialog::insertMessages()
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())
text += ", ";
@ -1136,7 +1136,7 @@ void MessagesDialog::insertMessages()
else
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())
text += ", ";

View File

@ -225,7 +225,7 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
void NetworkDialog::removeUnusedKeys()
{
std::list<RsPgpId> pre_selected ;
std::set<RsPgpId> pre_selected ;
std::list<RsPgpId> ids ;
rsPeers->getGPGAllList(ids) ;
@ -245,17 +245,17 @@ void NetworkDialog::removeUnusedKeys()
if(now > (time_t) (THREE_MONTHS + details.lastUsed))
{
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("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) ;
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::string backup_file ;

View File

@ -136,14 +136,14 @@ void ChatLobbyDialog::inviteFriends()
{
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;
if (!mChatId.isLobbyId())
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;

View File

@ -33,7 +33,7 @@
#include "ChatDialog.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)
{
ui = new Ui::CreateLobbyDialog() ;
@ -109,7 +109,7 @@ void CreateLobbyDialog::checkTextFields()
void CreateLobbyDialog::createLobby()
{
std::list<RsPeerId> shareList;
std::set<RsPeerId> shareList;
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
// if (shareList.empty()) {

View File

@ -13,7 +13,7 @@ public:
/*
*@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();
protected:

View File

@ -1343,8 +1343,11 @@ void FriendList::recommendfriend()
default:
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()
@ -1596,7 +1599,7 @@ void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &s
{
RsGroupInfo 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) {
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
}

View File

@ -4,65 +4,65 @@
#include <QDialogButtonBox>
#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::ShowTypes show_type,
const std::list<RsPgpId>& pre_selected_ids)
const std::set<RsPgpId>& pre_selected_ids)
{
std::list<std::string> psids ;
for(std::list<RsPgpId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
psids.push_back( (*it).toStdString() ) ;
std::set<std::string> psids ;
for(std::set<RsPgpId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
psids.insert( (*it).toStdString() ) ;
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_GPG,psids) ;
dialog.setWindowTitle(caption) ;
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) ;
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::ShowTypes show_type,
const std::list<RsPeerId>& pre_selected_ids)
const std::set<RsPeerId>& pre_selected_ids)
{
std::list<std::string> psids ;
for(std::list<RsPeerId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
psids.push_back( (*it).toStdString() ) ;
std::set<std::string> psids ;
for(std::set<RsPeerId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
psids.insert( (*it).toStdString() ) ;
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_SSL,psids) ;
dialog.setWindowTitle(caption) ;
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) ;
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::ShowTypes show_type,
const std::list<RsGxsId>& pre_selected_ids)
const std::set<RsGxsId>& pre_selected_ids)
{
std::list<std::string> psids ;
for(std::list<RsGxsId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
psids.push_back( (*it).toStdString() ) ;
std::set<std::string> psids ;
for(std::set<RsGxsId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
psids.insert( (*it).toStdString() ) ;
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_SSL,psids) ;
dialog.setWindowTitle(caption) ;
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) ;
return sids ;
@ -71,7 +71,7 @@ FriendSelectionDialog::FriendSelectionDialog(QWidget *parent,const QString& head
FriendSelectionWidget::Modus modus,
FriendSelectionWidget::ShowTypes show_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)
{
friends_widget = new FriendSelectionWidget(this) ;

View File

@ -8,26 +8,26 @@
class FriendSelectionDialog : public QDialog
{
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::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::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::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:
virtual ~FriendSelectionDialog() ;
FriendSelectionDialog(QWidget *parent,const QString& header_string,FriendSelectionWidget::Modus modus,FriendSelectionWidget::ShowTypes show_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 ;
};

View File

@ -266,22 +266,22 @@ void FriendSelectionWidget::secured_fillList()
mInFillList = true;
// get selected items
std::list<RsPeerId> sslIdsSelected;
std::set<RsPeerId> sslIdsSelected;
if (mShowTypes & SHOW_SSL) {
selectedIds<RsPeerId,IDTYPE_SSL>(sslIdsSelected,true);
}
std::list<std::string> groupIdsSelected;
std::set<std::string> groupIdsSelected;
if (mShowTypes & SHOW_GROUP) {
selectedIds<std::string,IDTYPE_GROUP>(groupIdsSelected,true);
}
std::list<RsPgpId> gpgIdsSelected;
std::set<RsPgpId> gpgIdsSelected;
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
selectedIds<RsPgpId,IDTYPE_GPG>(gpgIdsSelected,true);
}
std::list<RsGxsId> gxsIdsSelected;
std::set<RsGxsId> gxsIdsSelected;
if (mShowTypes & SHOW_GXS)
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
@ -881,7 +881,7 @@ std::string FriendSelectionWidget::selectedId(IdType &idType)
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);
QTreeWidgetItem *item;
@ -938,7 +938,7 @@ void FriendSelectionWidget::selectedIds(IdType idType, std::list<std::string> &i
break;
}
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);
}
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);
QTreeWidgetItem *item;
@ -973,7 +973,7 @@ void FriendSelectionWidget::setSelectedIds(IdType idType, const std::list<std::s
case IDTYPE_SSL:
case IDTYPE_GXS:
if (idType == itemType) {
if (std::find(ids.begin(), ids.end(), id) != ids.end()) {
if (ids.find(id) != ids.end()) {
setSelected(mListModus, item, true);
break;
}

View File

@ -83,19 +83,19 @@ public:
int selectedItemCount();
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);
ids.clear() ;
for(std::list<std::string>::const_iterator it(tmpids.begin());it!=tmpids.end();++it)
ids.push_back(ID_CLASS(*it)) ;
for(std::set<std::string>::const_iterator it(tmpids.begin());it!=tmpids.end();++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 ;
for(typename std::list<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
tmpids.push_back((*it).toStdString()) ;
std::set<std::string> tmpids ;
for(typename std::set<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
tmpids.insert((*it).toStdString()) ;
setSelectedIds(TYPE, tmpids, add);
}
@ -137,8 +137,8 @@ private:
void secured_fillList();
bool filterItem(QTreeWidgetItem *item, const QString &text);
void selectedIds(IdType idType, std::list<std::string> &ids, bool onlyDirectSelected);
void setSelectedIds(IdType idType, const std::list<std::string> &ids, bool add);
void selectedIds(IdType idType, std::set<std::string> &ids, bool onlyDirectSelected);
void setSelectedIds(IdType idType, const std::set<std::string> &ids, bool add);
void requestGXSIdList() ;

View File

@ -562,7 +562,7 @@ bool ConnectFriendWizard::validateCurrentPage()
break;
case Page_FriendRecommendations:
{
std::list<RsPeerId> recommendIds;
std::set<RsPeerId> recommendIds;
ui->frec_recommendList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(recommendIds, false);
if (recommendIds.empty()) {
@ -570,7 +570,7 @@ bool ConnectFriendWizard::validateCurrentPage()
return false;
}
std::list<RsPeerId> toIds;
std::set<RsPeerId> toIds;
ui->frec_toList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(toIds, false);
if (toIds.empty()) {
@ -578,7 +578,7 @@ bool ConnectFriendWizard::validateCurrentPage()
return false;
}
std::list<RsPeerId>::iterator toId;
std::set<RsPeerId>::iterator toId;
for (toId = toIds.begin(); toId != toIds.end(); ++toId) {
MessageComposer::recommendFriend(recommendIds, *toId, ui->frec_messageEdit->toHtml(), true);
}

View File

@ -249,7 +249,7 @@ void ChatMsgItem::sendMessage()
mi.title = tr("Quick Message").toUtf8().constData();
mi.msg = quickmsgText->toHtml().toUtf8().constData();
mi.rspeerid_msgto.push_back(mPeerId);
mi.rspeerid_msgto.insert(mPeerId);
rsMail->MessageSend(mi);

View File

@ -131,12 +131,12 @@ void CreateGroup::changeGroup()
}
}
std::list<RsPgpId> gpgIds;
std::set<RsPgpId> gpgIds;
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) {
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()) {
rsPeers->assignPeerToGroup(groupInfo.id, *it, false);
continue;

View File

@ -110,7 +110,7 @@ void GroupShareKey::setTyp()
void GroupShareKey::shareKey()
{
std::list<RsPeerId> shareList;
std::set<RsPeerId> shareList;
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
if (shareList.empty()) {

View File

@ -451,12 +451,12 @@ void MessageComposer::processSettings(bool bLoad)
/* 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;
/* process ssl ids */
std::list <RsPeerId>::const_iterator sslIt;
std::set <RsPeerId>::const_iterator sslIt;
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); ++sslIt) {
if (*sslIt == excludeId) {
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>");
}
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;
@ -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());
composer->setMsgText(sMsgText);
std::list <RsPeerId>::const_iterator peerIt;
std::set <RsPeerId>::const_iterator peerIt;
for (peerIt = sslIds.begin(); peerIt != sslIds.end(); ++peerIt) {
if (*peerIt == to) {
continue;
@ -876,7 +876,7 @@ static void calculateGroupsOfSslIds(const std::list<RsGroupInfo> &existingGroupI
}
// 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) {
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
for (groupInfoIt = groupInfos.begin(); groupInfoIt != groupInfos.end(); ++groupInfoIt) {
// 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) {
std::list<RsPeerId> sslIds;
@ -997,12 +997,12 @@ MessageComposer *MessageComposer::newMsg(const std::string &msgId /* = ""*/)
// 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::list<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::list<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::list<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgbcc.begin(); it != msgInfo.rsgxsid_msgbcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::BCC, *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::set<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_msgbcc.begin(); it != msgInfo.rspeerid_msgbcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::BCC, *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::set<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_msgbcc.begin(); it != msgInfo.rsgxsid_msgbcc.end(); ++it ) msgComposer->addRecipient(MessageComposer::BCC, *it) ;
MsgTagInfo tagInfo;
rsMail->getMessageTag(msgId, tagInfo);
@ -1024,7 +1024,7 @@ QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
QString from = link.toHtml();
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 (!to.isEmpty())
@ -1032,7 +1032,7 @@ QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
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 (!to.isEmpty())
@ -1043,14 +1043,14 @@ QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
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 (!cc.isEmpty()) {
cc += ", ";
}
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 (!cc.isEmpty()) {
cc += ", ";
@ -1137,19 +1137,19 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
{
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)
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)
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)
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)
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)
{
/* construct a message */
@ -1316,7 +1314,7 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
continue;
}
std::list<RsPgpId>::const_iterator groupIt;
std::set<RsPgpId>::const_iterator groupIt;
for (groupIt = groupInfo.peerIds.begin(); groupIt != groupInfo.peerIds.end(); ++groupIt) {
std::list<RsPeerId> sslIds;
rsPeers->getAssociatedSSLIds(*groupIt, sslIds);
@ -1330,11 +1328,11 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
switch (type)
{
case TO: addUnique(mi.rspeerid_msgto,*sslIt);
case TO: mi.rspeerid_msgto.insert(*sslIt);
break;
case CC: addUnique(mi.rspeerid_msgcc,*sslIt);
case CC: mi.rspeerid_msgcc.insert(*sslIt);
break;
case BCC:addUnique(mi.rspeerid_msgbcc,*sslIt);
case BCC:mi.rspeerid_msgbcc.insert(*sslIt);
break;
}
}
@ -1347,11 +1345,11 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
switch (type)
{
case TO: addUnique(mi.rspeerid_msgto,pid);
case TO: mi.rspeerid_msgto.insert(pid);
break ;
case CC: addUnique(mi.rspeerid_msgcc,pid);
case CC: mi.rspeerid_msgcc.insert(pid);
break ;
case BCC:addUnique(mi.rspeerid_msgbcc,pid);
case BCC:mi.rspeerid_msgbcc.insert(pid);
break ;
}
}
@ -1362,11 +1360,11 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
switch (type)
{
case TO: addUnique(mi.rsgxsid_msgto,gid) ;
case TO: mi.rsgxsid_msgto.insert(gid) ;
break ;
case CC: addUnique(mi.rsgxsid_msgcc,gid) ;
case CC: mi.rsgxsid_msgcc.insert(gid) ;
break ;
case BCC:addUnique(mi.rsgxsid_msgbcc,gid) ;
case BCC:mi.rsgxsid_msgbcc.insert(gid) ;
break ;
}
}
@ -2472,16 +2470,16 @@ void MessageComposer::fileHashingFinished(QList<HashedFile> hashedFiles)
void MessageComposer::addContact(enumType type)
{
std::list<RsPeerId> peerIds ;
std::set<RsPeerId> peerIds ;
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);
std::list<RsGxsId> gxsIds ;
std::set<RsGxsId> gxsIds ;
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);
}
@ -2522,18 +2520,18 @@ void MessageComposer::addBcc()
void MessageComposer::addRecommend()
{
std::list<RsPeerId> sslIds;
std::set<RsPeerId> sslIds;
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);
if (sslIds.empty() && gxsIds.empty())
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);
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);
QString text = buildRecommendHtml(sslIds);

View File

@ -60,7 +60,7 @@ public:
static void msgGroup(const std::string& group_id) ;
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 sendChannelPublishKey(RsGxsChannelGroup &group);
static void sendForumPublishKey(RsGxsForumGroup &group);

View File

@ -508,8 +508,8 @@ void MessageWidget::fill(const std::string &msgId)
RetroShareLink link;
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::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<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgto.begin(); pit != msgInfo.rspeerid_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);
@ -519,8 +519,8 @@ void MessageWidget::fill(const std::string &msgId)
ui.ccText->setVisible(true);
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::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<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgcc.begin(); pit != msgInfo.rspeerid_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);
} else {
@ -535,8 +535,8 @@ void MessageWidget::fill(const std::string &msgId)
ui.bccText->setVisible(true);
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::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<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgbcc.begin(); pit != msgInfo.rspeerid_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);
} else {