Merge pull request #1493 from csoler/v0.6-Messaging

V0.6 messaging
This commit is contained in:
csoler 2019-03-29 22:27:27 +01:00 committed by GitHub
commit ef1755d97f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1459 additions and 1034 deletions

View file

@ -93,8 +93,8 @@ const ChatLobbyFlags RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ( 0x00000010 ) ; // requi
typedef uint64_t ChatLobbyId ;
typedef uint64_t ChatLobbyMsgId ;
typedef std::string ChatLobbyNickName ;
typedef uint64_t MessageId ;
typedef std::string RsMailMessageId; // should be uint32_t !!
typedef uint64_t MessageId ;
namespace Rs
@ -237,10 +237,11 @@ struct MsgInfoSummary : RsSerializable
MsgInfoSummary() : msgflags(0), count(0), ts(0) {}
virtual ~MsgInfoSummary() = default;
std::string msgId;
RsMailMessageId msgId;
RsPeerId srcId;
uint32_t msgflags;
std::list<uint32_t> msgtags; // that leaves 25 bits for user-defined tags.
std::string title;
int count; /* file count */
@ -253,6 +254,7 @@ struct MsgInfoSummary : RsSerializable
RS_SERIAL_PROCESS(srcId);
RS_SERIAL_PROCESS(msgflags);
RS_SERIAL_PROCESS(msgtags);
RS_SERIAL_PROCESS(title);
RS_SERIAL_PROCESS(count);

View file

@ -50,8 +50,8 @@ typedef Sha1CheckSum RsFileHash ;
typedef Sha1CheckSum RsMessageId ;
const uint32_t FT_STATE_FAILED = 0x0000 ;
const uint32_t FT_STATE_OKAY = 0x0001 ;
const uint32_t FT_STATE_WAITING = 0x0002 ;
const uint32_t FT_STATE_OKAY = 0x0001 ;
const uint32_t FT_STATE_WAITING = 0x0002 ;
const uint32_t FT_STATE_DOWNLOADING = 0x0003 ;
const uint32_t FT_STATE_COMPLETE = 0x0004 ;
const uint32_t FT_STATE_QUEUED = 0x0005 ;

View file

@ -1290,6 +1290,12 @@ bool p3MsgService::MessageToDraft(MessageInfo &info, const std::string &msgParen
return false;
}
bool p3MsgService::getMessageTag(const std::string &msgId, Rs::Msgs::MsgTagInfo& info)
{
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
return locked_getMessageTag(msgId,info);
}
bool p3MsgService::getMessageTagTypes(MsgTagType& tags)
{
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
@ -1413,10 +1419,8 @@ bool p3MsgService::removeMessageTagType(uint32_t tagId)
return true;
}
bool p3MsgService::getMessageTag(const std::string &msgId, MsgTagInfo& info)
bool p3MsgService::locked_getMessageTag(const std::string &msgId, MsgTagInfo& info)
{
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
uint32_t mid = atoi(msgId.c_str());
if (mid == 0) {
std::cerr << "p3MsgService::MessageGetMsgTag: Unknown msgId " << msgId << std::endl;
@ -1740,6 +1744,10 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis)
mis.title = msg->subject;
mis.count = msg->attachment.items.size();
mis.ts = msg->sendTime;
MsgTagInfo taginfo;
locked_getMessageTag(mis.msgId,taginfo);
mis.msgtags = taginfo.tagIds ;
}
void p3MsgService::initMIRsMsg(RsMsgItem *msg,const MessageInfo& info)

View file

@ -77,11 +77,11 @@ public:
bool MessageToDraft(Rs::Msgs::MessageInfo &info, const std::string &msgParentId);
bool MessageToTrash(const std::string &mid, bool bTrash);
bool getMessageTag(const std::string &msgId, Rs::Msgs::MsgTagInfo& info);
bool getMessageTagTypes(Rs::Msgs::MsgTagType& tags);
bool setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color);
bool removeMessageTagType(uint32_t tagId);
bool getMessageTag(const std::string &msgId, Rs::Msgs::MsgTagInfo& info);
/* set == false && tagId == 0 --> remove all */
bool setMessageTag(const std::string &msgId, uint32_t tagId, bool set);
@ -142,6 +142,7 @@ public:
private:
void sendDistantMsgItem(RsMsgItem *msgitem);
bool locked_getMessageTag(const std::string &msgId, Rs::Msgs::MsgTagInfo& info);
/** This contains the ongoing tunnel handling contacts.
* The map is indexed by the hash */