mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-23 06:31:20 -04:00
improvements messages:
- save msgId in configuration file - enable previous improvements read/unread state and tags new function for creating backups of a file bool createBackup (std::string sFilename, unsigned int nCount = 5); currently its only available for windows compile. maybe there is a linux developer who change it for linux. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3064 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fe98568329
commit
342768e626
8 changed files with 123 additions and 111 deletions
|
@ -428,6 +428,11 @@ uint32_t RsMsgSerialiser::sizeItem(RsMsgItem *item)
|
|||
s += item->msgbcc.TlvSize();
|
||||
s += item->attachment.TlvSize();
|
||||
|
||||
if (m_bConfiguration) {
|
||||
// serialise msgId too
|
||||
s += 4;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -467,6 +472,12 @@ bool RsMsgSerialiser::serialiseItem(RsMsgItem *item, void *data, uint32_t *p
|
|||
ok &= item->msgbcc.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
ok &= item->attachment.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
if (m_bConfiguration) {
|
||||
// serialise msgId too
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, item->msgId);
|
||||
}
|
||||
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
|
@ -521,6 +532,12 @@ RsMsgItem *RsMsgSerialiser::deserialiseItem(void *data, uint32_t *pktsize)
|
|||
ok &= item->msgbcc.GetTlv(data, rssize, &offset);
|
||||
ok &= item->attachment.GetTlv(data, rssize, &offset);
|
||||
|
||||
if (m_bConfiguration) {
|
||||
// deserialise msgId too
|
||||
// ok &= getRawUInt32(data, rssize, &offset, &(item->msgId));
|
||||
getRawUInt32(data, rssize, &offset, &(item->msgId)); //use this line for backward compatibility
|
||||
}
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
/* error */
|
||||
|
|
|
@ -179,12 +179,12 @@ std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
|||
class RsMsgSerialiser: public RsSerialType
|
||||
{
|
||||
public:
|
||||
RsMsgSerialiser()
|
||||
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_MSG)
|
||||
RsMsgSerialiser(bool bConfiguration = false)
|
||||
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_MSG), m_bConfiguration (bConfiguration)
|
||||
{ return; }
|
||||
|
||||
RsMsgSerialiser(uint16_t type)
|
||||
:RsSerialType(RS_PKT_VERSION_SERVICE, type)
|
||||
:RsSerialType(RS_PKT_VERSION_SERVICE, type), m_bConfiguration (false)
|
||||
{ return; }
|
||||
|
||||
virtual ~RsMsgSerialiser() { return; }
|
||||
|
@ -200,6 +200,7 @@ virtual uint32_t sizeItem(RsMsgItem *);
|
|||
virtual bool serialiseItem (RsMsgItem *item, void *data, uint32_t *size);
|
||||
virtual RsMsgItem *deserialiseItem(void *data, uint32_t *size);
|
||||
|
||||
bool m_bConfiguration; // is set to true for saving configuration (enables serialising msgId)
|
||||
};
|
||||
|
||||
/**************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue