mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
sendMail check if recipients are known
This commit is contained in:
parent
d673ef3256
commit
ae0412c087
@ -165,6 +165,8 @@ public:
|
||||
virtual bool getKey(const RsGxsId &id, RsTlvPublicRSAKey& key) = 0;
|
||||
virtual bool getPrivateKey(const RsGxsId &id, RsTlvPrivateRSAKey& key) = 0; // For signing outgoing messages.
|
||||
virtual bool getIdDetails(const RsGxsId& id, RsIdentityDetails& details) = 0 ; // Proxy function so that we get p3Identity info from Gxs
|
||||
|
||||
virtual ~RsGixs();
|
||||
};
|
||||
|
||||
class GixsReputation
|
||||
|
@ -338,7 +338,7 @@ struct RsIdentityDetails : RsSerializable
|
||||
RS_SERIAL_PROCESS(mNickname);
|
||||
RS_SERIAL_PROCESS(mFlags);
|
||||
RS_SERIAL_PROCESS(mPgpId);
|
||||
//RS_SERIAL_PROCESS(mReputation);
|
||||
RS_SERIAL_PROCESS(mReputation);
|
||||
RS_SERIAL_PROCESS(mAvatar);
|
||||
RS_SERIAL_PROCESS(mPublishTS);
|
||||
RS_SERIAL_PROCESS(mLastUsageTS);
|
||||
@ -352,7 +352,6 @@ struct RsIdentityDetails : RsSerializable
|
||||
struct RsIdentity : RsGxsIfaceHelper
|
||||
{
|
||||
explicit RsIdentity(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||
virtual ~RsIdentity() {}
|
||||
|
||||
/**
|
||||
* @brief Create a new identity
|
||||
@ -419,6 +418,14 @@ struct RsIdentity : RsGxsIfaceHelper
|
||||
*/
|
||||
virtual bool getOwnPseudonimousIds(std::vector<RsGxsId>& ids) = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if an id is known
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id to check
|
||||
* @return true if the id is known, false otherwise
|
||||
*/
|
||||
virtual bool isKnownId(const RsGxsId& id) = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if an id is own
|
||||
* @jsonapi{development}
|
||||
@ -568,4 +575,6 @@ struct RsIdentity : RsGxsIfaceHelper
|
||||
RS_DEPRECATED_FOR("getIdentitiesSummaries getIdentitiesInfo")
|
||||
virtual bool getGroupData( const uint32_t& token,
|
||||
std::vector<RsGxsIdGroup>& groups) = 0;
|
||||
|
||||
virtual ~RsIdentity();
|
||||
};
|
||||
|
@ -72,7 +72,6 @@ struct RsReputationInfo : RsSerializable
|
||||
mFriendsNegativeVotes(0),
|
||||
mFriendAverageScore(RS_REPUTATION_THRESHOLD_DEFAULT),
|
||||
mOverallReputationLevel(RsReputationLevel::NEUTRAL) {}
|
||||
virtual ~RsReputationInfo() {}
|
||||
|
||||
RsOpinion mOwnOpinion;
|
||||
|
||||
@ -94,6 +93,8 @@ struct RsReputationInfo : RsSerializable
|
||||
RS_SERIAL_PROCESS(mFriendAverageScore);
|
||||
RS_SERIAL_PROCESS(mOverallReputationLevel);
|
||||
}
|
||||
|
||||
virtual ~RsReputationInfo();
|
||||
};
|
||||
|
||||
|
||||
|
@ -4788,3 +4788,7 @@ RsIdentityUsage::RsIdentityUsage(
|
||||
RsIdentityUsage::RsIdentityUsage() :
|
||||
mServiceId(RsServiceType::NONE), mUsageCode(UNKNOWN_USAGE), mAdditionalId(0)
|
||||
{}
|
||||
|
||||
RsIdentity::~RsIdentity() = default;
|
||||
RsReputationInfo::~RsReputationInfo() = default;
|
||||
RsGixs::~RsGixs() = default;
|
||||
|
@ -298,7 +298,9 @@ public:
|
||||
//virtual bool getPublicKey(const RsGxsId &id, RsTlvSecurityKey &key) ;
|
||||
//virtual void networkRequestPublicKey(const RsGxsId& key_id,const std::list<RsPeerId>& peer_ids) ;
|
||||
|
||||
virtual bool isOwnId(const RsGxsId& key_id) ;
|
||||
inline bool isKnownId(const RsGxsId& id) override { return haveKey(id); }
|
||||
|
||||
bool isOwnId(const RsGxsId& key_id) override;
|
||||
|
||||
virtual bool signData( const uint8_t* data,
|
||||
uint32_t data_size,
|
||||
@ -619,7 +621,7 @@ private:
|
||||
bool ownIdsAreLoaded() { RS_STACK_MUTEX(mIdMtx); return mOwnIdsLoaded; }
|
||||
|
||||
bool mAutoAddFriendsIdentitiesAsContacts;
|
||||
uint32_t mMaxKeepKeysBanned ;
|
||||
uint32_t mMaxKeepKeysBanned;
|
||||
|
||||
RS_SET_CONTEXT_DEBUG_LEVEL(1)
|
||||
};
|
||||
|
@ -1246,15 +1246,32 @@ uint32_t p3MsgService::sendMail(
|
||||
"You must specify at least one recipient" )) return false;
|
||||
|
||||
auto dstCheck =
|
||||
[&](const std::set<RsGxsId>& dstSet)
|
||||
[&](const std::set<RsGxsId>& dstSet, const std::string& setName)
|
||||
{
|
||||
for(const RsGxsId& dst: dstSet) if(dst.isNull()) return false;
|
||||
for(const RsGxsId& dst: dstSet)
|
||||
{
|
||||
if(dst.isNull())
|
||||
{
|
||||
errorMsg = setName + " contains a null recipient";
|
||||
RsErr() << fname << " " << errorMsg << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!rsIdentity->isKnownId(dst))
|
||||
{
|
||||
rsIdentity->requestIdentity(dst);
|
||||
errorMsg = setName + " contains an unknown recipient: " +
|
||||
dst.toStdString();
|
||||
RsErr() << fname << " " << errorMsg << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
if(!pCheck(dstCheck(to), "to contains a null recipient" )) return false;
|
||||
if(!pCheck(dstCheck(cc), "cc contains a null recipient" )) return false;
|
||||
if(!pCheck(dstCheck(bcc), "bcc contains a null recipient")) return false;
|
||||
if(!dstCheck(to, "to")) return false;
|
||||
if(!dstCheck(cc, "cc")) return false;
|
||||
if(!dstCheck(bcc, "bcc")) return false;
|
||||
|
||||
MessageInfo msgInfo;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user