From 0fd46e4f2bff91bfd2c3d7688380e7240ac12927 Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Sat, 8 Feb 2014 11:13:10 +0000 Subject: [PATCH] Added specific IDs to GXS service serialisers NOTE! YOU WILL LOSE CURRENT GXS data! git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7100 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/rsserver/rsinit.cc | 2 +- .../src/serialiser/rsgxschannelitems.cc | 8 +- .../src/serialiser/rsgxscircleitems.cc | 4 +- .../src/serialiser/rsgxsforumitems.cc | 8 +- libretroshare/src/serialiser/rsgxsiditems.cc | 16 ++-- .../src/serialiser/rsgxsrecognitems.cc | 20 ++--- libretroshare/src/serialiser/rsphotoitems.cc | 81 +++++++++---------- libretroshare/src/serialiser/rsposteditems.cc | 12 +-- libretroshare/src/serialiser/rstlvbase.h | 16 ++++ libretroshare/src/serialiser/rswikiitems.cc | 24 +++--- libretroshare/src/serialiser/rswireitems.cc | 12 +-- 11 files changed, 109 insertions(+), 94 deletions(-) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 8897d2aaf..aaa44b746 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1364,7 +1364,7 @@ int RsServer::StartupRetroShare() std::string currGxsDir = rsAccounts.PathAccountDirectory() + "/GXS_phase2"; #ifdef GXS_DEV_TESTNET // Different Directory for testing. - currGxsDir += "_TESTNET7"; + currGxsDir += "_TESTNET8"; #endif bool cleanUpGxsDir = false; diff --git a/libretroshare/src/serialiser/rsgxschannelitems.cc b/libretroshare/src/serialiser/rsgxschannelitems.cc index cdde8345f..863b77f9b 100644 --- a/libretroshare/src/serialiser/rsgxschannelitems.cc +++ b/libretroshare/src/serialiser/rsgxschannelitems.cc @@ -220,7 +220,7 @@ bool RsGxsChannelSerialiser::serialiseGxsChannelGroupItem(RsGxsChannelGroupItem offset += 8; /* GxsChannelGroupItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->mDescription); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DESCR, item->mDescription); item->mImage.SetTlv(data, tlvsize, &offset); if(offset != tlvsize) @@ -281,7 +281,7 @@ RsGxsChannelGroupItem* RsGxsChannelSerialiser::deserialiseGxsChannelGroupItem(vo /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->mDescription); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DESCR, item->mDescription); item->mImage.GetTlv(data, rssize, &offset); if (offset != rssize) @@ -442,7 +442,7 @@ bool RsGxsChannelSerialiser::serialiseGxsChannelPostItem(RsGxsChannelPostItem *i offset += 8; /* GxsChannelPostItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->mMsg); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSG, item->mMsg); item->mAttachment.SetTlv(data, tlvsize, &offset); item->mThumbnail.SetTlv(data, tlvsize, &offset); @@ -504,7 +504,7 @@ RsGxsChannelPostItem* RsGxsChannelSerialiser::deserialiseGxsChannelPostItem(void /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->mMsg); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSG, item->mMsg); item->mAttachment.GetTlv(data, rssize, &offset); item->mThumbnail.GetTlv(data, rssize, &offset); diff --git a/libretroshare/src/serialiser/rsgxscircleitems.cc b/libretroshare/src/serialiser/rsgxscircleitems.cc index a48a4fe24..c7fae86f6 100644 --- a/libretroshare/src/serialiser/rsgxscircleitems.cc +++ b/libretroshare/src/serialiser/rsgxscircleitems.cc @@ -368,7 +368,7 @@ bool RsGxsCircleSerialiser::serialiseGxsCircleMsgItem(RsGxsCircleMsgItem *item, offset += 8; /* GxsCircleMsgItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->msg.stuff); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSG, item->msg.stuff); if(offset != tlvsize) { @@ -428,7 +428,7 @@ RsGxsCircleMsgItem* RsGxsCircleSerialiser::deserialiseGxsCircleMsgItem(void *dat /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->msg.stuff); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSG, item->msg.stuff); if (offset != rssize) { diff --git a/libretroshare/src/serialiser/rsgxsforumitems.cc b/libretroshare/src/serialiser/rsgxsforumitems.cc index 800e26af0..460ea9062 100644 --- a/libretroshare/src/serialiser/rsgxsforumitems.cc +++ b/libretroshare/src/serialiser/rsgxsforumitems.cc @@ -164,7 +164,7 @@ bool RsGxsForumSerialiser::serialiseGxsForumGroupItem(RsGxsForumGroupItem *item, offset += 8; /* GxsForumGroupItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->mGroup.mDescription); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DESCR, item->mGroup.mDescription); if(offset != tlvsize) { @@ -224,7 +224,7 @@ RsGxsForumGroupItem* RsGxsForumSerialiser::deserialiseGxsForumGroupItem(void *da /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->mGroup.mDescription); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DESCR, item->mGroup.mDescription); if (offset != rssize) { @@ -312,7 +312,7 @@ bool RsGxsForumSerialiser::serialiseGxsForumMsgItem(RsGxsForumMsgItem *item, voi offset += 8; /* GxsForumMsgItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->mMsg.mMsg); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSG, item->mMsg.mMsg); if(offset != tlvsize) { @@ -372,7 +372,7 @@ RsGxsForumMsgItem* RsGxsForumSerialiser::deserialiseGxsForumMsgItem(void *data, /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->mMsg.mMsg); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSG, item->mMsg.mMsg); if (offset != rssize) { diff --git a/libretroshare/src/serialiser/rsgxsiditems.cc b/libretroshare/src/serialiser/rsgxsiditems.cc index 7853afeaf..32ff24c1a 100644 --- a/libretroshare/src/serialiser/rsgxsiditems.cc +++ b/libretroshare/src/serialiser/rsgxsiditems.cc @@ -192,8 +192,8 @@ bool RsGxsIdSerialiser::serialiseGxsIdGroupItem(RsGxsIdGroupItem *item, void *da offset += 8; /* GxsIdGroupItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->group.mPgpIdHash); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->group.mPgpIdSign); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_HASH_SHA1, item->group.mPgpIdHash); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_SIGN, item->group.mPgpIdSign); RsTlvStringSetRef set(TLV_TYPE_RECOGNSET, item->group.mRecognTags); ok &= set.SetTlv(data, tlvsize, &offset); @@ -252,8 +252,8 @@ RsGxsIdGroupItem* RsGxsIdSerialiser::deserialiseGxsIdGroupItem(void *data, uint3 /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->group.mPgpIdHash); - ok &= GetTlvString(data, rssize, &offset, 1, item->group.mPgpIdSign); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_HASH_SHA1, item->group.mPgpIdHash); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_SIGN, item->group.mPgpIdSign); RsTlvStringSetRef set(TLV_TYPE_RECOGNSET, item->group.mRecognTags); ok &= set.GetTlv(data, rssize, &offset); @@ -352,7 +352,7 @@ bool RsGxsIdSerialiser::serialiseGxsIdOpinionItem(RsGxsIdOpinionItem *item, void /* GxsIdOpinionItem */ ok &= setRawUInt32(data, tlvsize, &offset, item->opinion.mOpinion); ok &= setRawUInt32(data, tlvsize, &offset, item->opinion.mReputation); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->opinion.mComment); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->opinion.mComment); if(offset != tlvsize) { @@ -411,7 +411,7 @@ RsGxsIdOpinionItem* RsGxsIdSerialiser::deserialiseGxsIdOpinionItem(void *data, u ok &= getRawUInt32(data, rssize, &offset, &(item->opinion.mOpinion)); ok &= getRawUInt32(data, rssize, &offset, &(item->opinion.mReputation)); - ok &= GetTlvString(data, rssize, &offset, 1, item->opinion.mComment); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_COMMENT, item->opinion.mComment); if (offset != rssize) { @@ -494,7 +494,7 @@ bool RsGxsIdSerialiser::serialiseGxsIdCommentItem(RsGxsIdCommentItem *item, void offset += 8; /* GxsIdCommentItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->comment.mComment); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->comment.mComment); if(offset != tlvsize) { @@ -551,7 +551,7 @@ RsGxsIdCommentItem* RsGxsIdSerialiser::deserialiseGxsIdCommentItem(void *data, u /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->comment.mComment); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_COMMENT, item->comment.mComment); if (offset != rssize) { diff --git a/libretroshare/src/serialiser/rsgxsrecognitems.cc b/libretroshare/src/serialiser/rsgxsrecognitems.cc index 89b4576aa..a9cc72749 100644 --- a/libretroshare/src/serialiser/rsgxsrecognitems.cc +++ b/libretroshare/src/serialiser/rsgxsrecognitems.cc @@ -133,9 +133,9 @@ bool RsGxsRecognSerialiser::serialiseReq(RsGxsRecognReqItem *item, void *dat ok &= setRawUInt16(data, tlvsize, &offset, item->tag_class); ok &= setRawUInt16(data, tlvsize, &offset, item->tag_type); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->identity); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->nickname); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->comment); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GXS_ID, item->identity); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->nickname); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->comment); ok &= item->sign.SetTlv(data, tlvsize, &offset); @@ -186,9 +186,9 @@ RsGxsRecognReqItem *RsGxsRecognSerialiser::deserialiseReq(void *data, uint32_t * ok &= getRawUInt16(data, tlvsize, &offset, &(item->tag_class)); ok &= getRawUInt16(data, tlvsize, &offset, &(item->tag_type)); - ok &= GetTlvString(data, tlvsize, &offset, 1, item->identity); - ok &= GetTlvString(data, tlvsize, &offset, 1, item->nickname); - ok &= GetTlvString(data, tlvsize, &offset, 1, item->comment); + ok &= GetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->identity); + ok &= GetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GXS_ID, item->nickname); + ok &= GetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->comment); ok &= item->sign.GetTlv(data, tlvsize, &offset); @@ -307,8 +307,8 @@ bool RsGxsRecognSerialiser::serialiseTag(RsGxsRecognTagItem *item, void *dat ok &= setRawUInt16(data, tlvsize, &offset, item->tag_class); ok &= setRawUInt16(data, tlvsize, &offset, item->tag_type); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->identity); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->nickname); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GXS_ID, item->identity); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->nickname); ok &= item->sign.SetTlv(data, tlvsize, &offset); @@ -360,8 +360,8 @@ RsGxsRecognTagItem *RsGxsRecognSerialiser::deserialiseTag(void *data, uint32_t * ok &= getRawUInt16(data, tlvsize, &offset, &(item->tag_class)); ok &= getRawUInt16(data, tlvsize, &offset, &(item->tag_type)); - ok &= GetTlvString(data, tlvsize, &offset, 1, item->identity); - ok &= GetTlvString(data, tlvsize, &offset, 1, item->nickname); + ok &= GetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GXS_ID, item->identity); + ok &= GetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->nickname); ok &= item->sign.GetTlv(data, tlvsize, &offset); diff --git a/libretroshare/src/serialiser/rsphotoitems.cc b/libretroshare/src/serialiser/rsphotoitems.cc index dcc4ef2bd..cdc79eddc 100644 --- a/libretroshare/src/serialiser/rsphotoitems.cc +++ b/libretroshare/src/serialiser/rsphotoitems.cc @@ -190,16 +190,16 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoAlbumItem(RsGxsPhotoAlbumItem* item, /* GxsPhotoAlbumItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mCaption); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mCategory); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mDescription); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mHashTags); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mOther); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mPhotoPath); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mPhotographer); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhen); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mThumbnail.type); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_CAPTION, item->album.mCaption); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_CATEGORY, item->album.mCategory); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DESCR, item->album.mDescription); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_HASH_TAG, item->album.mHashTags); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSG, item->album.mOther); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_PATH, item->album.mPhotoPath); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->album.mPhotographer); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DATE, item->album.mWhen); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_LOCATION, item->album.mWhere); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_PIC_TYPE, item->album.mThumbnail.type); RsTlvBinaryData b(RS_SERVICE_GXSV2_TYPE_PHOTO); // TODO, need something more persisitent b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size); ok &= b.SetTlv(data, tlvsize, &offset); @@ -264,17 +264,16 @@ RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* da /* skip the header */ offset += 8; - - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mCaption); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mCategory); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mDescription); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mHashTags); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mOther); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mPhotoPath); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mPhotographer); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mWhen); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mWhere); - ok &= GetTlvString(data, rssize, &offset, 1, item->album.mThumbnail.type); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_CAPTION, item->album.mCaption); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_CATEGORY, item->album.mCategory); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DESCR, item->album.mDescription); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_HASH_TAG, item->album.mHashTags); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSG, item->album.mOther); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_PATH, item->album.mPhotoPath); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, item->album.mPhotographer); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DATE, item->album.mWhen); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_LOCATION, item->album.mWhere); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_PIC_TYPE, item->album.mThumbnail.type); RsTlvBinaryData b(RS_SERVICE_GXSV2_TYPE_PHOTO); // TODO, need something more persisitent ok &= b.GetTlv(data, rssize, &offset); @@ -357,15 +356,15 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoPhotoItem(RsGxsPhotoPhotoItem* item, /* GxsPhotoAlbumItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mCaption); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mCategory); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mDescription); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mHashTags); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mOther); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mPhotographer); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhen); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mThumbnail.type); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_CAPTION, item->photo.mCaption); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_CATEGORY, item->photo.mCategory); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DESCR, item->photo.mDescription); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_HASH_TAG, item->photo.mHashTags); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSG, item->photo.mOther); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_PIC_AUTH, item->photo.mPhotographer); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DATE, item->photo.mWhen); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_LOCATION, item->photo.mWhere); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_PIC_TYPE, item->photo.mThumbnail.type); RsTlvBinaryData b(RS_SERVICE_GXSV2_TYPE_PHOTO); // TODO, need something more persisitent b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size); ok &= b.SetTlv(data, tlvsize, &offset); @@ -430,15 +429,15 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mCaption); - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mCategory); - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mDescription); - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mHashTags); - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mOther); - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mPhotographer); - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mWhen); - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mWhere); - ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mThumbnail.type); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_CAPTION, item->photo.mCaption); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_CATEGORY, item->photo.mCategory); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DESCR, item->photo.mDescription); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_HASH_TAG, item->photo.mHashTags); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSG, item->photo.mOther); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_PIC_AUTH, item->photo.mPhotographer); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DATE, item->photo.mWhen); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_LOCATION, item->photo.mWhere); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_PIC_TYPE, item->photo.mThumbnail.type); RsTlvBinaryData b(RS_SERVICE_GXSV2_TYPE_PHOTO); // TODO, need something more persisitent ok &= b.GetTlv(data, rssize, &offset); @@ -499,7 +498,7 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoCommentItem (RsGxsPhotoComme /* GxsPhotoAlbumItem */ - ok &= SetTlvString(data, tlvsize, &offset, 0, item->comment.mComment); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->comment.mComment); ok &= setRawUInt32(data, tlvsize, &offset, item->comment.mCommentFlag); if(offset != tlvsize) @@ -562,7 +561,7 @@ RsGxsPhotoCommentItem * RsGxsPhotoSerialiser::deserialiseGxsPhotoCommentItem( /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 0, item->comment.mComment); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_COMMENT, item->comment.mComment); ok &= getRawUInt32(data, rssize, &offset, &(item->comment.mCommentFlag)); if (offset != rssize) diff --git a/libretroshare/src/serialiser/rsposteditems.cc b/libretroshare/src/serialiser/rsposteditems.cc index 14a150877..46bb6d9b7 100644 --- a/libretroshare/src/serialiser/rsposteditems.cc +++ b/libretroshare/src/serialiser/rsposteditems.cc @@ -172,8 +172,8 @@ bool RsGxsPostedSerialiser::serialiseGxsPostedPostItem(RsGxsPostedPostItem* item /* RsPostedPost */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->mPost.mLink); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->mPost.mNotes); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_LINK, item->mPost.mLink); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSG, item->mPost.mNotes); if(offset != tlvsize) { @@ -229,8 +229,8 @@ RsGxsPostedPostItem* RsGxsPostedSerialiser::deserialiseGxsPostedPostItem(void *d /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->mPost.mLink); - ok &= GetTlvString(data, rssize, &offset, 1, item->mPost.mNotes); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_LINK, item->mPost.mLink); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSG, item->mPost.mNotes); if (offset != rssize) { @@ -313,7 +313,7 @@ bool RsGxsPostedSerialiser::serialiseGxsPostedGroupItem(RsGxsPostedGroupItem* it offset += 8; /* PostedGroupItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->mGroup.mDescription); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DESCR, item->mGroup.mDescription); if(offset != tlvsize) @@ -369,7 +369,7 @@ RsGxsPostedGroupItem* RsGxsPostedSerialiser::deserialiseGxsPostedGroupItem(void /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->mGroup.mDescription); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DESCR, item->mGroup.mDescription); if (offset != rssize) { diff --git a/libretroshare/src/serialiser/rstlvbase.h b/libretroshare/src/serialiser/rstlvbase.h index f57dabf3e..4bd0ab955 100644 --- a/libretroshare/src/serialiser/rstlvbase.h +++ b/libretroshare/src/serialiser/rstlvbase.h @@ -139,6 +139,9 @@ const uint16_t TLV_TYPE_STR_PGPCERT = 0x005d; /* same as CERT_GPG */ const uint16_t TLV_TYPE_STR_CERT_SSL = 0x005e; const uint16_t TLV_TYPE_STR_VERSION = 0x005f; + + + /* Wide Chars (4 bytes per char) for internationalisation */ const uint16_t TLV_TYPE_WSTR_PEERID = 0x0060; const uint16_t TLV_TYPE_WSTR_NAME = 0x0061; @@ -175,6 +178,19 @@ const uint16_t TLV_TYPE_STR_KEYID = 0x00a4; const uint16_t TLV_TYPE_WSTR_CATEGORY = 0x00b0; +/* even MORE string Ids for GXS services */ + +const uint16_t TLV_TYPE_STR_CAPTION = 0x00b1; +const uint16_t TLV_TYPE_STR_CATEGORY = 0x00b2; +const uint16_t TLV_TYPE_STR_DESCR = 0x00b3; +const uint16_t TLV_TYPE_STR_SIGN = 0x00b4; +const uint16_t TLV_TYPE_STR_HASH_TAG = 0x00b5; +const uint16_t TLV_TYPE_STR_WIKI_PAGE = 0x00b6; +const uint16_t TLV_TYPE_STR_DATE = 0x00b7; +const uint16_t TLV_TYPE_STR_PIC_TYPE = 0x00b8; +const uint16_t TLV_TYPE_STR_PIC_AUTH = 0x00b9; +const uint16_t TLV_TYPE_STR_GXS_ID = 0x00ba; + /**** Binary Types ****/ const uint16_t TLV_TYPE_CERT_XPGP_DER = 0x0100; diff --git a/libretroshare/src/serialiser/rswikiitems.cc b/libretroshare/src/serialiser/rswikiitems.cc index 4b19fe9e4..7abd08e61 100644 --- a/libretroshare/src/serialiser/rswikiitems.cc +++ b/libretroshare/src/serialiser/rswikiitems.cc @@ -183,9 +183,9 @@ bool RsGxsWikiSerialiser::serialiseGxsWikiCollectionItem(RsGxsWikiCollectionItem offset += 8; /* GxsWikiCollectionItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->collection.mDescription); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->collection.mCategory); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->collection.mHashTags); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DESCR, item->collection.mDescription); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_CATEGORY, item->collection.mCategory); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_HASH_TAG, item->collection.mHashTags); if(offset != tlvsize) { @@ -245,9 +245,9 @@ RsGxsWikiCollectionItem* RsGxsWikiSerialiser::deserialiseGxsWikiCollectionItem(v /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->collection.mDescription); - ok &= GetTlvString(data, rssize, &offset, 1, item->collection.mCategory); - ok &= GetTlvString(data, rssize, &offset, 1, item->collection.mHashTags); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DESCR, item->collection.mDescription); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_CATEGORY, item->collection.mCategory); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_HASH_TAG, item->collection.mHashTags); if (offset != rssize) { @@ -340,8 +340,8 @@ bool RsGxsWikiSerialiser::serialiseGxsWikiSnapshotItem(RsGxsWikiSnapshotItem *it offset += 8; /* GxsWikiSnapshotItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->snapshot.mPage); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->snapshot.mHashTags); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_WIKI_PAGE, item->snapshot.mPage); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_HASH_TAG, item->snapshot.mHashTags); if(offset != tlvsize) { @@ -401,8 +401,8 @@ RsGxsWikiSnapshotItem* RsGxsWikiSerialiser::deserialiseGxsWikiSnapshotItem(void /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->snapshot.mPage); - ok &= GetTlvString(data, rssize, &offset, 1, item->snapshot.mHashTags); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_WIKI_PAGE, item->snapshot.mPage); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_HASH_TAG, item->snapshot.mHashTags); if (offset != rssize) { @@ -489,7 +489,7 @@ bool RsGxsWikiSerialiser::serialiseGxsWikiCommentItem(RsGxsWikiCommentItem *item offset += 8; /* GxsWikiCommentItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->comment.mComment); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->comment.mComment); if(offset != tlvsize) { @@ -549,7 +549,7 @@ RsGxsWikiCommentItem* RsGxsWikiSerialiser::deserialiseGxsWikiCommentItem(void *d /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->comment.mComment); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_COMMENT, item->comment.mComment); if (offset != rssize) { diff --git a/libretroshare/src/serialiser/rswireitems.cc b/libretroshare/src/serialiser/rswireitems.cc index 4eeb5fa32..285d2ab04 100644 --- a/libretroshare/src/serialiser/rswireitems.cc +++ b/libretroshare/src/serialiser/rswireitems.cc @@ -162,7 +162,7 @@ bool RsGxsWireSerialiser::serialiseGxsWireGroupItem(RsGxsWireGroupItem *item, vo offset += 8; /* GxsWireGroupItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->group.mDescription); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DESCR, item->group.mDescription); if(offset != tlvsize) { @@ -222,7 +222,7 @@ RsGxsWireGroupItem* RsGxsWireSerialiser::deserialiseGxsWireGroupItem(void *data, /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->group.mDescription); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DESCR, item->group.mDescription); if (offset != rssize) { @@ -315,8 +315,8 @@ bool RsGxsWireSerialiser::serialiseGxsWirePulseItem(RsGxsWirePulseItem *item, vo offset += 8; /* GxsWirePulseItem */ - ok &= SetTlvString(data, tlvsize, &offset, 1, item->pulse.mPulseText); - ok &= SetTlvString(data, tlvsize, &offset, 1, item->pulse.mHashTags); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSG, item->pulse.mPulseText); + ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_HASH_TAG, item->pulse.mHashTags); if(offset != tlvsize) { @@ -376,8 +376,8 @@ RsGxsWirePulseItem* RsGxsWireSerialiser::deserialiseGxsWirePulseItem(void *data, /* skip the header */ offset += 8; - ok &= GetTlvString(data, rssize, &offset, 1, item->pulse.mPulseText); - ok &= GetTlvString(data, rssize, &offset, 1, item->pulse.mHashTags); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSG, item->pulse.mPulseText); + ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_HASH_TAG, item->pulse.mHashTags); if (offset != rssize) {