added spam box

This commit is contained in:
defnax 2020-05-08 23:21:38 +02:00
parent 477f0a8a76
commit 38af9244a6
14 changed files with 120 additions and 17 deletions

View file

@ -62,6 +62,7 @@
#define RS_MSG_SIGNED 0x004000 /* message was signed and signature didn't check */
#define RS_MSG_LOAD_EMBEDDED_IMAGES 0x008000 /* load embedded images */
#define RS_MSG_PUBLISH_KEY 0x020000 /* publish key */
#define RS_MSG_SPAM 0x040000 /* Message is marked as spam */
#define RS_MSG_SYSTEM (RS_MSG_USER_REQUEST | RS_MSG_FRIEND_RECOMMENDATION | RS_MSG_PUBLISH_KEY)
@ -703,6 +704,15 @@ public:
*/
virtual bool MessageStar(const std::string &msgId, bool mark) = 0;
/**
* @brief MessageJunk
* @jsonapi{development}
* @param[in] msgId
* @param[in] mark
* @return true on success
*/
virtual bool MessageJunk(const std::string &msgId, bool mark) = 0;
/**
* @brief MessageLoadEmbeddedImages
* @jsonapi{development}

View file

@ -68,6 +68,7 @@ const uint32_t RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES = 0x00040000;
const uint32_t RS_MSG_FLAGS_DECRYPTED = 0x00080000;
const uint32_t RS_MSG_FLAGS_ROUTED = 0x00100000;
const uint32_t RS_MSG_FLAGS_PUBLISH_KEY = 0x00200000;
const uint32_t RS_MSG_FLAGS_SPAM = 0x00400000;
const uint32_t RS_MSG_FLAGS_SYSTEM = RS_MSG_FLAGS_USER_REQUEST | RS_MSG_FLAGS_FRIEND_RECOMMENDATION | RS_MSG_FLAGS_PUBLISH_KEY;

View file

@ -376,11 +376,15 @@ bool p3Msgs::getMessageTagTypes(MsgTagType& tags)
}
bool p3Msgs::MessageStar(const std::string &mid, bool star)
{
return mMsgSrv->setMsgFlag(mid, star ? RS_MSG_FLAGS_STAR : 0, RS_MSG_FLAGS_STAR);
}
bool p3Msgs::MessageJunk(const std::string &mid, bool junk)
{
return mMsgSrv->setMsgFlag(mid, junk ? RS_MSG_FLAGS_SPAM : 0, RS_MSG_FLAGS_SPAM);
}
bool p3Msgs::setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color)
{
return mMsgSrv->setMessageTagType(tagId, text, rgb_color);

View file

@ -78,6 +78,7 @@ public:
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 MessageJunk(const std::string &mid, bool junk);
virtual bool MessageLoadEmbeddedImages(const std::string &mid, bool load);
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId);

View file

@ -1737,6 +1737,7 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi)
if (msg->msgFlags & RS_MSG_FLAGS_REPLIED) mi.msgflags |= RS_MSG_REPLIED;
if (msg->msgFlags & RS_MSG_FLAGS_FORWARDED) mi.msgflags |= RS_MSG_FORWARDED;
if (msg->msgFlags & RS_MSG_FLAGS_STAR) mi.msgflags |= RS_MSG_STAR;
if (msg->msgFlags & RS_MSG_FLAGS_SPAM) mi.msgflags |= RS_MSG_SPAM;
if (msg->msgFlags & RS_MSG_FLAGS_USER_REQUEST) mi.msgflags |= RS_MSG_USER_REQUEST;
if (msg->msgFlags & RS_MSG_FLAGS_FRIEND_RECOMMENDATION) mi.msgflags |= RS_MSG_FRIEND_RECOMMENDATION;
if (msg->msgFlags & RS_MSG_FLAGS_PUBLISH_KEY) mi.msgflags |= RS_MSG_PUBLISH_KEY;
@ -1831,6 +1832,10 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis)
{
mis.msgflags |= RS_MSG_STAR;
}
if (msg->msgFlags & RS_MSG_FLAGS_SPAM)
{
mis.msgflags |= RS_MSG_SPAM;
}
if (msg->msgFlags & RS_MSG_FLAGS_USER_REQUEST)
{
mis.msgflags |= RS_MSG_USER_REQUEST;