Added new action "Load images always for this message" to image blocking.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6760 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-09-24 20:19:21 +00:00
parent 0a3419c692
commit 6a9dfed408
16 changed files with 255 additions and 97 deletions

View file

@ -34,9 +34,10 @@
#include "rstypes.h"
#include "rsdistrib.h" /* For FLAGS */
#define FORUM_MSG_STATUS_MASK 0x000f
#define FORUM_MSG_STATUS_READ 0x0001
#define FORUM_MSG_STATUS_UNREAD_BY_USER 0x0002
#define FORUM_MSG_STATUS_MASK 0x000f
#define FORUM_MSG_STATUS_READ 0x0001
#define FORUM_MSG_STATUS_UNREAD_BY_USER 0x0002
#define FORUM_MSG_STATUS_LOAD_EMBEDDED_IMAGES 0x0004
class ForumInfo
{

View file

@ -61,6 +61,7 @@
#define RS_MSG_ENCRYPTED 0x1000 /* message is encrypted */
#define RS_MSG_SIGNATURE_CHECKS 0x2000 /* message was signed, and signature checked */
#define RS_MSG_SIGNED 0x4000 /* message was signed and signature didn't check */
#define RS_MSG_LOAD_EMBEDDED_IMAGES 0x8000 /* load embedded images */
#define RS_CHAT_LOBBY_EVENT_PEER_LEFT 0x01
#define RS_CHAT_LOBBY_EVENT_PEER_STATUS 0x02
@ -264,6 +265,7 @@ virtual bool MessageRead(const std::string &mid, bool unreadByUser) = 0;
virtual bool MessageReplied(const std::string &mid, bool replied) = 0;
virtual bool MessageForwarded(const std::string &mid, bool forwarded) = 0;
virtual bool MessageStar(const std::string &mid, bool mark) = 0;
virtual bool MessageLoadEmbeddedImages(const std::string &mid, bool load) = 0;
/* message tagging */

View file

@ -169,6 +169,11 @@ bool p3Msgs::MessageForwarded(const std::string &mid, bool forwarded)
return mMsgSrv->setMsgFlag(mid, forwarded ? RS_MSG_FLAGS_FORWARDED : 0, RS_MSG_FLAGS_FORWARDED);
}
bool p3Msgs::MessageLoadEmbeddedImages(const std::string &mid, bool load)
{
return mMsgSrv->setMsgFlag(mid, load ? RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES : 0, RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES);
}
bool p3Msgs::getMessageTagTypes(MsgTagType& tags)
{
return mMsgSrv->getMessageTagTypes(tags);

View file

@ -67,6 +67,7 @@ class p3Msgs: public RsMsgs
virtual bool MessageReplied(const std::string &mid, bool replied);
virtual bool MessageForwarded(const std::string &mid, bool forwarded);
virtual bool MessageStar(const std::string &mid, bool star);
virtual bool MessageLoadEmbeddedImages(const std::string &mid, bool load);
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId);
virtual bool getMessageTagTypes(MsgTagType& tags);

View file

@ -431,6 +431,7 @@ const uint32_t RS_MSG_FLAGS_ENCRYPTED = 0x00004000;
const uint32_t RS_MSG_FLAGS_DISTANT = 0x00008000;
const uint32_t RS_MSG_FLAGS_SIGNATURE_CHECKS = 0x00010000;
const uint32_t RS_MSG_FLAGS_SIGNED = 0x00020000;
const uint32_t RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES = 0x00040000;
class RsMessageItem: public RsItem
{

View file

@ -362,7 +362,7 @@ bool p3Forums::ForumMessageSend(ForumMsgInfo &info)
// return id
info.msgId = mId;
return setMessageStatus(info.forumId, mId, FORUM_MSG_STATUS_READ, FORUM_MSG_STATUS_MASK);
return setMessageStatus(info.forumId, mId, FORUM_MSG_STATUS_READ | FORUM_MSG_STATUS_LOAD_EMBEDDED_IMAGES, FORUM_MSG_STATUS_MASK);
}
bool p3Forums::setMessageStatus(const std::string& fId,const std::string& mId,const uint32_t status, const uint32_t statusMask)

View file

@ -1539,6 +1539,10 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi)
{
mi.msgflags |= RS_MSG_FRIEND_RECOMMENDATION;
}
if (msg->msgFlags & RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES)
{
mi.msgflags |= RS_MSG_LOAD_EMBEDDED_IMAGES;
}
mi.ts = msg->sendTime;
mi.srcId = msg->PeerId();
@ -1652,6 +1656,10 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis)
{
mis.msgflags |= RS_MSG_FRIEND_RECOMMENDATION;
}
if (msg->msgFlags & RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES)
{
mis.msgflags |= RS_MSG_LOAD_EMBEDDED_IMAGES;
}
mis.srcId = msg->PeerId();
{
@ -1726,6 +1734,9 @@ RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, const std::string &to)
if (info.msgflags & RS_MSG_SIGNED)
msg->msgFlags |= RS_MSG_FLAGS_SIGNED;
/* load embedded images from own messages */
msg->msgFlags |= RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES;
// See if we need to encrypt this message. If so, we replace the msg text
// by the whole message serialized and binary encrypted, so as to obfuscate
// all its content.