2018-05-29 15:08:17 -04:00
|
|
|
/*******************************************************************************
|
|
|
|
* libretroshare/src/rsitems: rsgxsiditems.h *
|
|
|
|
* *
|
|
|
|
* libretroshare: retroshare core library *
|
|
|
|
* *
|
|
|
|
* Copyright 2012-2012 by Robert Fernie <retroshare@lunamutt.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2012-10-21 12:18:21 -04:00
|
|
|
#ifndef RS_GXS_IDENTITY_ITEMS_H
|
|
|
|
#define RS_GXS_IDENTITY_ITEMS_H
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
2017-04-18 15:11:37 -04:00
|
|
|
#include "rsitems/rsserviceids.h"
|
2012-10-21 12:18:21 -04:00
|
|
|
#include "serialiser/rsserial.h"
|
|
|
|
|
|
|
|
#include "rsgxsitems.h"
|
|
|
|
#include "retroshare/rsidentity.h"
|
|
|
|
|
2015-01-25 17:09:12 -05:00
|
|
|
//const uint8_t RS_PKT_SUBTYPE_GXSID_GROUP_ITEM_deprecated = 0x02;
|
|
|
|
|
2015-03-14 10:33:23 -04:00
|
|
|
const uint8_t RS_PKT_SUBTYPE_GXSID_GROUP_ITEM = 0x02;
|
|
|
|
const uint8_t RS_PKT_SUBTYPE_GXSID_OPINION_ITEM = 0x03;
|
|
|
|
const uint8_t RS_PKT_SUBTYPE_GXSID_COMMENT_ITEM = 0x04;
|
|
|
|
const uint8_t RS_PKT_SUBTYPE_GXSID_LOCAL_INFO_ITEM = 0x05;
|
2012-10-21 12:18:21 -04:00
|
|
|
|
2015-03-14 10:33:23 -04:00
|
|
|
class RsGxsIdItem: public RsGxsGrpItem
|
2012-10-21 12:18:21 -04:00
|
|
|
{
|
2015-03-14 10:33:23 -04:00
|
|
|
public:
|
|
|
|
RsGxsIdItem(uint8_t item_subtype) : RsGxsGrpItem(RS_SERVICE_GXS_TYPE_GXSID,item_subtype) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class RsGxsIdGroupItem : public RsGxsIdItem
|
|
|
|
{
|
2012-10-21 12:18:21 -04:00
|
|
|
public:
|
|
|
|
|
2015-03-14 10:33:23 -04:00
|
|
|
RsGxsIdGroupItem(): RsGxsIdItem(RS_PKT_SUBTYPE_GXSID_GROUP_ITEM) {}
|
|
|
|
virtual ~RsGxsIdGroupItem() {}
|
2012-10-21 12:18:21 -04:00
|
|
|
|
2017-04-26 08:17:38 -04:00
|
|
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
2015-03-14 10:33:23 -04:00
|
|
|
virtual void clear();
|
2015-01-25 17:09:12 -05:00
|
|
|
|
|
|
|
bool fromGxsIdGroup(RsGxsIdGroup &group, bool moveImage);
|
|
|
|
bool toGxsIdGroup(RsGxsIdGroup &group, bool moveImage);
|
|
|
|
|
|
|
|
Sha1CheckSum mPgpIdHash;
|
|
|
|
// Need a signature as proof - otherwise anyone could add others Hashes.
|
|
|
|
// This is a string, as the length is variable.
|
|
|
|
std::string mPgpIdSign;
|
2012-10-21 12:18:21 -04:00
|
|
|
|
2015-01-25 17:09:12 -05:00
|
|
|
// Recognition Strings. MAX# defined above.
|
|
|
|
std::list<std::string> mRecognTags;
|
2012-10-21 12:18:21 -04:00
|
|
|
|
2015-01-25 17:09:12 -05:00
|
|
|
// Avatar
|
|
|
|
RsTlvImage mImage ;
|
2012-10-21 12:18:21 -04:00
|
|
|
};
|
2015-03-14 10:33:23 -04:00
|
|
|
class RsGxsIdLocalInfoItem : public RsGxsIdItem
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
RsGxsIdLocalInfoItem(): RsGxsIdItem(RS_PKT_SUBTYPE_GXSID_LOCAL_INFO_ITEM) {}
|
|
|
|
virtual ~RsGxsIdLocalInfoItem() {}
|
|
|
|
|
|
|
|
virtual void clear();
|
|
|
|
|
2017-04-26 08:17:38 -04:00
|
|
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
2015-03-14 10:33:23 -04:00
|
|
|
|
|
|
|
std::map<RsGxsId,time_t> mTimeStamps ;
|
2015-11-19 22:58:28 -05:00
|
|
|
std::set<RsGxsId> mContacts ;
|
2015-03-14 10:33:23 -04:00
|
|
|
};
|
2012-10-21 12:18:21 -04:00
|
|
|
|
2014-02-19 06:08:37 -05:00
|
|
|
#if 0
|
2012-10-21 12:18:21 -04:00
|
|
|
class RsGxsIdOpinionItem : public RsGxsMsgItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2015-01-25 17:09:12 -05:00
|
|
|
RsGxsIdOpinionItem(): RsGxsMsgItem(RS_SERVICE_GXS_TYPE_GXSID,
|
2012-10-21 12:18:21 -04:00
|
|
|
RS_PKT_SUBTYPE_GXSID_OPINION_ITEM) {return; }
|
|
|
|
virtual ~RsGxsIdOpinionItem() { return;}
|
|
|
|
void clear();
|
2015-03-14 10:33:23 -04:00
|
|
|
virtual bool serialise(void *data,uint32_t& size) = 0 ;
|
|
|
|
virtual uint32_t serial_size() = 0 ;
|
|
|
|
|
|
|
|
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
2012-10-21 12:18:21 -04:00
|
|
|
RsGxsIdOpinion opinion;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RsGxsIdCommentItem : public RsGxsMsgItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2014-03-29 11:34:37 -04:00
|
|
|
RsGxsIdCommentItem(): RsGxsMsgItem(RS_SERVICE_GXS_TYPE_GXSID,
|
2012-10-21 12:18:21 -04:00
|
|
|
RS_PKT_SUBTYPE_GXSID_COMMENT_ITEM) { return; }
|
|
|
|
virtual ~RsGxsIdCommentItem() { return; }
|
|
|
|
void clear();
|
2015-03-14 10:33:23 -04:00
|
|
|
virtual bool serialise(void *data,uint32_t& size) = 0 ;
|
|
|
|
virtual uint32_t serial_size() = 0 ;
|
|
|
|
|
2012-10-21 12:18:21 -04:00
|
|
|
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
|
|
|
RsGxsIdComment comment;
|
|
|
|
|
|
|
|
};
|
2014-02-19 06:08:37 -05:00
|
|
|
#endif
|
2012-10-21 12:18:21 -04:00
|
|
|
|
2017-04-26 08:17:38 -04:00
|
|
|
class RsGxsIdSerialiser : public RsServiceSerializer
|
2012-10-21 12:18:21 -04:00
|
|
|
{
|
|
|
|
public:
|
2017-04-26 08:17:38 -04:00
|
|
|
RsGxsIdSerialiser() :RsServiceSerializer(RS_SERVICE_GXS_TYPE_GXSID) {}
|
2015-03-14 10:33:23 -04:00
|
|
|
virtual ~RsGxsIdSerialiser() {}
|
|
|
|
|
2017-04-26 08:17:38 -04:00
|
|
|
virtual RsItem *create_item(uint16_t service_id,uint8_t item_subtype) const ;
|
2012-10-21 12:18:21 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* RS_GXS_IDENTITY_ITEMS_H */
|