Save incoming not read private chat messages in config and delete it after reading.

Added queue for outgoing private offline chat messages. The queue is also saved until the private chat message could be delivered.
It does not work in the short time between the shutdown of the peer and the switch of the state to offline for that peer. For this we need a response of the peer.
Need recompile.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3517 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-21 00:08:06 +00:00
parent 412cf5f928
commit 37fe5ff3a3
19 changed files with 709 additions and 236 deletions

View file

@ -44,8 +44,11 @@ const uint32_t RS_CHAT_FLAG_PUBLIC = 0x0020;
const uint32_t RS_CHAT_FLAG_REQUEST_CUSTOM_STATE = 0x0040;
const uint32_t RS_CHAT_FLAG_CUSTOM_STATE_AVAILABLE = 0x0080;
const uint8_t RS_PKT_SUBTYPE_CHAT_AVATAR = 0x03 ; // default is 0x01
const uint8_t RS_PKT_SUBTYPE_CHAT_STATUS = 0x04 ; // default is 0x01
const uint32_t RS_CHATMSG_CONFIGFLAG_INCOMING = 0x0001;
const uint8_t RS_PKT_SUBTYPE_CHAT_AVATAR = 0x03 ; // default is 0x01
const uint8_t RS_PKT_SUBTYPE_CHAT_STATUS = 0x04 ; // default is 0x01
const uint8_t RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG = 0x05 ; // default is 0x01
// for defining tags themselves and msg tags
const uint8_t RS_PKT_SUBTYPE_MSG_TAG_TYPE = 0x03;
@ -86,7 +89,37 @@ class RsChatMsgItem: public RsChatItem
uint32_t sendTime;
std::wstring message;
/* not serialised */
uint32_t recvTime;
uint32_t recvTime;
};
/*!
* For saving incoming and outgoing chat msgs
* @see p3ChatService
*/
class RsPrivateChatMsgConfigItem: public RsChatItem
{
public:
RsPrivateChatMsgConfigItem() :RsChatItem(RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG) {}
RsPrivateChatMsgConfigItem(void *data,uint32_t size) ; // deserialization
virtual ~RsPrivateChatMsgConfigItem() {}
virtual void clear() {}
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
/* set data from RsChatMsgItem to RsPrivateChatMsgConfigItem */
void set(RsChatMsgItem *ci, const std::string &peerId, uint32_t confFlags);
/* get data from RsPrivateChatMsgConfigItem to RsChatMsgItem */
void get(RsChatMsgItem *ci);
std::string configPeerId;
uint32_t chatFlags;
uint32_t configFlags;
uint32_t sendTime;
std::wstring message;
uint32_t recvTime;
};
// This class contains activity info for the sending peer: active, idle, typing, etc.