mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
8387c538f1
- Defined expected parameters for GxsGroups (see comments in rsidentity.h) - Added Various #defines for Groups / Msgs (again in rsidentity.h) - Converted new Group / new Msg into async "token" calls, returing MetaData. - Refined Grp/Msg Status Flags... similarly to how Forums used them... Expect UNREAD & UNPROCESSED flags to be set for a new msg, and UPDATED flag to be set for the corresponding group. There is flexibility for services to add their own flags too. - removed groupsChanged(). This can alternatively be implemented using. getGroupList(opts.Status == UPDATED)... - refined SubscribeFlags in a similar manner. - Added "ServiceString" to Group/Msg MetaData. This is freeform cache storage for service to use... currently p3Posted uses it to count Votes. - Added MsgStatus & SubscribeFlag filtering to Cache Requests. - Implemented these filters in GxsDataProxy (no efficient yet!) * Cleaned up all 6 new Cache Services to conform to new interface. * Removed old interface code that was #ifdef'd out. * Implemented Basic Ranking algorithms for p3posted: - Background process to process new votes/comments. - getRanking(token) interface call. - Intercept StatusRequests, etc to hide internal data requests. - While the basic code is complete, it needs much testing / tweaking. - Should shift work to a seperate thread. - Comment Ranking has still to be done. - Interfacing with GUI not yet attempted. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5276 b45a01b8-16f6-495d-af2f-9b41ad6348cc
127 lines
4.0 KiB
C++
127 lines
4.0 KiB
C++
/*
|
|
* libretroshare/src/services: p3forumsv2.h
|
|
*
|
|
* Wiki interface for RetroShare.
|
|
*
|
|
* 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 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".
|
|
*
|
|
*/
|
|
|
|
#ifndef P3_FORUMSV2_SERVICE_HEADER
|
|
#define P3_FORUMSV2_SERVICE_HEADER
|
|
|
|
#include "services/p3gxsservice.h"
|
|
|
|
#include "retroshare/rsforumsv2.h"
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
/*
|
|
*
|
|
*/
|
|
|
|
class ForumDataProxy: public GxsDataProxy
|
|
{
|
|
public:
|
|
|
|
bool getForumGroup(const std::string &id, RsForumV2Group &group);
|
|
bool getForumMsg(const std::string &id, RsForumV2Msg &msg);
|
|
|
|
bool addForumGroup(const RsForumV2Group &group);
|
|
bool addForumMsg(const RsForumV2Msg &msg);
|
|
|
|
/* These Functions must be overloaded to complete the service */
|
|
virtual bool convertGroupToMetaData(void *groupData, RsGroupMetaData &meta);
|
|
virtual bool convertMsgToMetaData(void *msgData, RsMsgMetaData &meta);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class p3ForumsV2: public p3GxsDataService, public RsForumsV2
|
|
{
|
|
public:
|
|
|
|
p3ForumsV2(uint16_t type);
|
|
|
|
virtual int tick();
|
|
|
|
public:
|
|
|
|
|
|
virtual bool updated();
|
|
|
|
|
|
/* Data Requests */
|
|
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds);
|
|
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds);
|
|
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds);
|
|
|
|
/* Generic Lists */
|
|
virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds);
|
|
virtual bool getMsgList( const uint32_t &token, std::list<std::string> &msgIds);
|
|
|
|
/* Generic Summary */
|
|
virtual bool getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo);
|
|
virtual bool getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo);
|
|
|
|
/* Actual Data -> specific to Interface */
|
|
/* Specific Service Data */
|
|
virtual bool getGroupData(const uint32_t &token, RsForumV2Group &group);
|
|
virtual bool getMsgData(const uint32_t &token, RsForumV2Msg &msg);
|
|
|
|
/* Poll */
|
|
virtual uint32_t requestStatus(const uint32_t token);
|
|
|
|
/* Cancel Request */
|
|
virtual bool cancelRequest(const uint32_t &token);
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
|
|
virtual bool setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask);
|
|
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
|
|
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str);
|
|
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str);
|
|
|
|
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, RsForumV2Group &group, bool isNew);
|
|
virtual bool createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew);
|
|
|
|
private:
|
|
|
|
std::string genRandomId();
|
|
bool generateDummyData();
|
|
|
|
ForumDataProxy *mForumProxy;
|
|
|
|
RsMutex mForumMtx;
|
|
|
|
/***** below here is locked *****/
|
|
|
|
bool mUpdated;
|
|
|
|
};
|
|
|
|
#endif
|