mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-23 21:25:22 -04:00
Merged branch v0.5-gxs-b1 into trunk (from -r 5351 -> 5995)
This brings a huge amount of goodness into the trunk, but there is still a big chunk todo before it can be released. * GXS Backend. * GXS Services: - Identities. - Circles - Photos - Wiki - GxsForums - Posted. * SSH no-gui server. See branch commits for more info. To switch on GXS stuff, enable CONFIG += gxs in both libretroshare.pro and retroshare-gui.pro git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5996 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
069b72e0b2
549 changed files with 111171 additions and 25579 deletions
|
@ -1,106 +0,0 @@
|
|||
#ifndef RETROSHARE_FORUMV2_GUI_INTERFACE_H
|
||||
#define RETROSHARE_FORUMV2_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsforumv2.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include <retroshare/rsidentity.h>
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsForumsV2;
|
||||
extern RsForumsV2 *rsForumsV2;
|
||||
|
||||
class RsForumV2Group
|
||||
{
|
||||
public:
|
||||
|
||||
// All the MetaData is Stored here:
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mGroupId;
|
||||
//std::string mName;
|
||||
|
||||
std::string mDescription;
|
||||
|
||||
// THESE ARE CURRENTLY UNUSED.
|
||||
//std::string mCategory;
|
||||
//std::string mHashTags;
|
||||
};
|
||||
|
||||
class RsForumV2Msg
|
||||
{
|
||||
public:
|
||||
|
||||
// All the MetaData is Stored here:
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mGroupId;
|
||||
//std::string mMsgId;
|
||||
//std::string mOrigMsgId;
|
||||
//std::string mThreadId;
|
||||
//std::string mParentId;
|
||||
//std::string mName; (aka. Title)
|
||||
|
||||
std::string mMsg; // all the text is stored here.
|
||||
|
||||
// THESE ARE CURRENTLY UNUSED.
|
||||
//std::string mHashTags;
|
||||
};
|
||||
|
||||
class RsForumsV2: public RsTokenService
|
||||
{
|
||||
public:
|
||||
|
||||
RsForumsV2() { return; }
|
||||
virtual ~RsForumsV2() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroupData(const uint32_t &token, RsForumV2Group &group) = 0;
|
||||
virtual bool getMsgData(const uint32_t &token, RsForumV2Msg &msg) = 0;
|
||||
|
||||
|
||||
// ONES THAT WE ARE NOT IMPLEMENTING. (YET!)
|
||||
//virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status) = 0;
|
||||
|
||||
// THINK WE CAN GENERALISE THIS TO: a list function, and you can just count the list entries...
|
||||
// requestGroupList(groupId, UNREAD, ...)
|
||||
//virtual bool getMessageCount(const std::string &groupId, unsigned int &newCount, unsigned int &unreadCount) = 0;
|
||||
|
||||
|
||||
/* details are updated in group - to choose GroupID */
|
||||
virtual bool createGroup(uint32_t &token, RsForumV2Group &group, bool isNew) = 0;
|
||||
virtual bool createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
127
libretroshare/src/retroshare/rsgxscircles.h
Normal file
127
libretroshare/src/retroshare/rsgxscircles.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
#ifndef RETROSHARE_GXSCIRCLES_INTERFACE_H
|
||||
#define RETROSHARE_GXSCIRCLES_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsgxscircles.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "gxs/rstokenservice.h"
|
||||
#include "gxs/rsgxsifaceimpl.h"
|
||||
|
||||
#include "retroshare/rsidentity.h"
|
||||
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsGxsCircles;
|
||||
extern RsGxsCircles *rsGxsCircles;
|
||||
|
||||
|
||||
typedef std::string RsGxsCircleId;
|
||||
typedef std::string RsPeerId; // SSL ID.
|
||||
typedef std::string RsPgpId;
|
||||
typedef std::string RsCircleInternalId;
|
||||
|
||||
#define GXS_CIRCLE_TYPE_PUBLIC 0x0001
|
||||
#define GXS_CIRCLE_TYPE_EXTERNAL 0x0002
|
||||
#define GXS_CIRCLE_TYPE_YOUREYESONLY 0x0003
|
||||
|
||||
/* Permissions is part of GroupMetaData
|
||||
*/
|
||||
|
||||
class GxsPermissions
|
||||
{
|
||||
public:
|
||||
uint32_t mCircleType; // PUBLIC, EXTERNAL or YOUREYESONLY.
|
||||
RsGxsCircleId mCircleId; // If EXTERNAL, otherwise Blank.
|
||||
|
||||
// BELOW IS NOT SERIALISED - BUT MUST BE STORED LOCALLY BY GXS. (If YOUREYESONLY)
|
||||
RsPeerId mOriginator;
|
||||
RsCircleInternalId mInternalCircle; // if Originator == ownId, otherwise blank.
|
||||
};
|
||||
|
||||
|
||||
class RsGxsCircleGroup
|
||||
{
|
||||
public:
|
||||
RsGroupMetaData mMeta; // includes GxsPermissions, for control of group distribution.
|
||||
|
||||
std::list<RsGxsId> mInvitedMembers;
|
||||
std::list<RsGxsCircleId> mSubCircles;
|
||||
|
||||
// Not Serialised.
|
||||
// Internally inside rsCircles, this will be turned into:
|
||||
// std::list<RsPeerId> mAllowedFriends;
|
||||
};
|
||||
|
||||
class RsGxsCircleMsg
|
||||
{
|
||||
public:
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
// Signature by user signifying that they want to be part of the group.
|
||||
// maybe Phase 3.
|
||||
std::string stuff;
|
||||
};
|
||||
|
||||
class RsGxsCircleDetails
|
||||
{
|
||||
public:
|
||||
RsGxsCircleId mCircleId;
|
||||
std::string mCircleName;
|
||||
std::set<RsGxsId> mUnknownPeers;
|
||||
std::map<RsPgpId, std::list<RsGxsId> > mAllowedPeers;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class RsGxsCircles: public RsGxsIfaceImpl
|
||||
{
|
||||
public:
|
||||
|
||||
RsGxsCircles(RsGenExchange *gxs)
|
||||
:RsGxsIfaceImpl(gxs) { return; }
|
||||
virtual ~RsGxsCircles() { return; }
|
||||
|
||||
|
||||
/* External Interface (Cached stuff) */
|
||||
virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) = 0;
|
||||
virtual bool getCircleIdList(std::list<RsGxsCircleId> &circleIds) = 0;
|
||||
|
||||
/* standard load */
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsCircleGroup> &groups) = 0;
|
||||
|
||||
/* make new group */
|
||||
virtual bool createGroup(uint32_t& token, RsGxsCircleGroup &group) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
97
libretroshare/src/retroshare/rsgxsforums.h
Normal file
97
libretroshare/src/retroshare/rsgxsforums.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
#ifndef RETROSHARE_GXS_FORUM_GUI_INTERFACE_H
|
||||
#define RETROSHARE_GXS_FORUM_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsgxsforum.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "gxs/rstokenservice.h"
|
||||
#include "gxs/rsgxsifaceimpl.h"
|
||||
|
||||
|
||||
#define IS_MSG_NEW(status) (status & GXS_SERV::GXS_MSG_STATUS_UNPROCESSED)
|
||||
#define IS_MSG_UNREAD(status) (status & GXS_SERV::GXS_MSG_STATUS_UNREAD)
|
||||
#define IS_GROUP_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
||||
#define IS_GROUP_SUBSCRIBED(subscribeFlags) (subscribeFlags & (GXS_SERV::GROUP_SUBSCRIBE_ADMIN | GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED))
|
||||
|
||||
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsGxsForums;
|
||||
extern RsGxsForums *rsGxsForums;
|
||||
|
||||
class RsGxsForumGroup
|
||||
{
|
||||
public:
|
||||
RsGroupMetaData mMeta;
|
||||
std::string mDescription;
|
||||
};
|
||||
|
||||
class RsGxsForumMsg
|
||||
{
|
||||
public:
|
||||
RsMsgMetaData mMeta;
|
||||
std::string mMsg;
|
||||
};
|
||||
|
||||
|
||||
//typedef std::map<RsGxsGroupId, std::vector<RsGxsForumMsg> > GxsForumMsgResult;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGxsForumGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsGxsForumMsg &msg);
|
||||
|
||||
class RsGxsForums: public RsGxsIfaceImpl
|
||||
{
|
||||
public:
|
||||
|
||||
RsGxsForums(RsGenExchange *gxs)
|
||||
:RsGxsIfaceImpl(gxs) { return; }
|
||||
virtual ~RsGxsForums() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) = 0;
|
||||
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs) = 0;
|
||||
virtual bool getRelatedMessages(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
|
||||
|
||||
//virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
|
||||
//virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
|
||||
|
||||
//virtual bool groupRestoreKeys(const std::string &groupId);
|
||||
//virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers);
|
||||
|
||||
virtual bool createGroup(uint32_t &token, RsGxsForumGroup &group) = 0;
|
||||
virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -17,6 +17,7 @@ class RsGxsNotify
|
|||
{
|
||||
public:
|
||||
RsGxsNotify(){ return; }
|
||||
virtual ~RsGxsNotify() {return; }
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -30,332 +30,19 @@
|
|||
#include <string>
|
||||
#include <list>
|
||||
|
||||
// FLAGS WILL BE REUSED FROM RSDISTRIB -> FOR NOW.
|
||||
#include <retroshare/rsdistrib.h>
|
||||
|
||||
/********** Generic Token Request Interface ***********************
|
||||
* This is packaged here, as most TokenServices will require ID Services too.
|
||||
* The requests can be generic, but the reponses are service specific (dependent on data types).
|
||||
*/
|
||||
|
||||
// This bit will be filled out over time.
|
||||
#define RS_TOKREQOPT_MSG_VERSIONS 0x0001 // MSGRELATED: Returns All MsgIds with OrigMsgId = MsgId.
|
||||
#define RS_TOKREQOPT_MSG_ORIGMSG 0x0002 // MSGLIST: All Unique OrigMsgIds in a Group.
|
||||
#define RS_TOKREQOPT_MSG_LATEST 0x0004 // MSGLIST: All Latest MsgIds in Group. MSGRELATED: Latest MsgIds for Input Msgs.
|
||||
|
||||
#define RS_TOKREQOPT_MSG_THREAD 0x0010 // MSGRELATED: All Msgs in Thread. MSGLIST: All Unique Thread Ids in Group.
|
||||
#define RS_TOKREQOPT_MSG_PARENT 0x0020 // MSGRELATED: All Children Msgs.
|
||||
|
||||
#define RS_TOKREQOPT_MSG_AUTHOR 0x0040 // MSGLIST: Messages from this AuthorId
|
||||
|
||||
|
||||
// Status Filtering... should it be a different Option Field.
|
||||
#define RS_TOKREQOPT_GROUP_UPDATED 0x0100 // GROUPLIST: Groups that have been updated.
|
||||
#define RS_TOKREQOPT_MSG_UPDATED 0x0200 // MSGLIST: Msg that have been updated from specified groups.
|
||||
#define RS_TOKREQOPT_MSG_UPDATED 0x0200 // MSGLIST: Msg that have been updated from specified groups.
|
||||
|
||||
|
||||
|
||||
// Read Status.
|
||||
#define RS_TOKREQOPT_READ 0x0001
|
||||
#define RS_TOKREQOPT_UNREAD 0x0002
|
||||
|
||||
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
|
||||
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
|
||||
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
|
||||
|
||||
|
||||
|
||||
|
||||
class RsTokReqOptions
|
||||
{
|
||||
public:
|
||||
RsTokReqOptions()
|
||||
{
|
||||
mOptions = 0;
|
||||
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
|
||||
mBefore = 0; mAfter = 0;
|
||||
}
|
||||
|
||||
uint32_t mOptions;
|
||||
|
||||
// Request specific matches with Group / Message Status.
|
||||
// Should be usable with any Options... applied afterwards.
|
||||
uint32_t mStatusFilter;
|
||||
uint32_t mStatusMask;
|
||||
|
||||
uint32_t mSubscribeFilter; // Only for Groups.
|
||||
|
||||
// Time range... again applied after Options.
|
||||
time_t mBefore;
|
||||
time_t mAfter;
|
||||
};
|
||||
|
||||
|
||||
/*********************************************************
|
||||
* Documentation for Groups Definitions.
|
||||
*
|
||||
* A Group is defined by:
|
||||
* - TWO RSA Keys. (Admin Key & Publish Key)
|
||||
* - Publish TS: Used to select the latest definition.
|
||||
*
|
||||
* - Operating Mode:
|
||||
* - Circle (Public, External, Private).
|
||||
* - Publish Mode: Encrypted / All-Signed / Only ThreadHead / None Required.
|
||||
* - AuthorId: GPG Required / Any Required / Only if no Publish Signature.
|
||||
*
|
||||
* - Description:
|
||||
* - Name & Description.
|
||||
* - Optional AuthorId.
|
||||
*
|
||||
* Most of this information is contained inside the GroupMetaData.
|
||||
* except for Actual Admin / Publish Keys, which are maintained internally.
|
||||
*
|
||||
*******
|
||||
* - Group Definition must be signed by Admin Key, otherwise invalid.
|
||||
* - Circle Definition controls distribution of Group and Messages, see section on this for more details.
|
||||
* - Public parts of Keys are distributed with Definition.
|
||||
* - Private parts can be distributed to select people via alternative channels.
|
||||
* - A Message Requires at least one signature: publish or Author. This signature will be used as MsgId.
|
||||
*
|
||||
* Groups will operate in the following modes:
|
||||
* 1) Public Forum: PublishMode = None Required, AuthorId: Required.
|
||||
* 2) Closed Forum: PublishMode = All-Signed, AuthorId: Required.
|
||||
* 3) Private Forum: PublishMode = Encrypted, AuthorId: Required.
|
||||
*
|
||||
* 4) Anon Channel: PublishMode = All-Signed, AuthorId: None.
|
||||
* 5) Anon Channel with Comments: PublishMode = Only ThreadHead, AuthorId: If No Publish Signature.
|
||||
* 6) Private Channel: PublishMode = Encrypted.
|
||||
*
|
||||
* 7) Personal Photos - with comments: PublishMode = Only ThreadHead, AuthorId: Required.
|
||||
* 8) Personal Photos - no comments: PublishMode = All-Signed, AuthorId: Required.
|
||||
*
|
||||
* 9 ) Public Wiki: PublishMode = None Required, AuthorId: Required.
|
||||
* 10) Closed Wiki: PublishMode = All-Signed, AuthorId: Required.
|
||||
* 11) Private Wiki: PublishMode = Encrypted, AuthorId: Required.
|
||||
*
|
||||
* 12) Twitter: PublishMode = Only ThreadHead, AuthorId: Required.
|
||||
*
|
||||
* 13) Posted: PublishMode = None Required, AuthorId: Required.
|
||||
*
|
||||
*
|
||||
******
|
||||
*
|
||||
* Additionally to this information. The MetaData also contains several fields which can
|
||||
* be used to store local information for the benefit of the service.
|
||||
*
|
||||
* In Particular: MsgStatus & GroupStatus inform the service if the user has read the message or if anything has changed.
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
// Control of Publish Signatures.
|
||||
#define RSGXS_GROUP_SIGN_PUBLISH_MASK 0x000000ff
|
||||
#define RSGXS_GROUP_SIGN_PUBLISH_ENCRYPTED 0x00000001
|
||||
#define RSGXS_GROUP_SIGN_PUBLISH_ALLSIGNED 0x00000002
|
||||
#define RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD 0x00000004
|
||||
#define RSGXS_GROUP_SIGN_PUBLISH_NONEREQ 0x00000008
|
||||
|
||||
// Author Signature.
|
||||
#define RSGXS_GROUP_SIGN_AUTHOR_MASK 0x0000ff00
|
||||
#define RSGXS_GROUP_SIGN_AUTHOR_GPG 0x00000100
|
||||
#define RSGXS_GROUP_SIGN_AUTHOR_REQUIRED 0x00000200
|
||||
#define RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN 0x00000400
|
||||
#define RSGXS_GROUP_SIGN_AUTHOR_NONE 0x00000800
|
||||
|
||||
// NB: That one signature is required...
|
||||
// so some combinations are not possible. e.g.
|
||||
// SIGN_PUBLISH_NONEREQ && SIGN_AUTHOR_NONE is not allowed.
|
||||
// SIGN_PUBLISH_THREADHEAD && SIGN_AUTHOR_NONE is also invalid.
|
||||
|
||||
#define RSGXS_GROUP_SIGN_RESERVED_MASK 0xffff0000
|
||||
|
||||
|
||||
// STATUS FLAGS: There is space here for Service specific flags - if they so desire.
|
||||
//
|
||||
// Msgs: UNREAD_BY_USER & PROCESSED are useful.
|
||||
// Groups: NEW_MESSAGES & GROUP_UPDATED.
|
||||
|
||||
#define RSGXS_MSG_STATUS_MASK 0x0000000f
|
||||
#define RSGXS_MSG_STATUS_READ 0x00000001 // New or Not New
|
||||
#define RSGXS_MSG_STATUS_UNREAD_BY_USER 0x00000002
|
||||
#define RSGXS_MSG_STATUS_UNPROCESSED 0x00000004 // By the Service.
|
||||
|
||||
#define RSGXS_MSG_STATUS_SERVICE_MASK 0xffff0000
|
||||
|
||||
#define RSGXS_GROUP_STATUS_MASK 0x0000000f
|
||||
#define RSGXS_GROUP_STATUS_UPDATED 0x00000001
|
||||
#define RSGXS_GROUP_STATUS_NEWGROUP 0x00000002
|
||||
#define RSGXS_GROUP_STATUS_NEWMSG 0x00000004
|
||||
|
||||
#define RSGXS_GROUP_STATUS_SERVICE_MASK 0xffff0000
|
||||
|
||||
|
||||
|
||||
// Subscription Flags. (LOCAL)
|
||||
#define RSGXS_GROUP_SUBSCRIBE_MASK 0x0000000f
|
||||
#define RSGXS_GROUP_SUBSCRIBE_ADMIN 0x00000001
|
||||
#define RSGXS_GROUP_SUBSCRIBE_PUBLISH 0x00000002
|
||||
#define RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED 0x00000004
|
||||
#define RSGXS_GROUP_SUBSCRIBE_MONITOR 0x00000008
|
||||
|
||||
|
||||
// Some MACROS for EASE OF USE. (USED BY FORUMSV2 At the moment.
|
||||
#define IS_MSG_UNREAD(status) ((status & RSGXS_MSG_STATUS_READ) == 0 || (status & RSGXS_MSG_STATUS_UNREAD_BY_USER))
|
||||
#define IS_GROUP_ADMIN(subscribeFlags) (subscribeFlags & RSGXS_GROUP_SUBSCRIBE_ADMIN)
|
||||
#define IS_GROUP_SUBSCRIBED(subscribeFlags) (subscribeFlags & (RSGXS_GROUP_SUBSCRIBE_ADMIN | RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED))
|
||||
|
||||
|
||||
|
||||
#define RSGXS_MAX_SERVICE_STRING 200 // Sensible limit for dbase usage.
|
||||
|
||||
|
||||
class RsGroupMetaData
|
||||
{
|
||||
public:
|
||||
|
||||
RsGroupMetaData()
|
||||
{
|
||||
mGroupFlags = 0;
|
||||
mSignFlags = 0;
|
||||
mSubscribeFlags = 0;
|
||||
|
||||
mPop = 0;
|
||||
mMsgCount = 0;
|
||||
mLastPost = 0;
|
||||
mGroupStatus = 0;
|
||||
|
||||
//mPublishTs = 0;
|
||||
}
|
||||
|
||||
std::string mGroupId;
|
||||
std::string mGroupName;
|
||||
uint32_t mGroupFlags; // Service Specific Options ????
|
||||
uint32_t mSignFlags; // Combination of RSGXS_GROUP_SIGN_PUBLISH_MASK & RSGXS_GROUP_SIGN_AUTHOR_MASK.
|
||||
|
||||
time_t mPublishTs; // Mandatory.
|
||||
std::string mAuthorId; // Optional.
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
|
||||
uint32_t mSubscribeFlags;
|
||||
|
||||
uint32_t mPop; // HOW DO WE DO THIS NOW.
|
||||
uint32_t mMsgCount; // ???
|
||||
time_t mLastPost; // ???
|
||||
|
||||
uint32_t mGroupStatus;
|
||||
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class RsMsgMetaData
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgMetaData()
|
||||
{
|
||||
mPublishTs = 0;
|
||||
mMsgFlags = 0;
|
||||
mMsgStatus = 0;
|
||||
mChildTs = 0;
|
||||
}
|
||||
|
||||
std::string mGroupId;
|
||||
std::string mMsgId;
|
||||
|
||||
std::string mThreadId;
|
||||
std::string mParentId;
|
||||
std::string mOrigMsgId;
|
||||
|
||||
std::string mAuthorId;
|
||||
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
|
||||
uint32_t mMsgFlags; // Whats this for? (Optional Service Specific - e.g. flag MsgType)
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
// normally READ / UNREAD flags. LOCAL Data.
|
||||
uint32_t mMsgStatus;
|
||||
time_t mChildTs;
|
||||
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta);
|
||||
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta);
|
||||
|
||||
class RsTokenService
|
||||
{
|
||||
public:
|
||||
|
||||
RsTokenService() { return; }
|
||||
virtual ~RsTokenService() { return; }
|
||||
|
||||
/* changed? */
|
||||
virtual bool updated() = 0;
|
||||
|
||||
/* Data Requests */
|
||||
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
|
||||
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
|
||||
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds) = 0;
|
||||
|
||||
/* Generic Lists */
|
||||
virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds) = 0;
|
||||
virtual bool getMsgList( const uint32_t &token, std::list<std::string> &msgIds) = 0;
|
||||
|
||||
/* Generic Summary */
|
||||
virtual bool getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo) = 0;
|
||||
virtual bool getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo) = 0;
|
||||
|
||||
/* Actual Data -> specific to Interface */
|
||||
|
||||
|
||||
|
||||
/* Poll */
|
||||
virtual uint32_t requestStatus(const uint32_t token) = 0;
|
||||
|
||||
/* Cancel Request */
|
||||
virtual bool cancelRequest(const uint32_t &token) = 0;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/* Functions from Forums -> need to be implemented generically */
|
||||
// Groups Changed is now part of requestGroupInfo request.
|
||||
//virtual bool groupsChanged(std::list<std::string> &groupIds) = 0;
|
||||
|
||||
// Message/Group Status - is retrived via requests...
|
||||
// These operations could have a token, but for the moment we are going to assume
|
||||
// they are async and always succeed - (or fail silently).
|
||||
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask) = 0;
|
||||
virtual bool setGroupStatus(const std::string &grpId, const uint32_t status, const uint32_t statusMask) = 0;
|
||||
|
||||
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask) = 0;
|
||||
|
||||
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str) = 0;
|
||||
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str) = 0;
|
||||
|
||||
// (FUTURE WORK).
|
||||
virtual bool groupRestoreKeys(const std::string &groupId) = 0;
|
||||
virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#include "gxs/rstokenservice.h"
|
||||
#include "gxs/rsgxsifaceimpl.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsIdentity;
|
||||
extern RsIdentity *rsIdentity;
|
||||
|
||||
|
||||
// GroupFlags: Only one so far:
|
||||
#define RSGXSID_GROUPFLAG_REALID 0x0001
|
||||
|
||||
|
||||
// THESE ARE FLAGS FOR INTERFACE.
|
||||
#define RSID_TYPE_MASK 0xff00
|
||||
#define RSID_RELATION_MASK 0x00ff
|
||||
|
||||
|
@ -370,9 +57,10 @@ extern RsIdentity *rsIdentity;
|
|||
|
||||
std::string rsIdTypeToString(uint32_t idtype);
|
||||
|
||||
class RsIdGroup
|
||||
class RsGxsIdGroup
|
||||
{
|
||||
public:
|
||||
RsGxsIdGroup():mPgpKnown(false) { return; }
|
||||
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
@ -380,22 +68,28 @@ class RsIdGroup
|
|||
// In GroupMetaData.
|
||||
//std::string mNickname; (mGroupName)
|
||||
//std::string mKeyId; (mGroupId)
|
||||
//uint32_t mIdType; (mGroupFlags)
|
||||
|
||||
uint32_t mIdType;
|
||||
// SHA(KeyId + Gpg Fingerprint) -> can only be IDed if GPG known.
|
||||
// The length of the input must be long enough to make brute force search implausible.
|
||||
|
||||
std::string mGpgIdHash; // SHA(KeyId + Gpg Fingerprint) -> can only be IDed if GPG known.
|
||||
// Easy to do 1e9 SHA-1 hash computations per second on a GPU.
|
||||
// We will need a minimum of 256 bits, ideally 1024 bits or 2048 bits.
|
||||
|
||||
// NOTE: These cannot be transmitted as part of underlying messages....
|
||||
// Must use ServiceString.
|
||||
bool mGpgIdKnown; // if GpgIdHash has been identified.
|
||||
std::string mGpgId; // if known.
|
||||
std::string mGpgName; // if known.
|
||||
std::string mGpgEmail; // if known.
|
||||
// Actually PgpIdHash is SHA1(.mMeta.mGroupId + PGPHandler->GpgFingerprint(ownId))
|
||||
// ??? 160 bits.
|
||||
|
||||
std::string mPgpIdHash;
|
||||
std::string mPgpIdSign; // Need a signature as proof - otherwise anyone could add others Hashes.
|
||||
|
||||
// Not Serialised - for GUI's benefit.
|
||||
bool mPgpKnown;
|
||||
std::string mPgpId;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class RsIdMsg
|
||||
class RsGxsIdOpinion
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -405,7 +99,11 @@ class RsIdMsg
|
|||
//std::string mKeyId; (mGroupId)
|
||||
//std::string mPeerId; (mAuthorId) ???
|
||||
|
||||
int mOpinion;
|
||||
uint32_t mOpinion;
|
||||
|
||||
|
||||
// NOT SERIALISED YET!
|
||||
|
||||
double mReputation;
|
||||
//int mRating;
|
||||
//int mPeersRating;
|
||||
|
@ -413,11 +111,18 @@ class RsIdMsg
|
|||
};
|
||||
|
||||
|
||||
// This will probably be dropped.
|
||||
class RsGxsIdComment
|
||||
{
|
||||
public:
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsIdGroup &meta);
|
||||
std::ostream &operator<<(std::ostream &out, const RsIdMsg &meta);
|
||||
RsMsgMetaData mMeta;
|
||||
std::string mComment;
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGxsIdGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsGxsIdOpinion &msg);
|
||||
|
||||
#if 0
|
||||
class RsIdReputation
|
||||
|
@ -448,80 +153,84 @@ class RsIdOpinion
|
|||
#endif
|
||||
|
||||
|
||||
class RsIdentity: public RsTokenService
|
||||
// DATA TYPE FOR EXTERNAL INTERFACE.
|
||||
|
||||
typedef std::string RsGxsId; // TMP. =>
|
||||
|
||||
class RsIdentityDetails
|
||||
{
|
||||
public:
|
||||
RsIdentityDetails()
|
||||
:mIsOwnId(false), mPgpLinked(false), mPgpKnown(false),
|
||||
mOpinion(0), mReputation(0) { return; }
|
||||
|
||||
RsIdentity() { return; }
|
||||
virtual ~RsIdentity() { return; }
|
||||
RsGxsId mId;
|
||||
|
||||
// identity details.
|
||||
std::string mNickname;
|
||||
bool mIsOwnId;
|
||||
|
||||
/* INCLUDES INTERFACE FROM RS TOKEN SERVICE */
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroupData(const uint32_t &token, RsIdGroup &group) = 0;
|
||||
virtual bool getMsgData(const uint32_t &token, RsIdMsg &msg) = 0;
|
||||
|
||||
virtual bool createGroup(uint32_t &token, RsIdGroup &group, bool isNew) = 0;
|
||||
virtual bool createMsg(uint32_t &token, RsIdMsg &msg, bool isNew) = 0;
|
||||
|
||||
/* In the Identity System - You don't access the Messages Directly.
|
||||
* as they represent idividuals opinions....
|
||||
* This is reflected in the TokenService calls returning false.
|
||||
*
|
||||
* Below is the additional interface to look at reputation.
|
||||
*/
|
||||
|
||||
/* So we will want to cache much of the identity stuff, so that we have quick access to the results.
|
||||
* The following bits of data will not use the request/response interface, and should be available immediately.
|
||||
*
|
||||
* ID => Nickname, knownGPG, reputation.
|
||||
*
|
||||
* This will require quite a bit of data...
|
||||
* 20 Bytes + 50 + 1 + 4 Bytes? (< 100 Bytes).
|
||||
* x 10,000 IDs. => ~1 MB of cache (Good).
|
||||
* x 100,000 IDs. => ~10 MB of cache (Good).
|
||||
* x 1,000,000 IDs. => ~100 MB of cache (Too Big).
|
||||
*
|
||||
* We also need to store quick access to your OwnIds.
|
||||
*/
|
||||
|
||||
//virtual uint32_t getIdDetails(const std::string &id, std::string &nickname, bool &isGpgKnown,
|
||||
// uint32_t &ownOpinion, float &reputation);
|
||||
//virtual uint32_t getOwnIds(std::list<std::string> &ownIds);
|
||||
//virtual bool setOpinion(const std::string &id, uint32_t opinion);
|
||||
|
||||
|
||||
virtual void generateDummyData() = 0;
|
||||
|
||||
#if 0
|
||||
|
||||
/* Data Requests */
|
||||
virtual bool requestIdentityList(uint32_t &token) = 0;
|
||||
virtual bool requestIdentities(uint32_t &token, const std::list<std::string> &ids) = 0;
|
||||
virtual bool requestIdReputations(uint32_t &token, const std::list<std::string> &ids) = 0;
|
||||
virtual bool requestIdPeerOpinion(uint32_t &token, const std::string &aboutId, const std::string &peerId) = 0;
|
||||
//virtual bool requestIdGpgDetails(uint32_t &token, const std::list<std::string> &ids) = 0;
|
||||
|
||||
/* Poll */
|
||||
virtual uint32_t requestStatus(const uint32_t token) = 0;
|
||||
|
||||
/* Retrieve Data */
|
||||
virtual bool getIdentityList(const uint32_t token, std::list<std::string> &ids) = 0;
|
||||
virtual bool getIdentity(const uint32_t token, RsIdData &data) = 0;
|
||||
virtual bool getIdReputation(const uint32_t token, RsIdReputation &reputation) = 0;
|
||||
virtual bool getIdPeerOpinion(const uint32_t token, RsIdOpinion &opinion) = 0;
|
||||
|
||||
/* Updates */
|
||||
virtual bool updateIdentity(RsIdData &data) = 0;
|
||||
virtual bool updateOpinion(RsIdOpinion &opinion) = 0;
|
||||
|
||||
#endif
|
||||
// PGP Stuff.
|
||||
bool mPgpLinked;
|
||||
bool mPgpKnown;
|
||||
std::string mPgpId;
|
||||
|
||||
// reputation details.
|
||||
double mOpinion;
|
||||
double mReputation;
|
||||
};
|
||||
|
||||
|
||||
class RsIdOpinion
|
||||
{
|
||||
public:
|
||||
RsGxsId id;
|
||||
int rating;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
class RsIdentityParameters
|
||||
{
|
||||
public:
|
||||
RsIdentityParameters(): isPgpLinked(false) { return; }
|
||||
bool isPgpLinked;
|
||||
std::string nickname;
|
||||
};
|
||||
|
||||
|
||||
class RsIdentity: public RsGxsIfaceImpl
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
RsIdentity(RsGenExchange *gxs): RsGxsIfaceImpl(gxs) { return; }
|
||||
virtual ~RsIdentity() { return; }
|
||||
|
||||
/********************************************************************************************/
|
||||
/********************************************************************************************/
|
||||
|
||||
// For Other Services....
|
||||
// It should be impossible for them to get a message which we don't have the identity.
|
||||
// Its a major error if we don't have the identity.
|
||||
|
||||
// We cache all identities, and provide alternative (instantaneous)
|
||||
// functions to extract info, rather than the standard Token system.
|
||||
|
||||
//virtual bool getNickname(const RsGxsId &id, std::string &nickname) = 0;
|
||||
virtual bool getIdDetails(const RsGxsId &id, RsIdentityDetails &details) = 0;
|
||||
virtual bool getOwnIds(std::list<RsGxsId> &ownIds) = 0;
|
||||
|
||||
//
|
||||
virtual bool submitOpinion(uint32_t& token, RsIdOpinion &opinion) = 0;
|
||||
virtual bool createIdentity(uint32_t& token, RsIdentityParameters ¶ms) = 0;
|
||||
|
||||
// Specific RsIdentity Functions....
|
||||
/* Specific Service Data */
|
||||
/* We expose these initially for testing / GUI purposes.
|
||||
*/
|
||||
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup> &groups) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // RETROSHARE_IDENTITY_GUI_INTERFACE_H
|
||||
|
|
|
@ -1,179 +1,347 @@
|
|||
#ifndef RETROSHARE_PHOTO_GUI_INTERFACE_H
|
||||
#define RETROSHARE_PHOTO_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsphoto.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <retroshare/rsidentity.h>
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsPhoto;
|
||||
extern RsPhoto *rsPhoto;
|
||||
|
||||
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
|
||||
|
||||
#define RSPHOTO_MODE_NEW 1
|
||||
#define RSPHOTO_MODE_OWN 2
|
||||
#define RSPHOTO_MODE_REMOTE 3
|
||||
|
||||
class RsPhotoThumbnail
|
||||
{
|
||||
public:
|
||||
RsPhotoThumbnail()
|
||||
:data(NULL), size(0), type("N/A") { return; }
|
||||
|
||||
bool deleteImage();
|
||||
bool copyFrom(const RsPhotoThumbnail &nail);
|
||||
|
||||
// Holds Thumbnail image.
|
||||
uint8_t *data;
|
||||
int size;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
|
||||
/* If these flags are no set - the Photo inherits values from the Album
|
||||
*/
|
||||
|
||||
#define RSPHOTO_FLAGS_ATTRIB_TITLE 0x0001
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CAPTION 0x0002
|
||||
#define RSPHOTO_FLAGS_ATTRIB_DESC 0x0004
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTOGRAPHER 0x0008
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHERE 0x0010
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHEN 0x0020
|
||||
#define RSPHOTO_FLAGS_ATTRIB_OTHER 0x0040
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CATEGORY 0x0080
|
||||
#define RSPHOTO_FLAGS_ATTRIB_HASHTAGS 0x0100
|
||||
#define RSPHOTO_FLAGS_ATTRIB_ORDER 0x0200
|
||||
#define RSPHOTO_FLAGS_ATTRIB_THUMBNAIL 0x0400
|
||||
#define RSPHOTO_FLAGS_ATTRIB_MODE 0x0800
|
||||
#define RSPHOTO_FLAGS_ATTRIB_AUTHOR 0x1000 // PUSH UP ORDER
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
||||
|
||||
|
||||
class RsPhotoPhoto
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
RsPhotoPhoto();
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
uint32_t mSetFlags;
|
||||
|
||||
int mOrder;
|
||||
|
||||
RsPhotoThumbnail mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
// These are not saved.
|
||||
std::string path; // if in Mode NEW.
|
||||
uint32_t mModFlags;
|
||||
};
|
||||
|
||||
class RsPhotoAlbumShare
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t mShareType;
|
||||
std::string mShareGroupId;
|
||||
std::string mPublishKey;
|
||||
uint32_t mCommentMode;
|
||||
uint32_t mResizeMode;
|
||||
};
|
||||
|
||||
class RsPhotoAlbum
|
||||
{
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
RsPhotoThumbnail mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
std::string mPhotoPath;
|
||||
RsPhotoAlbumShare mShareOptions;
|
||||
|
||||
// These aren't saved.
|
||||
uint32_t mSetFlags;
|
||||
uint32_t mModFlags;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||
|
||||
|
||||
class RsPhoto: public RsTokenService
|
||||
{
|
||||
public:
|
||||
|
||||
RsPhoto() { return; }
|
||||
virtual ~RsPhoto() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getAlbum(const uint32_t &token, RsPhotoAlbum &album) = 0;
|
||||
virtual bool getPhoto(const uint32_t &token, RsPhotoPhoto &photo) = 0;
|
||||
|
||||
virtual bool submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bool isNew) = 0;
|
||||
virtual bool submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNew) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef RSPHOTOV2_H
|
||||
#define RSPHOTOV2_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsphoto.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "rsgxsservice.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsPhoto;
|
||||
extern RsPhoto *rsPhoto;
|
||||
|
||||
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
|
||||
|
||||
#define RSPHOTO_MODE_NEW 1
|
||||
#define RSPHOTO_MODE_OWN 2
|
||||
#define RSPHOTO_MODE_REMOTE 3
|
||||
|
||||
class RsPhotoThumbnail
|
||||
{
|
||||
public:
|
||||
RsPhotoThumbnail()
|
||||
:data(NULL), size(0), type("N/A") { return; }
|
||||
|
||||
bool deleteImage();
|
||||
bool copyFrom(const RsPhotoThumbnail &nail);
|
||||
|
||||
// Holds Thumbnail image.
|
||||
uint8_t *data;
|
||||
int size;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
/* If these flags are no set - the Photo inherits values from the Album
|
||||
*/
|
||||
|
||||
#define RSPHOTO_FLAGS_ATTRIB_TITLE 0x0001
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CAPTION 0x0002
|
||||
#define RSPHOTO_FLAGS_ATTRIB_DESC 0x0004
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTOGRAPHER 0x0008
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHERE 0x0010
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHEN 0x0020
|
||||
#define RSPHOTO_FLAGS_ATTRIB_OTHER 0x0040
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CATEGORY 0x0080
|
||||
#define RSPHOTO_FLAGS_ATTRIB_HASHTAGS 0x0100
|
||||
#define RSPHOTO_FLAGS_ATTRIB_ORDER 0x0200
|
||||
#define RSPHOTO_FLAGS_ATTRIB_THUMBNAIL 0x0400
|
||||
#define RSPHOTO_FLAGS_ATTRIB_MODE 0x0800
|
||||
#define RSPHOTO_FLAGS_ATTRIB_AUTHOR 0x1000 // PUSH UP ORDER
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
||||
|
||||
class RsPhotoPhoto
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
RsPhotoPhoto();
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
uint32_t mSetFlags;
|
||||
|
||||
int mOrder;
|
||||
|
||||
RsPhotoThumbnail mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
// These are not saved.
|
||||
std::string path; // if in Mode NEW.
|
||||
uint32_t mModFlags;
|
||||
};
|
||||
|
||||
class RsPhotoAlbumShare
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t mShareType;
|
||||
std::string mShareGroupId;
|
||||
std::string mPublishKey;
|
||||
uint32_t mCommentMode;
|
||||
uint32_t mResizeMode;
|
||||
};
|
||||
|
||||
class RsPhotoAlbum
|
||||
{
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
RsPhotoThumbnail mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
std::string mPhotoPath;
|
||||
RsPhotoAlbumShare mShareOptions;
|
||||
|
||||
// These aren't saved.
|
||||
uint32_t mSetFlags;
|
||||
uint32_t mModFlags;
|
||||
};
|
||||
|
||||
class RsGxsPhotoCommentItem;
|
||||
class RsPhotoComment
|
||||
{
|
||||
public:
|
||||
RsPhotoComment();
|
||||
|
||||
RsPhotoComment(const RsGxsPhotoCommentItem& comment);
|
||||
|
||||
RsPhotoComment& operator=(const RsGxsPhotoCommentItem& comment);
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
std::string mComment;
|
||||
uint32_t mCommentFlag;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPhotoPhoto> > PhotoResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPhotoComment> > PhotoCommentResult;
|
||||
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsPhotoComment> > PhotoRelatedCommentResult;
|
||||
|
||||
class RsPhoto
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static const uint32_t FLAG_MSG_TYPE_PHOTO_POST;
|
||||
static const uint32_t FLAG_MSG_TYPE_PHOTO_COMMENT;
|
||||
static const uint32_t FLAG_MSG_TYPE_MASK;
|
||||
|
||||
|
||||
RsPhoto() { return; }
|
||||
|
||||
virtual ~RsPhoto() { return; }
|
||||
|
||||
/*!
|
||||
* Use to enquire if groups or msgs have changed
|
||||
* Poll regularly, particularly after a photo submission
|
||||
* @return true if msgs or groups have changed
|
||||
*/
|
||||
virtual bool updated() = 0;
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param grpIds
|
||||
*/
|
||||
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds) = 0;
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param msgs
|
||||
*/
|
||||
virtual void msgsChanged(GxsMsgIdResult& msgs) = 0;
|
||||
|
||||
/*!
|
||||
* To acquire a handle to token service handler
|
||||
* needed to make requests to the service
|
||||
* @return handle to token service for this gxs service
|
||||
*/
|
||||
virtual RsTokenService* getTokenService() = 0;
|
||||
|
||||
/* Generic Lists */
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token token to be redeemed for this request
|
||||
* @param groupIds the ids return for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getGroupList(const uint32_t &token,
|
||||
std::list<RsGxsGroupId> &groupIds) = 0;
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for this request
|
||||
* @param msgIds the ids return for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getMsgList(const uint32_t &token,
|
||||
GxsMsgIdResult &msgIds) = 0;
|
||||
|
||||
/* Generic Summary */
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for group summary request
|
||||
* @param groupInfo the ids returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getGroupSummary(const uint32_t &token,
|
||||
std::list<RsGroupMetaData> &groupInfo) = 0;
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for message summary request
|
||||
* @param msgInfo the message metadata returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getMsgSummary(const uint32_t &token,
|
||||
MsgMetaResult &msgInfo) = 0;
|
||||
|
||||
/* Specific Service Data */
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for album request
|
||||
* @param album the album returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &album) = 0;
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for photo request
|
||||
* @param photo the photo returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getPhoto(const uint32_t &token,
|
||||
PhotoResult &photo) = 0;
|
||||
|
||||
/* details are updated in album - to choose Album ID, and storage path */
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for photo request
|
||||
* @param photo the photo returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getPhotoComment(const uint32_t &token,
|
||||
PhotoCommentResult& comments) = 0;
|
||||
/*!
|
||||
* @param token token to be redeemed for photo request
|
||||
* @param photo the photo returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments) = 0;
|
||||
|
||||
/*!
|
||||
* submits album, which returns a token that needs
|
||||
* to be acknowledge to get album grp id
|
||||
* @param token token to redeem for acknowledgement
|
||||
* @param album album to be submitted
|
||||
*/
|
||||
virtual bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album) = 0;
|
||||
|
||||
/*!
|
||||
* submits photo, which returns a token that needs
|
||||
* to be acknowledged to get photo msg-grp id pair
|
||||
* @param token token to redeem for acknowledgement
|
||||
* @param photo photo to be submitted
|
||||
*/
|
||||
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
|
||||
|
||||
/*!
|
||||
* submits photo comment, which returns a token that needs
|
||||
* to be acknowledged to get photo msg-grp id pair
|
||||
* The mParentId needs to be set to an existing msg for which
|
||||
* commenting is enabled
|
||||
* @param token token to redeem for acknowledgement
|
||||
* @param comment comment to be submitted
|
||||
*/
|
||||
virtual bool submitComment(uint32_t& token, RsPhotoComment &photo) = 0;
|
||||
|
||||
/*!
|
||||
* subscribes to group, and returns token which can be used
|
||||
* to be acknowledged to get group Id
|
||||
* @param token token to redeem for acknowledgement
|
||||
* @param grpId the id of the group to subscribe to
|
||||
*/
|
||||
virtual bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe) = 0;
|
||||
|
||||
/*!
|
||||
* This allows the client service to acknowledge that their msgs has
|
||||
* been created/modified and retrieve the create/modified msg ids
|
||||
* @param token the token related to modification/create request
|
||||
* @param msgIds map of grpid->msgIds of message created/modified
|
||||
* @return true if token exists false otherwise
|
||||
*/
|
||||
virtual bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* This allows the client service to acknowledge that their grps has
|
||||
* been created/modified and retrieve the create/modified grp ids
|
||||
* @param token the token related to modification/create request
|
||||
* @param msgIds vector of ids of groups created/modified
|
||||
* @return true if token exists false otherwise
|
||||
*/
|
||||
virtual bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // RSPHOTOV2_H
|
||||
|
|
|
@ -1,277 +0,0 @@
|
|||
#ifndef RSPHOTOV2_H
|
||||
#define RSPHOTOV2_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsphoto.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "rsgxsservice.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsPhoto;
|
||||
extern RsPhoto *rsPhoto;
|
||||
|
||||
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
|
||||
|
||||
#define RSPHOTO_MODE_NEW 1
|
||||
#define RSPHOTO_MODE_OWN 2
|
||||
#define RSPHOTO_MODE_REMOTE 3
|
||||
|
||||
class RsPhotoThumbnail
|
||||
{
|
||||
public:
|
||||
RsPhotoThumbnail()
|
||||
:data(NULL), size(0), type("N/A") { return; }
|
||||
|
||||
bool deleteImage();
|
||||
bool copyFrom(const RsPhotoThumbnail &nail);
|
||||
|
||||
// Holds Thumbnail image.
|
||||
uint8_t *data;
|
||||
int size;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
|
||||
/* If these flags are no set - the Photo inherits values from the Album
|
||||
*/
|
||||
|
||||
#define RSPHOTO_FLAGS_ATTRIB_TITLE 0x0001
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CAPTION 0x0002
|
||||
#define RSPHOTO_FLAGS_ATTRIB_DESC 0x0004
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTOGRAPHER 0x0008
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHERE 0x0010
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHEN 0x0020
|
||||
#define RSPHOTO_FLAGS_ATTRIB_OTHER 0x0040
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CATEGORY 0x0080
|
||||
#define RSPHOTO_FLAGS_ATTRIB_HASHTAGS 0x0100
|
||||
#define RSPHOTO_FLAGS_ATTRIB_ORDER 0x0200
|
||||
#define RSPHOTO_FLAGS_ATTRIB_THUMBNAIL 0x0400
|
||||
#define RSPHOTO_FLAGS_ATTRIB_MODE 0x0800
|
||||
#define RSPHOTO_FLAGS_ATTRIB_AUTHOR 0x1000 // PUSH UP ORDER
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
||||
|
||||
|
||||
class RsPhotoPhoto
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
RsPhotoPhoto();
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
uint32_t mSetFlags;
|
||||
|
||||
int mOrder;
|
||||
|
||||
RsPhotoThumbnail mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
// These are not saved.
|
||||
std::string path; // if in Mode NEW.
|
||||
uint32_t mModFlags;
|
||||
};
|
||||
|
||||
class RsPhotoAlbumShare
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t mShareType;
|
||||
std::string mShareGroupId;
|
||||
std::string mPublishKey;
|
||||
uint32_t mCommentMode;
|
||||
uint32_t mResizeMode;
|
||||
};
|
||||
|
||||
class RsPhotoAlbum
|
||||
{
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
RsPhotoThumbnail mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
std::string mPhotoPath;
|
||||
RsPhotoAlbumShare mShareOptions;
|
||||
|
||||
// These aren't saved.
|
||||
uint32_t mSetFlags;
|
||||
uint32_t mModFlags;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPhotoPhoto> > PhotoResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsMsgMetaData> > MsgMetaResult;
|
||||
|
||||
class RsPhotoV2
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
RsPhotoV2() { return; }
|
||||
|
||||
virtual ~RsPhotoV2() { return; }
|
||||
|
||||
/*!
|
||||
* Use to enquire if groups or msgs have changed
|
||||
* Poll regularly, particularly after a photo submission
|
||||
* @return true if msgs or groups have changed
|
||||
*/
|
||||
virtual bool updated() = 0;
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param grpIds
|
||||
*/
|
||||
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds) = 0;
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param msgs
|
||||
*/
|
||||
virtual void msgsChanged(GxsMsgIdResult& msgs) = 0;
|
||||
|
||||
/*!
|
||||
* To acquire a handle to token service handler
|
||||
* needed to make requests to the service
|
||||
* @return handle to token service for this gxs service
|
||||
*/
|
||||
virtual RsTokenServiceV2* getTokenService() = 0;
|
||||
|
||||
/* Generic Lists */
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token token to be redeemed for this request
|
||||
* @param groupIds the ids return for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getGroupList(const uint32_t &token,
|
||||
std::list<RsGxsGroupId> &groupIds) = 0;
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for this request
|
||||
* @param msgIds the ids return for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getMsgList(const uint32_t &token,
|
||||
GxsMsgIdResult &msgIds) = 0;
|
||||
|
||||
/* Generic Summary */
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for group summary request
|
||||
* @param groupInfo the ids returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getGroupSummary(const uint32_t &token,
|
||||
std::list<RsGroupMetaData> &groupInfo) = 0;
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for message summary request
|
||||
* @param msgInfo the message metadata returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getMsgSummary(const uint32_t &token,
|
||||
MsgMetaResult &msgInfo) = 0;
|
||||
|
||||
/* Specific Service Data */
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for album request
|
||||
* @param album the album returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &album) = 0;
|
||||
|
||||
/*!
|
||||
* @param token token to be redeemed for photo request
|
||||
* @param photo the photo returned for given request token
|
||||
* @return false if request token is invalid, check token status for error report
|
||||
*/
|
||||
virtual bool getPhoto(const uint32_t &token,
|
||||
PhotoResult &photo) = 0;
|
||||
|
||||
/* details are updated in album - to choose Album ID, and storage path */
|
||||
|
||||
/*!
|
||||
* This RsGenExchange service will be alerted to this album as \n
|
||||
* a new album. Do not keep the submitted album as representative, wait for
|
||||
* notification telling of successful submission
|
||||
* @param album The album to be submitted
|
||||
* @return false if submission failed
|
||||
*/
|
||||
virtual bool submitAlbumDetails(RsPhotoAlbum &album) = 0;
|
||||
|
||||
/*!
|
||||
* This RsGenExchange service will be alerted to this photo as \n
|
||||
* a new photo. Do not keep the submitted photo as representative, wait for new photo
|
||||
* returned
|
||||
* @param photo photo to submit
|
||||
* @return
|
||||
*/
|
||||
virtual bool submitPhoto(RsPhotoPhoto &photo) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // RSPHOTOV2_H
|
|
@ -105,6 +105,9 @@ class RsPlugin
|
|||
virtual RsPQIService *rs_pqi_service() const { return NULL ; }
|
||||
virtual uint16_t rs_service_id() const { return 0 ; }
|
||||
|
||||
// Shutdown
|
||||
virtual void stop() {}
|
||||
|
||||
// Filename used for saving the specific plugin configuration. Both RsCacheService and RsPQIService
|
||||
// derive from p3Config, which means that the service provided by the plugin can load/save its own
|
||||
// config by deriving loadList() and saveList() from p3Config.
|
||||
|
|
|
@ -1,140 +1,187 @@
|
|||
#ifndef RETROSHARE_POSTED_GUI_INTERFACE_H
|
||||
#define RETROSHARE_POSTED_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsposted.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <retroshare/rsidentity.h>
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsPosted;
|
||||
extern RsPosted *rsPosted;
|
||||
|
||||
|
||||
class RsPostedGroup
|
||||
{
|
||||
public:
|
||||
RsGroupMetaData mMeta;
|
||||
RsPostedGroup() { return; }
|
||||
};
|
||||
|
||||
class RsPostedMsg
|
||||
{
|
||||
public:
|
||||
RsPostedMsg(uint32_t t)
|
||||
:postedType(t) { return; }
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
uint32_t postedType;
|
||||
};
|
||||
|
||||
#define RSPOSTED_MSGTYPE_POST 0x0001
|
||||
#define RSPOSTED_MSGTYPE_VOTE 0x0002
|
||||
#define RSPOSTED_MSGTYPE_COMMENT 0x0004
|
||||
|
||||
#define RSPOSTED_PERIOD_YEAR 1
|
||||
#define RSPOSTED_PERIOD_MONTH 2
|
||||
#define RSPOSTED_PERIOD_WEEK 3
|
||||
#define RSPOSTED_PERIOD_DAY 4
|
||||
#define RSPOSTED_PERIOD_HOUR 5
|
||||
|
||||
#define RSPOSTED_VIEWMODE_LATEST 1
|
||||
#define RSPOSTED_VIEWMODE_TOP 2
|
||||
#define RSPOSTED_VIEWMODE_HOT 3
|
||||
#define RSPOSTED_VIEWMODE_COMMENTS 4
|
||||
|
||||
|
||||
class RsPostedPost: public RsPostedMsg
|
||||
{
|
||||
public:
|
||||
RsPostedPost(): RsPostedMsg(RSPOSTED_MSGTYPE_POST)
|
||||
{
|
||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_POST;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class RsPostedVote: public RsPostedMsg
|
||||
{
|
||||
public:
|
||||
RsPostedVote(): RsPostedMsg(RSPOSTED_MSGTYPE_VOTE)
|
||||
{
|
||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_VOTE;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class RsPostedComment: public RsPostedMsg
|
||||
{
|
||||
public:
|
||||
RsPostedComment(): RsPostedMsg(RSPOSTED_MSGTYPE_COMMENT)
|
||||
{
|
||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_COMMENT;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedVote &vote);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedComment &comment);
|
||||
|
||||
|
||||
class RsPosted: public RsTokenService
|
||||
{
|
||||
public:
|
||||
|
||||
RsPosted() { return; }
|
||||
virtual ~RsPosted() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroup(const uint32_t &token, RsPostedGroup &group) = 0;
|
||||
virtual bool getPost(const uint32_t &token, RsPostedPost &post) = 0;
|
||||
virtual bool getComment(const uint32_t &token, RsPostedComment &comment) = 0;
|
||||
|
||||
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group, bool isNew) = 0;
|
||||
virtual bool submitPost(uint32_t &token, RsPostedPost &post, bool isNew) = 0;
|
||||
virtual bool submitVote(uint32_t &token, RsPostedVote &vote, bool isNew) = 0;
|
||||
virtual bool submitComment(uint32_t &token, RsPostedComment &comment, bool isNew) = 0;
|
||||
|
||||
// Special Ranking Request.
|
||||
virtual bool requestRanking(uint32_t &token, std::string groupId) = 0;
|
||||
virtual bool getRankedPost(const uint32_t &token, RsPostedPost &post) = 0;
|
||||
|
||||
virtual bool extractPostedCache(const std::string &str, uint32_t &votes, uint32_t &comments) = 0;
|
||||
|
||||
// exposed for testing...
|
||||
virtual float calcPostScore(const RsMsgMetaData &meta) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef RSPOSTED_H
|
||||
#define RSPOSTED_H
|
||||
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsposted.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "gxs/rstokenservice.h"
|
||||
#include "gxs/rsgxsifaceimpl.h"
|
||||
|
||||
class RsPosted;
|
||||
extern RsPosted *rsPosted;
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
|
||||
class RsPostedGroup
|
||||
{
|
||||
public:
|
||||
RsGroupMetaData mMeta;
|
||||
std::string mDescription;
|
||||
RsPostedGroup() { return; }
|
||||
};
|
||||
|
||||
//#define RSPOSTED_MSGTYPE_POST 0x0001
|
||||
//#define RSPOSTED_MSGTYPE_VOTE 0x0002
|
||||
//#define RSPOSTED_MSGTYPE_COMMENT 0x0004
|
||||
|
||||
#define RSPOSTED_PERIOD_YEAR 1
|
||||
#define RSPOSTED_PERIOD_MONTH 2
|
||||
#define RSPOSTED_PERIOD_WEEK 3
|
||||
#define RSPOSTED_PERIOD_DAY 4
|
||||
#define RSPOSTED_PERIOD_HOUR 5
|
||||
|
||||
#define RSPOSTED_VIEWMODE_LATEST 1
|
||||
#define RSPOSTED_VIEWMODE_TOP 2
|
||||
#define RSPOSTED_VIEWMODE_HOT 3
|
||||
#define RSPOSTED_VIEWMODE_COMMENTS 4
|
||||
|
||||
class RsPostedPost;
|
||||
class RsPostedComment;
|
||||
class RsPostedVote;
|
||||
class RsPostedPostRanking;
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPostedPost> > PostedPostResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPostedComment> > PostedCommentResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPostedVote> > PostedVoteResult;
|
||||
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsPostedComment> > PostedRelatedCommentResult;
|
||||
typedef std::pair<RsGxsGroupId, int32_t> GroupRank;
|
||||
typedef std::map<uint32_t, RsGxsMessageId> PostedRanking;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedVote &vote);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedComment &comment);
|
||||
|
||||
|
||||
|
||||
class RsPosted : public RsGxsIfaceImpl
|
||||
{
|
||||
public:
|
||||
|
||||
enum RankType {TopRankType, HotRankType, NewRankType };
|
||||
|
||||
static const uint32_t FLAG_MSGTYPE_POST;
|
||||
static const uint32_t FLAG_MSGTYPE_VOTE;
|
||||
static const uint32_t FLAG_MSGTYPE_COMMENT;
|
||||
static const uint32_t FLAG_MSGTYPE_MASK;
|
||||
|
||||
|
||||
RsPosted(RsGenExchange* gxs) : RsGxsIfaceImpl(gxs) { return; }
|
||||
virtual ~RsPosted() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
|
||||
virtual bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group) = 0;
|
||||
virtual bool getPost(const uint32_t &token, PostedPostResult &post) = 0;
|
||||
virtual bool getComment(const uint32_t &token, PostedCommentResult &comment) = 0;
|
||||
virtual bool getRelatedComment(const uint32_t& token, PostedRelatedCommentResult& comments) = 0;
|
||||
virtual bool getPostRanking(const uint32_t& token, RsPostedPostRanking& ranking) = 0;
|
||||
|
||||
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
||||
virtual bool submitPost(uint32_t &token, RsPostedPost &post) = 0;
|
||||
virtual bool submitVote(uint32_t &token, RsPostedVote &vote) = 0;
|
||||
virtual bool submitComment(uint32_t &token, RsPostedComment &comment) = 0;
|
||||
|
||||
virtual bool retrieveScores(const std::string& serviceString, uint32_t& upVotes, uint32_t& downVotes, uint32_t& nComments) const = 0;
|
||||
|
||||
// Special Ranking Request.
|
||||
/*!
|
||||
* Makes request for posts of a topic
|
||||
* @param token
|
||||
* @param rType
|
||||
* @param groupId
|
||||
*/
|
||||
virtual bool requestPostRankings(uint32_t &token, const RankType& rType, const RsGxsGroupId& groupId) = 0;
|
||||
|
||||
/*!
|
||||
* Makes request for ranking of comments for a post
|
||||
* @param token
|
||||
* @param rType type of ranking to collect
|
||||
* @param msgId message id of post as groupid-messageid pair
|
||||
*/
|
||||
virtual bool requestCommentRankings(uint32_t &token, const RankType& rType, const RsGxsGrpMsgIdPair& msgId) = 0;
|
||||
|
||||
};
|
||||
|
||||
class RsPostedPost
|
||||
{
|
||||
public:
|
||||
RsPostedPost()
|
||||
{
|
||||
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST;
|
||||
mMeta.mServiceString = " 0 0 0";
|
||||
return;
|
||||
}
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
std::string mLink;
|
||||
std::string mNotes;
|
||||
};
|
||||
|
||||
class RsGxsPostedVoteItem;
|
||||
|
||||
class RsPostedVote
|
||||
{
|
||||
public:
|
||||
|
||||
RsPostedVote(const RsGxsPostedVoteItem&);
|
||||
RsPostedVote()
|
||||
{
|
||||
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_VOTE;
|
||||
return;
|
||||
}
|
||||
uint8_t mDirection;
|
||||
RsMsgMetaData mMeta;
|
||||
};
|
||||
|
||||
class RsGxsPostedCommentItem;
|
||||
|
||||
class RsPostedComment
|
||||
{
|
||||
public:
|
||||
RsPostedComment()
|
||||
{
|
||||
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_COMMENT;
|
||||
return;
|
||||
}
|
||||
|
||||
RsPostedComment(const RsGxsPostedCommentItem& );
|
||||
std::string mComment;
|
||||
RsMsgMetaData mMeta;
|
||||
};
|
||||
|
||||
class RsPostedPostRanking
|
||||
{
|
||||
public:
|
||||
|
||||
RsGxsGroupId grpId;
|
||||
PostedRanking ranking;
|
||||
RsPosted::RankType rType;
|
||||
};
|
||||
#endif // RSPOSTED_H
|
||||
|
|
151
libretroshare/src/retroshare/rspostedVEG.h
Normal file
151
libretroshare/src/retroshare/rspostedVEG.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
#ifndef RETROSHARE_POSTED_GUI_INTERFACE_H
|
||||
#define RETROSHARE_POSTED_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsposted.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <retroshare/rsidentityVEG.h>
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsPostedVEG;
|
||||
extern RsPostedVEG *rsPostedVEG;
|
||||
|
||||
|
||||
class RsPostedGroup
|
||||
{
|
||||
public:
|
||||
RsGroupMetaData mMeta;
|
||||
RsPostedGroup() { return; }
|
||||
};
|
||||
|
||||
class RsPostedMsg
|
||||
{
|
||||
public:
|
||||
RsPostedMsg(uint32_t t)
|
||||
:postedType(t) { return; }
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
uint32_t postedType;
|
||||
};
|
||||
|
||||
#define RSPOSTED_MSGTYPE_POST 0x0001
|
||||
#define RSPOSTED_MSGTYPE_VOTE 0x0002
|
||||
#define RSPOSTED_MSGTYPE_COMMENT 0x0004
|
||||
|
||||
#define RSPOSTED_PERIOD_YEAR 1
|
||||
#define RSPOSTED_PERIOD_MONTH 2
|
||||
#define RSPOSTED_PERIOD_WEEK 3
|
||||
#define RSPOSTED_PERIOD_DAY 4
|
||||
#define RSPOSTED_PERIOD_HOUR 5
|
||||
|
||||
#define RSPOSTED_VIEWMODE_LATEST 1
|
||||
#define RSPOSTED_VIEWMODE_TOP 2
|
||||
#define RSPOSTED_VIEWMODE_HOT 3
|
||||
#define RSPOSTED_VIEWMODE_COMMENTS 4
|
||||
|
||||
|
||||
class RsPostedPost: public RsPostedMsg
|
||||
{
|
||||
public:
|
||||
RsPostedPost(): RsPostedMsg(RSPOSTED_MSGTYPE_POST)
|
||||
{
|
||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_POST;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string mLink;
|
||||
std::string mNotes;
|
||||
};
|
||||
|
||||
|
||||
class RsPostedVote: public RsPostedMsg
|
||||
{
|
||||
public:
|
||||
RsPostedVote(): RsPostedMsg(RSPOSTED_MSGTYPE_VOTE)
|
||||
{
|
||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_VOTE;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class RsPostedComment: public RsPostedMsg
|
||||
{
|
||||
public:
|
||||
RsPostedComment(): RsPostedMsg(RSPOSTED_MSGTYPE_COMMENT)
|
||||
{
|
||||
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_COMMENT;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string mComment;
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedVote &vote);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedComment &comment);
|
||||
|
||||
|
||||
class RsPostedVEG: public RsTokenServiceVEG
|
||||
{
|
||||
public:
|
||||
|
||||
RsPostedVEG() { return; }
|
||||
virtual ~RsPostedVEG() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroup(const uint32_t &token, RsPostedGroup &group) = 0;
|
||||
virtual bool getPost(const uint32_t &token, RsPostedPost &post) = 0;
|
||||
virtual bool getComment(const uint32_t &token, RsPostedComment &comment) = 0;
|
||||
|
||||
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group, bool isNew) = 0;
|
||||
virtual bool submitPost(uint32_t &token, RsPostedPost &post, bool isNew) = 0;
|
||||
virtual bool submitVote(uint32_t &token, RsPostedVote &vote, bool isNew) = 0;
|
||||
virtual bool submitComment(uint32_t &token, RsPostedComment &comment, bool isNew) = 0;
|
||||
|
||||
// Special Ranking Request.
|
||||
virtual bool requestRanking(uint32_t &token, std::string groupId) = 0;
|
||||
virtual bool getRankedPost(const uint32_t &token, RsPostedPost &post) = 0;
|
||||
|
||||
virtual bool extractPostedCache(const std::string &str, uint32_t &votes, uint32_t &comments) = 0;
|
||||
|
||||
|
||||
// Control Ranking Calculations.
|
||||
virtual bool setViewMode(uint32_t mode) = 0;
|
||||
virtual bool setViewPeriod(uint32_t period) = 0;
|
||||
virtual bool setViewRange(uint32_t first, uint32_t count) = 0;
|
||||
|
||||
// exposed for testing...
|
||||
virtual float calcPostScore(const RsMsgMetaData &meta) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -30,77 +30,107 @@
|
|||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include <retroshare/rsidentity.h>
|
||||
#include "gxs/rstokenservice.h"
|
||||
#include "gxs/rsgxsifaceimpl.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsWiki;
|
||||
extern RsWiki *rsWiki;
|
||||
|
||||
class RsWikiGroupShare
|
||||
|
||||
/* so the basic idea of Wiki is a set of Collections about subjects.
|
||||
*
|
||||
* Collection: RS
|
||||
* - page: DHT
|
||||
* - edit
|
||||
* - edit
|
||||
* - official revision. (new version of thread head).
|
||||
*
|
||||
* A collection will be moderated by it creator - important to prevent stupid changes.
|
||||
* We need a way to swap out / replace / fork collections if moderator is rubbish.
|
||||
*
|
||||
* This should probably be done that the collection level.
|
||||
* and enable all the references to be modified.
|
||||
*
|
||||
* Collection1 (RS DHT)
|
||||
* : Turtle Link: Collection 0x54e4dafc34
|
||||
* - Page 1
|
||||
* - Page 2
|
||||
* - Link to Self:Page 1
|
||||
* - Link to Turtle:Page 1
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#define FLAG_MSG_TYPE_WIKI_SNAPSHOT 0x0001
|
||||
#define FLAG_MSG_TYPE_WIKI_COMMENT 0x0002
|
||||
|
||||
class CollectionRef
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t mShareType;
|
||||
std::string mShareGroupId;
|
||||
std::string mPublishKey;
|
||||
uint32_t mCommentMode;
|
||||
uint32_t mResizeMode;
|
||||
std::string KeyWord;
|
||||
std::string CollectionId;
|
||||
};
|
||||
|
||||
class RsWikiGroup
|
||||
|
||||
class RsWikiCollection
|
||||
{
|
||||
public:
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
//std::string mGroupId;
|
||||
//std::string mName;
|
||||
|
||||
std::string mDescription;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
RsWikiGroupShare mShareOptions;
|
||||
//std::map<std::string, CollectionRef> linkReferences;
|
||||
};
|
||||
|
||||
class RsWikiPage
|
||||
|
||||
class RsWikiSnapshot
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
// IN META DATA.
|
||||
//std::string mGroupId;
|
||||
//std::string mOrigPageId;
|
||||
//std::string mPageId;
|
||||
//std::string mName;
|
||||
|
||||
// WE SHOULD SWITCH TO USING THREAD/PARENT IDS HERE....
|
||||
std::string mPrevId;
|
||||
|
||||
std::string mPage; // all the text is stored here.
|
||||
|
||||
std::string mHashTags;
|
||||
};
|
||||
|
||||
class RsWiki: public RsTokenService
|
||||
|
||||
class RsWikiComment
|
||||
{
|
||||
public:
|
||||
|
||||
RsWiki() { return; }
|
||||
RsMsgMetaData mMeta;
|
||||
std::string mComment;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsWikiCollection &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsWikiSnapshot &shot);
|
||||
std::ostream &operator<<(std::ostream &out, const RsWikiComment &comment);
|
||||
|
||||
|
||||
class RsWiki: public RsGxsIfaceImpl
|
||||
{
|
||||
public:
|
||||
|
||||
RsWiki(RsGenExchange *gxs): RsGxsIfaceImpl(gxs) { return; }
|
||||
virtual ~RsWiki() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroupData(const uint32_t &token, RsWikiGroup &group) = 0;
|
||||
virtual bool getMsgData(const uint32_t &token, RsWikiPage &page) = 0;
|
||||
virtual bool getCollections(const uint32_t &token, std::vector<RsWikiCollection> &collections) = 0;
|
||||
virtual bool getSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots) = 0;
|
||||
virtual bool getComments(const uint32_t &token, std::vector<RsWikiComment> &comments) = 0;
|
||||
|
||||
virtual bool createGroup(uint32_t &token, RsWikiGroup &group, bool isNew) = 0;
|
||||
virtual bool createPage(uint32_t &token, RsWikiPage &page, bool isNew) = 0;
|
||||
virtual bool getRelatedSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots) = 0;
|
||||
|
||||
virtual bool submitCollection(uint32_t &token, RsWikiCollection &collection) = 0;
|
||||
virtual bool submitSnapshot(uint32_t &token, RsWikiSnapshot &snapshot) = 0;
|
||||
virtual bool submitComment(uint32_t &token, RsWikiComment &comment) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,74 +30,94 @@
|
|||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include <retroshare/rsidentity.h>
|
||||
#include "gxs/rstokenservice.h"
|
||||
#include "gxs/rsgxsifaceimpl.h"
|
||||
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsWire;
|
||||
extern RsWire *rsWire;
|
||||
|
||||
class RsWireGroupShare
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t mShareType;
|
||||
std::string mShareGroupId;
|
||||
std::string mPublishKey;
|
||||
uint32_t mCommentMode;
|
||||
uint32_t mResizeMode;
|
||||
};
|
||||
|
||||
class RsWireGroup
|
||||
{
|
||||
public:
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
//std::string mGroupId;
|
||||
//std::string mName;
|
||||
|
||||
std::string mDescription;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
RsWireGroupShare mShareOptions;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* So pulses operate in the following modes.
|
||||
*
|
||||
* => Standard, a post to your own group.
|
||||
* => @User, gets duplicated on each user's group.
|
||||
* => RT, duplicated as child of original post.
|
||||
*
|
||||
* From Twitter:
|
||||
* twitter can be: embedded, replied to, favourited, unfavourited,
|
||||
* retweeted, unretweeted and deleted
|
||||
*
|
||||
* See: https://dev.twitter.com/docs/platform-objects
|
||||
*
|
||||
* Format of message: ....
|
||||
*
|
||||
* #HashTags.
|
||||
* @68769381495134 => ID of Sender.
|
||||
* <http>
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
class RsWirePlace
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
class RsWirePulse
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
//std::string mGroupId;
|
||||
//std::string mOrigPageId;
|
||||
//std::string mPrevId;
|
||||
//std::string mPageId;
|
||||
//std::string mName;
|
||||
std::string mPulseText; // all the text is stored here.
|
||||
std::string mHashTags;
|
||||
|
||||
std::string mPulse; // all the text is stored here.
|
||||
// These will be added at some point.
|
||||
// std::string mInReplyPulse;
|
||||
|
||||
std::string mHashTags;
|
||||
// uint32_t mPulseFlags;
|
||||
|
||||
// std::list<std::string> mMentions;
|
||||
// std::list<std::string> mHashTags;
|
||||
// std::list<std::string> mUrls;
|
||||
|
||||
// RsWirePlace mPlace;
|
||||
};
|
||||
|
||||
class RsWire: public RsTokenService
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsWireGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsWirePulse &pulse);
|
||||
|
||||
|
||||
class RsWire: public RsGxsIfaceImpl
|
||||
{
|
||||
public:
|
||||
|
||||
RsWire() { return; }
|
||||
RsWire(RsGenExchange *gxs): RsGxsIfaceImpl(gxs) { return; }
|
||||
virtual ~RsWire() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroupData(const uint32_t &token, RsWireGroup &group) = 0;
|
||||
virtual bool getMsgData(const uint32_t &token, RsWirePulse &pulse) = 0;
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsWireGroup> &groups) = 0;
|
||||
virtual bool getPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulses) = 0;
|
||||
|
||||
/* Create Stuff */
|
||||
virtual bool createGroup(uint32_t &token, RsWireGroup &group, bool isNew) = 0;
|
||||
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew) = 0;
|
||||
virtual bool createGroup(uint32_t &token, RsWireGroup &group) = 0;
|
||||
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue