mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-15 17:37:12 -05:00
Merge pull request #1361 from sehraf/pr_jsonfy-rsMsg
[jsonapi] add most remaining functions of rsMsg
This commit is contained in:
commit
18eee374f1
@ -165,9 +165,8 @@ class MessageInfo_v2
|
|||||||
int count; /* file count */
|
int count; /* file count */
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageInfo
|
struct MessageInfo : RsSerializable
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
MessageInfo(): msgflags(0), size(0), count(0), ts(0) {}
|
MessageInfo(): msgflags(0), size(0), count(0), ts(0) {}
|
||||||
std::string msgId;
|
std::string msgId;
|
||||||
|
|
||||||
@ -199,13 +198,42 @@ public:
|
|||||||
int count; /* file count */
|
int count; /* file count */
|
||||||
|
|
||||||
int ts;
|
int ts;
|
||||||
|
|
||||||
|
// RsSerializable interface
|
||||||
|
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||||
|
RS_SERIAL_PROCESS(msgId);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(rspeerid_srcId);
|
||||||
|
RS_SERIAL_PROCESS(rsgxsid_srcId);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(msgflags);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(rspeerid_msgto);
|
||||||
|
RS_SERIAL_PROCESS(rspeerid_msgcc);
|
||||||
|
RS_SERIAL_PROCESS(rspeerid_msgbcc);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(rsgxsid_msgto);
|
||||||
|
RS_SERIAL_PROCESS(rsgxsid_msgcc);
|
||||||
|
RS_SERIAL_PROCESS(rsgxsid_msgcc);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(title);
|
||||||
|
RS_SERIAL_PROCESS(msg);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(attach_title);
|
||||||
|
RS_SERIAL_PROCESS(attach_comment);
|
||||||
|
RS_SERIAL_PROCESS(files);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(size);
|
||||||
|
RS_SERIAL_PROCESS(count);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(ts);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class MsgInfoSummary
|
struct MsgInfoSummary : RsSerializable
|
||||||
{
|
{
|
||||||
public:
|
MsgInfoSummary() : msgflags(0), count(0), ts(0) {}
|
||||||
MsgInfoSummary(): msgflags(0), count(0), ts(0) {}
|
|
||||||
|
|
||||||
std::string msgId;
|
std::string msgId;
|
||||||
RsPeerId srcId;
|
RsPeerId srcId;
|
||||||
@ -216,25 +244,41 @@ class MsgInfoSummary
|
|||||||
int count; /* file count */
|
int count; /* file count */
|
||||||
rstime_t ts;
|
rstime_t ts;
|
||||||
|
|
||||||
|
|
||||||
|
// RsSerializable interface
|
||||||
|
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||||
|
RS_SERIAL_PROCESS(msgId);
|
||||||
|
RS_SERIAL_PROCESS(srcId);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(msgflags);
|
||||||
|
|
||||||
|
RS_SERIAL_PROCESS(title);
|
||||||
|
RS_SERIAL_PROCESS(count);
|
||||||
|
RS_SERIAL_PROCESS(ts);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MsgTagInfo
|
struct MsgTagInfo : RsSerializable
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
MsgTagInfo() {}
|
|
||||||
|
|
||||||
std::string msgId;
|
std::string msgId;
|
||||||
std::list<uint32_t> tagIds;
|
std::list<uint32_t> tagIds;
|
||||||
|
|
||||||
|
// RsSerializable interface
|
||||||
|
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||||
|
RS_SERIAL_PROCESS(msgId);
|
||||||
|
RS_SERIAL_PROCESS(tagIds);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MsgTagType
|
struct MsgTagType : RsSerializable
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
MsgTagType() {}
|
|
||||||
|
|
||||||
/* map containing tagId -> pair (text, rgb color) */
|
/* map containing tagId -> pair (text, rgb color) */
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> > types;
|
std::map<uint32_t, std::pair<std::string, uint32_t> > types;
|
||||||
|
|
||||||
|
// RsSerializable interface
|
||||||
|
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||||
|
RS_SERIAL_PROCESS(types);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace Rs
|
} //namespace Rs
|
||||||
@ -444,52 +488,204 @@ public:
|
|||||||
RsMsgs() {}
|
RsMsgs() {}
|
||||||
virtual ~RsMsgs() {}
|
virtual ~RsMsgs() {}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* Message Items */
|
/* Message Items */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
virtual bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList) = 0;
|
/**
|
||||||
virtual bool getMessage(const std::string &mId, Rs::Msgs::MessageInfo &msg) = 0;
|
* @brief getMessageSummaries
|
||||||
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox) = 0;
|
* @jsonapi{development}
|
||||||
|
* @param[out] msgList
|
||||||
|
* @return always true
|
||||||
|
*/
|
||||||
|
virtual bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList) = 0;
|
||||||
|
|
||||||
virtual bool MessageSend(Rs::Msgs::MessageInfo &info) = 0;
|
/**
|
||||||
virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag) = 0;
|
* @brief getMessage
|
||||||
virtual bool MessageToDraft(Rs::Msgs::MessageInfo &info, const std::string &msgParentId) = 0;
|
* @jsonapi{development}
|
||||||
virtual bool MessageToTrash(const std::string &mid, bool bTrash) = 0;
|
* @param[in] msgId message ID to lookup
|
||||||
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId) = 0;
|
* @param[out] msg
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool getMessage(const std::string &msgId, Rs::Msgs::MessageInfo &msg) = 0;
|
||||||
|
/**
|
||||||
|
* @brief getMessageCount
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[out] nInbox
|
||||||
|
* @param[out] nInboxNew
|
||||||
|
* @param[out] nOutbox
|
||||||
|
* @param[out] nDraftbox
|
||||||
|
* @param[out] nSentbox
|
||||||
|
* @param[out] nTrashbox
|
||||||
|
*/
|
||||||
|
virtual void getMessageCount(uint32_t &nInbox, uint32_t &nInboxNew, uint32_t &nOutbox, uint32_t &nDraftbox, uint32_t &nSentbox, uint32_t &nTrashbox) = 0;
|
||||||
|
|
||||||
virtual bool MessageDelete(const std::string &mid) = 0;
|
/**
|
||||||
virtual bool MessageRead(const std::string &mid, bool unreadByUser) = 0;
|
* @brief MessageSend
|
||||||
virtual bool MessageReplied(const std::string &mid, bool replied) = 0;
|
* @jsonapi{development}
|
||||||
virtual bool MessageForwarded(const std::string &mid, bool forwarded) = 0;
|
* @param[in] info
|
||||||
virtual bool MessageStar(const std::string &mid, bool mark) = 0;
|
* @return always true
|
||||||
virtual bool MessageLoadEmbeddedImages(const std::string &mid, bool load) = 0;
|
*/
|
||||||
|
virtual bool MessageSend(Rs::Msgs::MessageInfo &info) = 0;
|
||||||
|
|
||||||
/* message tagging */
|
/**
|
||||||
|
* @brief SystemMessage
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] title
|
||||||
|
* @param[in] message
|
||||||
|
* @param[in] systemFlag
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag) = 0;
|
||||||
|
|
||||||
virtual bool getMessageTagTypes(Rs::Msgs::MsgTagType& tags) = 0;
|
/**
|
||||||
/* set == false && tagId == 0 --> remove all */
|
* @brief MessageToDraft
|
||||||
virtual bool setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color) = 0;
|
* @jsonapi{development}
|
||||||
virtual bool removeMessageTagType(uint32_t tagId) = 0;
|
* @param[in] info
|
||||||
|
* @param[in] msgParentId
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool MessageToDraft(Rs::Msgs::MessageInfo &info, const std::string &msgParentId) = 0;
|
||||||
|
|
||||||
virtual bool getMessageTag(const std::string &msgId, Rs::Msgs::MsgTagInfo& info) = 0;
|
/**
|
||||||
virtual bool setMessageTag(const std::string &msgId, uint32_t tagId, bool set) = 0;
|
* @brief MessageToTrash
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[in] bTrash
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool MessageToTrash(const std::string &msgId, bool bTrash) = 0;
|
||||||
|
|
||||||
virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags) = 0;
|
/**
|
||||||
|
* @brief getMsgParentId
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[out] msgParentId
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId) = 0;
|
||||||
|
|
||||||
/****************************************/
|
/**
|
||||||
/* Private distant messages */
|
* @brief MessageDelete
|
||||||
/****************************************/
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool MessageDelete(const std::string &msgId) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MessageRead
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[in] unreadByUser
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool MessageRead(const std::string &msgId, bool unreadByUser) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MessageReplied
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[in] replied
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool MessageReplied(const std::string &msgId, bool replied) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MessageForwarded
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[in] forwarded
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool MessageForwarded(const std::string &msgId, bool forwarded) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MessageStar
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[in] mark
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool MessageStar(const std::string &msgId, bool mark) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MessageLoadEmbeddedImages
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[in] load
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool MessageLoadEmbeddedImages(const std::string &msgId, bool load) = 0;
|
||||||
|
|
||||||
|
/* message tagging */
|
||||||
|
/**
|
||||||
|
* @brief getMessageTagTypes
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[out] tags
|
||||||
|
* @return always true
|
||||||
|
*/
|
||||||
|
virtual bool getMessageTagTypes(Rs::Msgs::MsgTagType& tags) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setMessageTagType
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] tagId
|
||||||
|
* @param[in] text
|
||||||
|
* @param[in] rgb_color
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief removeMessageTagType
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] tagId
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool removeMessageTagType(uint32_t tagId) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getMessageTag
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[out] info
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool getMessageTag(const std::string &msgId, Rs::Msgs::MsgTagInfo& info) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setMessageTag
|
||||||
|
* set == false && tagId == 0 --> remove all
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] msgId
|
||||||
|
* @param[in] tagId
|
||||||
|
* @param[in] set
|
||||||
|
* @return true on success
|
||||||
|
*/
|
||||||
|
virtual bool setMessageTag(const std::string &msgId, uint32_t tagId, bool set) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetMessageStandardTagTypes
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[out] tags
|
||||||
|
* @return always true
|
||||||
|
*/
|
||||||
|
virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags) = 0;
|
||||||
|
|
||||||
|
/****************************************/
|
||||||
|
/* Private distant messages */
|
||||||
|
/****************************************/
|
||||||
|
|
||||||
virtual uint32_t getDistantMessagingPermissionFlags()=0 ;
|
virtual uint32_t getDistantMessagingPermissionFlags()=0 ;
|
||||||
virtual void setDistantMessagingPermissionFlags(uint32_t flags)=0 ;
|
virtual void setDistantMessagingPermissionFlags(uint32_t flags)=0 ;
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* Chat */
|
/* Chat */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
// sendChat for broadcast, private, lobby and private distant chat
|
// sendChat for broadcast, private, lobby and private distant chat
|
||||||
// note: for lobby chat, you first have to subscribe to a lobby
|
// note: for lobby chat, you first have to subscribe to a lobby
|
||||||
// for private distant chat, it is reqired to have an active distant chat session
|
// for private distant chat, it is reqired to have an active distant chat session
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief sendChat send a chat message to a given id
|
* @brief sendChat send a chat message to a given id
|
||||||
|
@ -287,9 +287,9 @@ bool p3Msgs::getMessage(const std::string &mid, MessageInfo &msg)
|
|||||||
return mMsgSrv->getMessage(mid, msg);
|
return mMsgSrv->getMessage(mid, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3Msgs::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox)
|
void p3Msgs::getMessageCount(uint32_t &nInbox, uint32_t &nInboxNew, uint32_t &nOutbox, uint32_t &nDraftbox, uint32_t &nSentbox, uint32_t &nTrashbox)
|
||||||
{
|
{
|
||||||
mMsgSrv->getMessageCount(pnInbox, pnInboxNew, pnOutbox, pnDraftbox, pnSentbox, pnTrashbox);
|
mMsgSrv->getMessageCount(nInbox, nInboxNew, nOutbox, nDraftbox, nSentbox, nTrashbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
@ -52,7 +52,7 @@ class p3Msgs: public RsMsgs
|
|||||||
*/
|
*/
|
||||||
virtual bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList);
|
virtual bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList);
|
||||||
virtual bool getMessage(const std::string &mId, Rs::Msgs::MessageInfo &msg);
|
virtual bool getMessage(const std::string &mId, Rs::Msgs::MessageInfo &msg);
|
||||||
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox);
|
virtual void getMessageCount(uint32_t &nInbox, uint32_t &nInboxNew, uint32_t &nOutbox, uint32_t &nDraftbox, uint32_t &nSentbox, uint32_t &nTrashbox);
|
||||||
|
|
||||||
virtual bool MessageSend(Rs::Msgs::MessageInfo &info);
|
virtual bool MessageSend(Rs::Msgs::MessageInfo &info);
|
||||||
virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag);
|
virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag);
|
||||||
|
@ -290,11 +290,11 @@ struct RsTypeSerializer
|
|||||||
// Use same allocator to avoid deep copy
|
// Use same allocator to avoid deep copy
|
||||||
RsGenericSerializer::SerializeContext kCtx(
|
RsGenericSerializer::SerializeContext kCtx(
|
||||||
nullptr, 0, ctx.mFlags, &allocator );
|
nullptr, 0, ctx.mFlags, &allocator );
|
||||||
serial_process<T>(j, kCtx, const_cast<T&>(kv.first), "key");
|
serial_process(j, kCtx, const_cast<T&>(kv.first), "key");
|
||||||
|
|
||||||
RsGenericSerializer::SerializeContext vCtx(
|
RsGenericSerializer::SerializeContext vCtx(
|
||||||
nullptr, 0, ctx.mFlags, &allocator );
|
nullptr, 0, ctx.mFlags, &allocator );
|
||||||
serial_process<U>(j, vCtx, const_cast<U&>(kv.second), "value");
|
serial_process(j, vCtx, const_cast<U&>(kv.second), "value");
|
||||||
|
|
||||||
if(kCtx.mOk && vCtx.mOk)
|
if(kCtx.mOk && vCtx.mOk)
|
||||||
{
|
{
|
||||||
@ -394,8 +394,8 @@ struct RsTypeSerializer
|
|||||||
RsGenericSerializer::SerializeContext lCtx(
|
RsGenericSerializer::SerializeContext lCtx(
|
||||||
nullptr, 0, ctx.mFlags, &allocator );
|
nullptr, 0, ctx.mFlags, &allocator );
|
||||||
|
|
||||||
serial_process(j, ctx, p.first, "first");
|
serial_process(j, lCtx, p.first, "first");
|
||||||
serial_process(j, ctx, p.second, "second");
|
serial_process(j, lCtx, p.second, "second");
|
||||||
|
|
||||||
rapidjson::Value key;
|
rapidjson::Value key;
|
||||||
key.SetString(memberName.c_str(), memberName.length(), allocator);
|
key.SetString(memberName.c_str(), memberName.length(), allocator);
|
||||||
@ -434,8 +434,8 @@ struct RsTypeSerializer
|
|||||||
RsGenericSerializer::SerializeContext lCtx(nullptr, 0, ctx.mFlags);
|
RsGenericSerializer::SerializeContext lCtx(nullptr, 0, ctx.mFlags);
|
||||||
lCtx.mJson.SetObject() = v; // Beware of move semantic!!
|
lCtx.mJson.SetObject() = v; // Beware of move semantic!!
|
||||||
|
|
||||||
serial_process(j, ctx, p.first, "first");
|
serial_process(j, lCtx, p.first, "first");
|
||||||
serial_process(j, ctx, p.second, "second");
|
serial_process(j, lCtx, p.second, "second");
|
||||||
ctx.mOk &= lCtx.mOk;
|
ctx.mOk &= lCtx.mOk;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -532,7 +532,7 @@ struct RsTypeSerializer
|
|||||||
for(uint32_t i=0; i<n; ++i)
|
for(uint32_t i=0; i<n; ++i)
|
||||||
{
|
{
|
||||||
T tmp;
|
T tmp;
|
||||||
serial_process<T>(j,ctx,tmp,memberName);
|
serial_process(j,ctx,tmp,memberName);
|
||||||
v.insert(tmp);
|
v.insert(tmp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -590,7 +590,7 @@ struct RsTypeSerializer
|
|||||||
for(uint32_t i=0;i<n;++i)
|
for(uint32_t i=0;i<n;++i)
|
||||||
{
|
{
|
||||||
T tmp;
|
T tmp;
|
||||||
serial_process<T>(j,ctx,tmp,memberName);
|
serial_process(j,ctx,tmp,memberName);
|
||||||
v.push_back(tmp);
|
v.push_back(tmp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -857,16 +857,16 @@ bool p3MsgService::getMessage(const std::string &mId, MessageInfo &msg)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3MsgService::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox)
|
void p3MsgService::getMessageCount(uint32_t &nInbox, uint32_t &nInboxNew, uint32_t &nOutbox, uint32_t &nDraftbox, uint32_t &nSentbox, uint32_t &nTrashbox)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
if (pnInbox) *pnInbox = 0;
|
nInbox = 0;
|
||||||
if (pnInboxNew) *pnInboxNew = 0;
|
nInboxNew = 0;
|
||||||
if (pnOutbox) *pnOutbox = 0;
|
nOutbox = 0;
|
||||||
if (pnDraftbox) *pnDraftbox = 0;
|
nDraftbox = 0;
|
||||||
if (pnSentbox) *pnSentbox = 0;
|
nSentbox = 0;
|
||||||
if (pnTrashbox) *pnTrashbox = 0;
|
nTrashbox = 0;
|
||||||
|
|
||||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||||
std::map<uint32_t, RsMsgItem *> *apMsg [2] = { &imsg, &msgOutgoing };
|
std::map<uint32_t, RsMsgItem *> *apMsg [2] = { &imsg, &msgOutgoing };
|
||||||
@ -877,24 +877,23 @@ void p3MsgService::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxN
|
|||||||
initRsMIS(mit->second, mis);
|
initRsMIS(mit->second, mis);
|
||||||
|
|
||||||
if (mis.msgflags & RS_MSG_TRASH) {
|
if (mis.msgflags & RS_MSG_TRASH) {
|
||||||
if (pnTrashbox) ++(*pnTrashbox);
|
++nTrashbox;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (mis.msgflags & RS_MSG_BOXMASK) {
|
switch (mis.msgflags & RS_MSG_BOXMASK) {
|
||||||
case RS_MSG_INBOX:
|
case RS_MSG_INBOX:
|
||||||
if (pnInbox) ++(*pnInbox);
|
++nInbox;
|
||||||
if ((mis.msgflags & RS_MSG_NEW) == RS_MSG_NEW) {
|
if ((mis.msgflags & RS_MSG_NEW) == RS_MSG_NEW)
|
||||||
if (pnInboxNew) ++(*pnInboxNew);
|
++nInboxNew;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case RS_MSG_OUTBOX:
|
case RS_MSG_OUTBOX:
|
||||||
if (pnOutbox) ++(*pnOutbox);
|
++nOutbox;
|
||||||
break;
|
break;
|
||||||
case RS_MSG_DRAFTBOX:
|
case RS_MSG_DRAFTBOX:
|
||||||
if (pnDraftbox) ++(*pnDraftbox);
|
++nDraftbox;
|
||||||
break;
|
break;
|
||||||
case RS_MSG_SENTBOX:
|
case RS_MSG_SENTBOX:
|
||||||
if (pnSentbox) ++(*pnSentbox);
|
++nSentbox;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public:
|
|||||||
/* External Interface */
|
/* External Interface */
|
||||||
bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList);
|
bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList);
|
||||||
bool getMessage(const std::string &mid, Rs::Msgs::MessageInfo &msg);
|
bool getMessage(const std::string &mid, Rs::Msgs::MessageInfo &msg);
|
||||||
void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox);
|
void getMessageCount(uint32_t &nInbox, uint32_t &nInboxNew, uint32_t &nOutbox, uint32_t &nDraftbox, uint32_t &nSentbox, uint32_t &nTrashbox);
|
||||||
|
|
||||||
bool decryptMessage(const std::string& mid) ;
|
bool decryptMessage(const std::string& mid) ;
|
||||||
bool removeMsgId(const std::string &mid);
|
bool removeMsgId(const std::string &mid);
|
||||||
|
@ -51,8 +51,9 @@ QIcon MessageUserNotify::getMainIcon(bool hasNew)
|
|||||||
|
|
||||||
unsigned int MessageUserNotify::getNewCount()
|
unsigned int MessageUserNotify::getNewCount()
|
||||||
{
|
{
|
||||||
unsigned int newInboxCount = 0;
|
uint32_t newInboxCount = 0;
|
||||||
rsMail->getMessageCount(NULL, &newInboxCount, NULL, NULL, NULL, NULL);
|
uint32_t a, b, c, d, e; // dummies
|
||||||
|
rsMail->getMessageCount(a, newInboxCount, b, c, d, e);
|
||||||
|
|
||||||
return newInboxCount;
|
return newInboxCount;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user