mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-15 01:25:56 -04:00
ID cleaning. Saving progress
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7105 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
55e35975e9
commit
328d820421
9 changed files with 128 additions and 127 deletions
|
@ -2092,7 +2092,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).toStdString()) ;
|
||||
rft->allPeerIds.ids.push_back(*it) ;
|
||||
|
||||
rft->transferred = fit->second->mCreator->getRecvd();
|
||||
fit->second->mCreator->getAvailabilityMap(rft->compressed_chunk_map) ;
|
||||
|
@ -2129,19 +2129,21 @@ 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).toStdString() ) ;
|
||||
rft->allPeerIds.ids.push_back( *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<std::string>::iterator sit(rft->allPeerIds.ids.begin());sit!=rft->allPeerIds.ids.end();)
|
||||
for(std::list<RsPeerId>::iterator sit(rft->allPeerIds.ids.begin());sit!=rft->allPeerIds.ids.end();)
|
||||
if(mTurtle->isTurtlePeer(RsPeerId(*sit)))
|
||||
{
|
||||
std::list<std::string>::iterator sittmp(sit) ;
|
||||
sit = rft->allPeerIds.ids.erase(sit) ;
|
||||
}
|
||||
{
|
||||
std::list<RsPeerId>::iterator sittmp(sit) ;
|
||||
++sittmp ;
|
||||
rft->allPeerIds.ids.erase(sit) ;
|
||||
sit = sittmp ;
|
||||
}
|
||||
else
|
||||
++sit ;
|
||||
|
||||
|
@ -2200,8 +2202,8 @@ 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<std::string>::const_iterator it(rsft->allPeerIds.ids.begin());it!=rsft->allPeerIds.ids.end();++it)
|
||||
src_lst.push_back(RsPeerId(*it)) ;
|
||||
for(std::list<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);
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ std::string AuthGPG::getGPGEmail(const PGPIdType& id,bool *success)
|
|||
|
||||
/**** GPG versions ***/
|
||||
|
||||
PGPIdType AuthGPG::getGPGOwnId()
|
||||
const PGPIdType& AuthGPG::getGPGOwnId()
|
||||
{
|
||||
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
|
||||
return mOwnGpgId ;
|
||||
|
|
|
@ -152,7 +152,7 @@ class AuthGPG: public p3Config, public RsThread, public PGPHandler
|
|||
virtual std::string getGPGEmail(const PGPIdType &pgp_id,bool *success = NULL);
|
||||
|
||||
/* PGP web of trust management */
|
||||
virtual PGPIdType getGPGOwnId();
|
||||
virtual const PGPIdType& getGPGOwnId();
|
||||
virtual std::string getGPGOwnName();
|
||||
|
||||
//virtual std::string getGPGOwnEmail();
|
||||
|
|
|
@ -92,7 +92,7 @@ template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> c
|
|||
inline std::string toStdString() const { return toStdString(UPPER_CASE) ; }
|
||||
|
||||
inline uint32_t serial_size() const { return SIZE_IN_BYTES ; }
|
||||
bool serialise(void *data,uint32_t pktsize,uint32_t& offset)
|
||||
bool serialise(void *data,uint32_t pktsize,uint32_t& offset) const
|
||||
{
|
||||
if(offset + SIZE_IN_BYTES >= pktsize)
|
||||
return false ;
|
||||
|
|
|
@ -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<std::string>::const_iterator it(hashes.ids.begin());it!=hashes.ids.end();++it)
|
||||
for(std::list<Sha1CheckSum>::const_iterator it(hashes.ids.begin());it!=hashes.ids.end();++it)
|
||||
o << " " << *it << std::endl;
|
||||
|
||||
return o ;
|
||||
|
|
|
@ -245,70 +245,6 @@ std::ostream &RsTlvBinaryData::print(std::ostream &out, uint16_t indent)
|
|||
|
||||
/************************************* Peer Id Set ************************************/
|
||||
|
||||
RsTlvPeerIdSet::RsTlvPeerIdSet(): RsTlvStringSet(TLV_TYPE_PEERSET) {}
|
||||
RsTlvHashSet::RsTlvHashSet(): RsTlvStringSet(TLV_TYPE_HASHSET) {}
|
||||
RsTlvPgpIdSet::RsTlvPgpIdSet(): RsTlvStringSet(TLV_TYPE_PGPIDSET) {}
|
||||
|
||||
|
||||
RsTlvStringSet::RsTlvStringSet(uint16_t type) :mType(type)
|
||||
{
|
||||
}
|
||||
|
||||
void RsTlvStringSet::TlvClear()
|
||||
{
|
||||
ids.clear();
|
||||
|
||||
}
|
||||
|
||||
uint32_t RsTlvStringSet::TlvSize()
|
||||
{
|
||||
|
||||
uint32_t s = TLV_HEADER_SIZE; /* header */
|
||||
|
||||
/* determine the total size of ids strings in list */
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
for(it = ids.begin(); it != ids.end() ; ++it)
|
||||
{
|
||||
if (it->length() > 0)
|
||||
s += GetTlvStringSize(*it);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
bool RsTlvStringSet::SetTlv(void *data, uint32_t size, uint32_t *offset) /* serialise */
|
||||
{
|
||||
/* must check sizes */
|
||||
uint32_t tlvsize = TlvSize();
|
||||
uint32_t tlvend = *offset + tlvsize;
|
||||
|
||||
if (size < tlvend)
|
||||
return false; /* not enough space */
|
||||
|
||||
bool ok = true;
|
||||
|
||||
|
||||
/* start at data[offset] */
|
||||
ok &= SetTlvBase(data, tlvend, offset, mType , tlvsize);
|
||||
|
||||
/* determine the total size of ids strings in list */
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
for(it = ids.begin(); it != ids.end() ; ++it)
|
||||
{
|
||||
if (it->length() > 0)
|
||||
ok &= SetTlvString(data, tlvend, offset, TLV_TYPE_STR_GENID, *it);
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool RsTlvStringSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /* serialise */
|
||||
{
|
||||
if (size < *offset + TLV_HEADER_SIZE)
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
#include <serialiser/rstlvtypes.h>
|
||||
#include <serialiser/rstlvbase.h>
|
||||
#include <serialiser/rsbaseserial.h>
|
||||
|
||||
|
||||
//! A base class for all tlv items
|
||||
|
@ -112,23 +116,82 @@ virtual std::ostream &printHex(std::ostream &out, uint16_t indent); /* SPECIAL O
|
|||
std::list<std::string> ids; /* Mandatory */
|
||||
};
|
||||
|
||||
class RsTlvPeerIdSet: public RsTlvStringSet
|
||||
template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
||||
{
|
||||
public:
|
||||
RsTlvPeerIdSet();
|
||||
public:
|
||||
t_RsTlvIdSet() {}
|
||||
virtual ~t_RsTlvIdSet() {}
|
||||
|
||||
virtual uint32_t TlvSize() { return ID_CLASS::SIZE_IN_BYTES * ids.size() + TLV_HEADER_SIZE; }
|
||||
virtual void TlvClear(){ ids.clear() ; }
|
||||
virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset) /* serialise */
|
||||
{ /* must check sizes */
|
||||
uint32_t tlvsize = TlvSize();
|
||||
uint32_t tlvend = *offset + tlvsize;
|
||||
|
||||
if (size < tlvend)
|
||||
return false; /* not enough space */
|
||||
|
||||
bool ok = true;
|
||||
|
||||
/* 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)
|
||||
ok = ok && (*it).serialise(data,size,*offset) ;
|
||||
|
||||
return ok ;
|
||||
}
|
||||
virtual bool GetTlv(void *data, uint32_t size, uint32_t *offset) /* deserialise */
|
||||
{
|
||||
if (size < *offset + TLV_HEADER_SIZE)
|
||||
return false;
|
||||
|
||||
uint16_t tlvtype = GetTlvType( &(((uint8_t *) data)[*offset]) );
|
||||
uint32_t tlvsize = GetTlvSize( &(((uint8_t *) data)[*offset]) );
|
||||
uint32_t tlvend = *offset + tlvsize;
|
||||
|
||||
if (size < tlvend) /* check size */
|
||||
return false; /* not enough space */
|
||||
|
||||
if (tlvtype != TLV_TYPE) /* check type */
|
||||
return false;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
/* ready to load */
|
||||
TlvClear();
|
||||
|
||||
/* skip the header */
|
||||
(*offset) += TLV_HEADER_SIZE;
|
||||
|
||||
while(*offset + ID_CLASS::SIZE_IN_BYTES < tlvend)
|
||||
{
|
||||
ID_CLASS id ;
|
||||
ok = ok && id.deserialise(data,size,*offset) ;
|
||||
ids.push_back(id) ;
|
||||
}
|
||||
if(*offset != tlvsize)
|
||||
std::cerr << "(EE) deserialisaiton error in " << __PRETTY_FUNCTION__ << std::endl;
|
||||
return *offset == tlvsize ;
|
||||
}
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": not implemented" << std::endl;
|
||||
return out ;
|
||||
}
|
||||
virtual std::ostream &printHex(std::ostream &out, uint16_t indent) /* SPECIAL One */
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": not implemented" << std::endl;
|
||||
return out ;
|
||||
}
|
||||
|
||||
std::list<ID_CLASS> ids ;
|
||||
};
|
||||
|
||||
class RsTlvHashSet: public RsTlvStringSet
|
||||
{
|
||||
public:
|
||||
RsTlvHashSet();
|
||||
};
|
||||
|
||||
class RsTlvPgpIdSet: public RsTlvStringSet
|
||||
{
|
||||
public:
|
||||
RsTlvPgpIdSet();
|
||||
};
|
||||
typedef t_RsTlvIdSet<RsPeerId,TLV_TYPE_PEERSET> RsTlvPeerIdSet ;
|
||||
typedef t_RsTlvIdSet<PGPIdType,TLV_TYPE_PGPIDSET> RsTlvPgpIdSet ;
|
||||
typedef t_RsTlvIdSet<Sha1CheckSum,TLV_TYPE_HASHSET> RsTlvHashSet ;
|
||||
|
||||
class RsTlvServiceIdSet: public RsTlvItem
|
||||
{
|
||||
|
|
|
@ -167,9 +167,9 @@ void p3MsgService::processMsg(RsMsgItem *mi, bool incoming)
|
|||
if (notify)
|
||||
{
|
||||
if(mi->msgFlags & RS_MSG_FLAGS_ENCRYPTED)
|
||||
notify->AddPopupMessage(RS_POPUP_ENCRYPTED_MSG, mi->PeerId(), mi->subject, mi->message);
|
||||
notify->AddPopupMessage(RS_POPUP_ENCRYPTED_MSG, mi->PeerId().toStdString(), mi->subject, mi->message);
|
||||
else
|
||||
notify->AddPopupMessage(RS_POPUP_MSG, mi->PeerId(), mi->subject, mi->message);
|
||||
notify->AddPopupMessage(RS_POPUP_MSG, mi->PeerId().toStdString(), mi->subject, mi->message);
|
||||
|
||||
std::string out;
|
||||
rs_sprintf(out, "%lu", mi->msgId);
|
||||
|
@ -197,7 +197,7 @@ bool p3MsgService::checkAndRebuildPartialMessage(RsMsgItem *ci)
|
|||
{
|
||||
// Check is the item is ending an incomplete item.
|
||||
//
|
||||
std::map<std::string,RsMsgItem*>::iterator it = _pendingPartialMessages.find(ci->PeerId()) ;
|
||||
std::map<RsPeerId,RsMsgItem*>::iterator it = _pendingPartialMessages.find(ci->PeerId()) ;
|
||||
|
||||
bool ci_is_partial = ci->msgFlags & RS_MSG_FLAGS_PARTIAL ;
|
||||
|
||||
|
@ -320,7 +320,7 @@ int p3MsgService::checkOutgoingMessages()
|
|||
std::list<RsMsgItem*> output_queue ;
|
||||
|
||||
{
|
||||
const std::string ownId = mLinkMgr->getOwnId();
|
||||
const RsPeerId& ownId = mLinkMgr->getOwnId();
|
||||
|
||||
std::list<uint32_t>::iterator it;
|
||||
std::list<uint32_t> toErase;
|
||||
|
@ -334,7 +334,7 @@ int p3MsgService::checkOutgoingMessages()
|
|||
}
|
||||
|
||||
/* find the certificate */
|
||||
std::string pid = mit->second->PeerId();
|
||||
RsPeerId pid = mit->second->PeerId();
|
||||
bool tunnel_is_ok = false ;
|
||||
|
||||
if(mit->second->msgFlags & RS_MSG_FLAGS_DISTANT)
|
||||
|
@ -344,7 +344,7 @@ int p3MsgService::checkOutgoingMessages()
|
|||
#ifdef GROUTER
|
||||
tunnel_is_ok = true ;
|
||||
#else
|
||||
const std::string& hash = mit->second->PeerId() ;
|
||||
const RsPeerId& hash = mit->second->PeerId() ;
|
||||
std::map<std::string,DistantMessengingContact>::iterator it = _messenging_contacts.find(hash) ;
|
||||
|
||||
if(it != _messenging_contacts.end())
|
||||
|
@ -517,7 +517,7 @@ static void getStandardTagTypes(MsgTagType &tags)
|
|||
void p3MsgService::initStandardTagTypes()
|
||||
{
|
||||
bool bChanged = false;
|
||||
std::string ownId = mLinkMgr->getOwnId();
|
||||
const RsPeerId& ownId = mLinkMgr->getOwnId();
|
||||
|
||||
MsgTagType tags;
|
||||
getStandardTagTypes(tags);
|
||||
|
@ -527,7 +527,7 @@ void p3MsgService::initStandardTagTypes()
|
|||
std::map<uint32_t, RsMsgTagType*>::iterator mit = mTags.find(tit->first);
|
||||
if (mit == mTags.end()) {
|
||||
RsMsgTagType* tagType = new RsMsgTagType();
|
||||
tagType->PeerId (ownId);
|
||||
tagType->PeerId (ownId);
|
||||
tagType->tagId = tit->first;
|
||||
tagType->text = tit->second.first;
|
||||
tagType->rgb_color = tit->second.second;
|
||||
|
@ -555,8 +555,8 @@ bool p3MsgService::loadList(std::list<RsItem*>& load)
|
|||
std::list<RsMsgItem*> items;
|
||||
std::list<RsItem*>::iterator it;
|
||||
std::map<uint32_t, RsMsgTagType*>::iterator tagIt;
|
||||
std::map<uint32_t, std::string> srcIdMsgMap;
|
||||
std::map<uint32_t, std::string>::iterator srcIt;
|
||||
std::map<uint32_t, RsPeerId> srcIdMsgMap;
|
||||
std::map<uint32_t, RsPeerId>::iterator srcIt;
|
||||
|
||||
bool distant_messaging_set = false ;
|
||||
|
||||
|
@ -593,7 +593,7 @@ bool p3MsgService::loadList(std::list<RsItem*>& load)
|
|||
}
|
||||
else if(NULL != (msi = dynamic_cast<RsMsgSrcId *>(*it)))
|
||||
{
|
||||
srcIdMsgMap.insert(std::pair<uint32_t, std::string>(msi->msgId, msi->srcId));
|
||||
srcIdMsgMap.insert(std::pair<uint32_t, RsPeerId>(msi->msgId, msi->srcId));
|
||||
mSrcIds.insert(std::pair<uint32_t, RsMsgSrcId*>(msi->msgId, msi)); // does not need to be kept
|
||||
}
|
||||
else if(NULL != (msp = dynamic_cast<RsMsgParentId *>(*it)))
|
||||
|
@ -1049,7 +1049,7 @@ int p3MsgService::sendMessage(RsMsgItem *item)
|
|||
|
||||
bool p3MsgService::MessageSend(MessageInfo &info)
|
||||
{
|
||||
std::list<std::string>::const_iterator pit;
|
||||
std::list<RsPeerId>::const_iterator pit;
|
||||
|
||||
for(pit = info.msgto.begin(); pit != info.msgto.end(); pit++)
|
||||
{
|
||||
|
@ -1082,7 +1082,7 @@ bool p3MsgService::MessageSend(MessageInfo &info)
|
|||
RsMsgItem *msg = initMIRsMsg(info, mLinkMgr->getOwnId());
|
||||
if (msg)
|
||||
{
|
||||
std::list<std::string>::iterator it ;
|
||||
std::list<RsPeerId>::iterator it ;
|
||||
|
||||
// Update destination ids in place of distant message hash, since this Outgoing message is for display
|
||||
//
|
||||
|
@ -1113,7 +1113,7 @@ bool p3MsgService::SystemMessage(const std::string &title, const std::string &me
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string ownId = mLinkMgr->getOwnId();
|
||||
const RsPeerId& ownId = mLinkMgr->getOwnId();
|
||||
|
||||
RsMsgItem *msg = new RsMsgItem();
|
||||
|
||||
|
@ -1580,10 +1580,10 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi)
|
|||
rs_sprintf(mi.msgId, "%lu", msg->msgId);
|
||||
}
|
||||
|
||||
std::list<std::string>::iterator pit;
|
||||
std::list<RsPeerId>::iterator pit;
|
||||
|
||||
for(pit = msg->msgto.ids.begin();
|
||||
pit != msg->msgto.ids.end(); pit++)
|
||||
pit != msg->msgto.ids.end(); pit++)
|
||||
{
|
||||
mi.msgto.push_back(*pit);
|
||||
}
|
||||
|
@ -1704,7 +1704,7 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis)
|
|||
mis.ts = msg->sendTime;
|
||||
}
|
||||
|
||||
RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, const std::string &to)
|
||||
RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, const RsPeerId &to)
|
||||
{
|
||||
RsMsgItem *msg = new RsMsgItem();
|
||||
|
||||
|
@ -1719,7 +1719,7 @@ RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, const std::string &to)
|
|||
|
||||
msg -> message = info.msg;
|
||||
|
||||
std::list<std::string>::iterator pit;
|
||||
std::list<RsPeerId>::iterator pit;
|
||||
for(pit = info.msgto.begin(); pit != info.msgto.end(); pit++)
|
||||
{
|
||||
msg -> msgto.ids.push_back(*pit);
|
||||
|
@ -2028,7 +2028,7 @@ bool p3MsgService::decryptMessage(const std::string& mId)
|
|||
item->print(std::cerr,0) ;
|
||||
#endif
|
||||
std::string own_hash ;
|
||||
std::string own_pgp_id = AuthGPG::getAuthGPG()->getGPGOwnId();
|
||||
const PGPIdType& own_pgp_id = AuthGPG::getAuthGPG()->getGPGOwnId();
|
||||
getDistantMessageHash(own_pgp_id,own_hash) ;
|
||||
|
||||
{
|
||||
|
@ -2043,9 +2043,9 @@ bool p3MsgService::decryptMessage(const std::string& mId)
|
|||
msgi.msgFlags |= RS_MSG_FLAGS_DECRYPTED ; // previousy encrypted msg is now decrypted
|
||||
msgi.PeerId(senders_id.toStdString()) ;
|
||||
|
||||
for(std::list<std::string>::iterator it(msgi.msgto.ids.begin());it!=msgi.msgto.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
|
||||
for(std::list<std::string>::iterator it(msgi.msgcc.ids.begin());it!=msgi.msgcc.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
|
||||
for(std::list<std::string>::iterator it(msgi.msgbcc.ids.begin());it!=msgi.msgbcc.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
|
||||
for(std::list<RsPeerId>::iterator it(msgi.msgto.ids.begin());it!=msgi.msgto.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
|
||||
for(std::list<RsPeerId>::iterator it(msgi.msgcc.ids.begin());it!=msgi.msgcc.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
|
||||
for(std::list<RsPeerId>::iterator it(msgi.msgbcc.ids.begin());it!=msgi.msgbcc.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
|
||||
|
||||
if(signature_present)
|
||||
{
|
||||
|
@ -2065,14 +2065,14 @@ bool p3MsgService::decryptMessage(const std::string& mId)
|
|||
|
||||
RsMsgSrcId* msi = new RsMsgSrcId();
|
||||
msi->msgId = msgi.msgId;
|
||||
msi->srcId = senders_id.toStdString() ;
|
||||
msi->srcId = senders_id ;
|
||||
|
||||
mSrcIds.insert(std::pair<uint32_t, RsMsgSrcId*>(msi->msgId, msi));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Substituting source name for message id " << msgi.msgId << ": " << it->second->srcId << " -> " << senders_id.toStdString() << std::endl;
|
||||
it->second->srcId = senders_id.toStdString() ;
|
||||
std::cerr << "Substituting source name for message id " << msgi.msgId << ": " << it->second->srcId << " -> " << senders_id << std::endl;
|
||||
it->second->srcId = senders_id ;
|
||||
}
|
||||
}
|
||||
delete item ;
|
||||
|
@ -2101,7 +2101,7 @@ bool p3MsgService::createDistantOfflineMessengingInvite(time_t time_of_validity,
|
|||
unsigned char hash_bytes[DISTANT_MSG_HASH_SIZE] ;
|
||||
RSRandom::random_bytes( hash_bytes, DISTANT_MSG_HASH_SIZE) ;
|
||||
|
||||
hash = Sha1CheckSum(hash_bytes).toStdString(false) ;
|
||||
hash = Sha1CheckSum(hash_bytes).toStdString() ;
|
||||
|
||||
DistantMessengingInvite invite ;
|
||||
invite.time_of_validity = time_of_validity + time(NULL);
|
||||
|
@ -2198,7 +2198,7 @@ bool p3MsgService::distantMessagingEnabled()
|
|||
}
|
||||
return res ;
|
||||
}
|
||||
bool p3MsgService::getDistantMessageHash(const std::string& pgp_id,std::string& hash)
|
||||
bool p3MsgService::getDistantMessageHash(const PGPIdType& pgp_id,Sha1CheckSum& hash)
|
||||
{
|
||||
if(pgp_id.length() != 16)
|
||||
{
|
||||
|
@ -2233,11 +2233,11 @@ bool p3MsgService::getDistantOfflineMessengingInvites(std::vector<DistantOffline
|
|||
return true ;
|
||||
}
|
||||
|
||||
bool p3MsgService::handleTunnelRequest(const std::string& hash,const std::string& /*peer_id*/)
|
||||
bool p3MsgService::handleTunnelRequest(const Sha1CheckSum &hash,const RsPeerId& /*peer_id*/)
|
||||
{
|
||||
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
std::map<std::string,DistantMessengingInvite>::const_iterator it = _messenging_invites.find(hash) ;
|
||||
std::map<Sha1CheckSum,DistantMessengingInvite>::const_iterator it = _messenging_invites.find(hash) ;
|
||||
|
||||
#ifdef DEBUG_DISTANT_MSG
|
||||
if(it != _messenging_invites.end())
|
||||
|
@ -2383,7 +2383,7 @@ void p3MsgService::sendTurtleData(const std::string& hash,RsMsgItem *msgitem)
|
|||
// do we have a working tunnel for that hash ?
|
||||
// If not, put on the contact's waiting list.
|
||||
|
||||
std::string virtual_peer_id ;
|
||||
RsPeerId virtual_peer_id ;
|
||||
{
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
std::map<std::string,DistantMessengingContact>::const_iterator it = _messenging_contacts.find(hash) ;
|
||||
|
|
|
@ -132,25 +132,25 @@ int checkOutgoingMessages();
|
|||
|
||||
void enableDistantMessaging(bool b) ;
|
||||
bool distantMessagingEnabled() ;
|
||||
bool getDistantMessageHash(const PGPIdType& pgp_id,std::string& hash) ;
|
||||
bool getDistantMessageHash(const PGPIdType& pgp_id,Sha1CheckSum &hash) ;
|
||||
|
||||
void sendPrivateMsgItem(RsMsgItem *) ;
|
||||
|
||||
private:
|
||||
// This maps contains the current invitations to respond to.
|
||||
//
|
||||
// The map is indexed by the hash
|
||||
std::map<std::string,DistantMessengingInvite> _messenging_invites ;
|
||||
|
||||
// This contains the ongoing tunnel handling contacts.
|
||||
//
|
||||
std::map<std::string,DistantMessengingContact> _messenging_contacts ;
|
||||
// The map is indexed by the hash
|
||||
std::map<std::string,DistantMessengingContact> _messenging_contacts ;
|
||||
|
||||
// Overloaded from RsTurtleClientService
|
||||
|
||||
#ifdef GROUTER
|
||||
virtual void receiveGRouterData(RsGRouterGenericDataItem *item, const GRouterKeyId& key) ;
|
||||
#endif
|
||||
virtual bool handleTunnelRequest(const std::string& hash,const RsPeerId& peer_id) ;
|
||||
virtual bool handleTunnelRequest(const Sha1CheckSum& hash,const RsPeerId& peer_id) ;
|
||||
virtual void receiveTurtleData(RsTurtleGenericTunnelItem *item,const std::string& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ;
|
||||
void addVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&,RsTurtleGenericTunnelItem::Direction dir) ;
|
||||
void removeVirtualPeer(const TurtleFileHash&, const TurtleVirtualPeerId&) ;
|
||||
|
@ -197,7 +197,7 @@ void initStandardTagTypes();
|
|||
/* ones that haven't made it out yet! */
|
||||
std::map<uint32_t, RsMsgItem *> msgOutgoing;
|
||||
|
||||
std::map<std::string, RsMsgItem *> _pendingPartialMessages ;
|
||||
std::map<RsPeerId, RsMsgItem *> _pendingPartialMessages ;
|
||||
|
||||
/* maps for tags types and msg tags */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue