mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
Removed references to postedVEG from GxsGroupDialog and associated classes and PostedDialog (GUI does not work now but does not crash)
Removed V2 references: TokenQueueV2 and RsTokReqOptionsV2 are now TokenQueue and RsTokReqOptions and renamed file Added initialisation of Posted back end service successfully Added new msg status flags GXS_SERV::MSG_STATUS_UNPROCESSED and ::MSG_STATUS_UNREAD git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5707 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dcb64f6631
commit
c518bd2f19
@ -36,7 +36,7 @@
|
||||
#include "serialiser/rsnxsitems.h"
|
||||
#include "gxs/rsgxsdata.h"
|
||||
#include "rsgxs.h"
|
||||
#include "util/retrodb.h"
|
||||
#include "util/contentvalue.h"
|
||||
|
||||
|
||||
class RsGxsSearchModule {
|
||||
|
@ -109,6 +109,7 @@ public:
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
// normally READ / UNREAD flags. LOCAL Data.
|
||||
|
||||
uint32_t mMsgStatus;
|
||||
time_t mChildTs;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,367 +1,367 @@
|
||||
#ifndef RSGXSDATAACCESS_H
|
||||
#define RSGXSDATAACCESS_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsgxsdataaccess.cc
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2012-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 "rstokenservice.h"
|
||||
#include "rsgxsrequesttypes.h"
|
||||
#include "rsgds.h"
|
||||
|
||||
|
||||
typedef std::map< RsGxsGroupId, std::map<RsGxsMessageId, RsGxsMsgMetaData*> > MsgMetaFilter;
|
||||
|
||||
class RsGxsDataAccess : public RsTokenService
|
||||
{
|
||||
public:
|
||||
RsGxsDataAccess(RsGeneralDataService* ds);
|
||||
virtual ~RsGxsDataAccess() { return ;}
|
||||
|
||||
public:
|
||||
|
||||
/** S: RsTokenService **/
|
||||
|
||||
/*!
|
||||
* Use this to request group related information
|
||||
* @param token The token returned for the request, store this value to pool for request completion
|
||||
* @param ansType The type of result (e.g. group data, meta, ids)
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @param groupIds group id to request info for
|
||||
* @return
|
||||
*/
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &groupIds);
|
||||
|
||||
/*!
|
||||
* Use this to request all group related info
|
||||
* @param token The token returned for the request, store this value to pool for request completion
|
||||
* @param ansType The type of result (e.g. group data, meta, ids)
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @return
|
||||
*/
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts);
|
||||
|
||||
/*!
|
||||
* Use this to get msg related information, store this value to pole for request completion
|
||||
* @param token The token returned for the request
|
||||
* @param ansType The type of result wanted
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds);
|
||||
|
||||
/*!
|
||||
* Use this to get msg related information, store this value to pole for request completion
|
||||
* @param token The token returned for the request
|
||||
* @param ansType The type of result wanted
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& grpIds);
|
||||
|
||||
/*!
|
||||
* For requesting msgs related to a given msg id within a group
|
||||
* @param token The token returned for the request
|
||||
* @param ansType The type of result wanted
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair &msgIds);
|
||||
|
||||
/* Poll */
|
||||
uint32_t requestStatus(const uint32_t token);
|
||||
|
||||
/* Cancel Request */
|
||||
bool cancelRequest(const uint32_t &token);
|
||||
|
||||
/** E: RsTokenService **/
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* This adds a groups to the gxs data base, this is a blocking call
|
||||
* Responsibility for grp still lies with callee \n
|
||||
* If function returns successfully DataAccess can be queried for grp
|
||||
* @param grp the group to add, responsibility grp passed lies with callee
|
||||
* @return false if group cound not be added
|
||||
*/
|
||||
bool addGroupData(RsNxsGrp* grp);
|
||||
|
||||
/*!
|
||||
* This adds a group to the gxs data base, this is a blocking call \n
|
||||
* Responsibility for msg still lies with callee \n
|
||||
* If function returns successfully DataAccess can be queried for msg
|
||||
* @param msg the msg to add
|
||||
* @return false if msg could not be added, true otherwise
|
||||
*/
|
||||
bool addMsgData(RsNxsMsg* msg);
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* This must be called periodically to progress requests
|
||||
*/
|
||||
void processRequests();
|
||||
|
||||
/*!
|
||||
* Retrieve group list for a given token
|
||||
* @param token request token to be redeemed
|
||||
* @param groupIds
|
||||
* @param msgIds
|
||||
* @return false if token cannot be redeemed, if false you may have tried to redeem when not ready
|
||||
*/
|
||||
bool getGroupList(const uint32_t &token, std::list<std::string> &groupIds);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token request token to be redeemed
|
||||
* @param msgIds
|
||||
*/
|
||||
bool getMsgList(const uint32_t &token, GxsMsgIdResult &msgIds);
|
||||
|
||||
|
||||
/*!
|
||||
* @param token request token to be redeemed
|
||||
* @param groupInfo
|
||||
*/
|
||||
bool getGroupSummary(const uint32_t &token, std::list<RsGxsGrpMetaData*> &groupInfo);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token request token to be redeemed
|
||||
* @param msgInfo
|
||||
*/
|
||||
bool getMsgSummary(const uint32_t &token, GxsMsgMetaResult &msgInfo);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token request token to be redeemed
|
||||
* @param grpData
|
||||
*/
|
||||
bool getGroupData(const uint32_t &token, std::list<RsNxsGrp*>& grpData);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token request token to be redeemed
|
||||
* @param msgData
|
||||
* @return false if data cannot be found for token
|
||||
*/
|
||||
bool getMsgData(const uint32_t &token, NxsMsgDataResult& msgData);
|
||||
|
||||
private:
|
||||
|
||||
/** helper functions to implement token service **/
|
||||
|
||||
/*!
|
||||
* Assigns a token value to passed integer
|
||||
* @param token is assigned a unique token value
|
||||
*/
|
||||
void generateToken(uint32_t &token);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token the value of the token for the request object handle wanted
|
||||
* @return the request associated to this token
|
||||
*/
|
||||
GxsRequest* locked_retrieveRequest(const uint32_t& token);
|
||||
|
||||
/*!
|
||||
* Add a gxs request to queue
|
||||
* @param req gxs request to add
|
||||
*/
|
||||
void storeRequest(GxsRequest* req);
|
||||
|
||||
/*!
|
||||
* convenience function to setting members of request
|
||||
* @param req
|
||||
* @param token
|
||||
* @param ansType
|
||||
* @param opts
|
||||
*/
|
||||
void setReq(GxsRequest* req,const uint32_t &token, const uint32_t& ansType, const RsTokReqOptionsV2 &opts) const;
|
||||
|
||||
/*!
|
||||
* Remove request for request queue
|
||||
* Request is deleted
|
||||
* @param token the token associated to the request
|
||||
* @return true if token successfully cleared, false if token does not exist
|
||||
*/
|
||||
bool clearRequest(const uint32_t &token);
|
||||
|
||||
/*!
|
||||
* Updates the status flag of a request
|
||||
* @param token the token value of the request to set
|
||||
* @param status the status to set
|
||||
* @return
|
||||
*/
|
||||
bool locked_updateRequestStatus(const uint32_t &token, const uint32_t &status);
|
||||
|
||||
/*!
|
||||
* Use to query the status and other values of a given token
|
||||
* @param token the toke of the request to check for
|
||||
* @param status set to current status of request
|
||||
* @param reqtype set to request type of request
|
||||
* @param anstype set to to anstype of request
|
||||
* @param ts time stamp
|
||||
* @return false if token does not exist, true otherwise
|
||||
*/
|
||||
bool checkRequestStatus(const uint32_t &token, uint32_t &status, uint32_t &reqtype, uint32_t &anstype, time_t &ts);
|
||||
|
||||
// special ones for testing (not in final design)
|
||||
/*!
|
||||
* Get list of active tokens of this token service
|
||||
* @param tokens sets to list of token contained in this tokenservice
|
||||
*/
|
||||
void tokenList(std::list<uint32_t> &tokens);
|
||||
|
||||
/*!
|
||||
* Convenience function to delete the ids
|
||||
* @param filter the meta filter to clean
|
||||
*/
|
||||
void cleanseMsgMetaMap(GxsMsgMetaResult& result);
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Assigns a token value to passed integer
|
||||
* The status of the token can still be queried from request status feature
|
||||
* @param token is assigned a unique token value
|
||||
*/
|
||||
uint32_t generatePublicToken();
|
||||
|
||||
/*!
|
||||
* Updates the status of associate token
|
||||
* @param token
|
||||
* @param status
|
||||
* @return false if token could not be found, true if token disposed of
|
||||
*/
|
||||
bool updatePublicRequestStatus(const uint32_t &token, const uint32_t &status);
|
||||
|
||||
/*!
|
||||
* This gets rid of a publicly issued token
|
||||
* @param token
|
||||
* @return false if token could not found, true if token disposed of
|
||||
*/
|
||||
bool disposeOfPublicToken(const uint32_t &token);
|
||||
|
||||
private:
|
||||
|
||||
/* These perform the actual blocking retrieval of data */
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve group id list from data store
|
||||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getGroupList(GroupIdReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve msg id list from data store
|
||||
* Computationally/CPU-Bandwidth expensive
|
||||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getMsgList(MsgIdReq* req);
|
||||
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve group meta data from data store
|
||||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getGroupSummary(GroupMetaReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve msg meta data from data store
|
||||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getMsgSummary(MsgMetaReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve group data from data store
|
||||
* @param req The request specifying data to retrieve
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getGroupData(GroupDataReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve message data from data store
|
||||
* @param req The request specifying data to retrieve
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getMsgData(MsgDataReq* req);
|
||||
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve messages related to msgIds of associated equest
|
||||
* @param token request token to be redeemed
|
||||
* @param msgIds
|
||||
* @return false if data cannot be found for token
|
||||
*/
|
||||
bool getMsgRelatedInfo(MsgRelatedInfoReq* req);
|
||||
|
||||
/*!
|
||||
* This filter msgs based of options supplied (at the moment just status masks)
|
||||
* @param msgIds The msgsIds to filter
|
||||
* @param opts the request options set by user
|
||||
* @param meta The accompanying meta information for msg, ids
|
||||
*/
|
||||
void filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptionsV2& opts, const MsgMetaFilter& meta) const;
|
||||
|
||||
|
||||
/*!
|
||||
* This applies the options to the meta to find out if the given message satisfies
|
||||
* them
|
||||
* @param opts options containing filters to check
|
||||
* @param meta meta containing currently defined options for msg
|
||||
* @return true if msg meta passes all options
|
||||
*/
|
||||
bool checkMsgFilter(const RsTokReqOptionsV2& opts, const RsGxsMsgMetaData* meta) const;
|
||||
|
||||
/*!
|
||||
* This is a filter method which applies the request options to the list of ids
|
||||
* requested
|
||||
* @param msgIds the msg ids for filter to be applied to
|
||||
* @param opts the options used to parameterise the id filter
|
||||
* @param msgIdsOut the left overs ids after filter is applied to msgIds
|
||||
*/
|
||||
bool getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq& msgIdsOut);
|
||||
|
||||
private:
|
||||
|
||||
RsGeneralDataService* mDataStore;
|
||||
uint32_t mNextToken;
|
||||
std::map<uint32_t, uint32_t> mPublicToken;
|
||||
std::map<uint32_t, GxsRequest*> mRequests;
|
||||
|
||||
RsMutex mDataMutex;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // RSGXSDATAACCESS_H
|
||||
#ifndef RSGXSDATAACCESS_H
|
||||
#define RSGXSDATAACCESS_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsgxsdataaccess.cc
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2012-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 "rstokenservice.h"
|
||||
#include "rsgxsrequesttypes.h"
|
||||
#include "rsgds.h"
|
||||
|
||||
|
||||
typedef std::map< RsGxsGroupId, std::map<RsGxsMessageId, RsGxsMsgMetaData*> > MsgMetaFilter;
|
||||
|
||||
class RsGxsDataAccess : public RsTokenService
|
||||
{
|
||||
public:
|
||||
RsGxsDataAccess(RsGeneralDataService* ds);
|
||||
virtual ~RsGxsDataAccess() { return ;}
|
||||
|
||||
public:
|
||||
|
||||
/** S: RsTokenService **/
|
||||
|
||||
/*!
|
||||
* Use this to request group related information
|
||||
* @param token The token returned for the request, store this value to pool for request completion
|
||||
* @param ansType The type of result (e.g. group data, meta, ids)
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @param groupIds group id to request info for
|
||||
* @return
|
||||
*/
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId> &groupIds);
|
||||
|
||||
/*!
|
||||
* Use this to request all group related info
|
||||
* @param token The token returned for the request, store this value to pool for request completion
|
||||
* @param ansType The type of result (e.g. group data, meta, ids)
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @return
|
||||
*/
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts);
|
||||
|
||||
/*!
|
||||
* Use this to get msg related information, store this value to pole for request completion
|
||||
* @param token The token returned for the request
|
||||
* @param ansType The type of result wanted
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds);
|
||||
|
||||
/*!
|
||||
* Use this to get msg related information, store this value to pole for request completion
|
||||
* @param token The token returned for the request
|
||||
* @param ansType The type of result wanted
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& grpIds);
|
||||
|
||||
/*!
|
||||
* For requesting msgs related to a given msg id within a group
|
||||
* @param token The token returned for the request
|
||||
* @param ansType The type of result wanted
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair &msgIds);
|
||||
|
||||
/* Poll */
|
||||
uint32_t requestStatus(const uint32_t token);
|
||||
|
||||
/* Cancel Request */
|
||||
bool cancelRequest(const uint32_t &token);
|
||||
|
||||
/** E: RsTokenService **/
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* This adds a groups to the gxs data base, this is a blocking call
|
||||
* Responsibility for grp still lies with callee \n
|
||||
* If function returns successfully DataAccess can be queried for grp
|
||||
* @param grp the group to add, responsibility grp passed lies with callee
|
||||
* @return false if group cound not be added
|
||||
*/
|
||||
bool addGroupData(RsNxsGrp* grp);
|
||||
|
||||
/*!
|
||||
* This adds a group to the gxs data base, this is a blocking call \n
|
||||
* Responsibility for msg still lies with callee \n
|
||||
* If function returns successfully DataAccess can be queried for msg
|
||||
* @param msg the msg to add
|
||||
* @return false if msg could not be added, true otherwise
|
||||
*/
|
||||
bool addMsgData(RsNxsMsg* msg);
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* This must be called periodically to progress requests
|
||||
*/
|
||||
void processRequests();
|
||||
|
||||
/*!
|
||||
* Retrieve group list for a given token
|
||||
* @param token request token to be redeemed
|
||||
* @param groupIds
|
||||
* @param msgIds
|
||||
* @return false if token cannot be redeemed, if false you may have tried to redeem when not ready
|
||||
*/
|
||||
bool getGroupList(const uint32_t &token, std::list<std::string> &groupIds);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token request token to be redeemed
|
||||
* @param msgIds
|
||||
*/
|
||||
bool getMsgList(const uint32_t &token, GxsMsgIdResult &msgIds);
|
||||
|
||||
|
||||
/*!
|
||||
* @param token request token to be redeemed
|
||||
* @param groupInfo
|
||||
*/
|
||||
bool getGroupSummary(const uint32_t &token, std::list<RsGxsGrpMetaData*> &groupInfo);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token request token to be redeemed
|
||||
* @param msgInfo
|
||||
*/
|
||||
bool getMsgSummary(const uint32_t &token, GxsMsgMetaResult &msgInfo);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token request token to be redeemed
|
||||
* @param grpData
|
||||
*/
|
||||
bool getGroupData(const uint32_t &token, std::list<RsNxsGrp*>& grpData);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token request token to be redeemed
|
||||
* @param msgData
|
||||
* @return false if data cannot be found for token
|
||||
*/
|
||||
bool getMsgData(const uint32_t &token, NxsMsgDataResult& msgData);
|
||||
|
||||
private:
|
||||
|
||||
/** helper functions to implement token service **/
|
||||
|
||||
/*!
|
||||
* Assigns a token value to passed integer
|
||||
* @param token is assigned a unique token value
|
||||
*/
|
||||
void generateToken(uint32_t &token);
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token the value of the token for the request object handle wanted
|
||||
* @return the request associated to this token
|
||||
*/
|
||||
GxsRequest* locked_retrieveRequest(const uint32_t& token);
|
||||
|
||||
/*!
|
||||
* Add a gxs request to queue
|
||||
* @param req gxs request to add
|
||||
*/
|
||||
void storeRequest(GxsRequest* req);
|
||||
|
||||
/*!
|
||||
* convenience function to setting members of request
|
||||
* @param req
|
||||
* @param token
|
||||
* @param ansType
|
||||
* @param opts
|
||||
*/
|
||||
void setReq(GxsRequest* req,const uint32_t &token, const uint32_t& ansType, const RsTokReqOptions &opts) const;
|
||||
|
||||
/*!
|
||||
* Remove request for request queue
|
||||
* Request is deleted
|
||||
* @param token the token associated to the request
|
||||
* @return true if token successfully cleared, false if token does not exist
|
||||
*/
|
||||
bool clearRequest(const uint32_t &token);
|
||||
|
||||
/*!
|
||||
* Updates the status flag of a request
|
||||
* @param token the token value of the request to set
|
||||
* @param status the status to set
|
||||
* @return
|
||||
*/
|
||||
bool locked_updateRequestStatus(const uint32_t &token, const uint32_t &status);
|
||||
|
||||
/*!
|
||||
* Use to query the status and other values of a given token
|
||||
* @param token the toke of the request to check for
|
||||
* @param status set to current status of request
|
||||
* @param reqtype set to request type of request
|
||||
* @param anstype set to to anstype of request
|
||||
* @param ts time stamp
|
||||
* @return false if token does not exist, true otherwise
|
||||
*/
|
||||
bool checkRequestStatus(const uint32_t &token, uint32_t &status, uint32_t &reqtype, uint32_t &anstype, time_t &ts);
|
||||
|
||||
// special ones for testing (not in final design)
|
||||
/*!
|
||||
* Get list of active tokens of this token service
|
||||
* @param tokens sets to list of token contained in this tokenservice
|
||||
*/
|
||||
void tokenList(std::list<uint32_t> &tokens);
|
||||
|
||||
/*!
|
||||
* Convenience function to delete the ids
|
||||
* @param filter the meta filter to clean
|
||||
*/
|
||||
void cleanseMsgMetaMap(GxsMsgMetaResult& result);
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Assigns a token value to passed integer
|
||||
* The status of the token can still be queried from request status feature
|
||||
* @param token is assigned a unique token value
|
||||
*/
|
||||
uint32_t generatePublicToken();
|
||||
|
||||
/*!
|
||||
* Updates the status of associate token
|
||||
* @param token
|
||||
* @param status
|
||||
* @return false if token could not be found, true if token disposed of
|
||||
*/
|
||||
bool updatePublicRequestStatus(const uint32_t &token, const uint32_t &status);
|
||||
|
||||
/*!
|
||||
* This gets rid of a publicly issued token
|
||||
* @param token
|
||||
* @return false if token could not found, true if token disposed of
|
||||
*/
|
||||
bool disposeOfPublicToken(const uint32_t &token);
|
||||
|
||||
private:
|
||||
|
||||
/* These perform the actual blocking retrieval of data */
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve group id list from data store
|
||||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getGroupList(GroupIdReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve msg id list from data store
|
||||
* Computationally/CPU-Bandwidth expensive
|
||||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getMsgList(MsgIdReq* req);
|
||||
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve group meta data from data store
|
||||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getGroupSummary(GroupMetaReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve msg meta data from data store
|
||||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getMsgSummary(MsgMetaReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve group data from data store
|
||||
* @param req The request specifying data to retrieve
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getGroupData(GroupDataReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve message data from data store
|
||||
* @param req The request specifying data to retrieve
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getMsgData(MsgDataReq* req);
|
||||
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve messages related to msgIds of associated equest
|
||||
* @param token request token to be redeemed
|
||||
* @param msgIds
|
||||
* @return false if data cannot be found for token
|
||||
*/
|
||||
bool getMsgRelatedInfo(MsgRelatedInfoReq* req);
|
||||
|
||||
/*!
|
||||
* This filter msgs based of options supplied (at the moment just status masks)
|
||||
* @param msgIds The msgsIds to filter
|
||||
* @param opts the request options set by user
|
||||
* @param meta The accompanying meta information for msg, ids
|
||||
*/
|
||||
void filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptions& opts, const MsgMetaFilter& meta) const;
|
||||
|
||||
|
||||
/*!
|
||||
* This applies the options to the meta to find out if the given message satisfies
|
||||
* them
|
||||
* @param opts options containing filters to check
|
||||
* @param meta meta containing currently defined options for msg
|
||||
* @return true if msg meta passes all options
|
||||
*/
|
||||
bool checkMsgFilter(const RsTokReqOptions& opts, const RsGxsMsgMetaData* meta) const;
|
||||
|
||||
/*!
|
||||
* This is a filter method which applies the request options to the list of ids
|
||||
* requested
|
||||
* @param msgIds the msg ids for filter to be applied to
|
||||
* @param opts the options used to parameterise the id filter
|
||||
* @param msgIdsOut the left overs ids after filter is applied to msgIds
|
||||
*/
|
||||
bool getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions& opts, GxsMsgReq& msgIdsOut);
|
||||
|
||||
private:
|
||||
|
||||
RsGeneralDataService* mDataStore;
|
||||
uint32_t mNextToken;
|
||||
std::map<uint32_t, uint32_t> mPublicToken;
|
||||
std::map<uint32_t, GxsRequest*> mRequests;
|
||||
|
||||
RsMutex mDataMutex;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // RSGXSDATAACCESS_H
|
||||
|
@ -3,13 +3,22 @@
|
||||
|
||||
#include "inttypes.h"
|
||||
|
||||
// this serves a single point of call for definining grp and msg modes
|
||||
// GXS. These modes say
|
||||
/**
|
||||
* The GXS_SERV namespace serves a single point of reference for definining grp and msg flags
|
||||
* Declared and defined here are:
|
||||
* - privacy flags which define the level of privacy that can be given \n
|
||||
* to a group
|
||||
* - authentication types which defined types of authentication needed for a given message to
|
||||
* confirm its authenticity
|
||||
* - subscription flags: This used only locally by the peer to subscription status to a \n
|
||||
* a group
|
||||
* -
|
||||
*/
|
||||
namespace GXS_SERV {
|
||||
|
||||
|
||||
|
||||
/** privacy **/
|
||||
/** START privacy **/
|
||||
|
||||
static const uint32_t FLAG_PRIVACY_MASK = 0x0000000f;
|
||||
|
||||
@ -22,9 +31,9 @@ namespace GXS_SERV {
|
||||
// anyone can publish, publish key pair not needed
|
||||
static const uint32_t FLAG_PRIVACY_PUBLIC = 0x00000004;
|
||||
|
||||
/** privacy **/
|
||||
/** END privacy **/
|
||||
|
||||
/** authentication **/
|
||||
/** START authentication **/
|
||||
|
||||
static const uint32_t FLAG_AUTHEN_MASK = 0x000000f0;
|
||||
|
||||
@ -40,10 +49,10 @@ namespace GXS_SERV {
|
||||
// pgp sign identity
|
||||
static const uint32_t FLAG_AUTHEN_PGP_IDENTITY = 0x00000080;
|
||||
|
||||
/** authentication **/
|
||||
/** END authentication **/
|
||||
|
||||
|
||||
// Subscription Flags. (LOCAL)
|
||||
/** START Subscription Flags. (LOCAL) **/
|
||||
|
||||
static const uint32_t GROUP_SUBSCRIBE_ADMIN = 0x00000001;
|
||||
|
||||
@ -55,6 +64,16 @@ namespace GXS_SERV {
|
||||
|
||||
static const uint32_t GROUP_SUBSCRIBE_MASK = 0x0000000f;
|
||||
|
||||
/** END Subscription Flags. (LOCAL) **/
|
||||
|
||||
/** START GXS Msg status flags **/
|
||||
|
||||
static const uint32_t GXS_MSG_STATUS_UNPROCESSED = 0x000000100;
|
||||
|
||||
static const uint32_t GXS_MSG_STATUS_UNREAD = 0x00000200;
|
||||
|
||||
/** END GXS Msg status flags **/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1267,7 +1267,7 @@ NxsTransaction::~NxsTransaction(){
|
||||
/* Net Manager */
|
||||
|
||||
RsNxsNetMgrImpl::RsNxsNetMgrImpl(p3LinkMgr *lMgr)
|
||||
: mLinkMgr(lMgr)
|
||||
: mLinkMgr(lMgr), mNxsNetMgrMtx("RsNxsNetMgrImpl")
|
||||
{
|
||||
|
||||
}
|
||||
@ -1275,6 +1275,7 @@ RsNxsNetMgrImpl::RsNxsNetMgrImpl(p3LinkMgr *lMgr)
|
||||
|
||||
std::string RsNxsNetMgrImpl::getOwnId()
|
||||
{
|
||||
RsStackMutex stack(mNxsNetMgrMtx);
|
||||
return mLinkMgr->getOwnId();
|
||||
}
|
||||
|
||||
@ -1283,7 +1284,10 @@ void RsNxsNetMgrImpl::getOnlineList(std::set<std::string> &ssl_peers)
|
||||
ssl_peers.clear();
|
||||
|
||||
std::list<std::string> pList;
|
||||
mLinkMgr->getOnlineList(pList);
|
||||
{
|
||||
RsStackMutex stack(mNxsNetMgrMtx);
|
||||
mLinkMgr->getOnlineList(pList);
|
||||
}
|
||||
|
||||
std::list<std::string>::const_iterator lit = pList.begin();
|
||||
|
||||
|
@ -103,6 +103,7 @@ public:
|
||||
private:
|
||||
|
||||
p3LinkMgr* mLinkMgr;
|
||||
RsMutex mNxsNetMgrMtx;
|
||||
|
||||
};
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "gxs/rstokenservice.h"
|
||||
#include "gxs/rsgds.h"
|
||||
|
||||
class GxsRequest
|
||||
@ -40,7 +41,7 @@ public:
|
||||
|
||||
uint32_t ansType;
|
||||
uint32_t reqType;
|
||||
RsTokReqOptionsV2 Options;
|
||||
RsTokReqOptions Options;
|
||||
|
||||
uint32_t status;
|
||||
};
|
||||
|
@ -68,10 +68,10 @@
|
||||
* This class provides useful generic support for GXS style services.
|
||||
* I expect much of this will be incorporated into the base GXS.
|
||||
*/
|
||||
class RsTokReqOptionsV2
|
||||
class RsTokReqOptions
|
||||
{
|
||||
public:
|
||||
RsTokReqOptionsV2()
|
||||
RsTokReqOptions()
|
||||
{
|
||||
mOptions = 0;
|
||||
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
|
||||
@ -86,6 +86,7 @@ uint32_t mOptions;
|
||||
uint32_t mStatusFilter;
|
||||
uint32_t mStatusMask;
|
||||
|
||||
// use
|
||||
uint32_t mMsgFlagMask, mMsgFlagFilter;
|
||||
|
||||
uint32_t mReqType;
|
||||
@ -97,6 +98,8 @@ time_t mBefore;
|
||||
time_t mAfter;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta);
|
||||
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta);
|
||||
|
||||
/*!
|
||||
* A proxy class for requesting generic service data for GXS
|
||||
@ -129,7 +132,7 @@ public:
|
||||
* @param groupIds group id to request info for
|
||||
* @return
|
||||
*/
|
||||
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &groupIds) = 0;
|
||||
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId> &groupIds) = 0;
|
||||
|
||||
/*!
|
||||
* Use this to request all group related info
|
||||
@ -138,7 +141,7 @@ public:
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @return
|
||||
*/
|
||||
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts) = 0;
|
||||
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts) = 0;
|
||||
|
||||
/*!
|
||||
* Use this to get msg related information, store this value to pole for request completion
|
||||
@ -148,7 +151,7 @@ public:
|
||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds) = 0;
|
||||
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds) = 0;
|
||||
|
||||
/*!
|
||||
* Use this to get msg related information, store this value to pole for request completion
|
||||
@ -158,7 +161,7 @@ public:
|
||||
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& msgIds) = 0;
|
||||
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& msgIds) = 0;
|
||||
|
||||
/*!
|
||||
* For requesting msgs related to a given msg id within a group
|
||||
@ -168,7 +171,7 @@ public:
|
||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair& msgIds) = 0;
|
||||
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair& msgIds) = 0;
|
||||
|
||||
|
||||
/* Poll */
|
||||
|
@ -527,6 +527,7 @@ HEADERS += retroshare/rsgame.h \
|
||||
serialiser/rsbanlistitems.cc \
|
||||
serialiser/rsbwctrlitems.cc \
|
||||
serialiser/rstunnelitems.cc
|
||||
|
||||
SOURCES += services/p3channels.cc \
|
||||
services/p3chatservice.cc \
|
||||
services/p3disc.cc \
|
||||
@ -580,7 +581,7 @@ HEADERS += retroshare/rsgame.h \
|
||||
}
|
||||
|
||||
# new gxs cache system
|
||||
newcache {
|
||||
newcache {
|
||||
HEADERS += serialiser/rsnxsitems.h \
|
||||
gxs/rsgds.h \
|
||||
gxs/rsgxs.h \
|
||||
@ -603,6 +604,7 @@ HEADERS += retroshare/rsgame.h \
|
||||
gxs/rsgxsifaceimpl.h \
|
||||
services/p3posted.h \
|
||||
retroshare/rsposted.h \
|
||||
serialiser/rsposteditems.h
|
||||
|
||||
|
||||
SOURCES += serialiser/rsnxsitems.cc \
|
||||
@ -621,22 +623,23 @@ HEADERS += retroshare/rsgame.h \
|
||||
gxs/gxssecurity.cc \
|
||||
gxs/rsgxsifaceimpl.cc \
|
||||
services/p3posted.cc \
|
||||
serialiser/rsposteditems.cc
|
||||
|
||||
# Identity Service
|
||||
HEADERS += retroshare/rsidentity.h \
|
||||
gxs/rsgixs.h \
|
||||
services/p3idservice.h \
|
||||
serialiser/rsgxsiditems.h \
|
||||
serialiser/rsgxsiditems.h
|
||||
|
||||
SOURCES += services/p3idservice.cc \
|
||||
SOURCES += services/p3idservice.cc
|
||||
# serialiser/rsgxsiditems.cc \
|
||||
|
||||
# Wiki Service
|
||||
HEADERS += retroshare/rswiki.h \
|
||||
services/p3wiki.h \
|
||||
serialiser/rswikiitems.h \
|
||||
serialiser/rswikiitems.h
|
||||
|
||||
SOURCES += services/p3wiki.cc \
|
||||
SOURCES += services/p3wiki.cc
|
||||
# serialiser/rswikiitems.cc \
|
||||
|
||||
}
|
||||
@ -645,30 +648,20 @@ HEADERS += retroshare/rsgame.h \
|
||||
HEADERS += services/p3photoserviceV2.h \
|
||||
retroshare/rsphotoVEG.h \
|
||||
services/p3gxsserviceVEG.h \
|
||||
retroshare/rsidentityVEG.h \
|
||||
services/p3wikiserviceVEG.h \
|
||||
retroshare/rswikiVEG.h \
|
||||
retroshare/rswireVEG.h \
|
||||
services/p3wireVEG.h \
|
||||
services/p3idserviceVEG.h \
|
||||
retroshare/rsforumsVEG.h \
|
||||
services/p3forumsVEG.h \
|
||||
retroshare/rspostedVEG.h \
|
||||
services/p3postedVEG.h
|
||||
|
||||
services/p3forumsVEG.h
|
||||
# Do I need this?
|
||||
#serialiser/rsphotoitemsVEG.h \
|
||||
|
||||
SOURCES += services/p3gxsserviceVEG.cc \
|
||||
services/p3wikiserviceVEG.cc \
|
||||
services/p3wireVEG.cc \
|
||||
services/p3idserviceVEG.cc \
|
||||
services/p3forumsVEG.cc \
|
||||
services/p3postedVEG.cc
|
||||
|
||||
services/p3forumsVEG.cc
|
||||
# Do I need this?
|
||||
# serialiser/rsphotoitemsVEG.cc \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008-2012 by Robert Fernie.
|
||||
* 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
|
||||
@ -33,10 +33,10 @@
|
||||
#include "gxs/rstokenservice.h"
|
||||
#include "gxs/rsgxsifaceimpl.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsPostedVEG;
|
||||
extern RsPostedVEG *rsPostedVEG;
|
||||
class RsPosted;
|
||||
extern RsPosted *rsPosted;
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
|
||||
class RsPostedGroup
|
||||
{
|
||||
@ -45,19 +45,9 @@ class RsPostedGroup
|
||||
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_MSGTYPE_POST 0x0001
|
||||
//#define RSPOSTED_MSGTYPE_VOTE 0x0002
|
||||
//#define RSPOSTED_MSGTYPE_COMMENT 0x0004
|
||||
|
||||
#define RSPOSTED_PERIOD_YEAR 1
|
||||
#define RSPOSTED_PERIOD_MONTH 2
|
||||
@ -70,44 +60,13 @@ class RsPostedMsg
|
||||
#define RSPOSTED_VIEWMODE_HOT 3
|
||||
#define RSPOSTED_VIEWMODE_COMMENTS 4
|
||||
|
||||
class RsPostedPost;
|
||||
class RsPostedComment;
|
||||
class RsPostedVote;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPostedPost> > PostedPostResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPostedComment> > PostedCommentResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPostedVote> > PostedVoteResult;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
||||
@ -119,15 +78,19 @@ class RsPosted : public RsGxsIfaceImpl
|
||||
{
|
||||
public:
|
||||
|
||||
static const uint32_t FLAG_MSGTYPE_POST;
|
||||
static const uint32_t FLAG_MSGTYPE_VOTE;
|
||||
static const uint32_t FLAG_MSGTYPE_COMMENT;
|
||||
|
||||
|
||||
RsPosted(RsGenExchange* gxs) : RsGxsIfaceImpl(gxs) { return; }
|
||||
virtual ~RsPosted() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
|
||||
virtual RsTokenService* getToken() = 0;
|
||||
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 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 submitGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
||||
virtual bool submitPost(uint32_t &token, RsPostedPost &post) = 0;
|
||||
@ -136,20 +99,48 @@ virtual bool submitComment(uint32_t &token, RsPostedComment &comment) = 0;
|
||||
|
||||
// Special Ranking Request.
|
||||
virtual bool requestRanking(uint32_t &token, RsGxsGroupId groupId) = 0;
|
||||
virtual bool getRankedPost(const uint32_t &token, RsPostedPost &post) = 0;
|
||||
|
||||
virtual bool extractPostedCache() = 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(uint32_t& token, const RsGxsMessageId) = 0;
|
||||
|
||||
};
|
||||
|
||||
class RsPostedPost
|
||||
{
|
||||
public:
|
||||
RsPostedPost()
|
||||
{
|
||||
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST;
|
||||
return;
|
||||
}
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
std::string mLink;
|
||||
std::string mNotes;
|
||||
};
|
||||
|
||||
|
||||
class RsPostedVote
|
||||
{
|
||||
public:
|
||||
RsPostedVote()
|
||||
{
|
||||
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_VOTE;
|
||||
return;
|
||||
}
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
};
|
||||
|
||||
|
||||
class RsPostedComment
|
||||
{
|
||||
public:
|
||||
RsPostedComment()
|
||||
{
|
||||
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_COMMENT;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string mComment;
|
||||
RsMsgMetaData mMeta;
|
||||
};
|
||||
|
||||
#endif // RSPOSTED_H
|
||||
|
@ -1813,17 +1813,18 @@ RsTurtle *rsTurtle = NULL ;
|
||||
|
||||
#ifdef ENABLE_GXS_CORE
|
||||
#include "gxs/gxscoreserver.h"
|
||||
#include "services/p3photoserviceV2.h"
|
||||
|
||||
#include "gxs/rsdataservice.h"
|
||||
#include "gxs/rsgxsnetservice.h"
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_GXS_SERVICES
|
||||
#include "services/p3photoserviceV2.h"
|
||||
#include "services/p3posted.h"
|
||||
#include "services/p3wikiserviceVEG.h"
|
||||
#include "services/p3wireVEG.h"
|
||||
#include "services/p3idserviceVEG.h"
|
||||
#include "services/p3forumsVEG.h"
|
||||
#include "services/p3postedVEG.h"
|
||||
#endif
|
||||
|
||||
#ifndef PQI_DISABLE_TUNNEL
|
||||
@ -2266,41 +2267,7 @@ int RsServer::StartupRetroShare()
|
||||
mPluginsManager->registerClientServices(pqih) ;
|
||||
mPluginsManager->registerCacheServices() ;
|
||||
|
||||
#ifdef ENABLE_GXS_CORE
|
||||
|
||||
p3PhotoServiceV2 *mPhotoV2 = NULL;
|
||||
|
||||
// first prep the core
|
||||
|
||||
|
||||
RsDirUtil::checkCreateDirectory(mLinkMgr->getOwnId());
|
||||
RsGeneralDataService* photo_ds = new RsDataService("./" + mLinkMgr->getOwnId() + "/", "photoV2_db",
|
||||
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
||||
|
||||
photo_ds->resetDataStore();
|
||||
|
||||
// init gxs services
|
||||
mPhotoV2 = new p3PhotoServiceV2(photo_ds, NULL);
|
||||
|
||||
// TODO need net manager
|
||||
RsGxsNetService* photo_ns = new RsGxsNetService(
|
||||
RS_SERVICE_GXSV1_TYPE_PHOTO, photo_ds, new RsNxsNetMgrImpl(mLinkMgr), mPhotoV2);
|
||||
|
||||
|
||||
GxsCoreServer* mGxsCore = new GxsCoreServer();
|
||||
mGxsCore->addService(mPhotoV2);
|
||||
|
||||
// cores read start up servers !
|
||||
|
||||
// start nxs core core server
|
||||
createThread(*photo_ns);
|
||||
|
||||
// start up gxs core server
|
||||
createThread(*mGxsCore);
|
||||
|
||||
pqih->addService(photo_ns);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_GXS_SERVICES
|
||||
|
||||
@ -2315,12 +2282,69 @@ int RsServer::StartupRetroShare()
|
||||
// Testing New Cache Services.
|
||||
p3ForumsVEG *mForumsV2 = new p3ForumsVEG(RS_SERVICE_GXSV1_TYPE_FORUMS);
|
||||
pqih -> addService(mForumsV2);
|
||||
|
||||
// Testing New Cache Services.
|
||||
p3PostedServiceVEG *mPosted = new p3PostedServiceVEG(RS_SERVICE_GXSV1_TYPE_POSTED);
|
||||
pqih -> addService(mPosted);
|
||||
|
||||
|
||||
// TODO: temporary to store GXS service data, remove
|
||||
RsDirUtil::checkCreateDirectory(mLinkMgr->getOwnId());
|
||||
|
||||
RsNxsNetMgr* nxsMgr = new RsNxsNetMgrImpl(mLinkMgr);
|
||||
|
||||
/**** Photo service ****/
|
||||
|
||||
p3PhotoServiceV2 *mPhotoV2 = NULL;
|
||||
|
||||
|
||||
|
||||
RsGeneralDataService* photo_ds = new RsDataService("./" + mLinkMgr->getOwnId() + "/", "photoV2_db",
|
||||
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
||||
|
||||
photo_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||
|
||||
// init gxs services
|
||||
mPhotoV2 = new p3PhotoServiceV2(photo_ds, NULL);
|
||||
|
||||
// create GXS photo service
|
||||
RsGxsNetService* photo_ns = new RsGxsNetService(
|
||||
RS_SERVICE_GXSV1_TYPE_PHOTO, photo_ds, nxsMgr, mPhotoV2);
|
||||
|
||||
/**** Posted GXS service ****/
|
||||
|
||||
p3Posted *mPosted = NULL;
|
||||
|
||||
RsGeneralDataService* posted_ds = new RsDataService("./" + mLinkMgr->getOwnId()+ "/", "posted_db",
|
||||
RS_SERVICE_GXSV1_TYPE_POSTED);
|
||||
|
||||
posted_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||
|
||||
mPosted = new p3Posted(posted_ds, NULL);
|
||||
|
||||
// create GXS photo service
|
||||
RsGxsNetService* posted_ns = new RsGxsNetService(
|
||||
RS_SERVICE_GXSV1_TYPE_POSTED, posted_ds, nxsMgr, mPosted);
|
||||
|
||||
|
||||
#endif // ENABLE_GXS_SERVICES
|
||||
|
||||
#ifdef ENABLE_GXS_CORE
|
||||
|
||||
/*** start up GXS core runner ***/
|
||||
|
||||
GxsCoreServer* mGxsCore = new GxsCoreServer();
|
||||
mGxsCore->addService(mPhotoV2);
|
||||
mGxsCore->addService(mPosted);
|
||||
|
||||
// cores ready start up GXS net servers
|
||||
createThread(*photo_ns);
|
||||
createThread(*posted_ns);
|
||||
|
||||
// now add to p3service
|
||||
pqih->addService(photo_ns);
|
||||
pqih->addService(posted_ns);
|
||||
|
||||
// start up gxs core server
|
||||
createThread(*mGxsCore);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef RS_RELEASE
|
||||
p3GameLauncher *gameLauncher = new p3GameLauncher(mLinkMgr);
|
||||
@ -2578,14 +2602,15 @@ int RsServer::StartupRetroShare()
|
||||
rsForums = mForums;
|
||||
rsChannels = mChannels;
|
||||
|
||||
rsPhotoV2 = mPhotoV2;
|
||||
#ifdef ENABLE_GXS_SERVICES
|
||||
// Testing of new cache system interfaces.
|
||||
|
||||
rsWikiVEG = mWikis;
|
||||
rsWireVEG = mWire;
|
||||
rsForumsVEG = mForumsV2;
|
||||
rsPostedVEG = mPosted;
|
||||
rsPosted = mPosted;
|
||||
rsPhotoV2 = mPhotoV2;
|
||||
|
||||
#endif // ENABLE_GXS_SERVICES
|
||||
|
||||
|
||||
|
@ -36,41 +36,41 @@ class RsGxsMsgMetaData;
|
||||
|
||||
class RsGroupMetaData
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
RsGroupMetaData()
|
||||
{
|
||||
mGroupFlags = 0;
|
||||
mSubscribeFlags = 0;
|
||||
RsGroupMetaData()
|
||||
{
|
||||
mGroupFlags = 0;
|
||||
mSubscribeFlags = 0;
|
||||
|
||||
mPop = 0;
|
||||
mMsgCount = 0;
|
||||
mLastPost = 0;
|
||||
mGroupStatus = 0;
|
||||
mPop = 0;
|
||||
mMsgCount = 0;
|
||||
mLastPost = 0;
|
||||
mGroupStatus = 0;
|
||||
|
||||
//mPublishTs = 0;
|
||||
}
|
||||
//mPublishTs = 0;
|
||||
}
|
||||
|
||||
void operator =(const RsGxsGrpMetaData& rGxsMeta);
|
||||
void operator =(const RsGxsGrpMetaData& rGxsMeta);
|
||||
|
||||
std::string mGroupId;
|
||||
std::string mGroupName;
|
||||
uint32_t mGroupFlags;
|
||||
uint32_t mSignFlags; // Combination of RSGXS_GROUP_SIGN_PUBLISH_MASK & RSGXS_GROUP_SIGN_AUTHOR_MASK.
|
||||
std::string mGroupId;
|
||||
std::string mGroupName;
|
||||
uint32_t mGroupFlags;
|
||||
uint32_t mSignFlags; // Combination of RSGXS_GROUP_SIGN_PUBLISH_MASK & RSGXS_GROUP_SIGN_AUTHOR_MASK.
|
||||
|
||||
time_t mPublishTs; // Mandatory.
|
||||
std::string mAuthorId; // Optional.
|
||||
time_t mPublishTs; // Mandatory.
|
||||
std::string mAuthorId; // Optional.
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
|
||||
uint32_t mSubscribeFlags;
|
||||
uint32_t mSubscribeFlags;
|
||||
|
||||
uint32_t mPop; // HOW DO WE DO THIS NOW.
|
||||
uint32_t mMsgCount; // ???
|
||||
time_t mLastPost; // ???
|
||||
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.
|
||||
uint32_t mGroupStatus;
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
|
||||
};
|
||||
|
||||
@ -79,38 +79,43 @@ class RsGroupMetaData
|
||||
|
||||
class RsMsgMetaData
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgMetaData()
|
||||
{
|
||||
mPublishTs = 0;
|
||||
mMsgFlags = 0;
|
||||
mMsgStatus = 0;
|
||||
mChildTs = 0;
|
||||
}
|
||||
public:
|
||||
|
||||
void operator =(const RsGxsMsgMetaData& rGxsMeta);
|
||||
RsMsgMetaData()
|
||||
{
|
||||
mPublishTs = 0;
|
||||
mMsgFlags = 0;
|
||||
mMsgStatus = 0;
|
||||
mChildTs = 0;
|
||||
}
|
||||
|
||||
void operator =(const RsGxsMsgMetaData& rGxsMeta);
|
||||
|
||||
|
||||
std::string mGroupId;
|
||||
std::string mMsgId;
|
||||
std::string mGroupId;
|
||||
std::string mMsgId;
|
||||
|
||||
std::string mThreadId;
|
||||
std::string mParentId;
|
||||
std::string mOrigMsgId;
|
||||
std::string mThreadId;
|
||||
std::string mParentId;
|
||||
std::string mOrigMsgId;
|
||||
|
||||
std::string mAuthorId;
|
||||
std::string mAuthorId;
|
||||
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
|
||||
uint32_t mMsgFlags; // Whats this for?
|
||||
/// the first 16 bits for service, last 16 for GXS
|
||||
uint32_t mMsgFlags;
|
||||
|
||||
// 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.
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
// normally READ / UNREAD flags. LOCAL Data.
|
||||
|
||||
/// the first 16 bits for service, last 16 for GXS
|
||||
uint32_t mMsgStatus;
|
||||
|
||||
time_t mChildTs;
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
|
||||
};
|
||||
|
||||
|
@ -1445,23 +1445,23 @@ bool p3GxsDataServiceVEG::fakeprocessrequests()
|
||||
|
||||
#if 0 // DISABLED AND MOVED TO GXS CODE.
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta)
|
||||
{
|
||||
out << "[ GroupId: " << meta.mGroupId << " Name: " << meta.mGroupName << " ]";
|
||||
return out;
|
||||
}
|
||||
//std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta)
|
||||
//{
|
||||
// out << "[ GroupId: " << meta.mGroupId << " Name: " << meta.mGroupName << " ]";
|
||||
// return out;
|
||||
//}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta)
|
||||
{
|
||||
out << "[ GroupId: " << meta.mGroupId << " MsgId: " << meta.mMsgId;
|
||||
out << " Name: " << meta.mMsgName;
|
||||
out << " OrigMsgId: " << meta.mOrigMsgId;
|
||||
out << " ThreadId: " << meta.mThreadId;
|
||||
out << " ParentId: " << meta.mParentId;
|
||||
out << " AuthorId: " << meta.mAuthorId;
|
||||
out << " Name: " << meta.mMsgName << " ]";
|
||||
return out;
|
||||
}
|
||||
//std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta)
|
||||
//{
|
||||
// out << "[ GroupId: " << meta.mGroupId << " MsgId: " << meta.mMsgId;
|
||||
// out << " Name: " << meta.mMsgName;
|
||||
// out << " OrigMsgId: " << meta.mOrigMsgId;
|
||||
// out << " ThreadId: " << meta.mThreadId;
|
||||
// out << " ParentId: " << meta.mParentId;
|
||||
// out << " AuthorId: " << meta.mAuthorId;
|
||||
// out << " Name: " << meta.mMsgName << " ]";
|
||||
// return out;
|
||||
//}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -499,7 +499,7 @@ bool p3IdService::cache_start_load()
|
||||
}
|
||||
|
||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token = 0;
|
||||
|
||||
RsGenExchange::getTokenService()->requestGroupInfo(token, ansType, opts, groupIds);
|
||||
@ -971,7 +971,7 @@ bool p3IdService::background_requestGroups()
|
||||
}
|
||||
|
||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
std::list<std::string> groupIds;
|
||||
|
||||
/**
|
||||
@ -1034,7 +1034,7 @@ bool p3IdService::background_requestNewMessages()
|
||||
}
|
||||
|
||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
token = 0;
|
||||
|
||||
/* TODO
|
||||
@ -1319,7 +1319,7 @@ bool p3IdService::background_FullCalcRequest()
|
||||
/* request the summary info from the parents */
|
||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
|
||||
uint32_t token = 0;
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
|
||||
RsGenExchange::getTokenService()->requestMsgInfo(token, ansType, opts, groupIds);
|
||||
|
@ -1,4 +1,11 @@
|
||||
#include "p3posted.h"
|
||||
#include "serialiser/rsposteditems.h"
|
||||
|
||||
const uint32_t RsPosted::FLAG_MSGTYPE_COMMENT = 0x0001;
|
||||
const uint32_t RsPosted::FLAG_MSGTYPE_POST = 0x0002;
|
||||
const uint32_t RsPosted::FLAG_MSGTYPE_VOTE = 0x0004;
|
||||
|
||||
RsPosted *rsPosted = NULL;
|
||||
|
||||
p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes)
|
||||
: RsGenExchange(gds, nes, NULL, RS_SERVICE_GXSV1_TYPE_POSTED), RsPosted(this)
|
||||
@ -10,39 +17,147 @@ void p3Posted::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
receiveChanges(changes);
|
||||
}
|
||||
|
||||
bool p3Posted::getGroup(const uint32_t &token, RsPostedGroup &group)
|
||||
void p3Posted::service_tick()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool p3Posted::getPost(const uint32_t &token, RsPostedPost &post)
|
||||
bool p3Posted::getGroup(const uint32_t &token, std::vector<RsPostedGroup> &groups)
|
||||
{
|
||||
std::vector<RsGxsGrpItem*> grpData;
|
||||
bool ok = RsGenExchange::getGroupData(token, grpData);
|
||||
|
||||
if(ok)
|
||||
{
|
||||
std::vector<RsGxsGrpItem*>::iterator vit = grpData.begin();
|
||||
|
||||
for(; vit != grpData.end(); vit++)
|
||||
{
|
||||
RsGxsPostedGroupItem* item = dynamic_cast<RsGxsPostedGroupItem*>(*vit);
|
||||
RsPostedGroup grp = item->mGroup;
|
||||
item->mGroup.mMeta = item->meta;
|
||||
grp.mMeta = item->mGroup.mMeta;
|
||||
delete item;
|
||||
groups.push_back(grp);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool p3Posted::getComment(const uint32_t &token, RsPostedComment &comment)
|
||||
bool p3Posted::getPost(const uint32_t &token, PostedPostResult &posts)
|
||||
{
|
||||
GxsMsgDataMap msgData;
|
||||
bool ok = RsGenExchange::getMsgData(token, msgData);
|
||||
|
||||
if(ok)
|
||||
{
|
||||
GxsMsgDataMap::iterator mit = msgData.begin();
|
||||
|
||||
for(; mit != msgData.end(); mit++)
|
||||
{
|
||||
RsGxsGroupId grpId = mit->first;
|
||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||
|
||||
for(; vit != msgItems.end(); vit++)
|
||||
{
|
||||
RsGxsPostedPostItem* item = dynamic_cast<RsGxsPostedPostItem*>(*vit);
|
||||
|
||||
if(item)
|
||||
{
|
||||
RsPostedPost post = item->mPost;
|
||||
post.mMeta = item->meta;
|
||||
posts[grpId].push_back(post);
|
||||
delete item;
|
||||
}else
|
||||
{
|
||||
std::cerr << "Not a post Item, deleting!" << std::endl;
|
||||
delete *vit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool p3Posted::getComment(const uint32_t &token, PostedCommentResult &comments)
|
||||
{
|
||||
GxsMsgDataMap msgData;
|
||||
bool ok = RsGenExchange::getMsgData(token, msgData);
|
||||
|
||||
if(ok)
|
||||
{
|
||||
GxsMsgDataMap::iterator mit = msgData.begin();
|
||||
|
||||
for(; mit != msgData.end(); mit++)
|
||||
{
|
||||
RsGxsGroupId grpId = mit->first;
|
||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||
|
||||
for(; vit != msgItems.end(); vit++)
|
||||
{
|
||||
RsGxsPostedCommentItem* item = dynamic_cast<RsGxsPostedCommentItem*>(*vit);
|
||||
|
||||
if(item)
|
||||
{
|
||||
RsPostedComment comment = item->mComment;
|
||||
comment.mMeta = item->meta;
|
||||
comments[grpId].push_back(comment);
|
||||
delete item;
|
||||
}else
|
||||
{
|
||||
std::cerr << "Not a comment Item, deleting!" << std::endl;
|
||||
delete *vit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool p3Posted::submitGroup(uint32_t &token, RsPostedGroup &group)
|
||||
{
|
||||
|
||||
RsGxsPostedGroupItem* grpItem = new RsGxsPostedGroupItem();
|
||||
grpItem->mGroup = group;
|
||||
grpItem->meta = group.mMeta;
|
||||
RsGenExchange::publishGroup(token, grpItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Posted::submitPost(uint32_t &token, RsPostedPost &post)
|
||||
{
|
||||
RsGxsPostedPostItem* postItem = new RsGxsPostedPostItem();
|
||||
postItem->mPost = post;
|
||||
postItem->meta = post.mMeta;
|
||||
postItem->meta.mMsgFlags |= FLAG_MSGTYPE_POST;
|
||||
|
||||
RsGenExchange::publishMsg(token, postItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Posted::submitVote(uint32_t &token, RsPostedVote &vote)
|
||||
{
|
||||
RsGxsPostedVoteItem* voteItem = new RsGxsPostedVoteItem();
|
||||
voteItem->mVote = vote;
|
||||
voteItem->meta = vote.mMeta;
|
||||
voteItem->meta.mMsgFlags |= FLAG_MSGTYPE_POST;
|
||||
|
||||
RsGenExchange::publishMsg(token, voteItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Posted::submitComment(uint32_t &token, RsPostedComment &comment)
|
||||
{
|
||||
RsGxsPostedCommentItem* commentItem = new RsGxsPostedCommentItem();
|
||||
commentItem->mComment = comment;
|
||||
commentItem->meta = comment.mMeta;
|
||||
commentItem->meta.mMsgFlags |= FLAG_MSGTYPE_COMMENT;
|
||||
|
||||
RsGenExchange::publishMsg(token, commentItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Special Ranking Request.
|
||||
@ -50,36 +165,3 @@ bool p3Posted::requestRanking(uint32_t &token, RsGxsGroupId groupId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool p3Posted::getRankedPost(const uint32_t &token, RsPostedPost &post)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool p3Posted::extractPostedCache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Control Ranking Calculations.
|
||||
bool p3Posted::setViewMode(uint32_t mode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool p3Posted::setViewPeriod(uint32_t period)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool p3Posted::setViewRange(uint32_t first, uint32_t count)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// exposed for testing...
|
||||
float p3Posted::calcPostScore(uint32_t& token, const RsGxsMessageId)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -22,11 +22,13 @@ protected:
|
||||
*/
|
||||
void notifyChanges(std::vector<RsGxsNotify*>& changes) ;
|
||||
|
||||
void service_tick();
|
||||
|
||||
public:
|
||||
|
||||
bool getGroup(const uint32_t &token, RsPostedGroup &group);
|
||||
bool getPost(const uint32_t &token, RsPostedPost &post) ;
|
||||
bool getComment(const uint32_t &token, RsPostedComment &comment) ;
|
||||
bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group);
|
||||
bool getPost(const uint32_t &token, PostedPostResult& posts) ;
|
||||
bool getComment(const uint32_t &token, PostedCommentResult& comments) ;
|
||||
|
||||
bool submitGroup(uint32_t &token, RsPostedGroup &group);
|
||||
bool submitPost(uint32_t &token, RsPostedPost &post);
|
||||
@ -35,18 +37,12 @@ public:
|
||||
|
||||
// Special Ranking Request.
|
||||
bool requestRanking(uint32_t &token, RsGxsGroupId groupId) ;
|
||||
bool getRankedPost(const uint32_t &token, RsPostedPost &post) ;
|
||||
|
||||
bool extractPostedCache() ;
|
||||
|
||||
|
||||
// Control Ranking Calculations.
|
||||
bool setViewMode(uint32_t mode);
|
||||
bool setViewPeriod(uint32_t period);
|
||||
bool setViewRange(uint32_t first, uint32_t count);
|
||||
// bool setViewMode(uint32_t mode);
|
||||
// bool setViewPeriod(uint32_t period);
|
||||
// bool setViewRange(uint32_t first, uint32_t count);
|
||||
|
||||
// exposed for testing...
|
||||
float calcPostScore(uint32_t& token, const RsGxsMessageId);
|
||||
};
|
||||
|
||||
#endif // P3POSTED_H
|
||||
|
@ -125,12 +125,12 @@ win32 {
|
||||
|
||||
OBJECTS_DIR = temp/obj
|
||||
|
||||
PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
|
||||
#PRE_TARGETDEPS += ../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
|
||||
#PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
|
||||
PRE_TARGETDEPS += ../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
|
||||
LIBS += ../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
|
||||
|
||||
LIBS += ../../libretroshare/src/lib/libretroshare.a
|
||||
LIBS += ../../openpgpsdk/src/lib/libops.a
|
||||
LIBS += ../../../sqlite-autoconf-3070900/.libs/libsqlite3.a
|
||||
LIBS += C:\Development\Rs\v0.5-gxs-b1\openpgpsdk\openpgpsdk-build-desktop\lib\libops.a
|
||||
LIBS += C:\Development\Libraries\sqlite\sqlite-autoconf-3070900\.libs\libsqlite3.a
|
||||
LIBS += -L"../../../lib"
|
||||
LIBS += -lssl -lcrypto -lpthreadGC2d -lminiupnpc -lz -lbz2
|
||||
# added after bitdht
|
||||
@ -194,15 +194,15 @@ freebsd-* {
|
||||
# ###########################################
|
||||
|
||||
bitdht {
|
||||
LIBS += ../../libbitdht/src/lib/libbitdht.a
|
||||
PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
||||
#LIBS += ../../libbitdht/src/lib/libbitdht.a
|
||||
#PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
||||
|
||||
#LIBS += C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||
#PRE_TARGETDEPS *= C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||
|
||||
# Chris version.
|
||||
#LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
#PRE_TARGETDEPS *= ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
PRE_TARGETDEPS *= ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
}
|
||||
|
||||
win32 {
|
||||
@ -871,7 +871,7 @@ photoshare {
|
||||
gui/PhotoShare/AlbumItem.h \
|
||||
gui/PhotoShare/AlbumDialog.h \
|
||||
gui/PhotoShare/AlbumCreateDialog.h \
|
||||
util/TokenQueueV2.h \
|
||||
util/TokenQueue.h \
|
||||
gui/PhotoShare/PhotoItem.h \
|
||||
gui/PhotoShare/PhotoShareItemHolder.h \
|
||||
gui/PhotoShare/PhotoShare.h \
|
||||
@ -898,7 +898,7 @@ photoshare {
|
||||
gui/PhotoShare/AlbumItem.cpp \
|
||||
gui/PhotoShare/AlbumDialog.cpp \
|
||||
gui/PhotoShare/AlbumCreateDialog.cpp \
|
||||
util/TokenQueueV2.cpp \
|
||||
util/TokenQueue.cpp \
|
||||
gui/PhotoShare/PhotoShareItemHolder.cpp \
|
||||
gui/PhotoShare/PhotoShare.cpp \
|
||||
gui/PhotoShare/PhotoSlideShow.cpp \
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "util/misc.h"
|
||||
|
||||
AlbumCreateDialog::AlbumCreateDialog(TokenQueueV2 *photoQueue, RsPhotoV2 *rs_photo, QWidget *parent):
|
||||
AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhotoV2 *rs_photo, QWidget *parent):
|
||||
QDialog(parent),
|
||||
ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define ALBUMCREATEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "util/TokenQueueV2.h"
|
||||
#include "util/TokenQueue.h"
|
||||
#include "retroshare/rsphotoV2.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -15,7 +15,7 @@ class AlbumCreateDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlbumCreateDialog(TokenQueueV2* photoQueue, RsPhotoV2* rs_photo, QWidget *parent = 0);
|
||||
explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhotoV2* rs_photo, QWidget *parent = 0);
|
||||
~AlbumCreateDialog();
|
||||
|
||||
private slots:
|
||||
@ -28,7 +28,7 @@ private:
|
||||
private:
|
||||
Ui::AlbumCreateDialog *ui;
|
||||
|
||||
TokenQueueV2* mPhotoQueue;
|
||||
TokenQueue* mPhotoQueue;
|
||||
RsPhotoV2* mRsPhoto;
|
||||
QPixmap mThumbNail;
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "AlbumDialog.h"
|
||||
#include "ui_AlbumDialog.h"
|
||||
|
||||
AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueueV2* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) :
|
||||
AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::AlbumDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_Photo), mAlbum(album), mPhotoSelected(NULL)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "retroshare/rsphotoV2.h"
|
||||
#include "util/TokenQueueV2.h"
|
||||
#include "util/TokenQueue.h"
|
||||
#include "PhotoShareItemHolder.h"
|
||||
#include "PhotoItem.h"
|
||||
#include "PhotoDrop.h"
|
||||
@ -17,7 +17,7 @@ class AlbumDialog : public QWidget, public PhotoShareItemHolder
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlbumDialog(const RsPhotoAlbum& album, TokenQueueV2* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent = 0);
|
||||
explicit AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent = 0);
|
||||
~AlbumDialog();
|
||||
|
||||
void notifySelection(PhotoShareItem* selection);
|
||||
@ -34,7 +34,7 @@ private slots:
|
||||
private:
|
||||
Ui::AlbumDialog *ui;
|
||||
RsPhotoV2* mRsPhoto;
|
||||
TokenQueueV2* mPhotoQueue;
|
||||
TokenQueue* mPhotoQueue;
|
||||
RsPhotoAlbum mAlbum;
|
||||
PhotoDrop* mPhotoDrop;
|
||||
PhotoItem* mPhotoSelected;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueueV2(mRsPhoto->getTokenService(), this)),
|
||||
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)),
|
||||
mPhotoDetails(photo), mCommentDialog(NULL)
|
||||
|
||||
{
|
||||
@ -75,7 +75,7 @@ void PhotoDialog::resetComments()
|
||||
|
||||
void PhotoDialog::requestComments()
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mMsgFlagMask = RsPhotoV2::FLAG_MSG_TYPE_MASK;
|
||||
opts.mMsgFlagFilter = RsPhotoV2::FLAG_MSG_TYPE_PHOTO_COMMENT;
|
||||
|
||||
@ -107,7 +107,7 @@ void PhotoDialog::createComment()
|
||||
|
||||
/*************** message loading **********************/
|
||||
|
||||
void PhotoDialog::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req)
|
||||
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "PhotoShare::loadRequest()";
|
||||
std::cerr << std::endl;
|
||||
@ -177,7 +177,7 @@ void PhotoDialog::loadList(uint32_t token)
|
||||
{
|
||||
GxsMsgReq msgIds;
|
||||
mRsPhoto->getMsgList(token, msgIds);
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
|
||||
// just use data as no need to worry about getting comments
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QDialog>
|
||||
#include <QSet>
|
||||
#include "retroshare/rsphotoV2.h"
|
||||
#include "util/TokenQueueV2.h"
|
||||
#include "util/TokenQueue.h"
|
||||
#include "PhotoCommentItem.h"
|
||||
#include "AddCommentDialog.h"
|
||||
|
||||
@ -12,7 +12,7 @@ namespace Ui {
|
||||
class PhotoDialog;
|
||||
}
|
||||
|
||||
class PhotoDialog : public QDialog, public TokenResponseV2
|
||||
class PhotoDialog : public QDialog, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -26,7 +26,7 @@ private slots:
|
||||
void createComment();
|
||||
|
||||
public:
|
||||
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
private:
|
||||
void setUp();
|
||||
|
||||
@ -54,7 +54,7 @@ private:
|
||||
Ui::PhotoDialog *ui;
|
||||
|
||||
RsPhotoV2* mRsPhoto;
|
||||
TokenQueueV2* mPhotoQueue;
|
||||
TokenQueue* mPhotoQueue;
|
||||
RsPhotoPhoto mPhotoDetails;
|
||||
QSet<PhotoCommentItem*> mComments;
|
||||
AddCommentDialog* mCommentDialog;
|
||||
|
@ -96,7 +96,7 @@ PhotoShare::PhotoShare(QWidget *parent)
|
||||
timer->start(1000);
|
||||
|
||||
/* setup TokenQueue */
|
||||
mPhotoQueue = new TokenQueueV2(rsPhotoV2->getTokenService(), this);
|
||||
mPhotoQueue = new TokenQueue(rsPhotoV2->getTokenService(), this);
|
||||
requestAlbumData();
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ void PhotoShare::checkUpdate()
|
||||
rsPhotoV2->groupsChanged(grpIds);
|
||||
if(!grpIds.empty())
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
||||
@ -490,7 +490,7 @@ void PhotoShare::updatePhotos()
|
||||
|
||||
void PhotoShare::requestAlbumList(std::list<std::string>& ids)
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||
@ -498,7 +498,7 @@ void PhotoShare::requestAlbumList(std::list<std::string>& ids)
|
||||
|
||||
void PhotoShare::requestPhotoList(GxsMsgReq& req)
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
|
||||
@ -526,7 +526,7 @@ void PhotoShare::loadAlbumList(const uint32_t &token)
|
||||
|
||||
void PhotoShare::requestAlbumData(std::list<RsGxsGroupId> &ids)
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||
@ -534,7 +534,7 @@ void PhotoShare::requestAlbumData(std::list<RsGxsGroupId> &ids)
|
||||
|
||||
void PhotoShare::requestAlbumData()
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, 0);
|
||||
@ -569,7 +569,7 @@ void PhotoShare::requestPhotoList(const std::string &albumId)
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
grpIds.push_back(albumId);
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
@ -587,7 +587,7 @@ void PhotoShare::acknowledgeGroup(const uint32_t &token)
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
grpIds.push_back(grpId);
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
uint32_t reqToken;
|
||||
mPhotoQueue->requestGroupInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
||||
@ -630,7 +630,7 @@ void PhotoShare::loadPhotoList(const uint32_t &token)
|
||||
|
||||
void PhotoShare::requestPhotoData(GxsMsgReq &photoIds)
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
||||
@ -638,7 +638,7 @@ void PhotoShare::requestPhotoData(GxsMsgReq &photoIds)
|
||||
|
||||
void PhotoShare::requestPhotoData(const std::list<RsGxsGroupId>& grpIds)
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
||||
@ -677,7 +677,7 @@ void PhotoShare::loadPhotoData(const uint32_t &token)
|
||||
|
||||
/**************************** Request / Response Filling of Data ************************/
|
||||
|
||||
void PhotoShare::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req)
|
||||
void PhotoShare::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "PhotoShare::loadRequest()";
|
||||
std::cerr << std::endl;
|
||||
|
@ -16,14 +16,14 @@
|
||||
#include "PhotoItem.h"
|
||||
#include "PhotoSlideShow.h"
|
||||
|
||||
#include "util/TokenQueueV2.h"
|
||||
#include "util/TokenQueue.h"
|
||||
#include "PhotoShareItemHolder.h"
|
||||
|
||||
namespace Ui {
|
||||
class PhotoShare;
|
||||
}
|
||||
|
||||
class PhotoShare : public MainPage, public TokenResponseV2, public PhotoShareItemHolder
|
||||
class PhotoShare : public MainPage, public TokenResponse, public PhotoShareItemHolder
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -64,7 +64,7 @@ private:
|
||||
void loadPhotoList(const uint32_t &token);
|
||||
void loadPhotoData(const uint32_t &token);
|
||||
|
||||
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
void acknowledgeGroup(const uint32_t &token);
|
||||
void acknowledgeMessage(const uint32_t &token);
|
||||
@ -91,7 +91,7 @@ private:
|
||||
AlbumDialog* mAlbumDialog;
|
||||
PhotoDialog* mPhotoDialog;
|
||||
|
||||
TokenQueueV2 *mPhotoQueue;
|
||||
TokenQueue *mPhotoQueue;
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::PhotoShare ui;
|
||||
|
@ -38,7 +38,7 @@ PhotoSlideShow::PhotoSlideShow(const RsPhotoAlbum& album, QWidget *parent)
|
||||
connect(ui.pushButton_StartStop, SIGNAL( clicked( void ) ), this, SLOT( StartStop( void ) ) );
|
||||
connect(ui.pushButton_Close, SIGNAL( clicked( void ) ), this, SLOT( closeShow( void ) ) );
|
||||
|
||||
mPhotoQueue = new TokenQueueV2(rsPhotoV2->getTokenService(), this);
|
||||
mPhotoQueue = new TokenQueue(rsPhotoV2->getTokenService(), this);
|
||||
|
||||
mRunning = true;
|
||||
mShotActive = true;
|
||||
@ -215,37 +215,9 @@ void PhotoSlideShow::updateMoveButtons(uint32_t status)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void PhotoSlideShow::clearDialog()
|
||||
{
|
||||
#if 0
|
||||
ui.lineEdit_Title->setText(QString("title"));
|
||||
ui.lineEdit_Caption->setText(QString("Caption"));
|
||||
ui.lineEdit_Where->setText(QString("Where"));
|
||||
ui.lineEdit_When->setText(QString("When"));
|
||||
|
||||
ui.scrollAreaWidgetContents->clearPhotos();
|
||||
ui.AlbumDrop->clearPhotos();
|
||||
|
||||
/* clean up album image */
|
||||
mAlbumData.mThumbnail.deleteImage();
|
||||
|
||||
RsPhotoAlbum emptyAlbum;
|
||||
mAlbumData = emptyAlbum;
|
||||
|
||||
/* add empty image */
|
||||
PhotoItem *item = new PhotoItem(NULL, mAlbumData);
|
||||
ui.AlbumDrop->addPhotoItem(item);
|
||||
|
||||
mAlbumEdit = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PhotoSlideShow::requestPhotos()
|
||||
{
|
||||
RsTokReqOptionsV2 opts;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
uint32_t token;
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
@ -294,7 +266,7 @@ bool PhotoSlideShow::loadPhotoData(const uint32_t &token)
|
||||
return true;
|
||||
}
|
||||
|
||||
void PhotoSlideShow::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req)
|
||||
void PhotoSlideShow::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "PhotoSlideShow::loadRequest()";
|
||||
std::cerr << std::endl;
|
||||
|
@ -27,10 +27,10 @@
|
||||
#include "ui_PhotoSlideShow.h"
|
||||
|
||||
#include <retroshare/rsphotoV2.h>
|
||||
#include "util/TokenQueueV2.h"
|
||||
#include "util/TokenQueue.h"
|
||||
#include "AlbumItem.h"
|
||||
|
||||
class PhotoSlideShow : public QWidget, public TokenResponseV2
|
||||
class PhotoSlideShow : public QWidget, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -38,9 +38,7 @@ public:
|
||||
PhotoSlideShow(const RsPhotoAlbum& mAlbum, QWidget *parent = 0);
|
||||
virtual ~PhotoSlideShow();
|
||||
|
||||
void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req);
|
||||
|
||||
void clearDialog();
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
private slots:
|
||||
void showPhotoDetails();
|
||||
@ -70,7 +68,7 @@ private:
|
||||
|
||||
RsPhotoAlbum mAlbum;
|
||||
|
||||
TokenQueueV2 *mPhotoQueue;
|
||||
TokenQueue *mPhotoQueue;
|
||||
|
||||
Ui::PhotoSlideShow ui;
|
||||
};
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
#include "PostedComments.h"
|
||||
|
||||
//#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@ -64,26 +63,10 @@ PostedComments::PostedComments(QWidget *parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
#if 0
|
||||
mAddDialog = NULL;
|
||||
mAlbumSelected = NULL;
|
||||
mPhotoSelected = NULL;
|
||||
mSlideShow = NULL;
|
||||
|
||||
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(OpenOrShowPhotoAddDialog()));
|
||||
connect( ui.toolButton_EditAlbum, SIGNAL(clicked()), this, SLOT(OpenPhotoEditDialog()));
|
||||
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||
timer->start(1000);
|
||||
|
||||
#endif
|
||||
|
||||
/* setup TokenQueue */
|
||||
//mPhotoQueue = new TokenQueue(rsPhoto, this);
|
||||
|
||||
ui.treeWidget->setup(rsPostedVEG);
|
||||
ui.treeWidget->setup(rsPosted->getTokenService());
|
||||
|
||||
}
|
||||
|
||||
@ -96,543 +79,3 @@ void PostedComments::loadComments( std::string threadId )
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
void PhotoDialog::notifySelection(PhotoItem *item, int ptype)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifySelection() from : " << ptype << " " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
switch(ptype)
|
||||
{
|
||||
default:
|
||||
case PHOTO_ITEM_TYPE_ALBUM:
|
||||
notifyAlbumSelection(item);
|
||||
break;
|
||||
case PHOTO_ITEM_TYPE_PHOTO:
|
||||
notifyPhotoSelection(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PhotoDialog::notifyAlbumSelection(PhotoItem *item)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifyAlbumSelection() from : " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mAlbumSelected)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifyAlbumSelection() unselecting old one : " << mAlbumSelected;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mAlbumSelected->setSelected(false);
|
||||
}
|
||||
|
||||
mAlbumSelected = item;
|
||||
insertPhotosForSelectedAlbum();
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::notifyPhotoSelection(PhotoItem *item)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifyPhotoSelection() from : " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mPhotoSelected)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifyPhotoSelection() unselecting old one : " << mPhotoSelected;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mPhotoSelected->setSelected(false);
|
||||
}
|
||||
|
||||
mPhotoSelected = item;
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::checkUpdate()
|
||||
{
|
||||
/* update */
|
||||
if (!rsPhoto)
|
||||
return;
|
||||
|
||||
if (rsPhoto->updated())
|
||||
{
|
||||
//insertAlbums();
|
||||
requestAlbumList();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*************** New Photo Dialog ***************/
|
||||
|
||||
void PhotoDialog::OpenSlideShow()
|
||||
{
|
||||
|
||||
// TODO.
|
||||
if (!mAlbumSelected)
|
||||
{
|
||||
// ALERT.
|
||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
||||
tr("Please select an album before\n"
|
||||
"requesting to edit it!"),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAlbumSelected->mIsPhoto)
|
||||
{
|
||||
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||
|
||||
if (mSlideShow)
|
||||
{
|
||||
mSlideShow->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
mSlideShow = new PhotoSlideShow(NULL);
|
||||
mSlideShow->show();
|
||||
}
|
||||
mSlideShow->loadAlbum(albumId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*************** New Photo Dialog ***************/
|
||||
|
||||
void PhotoDialog::OpenOrShowPhotoAddDialog()
|
||||
{
|
||||
if (mAddDialog)
|
||||
{
|
||||
mAddDialog->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
mAddDialog = new PhotoAddDialog(NULL);
|
||||
mAddDialog->show();
|
||||
}
|
||||
mAddDialog->clearDialog();
|
||||
}
|
||||
|
||||
|
||||
/*************** Edit Photo Dialog ***************/
|
||||
|
||||
void PhotoDialog::OpenPhotoEditDialog()
|
||||
{
|
||||
/* check if we have an album selected */
|
||||
// THE TWO MessageBoxes - should be handled by disabling the Button!.
|
||||
// TODO.
|
||||
if (!mAlbumSelected)
|
||||
{
|
||||
// ALERT.
|
||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
||||
tr("Please select an album before\n"
|
||||
"requesting to edit it!"),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAlbumSelected->mIsPhoto)
|
||||
{
|
||||
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||
#if 0
|
||||
uint32_t flags = mAlbumSelected->mAlbumDetails.mMeta.mGroupFlags;
|
||||
|
||||
if (!(flags & OWN))
|
||||
{
|
||||
// ALERT.
|
||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
||||
tr("Cannot Edit Someone Else's Album"),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
OpenOrShowPhotoAddDialog();
|
||||
mAddDialog->loadAlbum(albumId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool PhotoDialog::matchesAlbumFilter(const RsPhotoAlbum &album)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
double PhotoDialog::AlbumScore(const RsPhotoAlbum &album)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
bool PhotoDialog::matchesPhotoFilter(const RsPhotoPhoto &photo)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
double PhotoDialog::PhotoScore(const RsPhotoPhoto &photo)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void PhotoDialog::insertPhotosForSelectedAlbum()
|
||||
{
|
||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
clearPhotos();
|
||||
|
||||
//std::list<std::string> albumIds;
|
||||
if (mAlbumSelected)
|
||||
{
|
||||
if (mAlbumSelected->mIsPhoto)
|
||||
{
|
||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() MAJOR ERROR!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||
//albumIds.push_back(albumId);
|
||||
|
||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() AlbumId: " << albumId;
|
||||
std::cerr << std::endl;
|
||||
requestPhotoList(albumId);
|
||||
}
|
||||
//requestPhotoList(albumIds);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::clearAlbums()
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearAlbums()" << std::endl;
|
||||
|
||||
std::list<PhotoItem *> photoItems;
|
||||
std::list<PhotoItem *>::iterator pit;
|
||||
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
int count = alayout->count();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QLayoutItem *litem = alayout->itemAt(i);
|
||||
if (!litem)
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearAlbums() missing litem";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearAlbums() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
photoItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearAlbums() Found Child, which is not a PhotoItem???";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
||||
{
|
||||
PhotoItem *item = *pit;
|
||||
alayout->removeWidget(item);
|
||||
delete item;
|
||||
}
|
||||
mAlbumSelected = NULL;
|
||||
|
||||
}
|
||||
|
||||
void PhotoDialog::clearPhotos()
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
|
||||
|
||||
std::list<PhotoItem *> photoItems;
|
||||
std::list<PhotoItem *>::iterator pit;
|
||||
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
||||
int count = alayout->count();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QLayoutItem *litem = alayout->itemAt(i);
|
||||
if (!litem)
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearPhotos() missing litem";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearPhotos() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
photoItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearPhotos() Found Child, which is not a PhotoItem???";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
||||
{
|
||||
PhotoItem *item = *pit;
|
||||
alayout->removeWidget(item);
|
||||
delete item;
|
||||
}
|
||||
|
||||
mPhotoSelected = NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PhotoDialog::addAlbum(const RsPhotoAlbum &album)
|
||||
{
|
||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
|
||||
PhotoItem *item = new PhotoItem(this, album);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
alayout->addWidget(item);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::addPhoto(const RsPhotoPhoto &photo)
|
||||
{
|
||||
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsPhotoAlbum dummyAlbum;
|
||||
dummyAlbum.mSetFlags = 0;
|
||||
|
||||
PhotoItem *item = new PhotoItem(this, photo, dummyAlbum);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
||||
alayout->addWidget(item);
|
||||
|
||||
}
|
||||
|
||||
void PhotoDialog::deletePhotoItem(PhotoItem *item, uint32_t type)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**************************** Request / Response Filling of Data ************************/
|
||||
|
||||
|
||||
void PhotoDialog::requestAlbumList()
|
||||
{
|
||||
|
||||
std::list<std::string> ids;
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::loadAlbumList(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadAlbumList()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> albumIds;
|
||||
rsPhoto->getGroupList(token, albumIds);
|
||||
|
||||
requestAlbumData(albumIds);
|
||||
|
||||
clearPhotos();
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = albumIds.begin(); it != albumIds.end(); it++)
|
||||
{
|
||||
requestPhotoList(*it);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::requestAlbumData(const std::list<std::string> &ids)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||
}
|
||||
|
||||
|
||||
bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadAlbumData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
clearAlbums();
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPhotoAlbum album;
|
||||
if (rsPhoto->getAlbum(token, album))
|
||||
{
|
||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
|
||||
PhotoItem *item = new PhotoItem(this, album);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
alayout->addWidget(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
||||
{
|
||||
|
||||
std::list<std::string> ids;
|
||||
ids.push_back(albumId);
|
||||
RsTokReqOptions opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void PhotoDialog::loadPhotoList(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadPhotoList()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
std::list<std::string> photoIds;
|
||||
|
||||
rsPhoto->getMsgList(token, photoIds);
|
||||
requestPhotoData(photoIds);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::requestPhotoData(const std::list<std::string> &photoIds)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::loadPhotoData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadPhotoData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPhotoPhoto photo;
|
||||
|
||||
if (rsPhoto->getPhoto(token, photo))
|
||||
{
|
||||
|
||||
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
addPhoto(photo);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************************/
|
||||
|
||||
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequestVEG &req)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadRequest()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (queue == mPhotoQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
switch(req.mType)
|
||||
{
|
||||
case TOKENREQ_GROUPINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_LIST:
|
||||
loadAlbumList(req.mToken);
|
||||
break;
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadAlbumData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TOKENREQ_MSGINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_LIST:
|
||||
loadPhotoList(req.mToken);
|
||||
break;
|
||||
//case RS_TOKREQ_ANSTYPE_DATA:
|
||||
// loadPhotoData(req.mToken);
|
||||
// break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TOKENREQ_MSGRELATEDINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadPhotoData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
//#include "gui/mainpage.h"
|
||||
#include "ui_PostedComments.h"
|
||||
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "PostedListDialog.h"
|
||||
#include "PostedComments.h"
|
||||
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@ -40,21 +40,8 @@
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* New Photo Display Widget.
|
||||
* Posted Dialog
|
||||
*
|
||||
* This has two 'lists'.
|
||||
* Top list shows Albums.
|
||||
* Lower list is photos from the selected Album.
|
||||
*
|
||||
* Notes:
|
||||
* Each Item will be an AlbumItem, which contains a thumbnail & random details.
|
||||
* We will limit Items to < 100. With a 'Filter to see more message.
|
||||
*
|
||||
* Thumbnails will come from Service.
|
||||
* Option to Share albums / pictures onward (if permissions allow).
|
||||
* Option to Download the albums to a specified directory. (is this required if sharing an album?)
|
||||
*
|
||||
* Will introduce a FullScreen SlideShow later... first get basics happening.
|
||||
*/
|
||||
|
||||
PostedDialog::PostedDialog(QWidget *parent)
|
||||
@ -74,587 +61,6 @@ PostedDialog::PostedDialog(QWidget *parent)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
|
||||
|
||||
/** Constructor */
|
||||
PhotoDialog::PhotoDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
mAddDialog = NULL;
|
||||
mAlbumSelected = NULL;
|
||||
mPhotoSelected = NULL;
|
||||
mSlideShow = NULL;
|
||||
|
||||
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(OpenOrShowPhotoAddDialog()));
|
||||
connect( ui.toolButton_EditAlbum, SIGNAL(clicked()), this, SLOT(OpenPhotoEditDialog()));
|
||||
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||
timer->start(1000);
|
||||
|
||||
|
||||
/* setup TokenQueue */
|
||||
mPhotoQueue = new TokenQueue(rsPhoto, this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::notifySelection(PhotoItem *item, int ptype)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifySelection() from : " << ptype << " " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
switch(ptype)
|
||||
{
|
||||
default:
|
||||
case PHOTO_ITEM_TYPE_ALBUM:
|
||||
notifyAlbumSelection(item);
|
||||
break;
|
||||
case PHOTO_ITEM_TYPE_PHOTO:
|
||||
notifyPhotoSelection(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PhotoDialog::notifyAlbumSelection(PhotoItem *item)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifyAlbumSelection() from : " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mAlbumSelected)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifyAlbumSelection() unselecting old one : " << mAlbumSelected;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mAlbumSelected->setSelected(false);
|
||||
}
|
||||
|
||||
mAlbumSelected = item;
|
||||
insertPhotosForSelectedAlbum();
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::notifyPhotoSelection(PhotoItem *item)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifyPhotoSelection() from : " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mPhotoSelected)
|
||||
{
|
||||
std::cerr << "PhotoDialog::notifyPhotoSelection() unselecting old one : " << mPhotoSelected;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mPhotoSelected->setSelected(false);
|
||||
}
|
||||
|
||||
mPhotoSelected = item;
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::checkUpdate()
|
||||
{
|
||||
/* update */
|
||||
if (!rsPhoto)
|
||||
return;
|
||||
|
||||
if (rsPhoto->updated())
|
||||
{
|
||||
//insertAlbums();
|
||||
requestAlbumList();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*************** New Photo Dialog ***************/
|
||||
|
||||
void PhotoDialog::OpenSlideShow()
|
||||
{
|
||||
|
||||
// TODO.
|
||||
if (!mAlbumSelected)
|
||||
{
|
||||
// ALERT.
|
||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
||||
tr("Please select an album before\n"
|
||||
"requesting to edit it!"),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAlbumSelected->mIsPhoto)
|
||||
{
|
||||
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||
|
||||
if (mSlideShow)
|
||||
{
|
||||
mSlideShow->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
mSlideShow = new PhotoSlideShow(NULL);
|
||||
mSlideShow->show();
|
||||
}
|
||||
mSlideShow->loadAlbum(albumId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*************** New Photo Dialog ***************/
|
||||
|
||||
void PhotoDialog::OpenOrShowPhotoAddDialog()
|
||||
{
|
||||
if (mAddDialog)
|
||||
{
|
||||
mAddDialog->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
mAddDialog = new PhotoAddDialog(NULL);
|
||||
mAddDialog->show();
|
||||
}
|
||||
mAddDialog->clearDialog();
|
||||
}
|
||||
|
||||
|
||||
/*************** Edit Photo Dialog ***************/
|
||||
|
||||
void PhotoDialog::OpenPhotoEditDialog()
|
||||
{
|
||||
/* check if we have an album selected */
|
||||
// THE TWO MessageBoxes - should be handled by disabling the Button!.
|
||||
// TODO.
|
||||
if (!mAlbumSelected)
|
||||
{
|
||||
// ALERT.
|
||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
||||
tr("Please select an album before\n"
|
||||
"requesting to edit it!"),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAlbumSelected->mIsPhoto)
|
||||
{
|
||||
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||
#if 0
|
||||
uint32_t flags = mAlbumSelected->mAlbumDetails.mMeta.mGroupFlags;
|
||||
|
||||
if (!(flags & OWN))
|
||||
{
|
||||
// ALERT.
|
||||
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
||||
tr("Cannot Edit Someone Else's Album"),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
OpenOrShowPhotoAddDialog();
|
||||
mAddDialog->loadAlbum(albumId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool PhotoDialog::matchesAlbumFilter(const RsPhotoAlbum &album)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
double PhotoDialog::AlbumScore(const RsPhotoAlbum &album)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
bool PhotoDialog::matchesPhotoFilter(const RsPhotoPhoto &photo)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
double PhotoDialog::PhotoScore(const RsPhotoPhoto &photo)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void PhotoDialog::insertPhotosForSelectedAlbum()
|
||||
{
|
||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
clearPhotos();
|
||||
|
||||
//std::list<std::string> albumIds;
|
||||
if (mAlbumSelected)
|
||||
{
|
||||
if (mAlbumSelected->mIsPhoto)
|
||||
{
|
||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() MAJOR ERROR!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||
//albumIds.push_back(albumId);
|
||||
|
||||
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() AlbumId: " << albumId;
|
||||
std::cerr << std::endl;
|
||||
requestPhotoList(albumId);
|
||||
}
|
||||
//requestPhotoList(albumIds);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::clearAlbums()
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearAlbums()" << std::endl;
|
||||
|
||||
std::list<PhotoItem *> photoItems;
|
||||
std::list<PhotoItem *>::iterator pit;
|
||||
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
int count = alayout->count();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QLayoutItem *litem = alayout->itemAt(i);
|
||||
if (!litem)
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearAlbums() missing litem";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearAlbums() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
photoItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearAlbums() Found Child, which is not a PhotoItem???";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
||||
{
|
||||
PhotoItem *item = *pit;
|
||||
alayout->removeWidget(item);
|
||||
delete item;
|
||||
}
|
||||
mAlbumSelected = NULL;
|
||||
|
||||
}
|
||||
|
||||
void PhotoDialog::clearPhotos()
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
|
||||
|
||||
std::list<PhotoItem *> photoItems;
|
||||
std::list<PhotoItem *>::iterator pit;
|
||||
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
||||
int count = alayout->count();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QLayoutItem *litem = alayout->itemAt(i);
|
||||
if (!litem)
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearPhotos() missing litem";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearPhotos() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
photoItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PhotoDialog::clearPhotos() Found Child, which is not a PhotoItem???";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
||||
{
|
||||
PhotoItem *item = *pit;
|
||||
alayout->removeWidget(item);
|
||||
delete item;
|
||||
}
|
||||
|
||||
mPhotoSelected = NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PhotoDialog::addAlbum(const RsPhotoAlbum &album)
|
||||
{
|
||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
|
||||
PhotoItem *item = new PhotoItem(this, album);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
alayout->addWidget(item);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::addPhoto(const RsPhotoPhoto &photo)
|
||||
{
|
||||
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsPhotoAlbum dummyAlbum;
|
||||
dummyAlbum.mSetFlags = 0;
|
||||
|
||||
PhotoItem *item = new PhotoItem(this, photo, dummyAlbum);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
||||
alayout->addWidget(item);
|
||||
|
||||
}
|
||||
|
||||
void PhotoDialog::deletePhotoItem(PhotoItem *item, uint32_t type)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**************************** Request / Response Filling of Data ************************/
|
||||
|
||||
|
||||
void PhotoDialog::requestAlbumList()
|
||||
{
|
||||
|
||||
std::list<std::string> ids;
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::loadAlbumList(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadAlbumList()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> albumIds;
|
||||
rsPhoto->getGroupList(token, albumIds);
|
||||
|
||||
requestAlbumData(albumIds);
|
||||
|
||||
clearPhotos();
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = albumIds.begin(); it != albumIds.end(); it++)
|
||||
{
|
||||
requestPhotoList(*it);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::requestAlbumData(const std::list<std::string> &ids)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||
}
|
||||
|
||||
|
||||
bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadAlbumData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
clearAlbums();
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPhotoAlbum album;
|
||||
if (rsPhoto->getAlbum(token, album))
|
||||
{
|
||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
|
||||
PhotoItem *item = new PhotoItem(this, album);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
alayout->addWidget(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
||||
{
|
||||
|
||||
std::list<std::string> ids;
|
||||
ids.push_back(albumId);
|
||||
RsTokReqOptions opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void PhotoDialog::loadPhotoList(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadPhotoList()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
std::list<std::string> photoIds;
|
||||
|
||||
rsPhoto->getMsgList(token, photoIds);
|
||||
requestPhotoData(photoIds);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::requestPhotoData(const std::list<std::string> &photoIds)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::loadPhotoData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadPhotoData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPhotoPhoto photo;
|
||||
|
||||
if (rsPhoto->getPhoto(token, photo))
|
||||
{
|
||||
|
||||
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
addPhoto(photo);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************************/
|
||||
|
||||
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "PhotoDialog::loadRequest()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (queue == mPhotoQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
switch(req.mType)
|
||||
{
|
||||
case TOKENREQ_GROUPINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_LIST:
|
||||
loadAlbumList(req.mToken);
|
||||
break;
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadAlbumData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TOKENREQ_MSGINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_LIST:
|
||||
loadPhotoList(req.mToken);
|
||||
break;
|
||||
//case RS_TOKREQ_ANSTYPE_DATA:
|
||||
// loadPhotoData(req.mToken);
|
||||
// break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TOKENREQ_MSGRELATEDINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadPhotoData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PhotoDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************** Request / Response Filling of Data ************************/
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "retroshare-gui/mainpage.h"
|
||||
#include "ui_PostedDialog.h"
|
||||
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "PostedItem.h"
|
||||
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
@ -53,7 +53,7 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
|
||||
//scoreLabel->setText(QString("1140"));
|
||||
|
||||
// exposed for testing...
|
||||
float score = rsPostedVEG->calcPostScore(post.mMeta);
|
||||
float score = 0;
|
||||
time_t now = time(NULL);
|
||||
|
||||
QString fromLabelTxt = QString(" Age: ") + QString::number(now - post.mMeta.mPublishTs);
|
||||
@ -62,7 +62,7 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
|
||||
|
||||
uint32_t votes = 0;
|
||||
uint32_t comments = 0;
|
||||
rsPostedVEG->extractPostedCache(post.mMeta.mServiceString, votes, comments);
|
||||
//rsPosted->extractPostedCache(post.mMeta.mServiceString, votes, comments);
|
||||
scoreLabel->setText(QString::number(votes));
|
||||
QString commentLabel = QString("Comments: ") + QString::number(comments);
|
||||
commentLabel += QString(" Votes: ") + QString::number(votes);
|
||||
@ -87,247 +87,3 @@ void PostedItem::loadComments()
|
||||
std::cerr << std::endl;
|
||||
mParent->requestComments(mThreadId);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
PhotoItem::PhotoItem(PhotoHolder *parent, const RsPhotoAlbum &album)
|
||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_ALBUM)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
mIsPhoto = false;
|
||||
setDummyText();
|
||||
updateAlbumText(album); // saves: mAlbumDetails = album;
|
||||
updateImage(album.mThumbnail);
|
||||
|
||||
setSelected(false);
|
||||
}
|
||||
|
||||
|
||||
PhotoItem::PhotoItem(PhotoHolder *parent, const RsPhotoPhoto &photo, const RsPhotoAlbum &album)
|
||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_PHOTO)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
mIsPhoto = true;
|
||||
|
||||
setDummyText();
|
||||
updatePhotoText(photo); // saves: mPhotoDetails = photo;
|
||||
updateAlbumText(album); // saves: mAlbumDetails = album;
|
||||
|
||||
updateImage(photo.mThumbnail);
|
||||
|
||||
setSelected(false);
|
||||
}
|
||||
|
||||
|
||||
PhotoItem::PhotoItem(PhotoHolder *parent, std::string path) // for new photos.
|
||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_NEW)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
setDummyText();
|
||||
mIsPhoto = true;
|
||||
|
||||
int width = 120;
|
||||
int height = 120;
|
||||
|
||||
//QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
imgLabel->setPixmap(qtn);
|
||||
setSelected(false);
|
||||
}
|
||||
|
||||
void PhotoItem::updateParent(PhotoHolder *parent) // for external construction.
|
||||
{
|
||||
mParent = parent;
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::setDummyText()
|
||||
{
|
||||
titleLabel->setText(QString("Unknown"));
|
||||
fromBoldLabel->setText(QString("By:"));
|
||||
fromLabel->setText(QString("Unknown"));
|
||||
statusBoldLabel->setText(QString("Where:"));
|
||||
statusLabel->setText(QString("Unknown"));
|
||||
dateBoldLabel->setText(QString("When:"));
|
||||
dateLabel->setText(QString("Unknown"));
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::updateAlbumText(const RsPhotoAlbum &album)
|
||||
{
|
||||
mAlbumDetails = album;
|
||||
mAlbumDetails.mThumbnail.data = 0;
|
||||
updateText();
|
||||
}
|
||||
|
||||
void PhotoItem::updatePhotoText(const RsPhotoPhoto &photo)
|
||||
{
|
||||
// Save new Photo details.
|
||||
mPhotoDetails = photo;
|
||||
mPhotoDetails.mThumbnail.data = 0;
|
||||
updateText();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PhotoItem::updateText()
|
||||
{
|
||||
// SET Album Values first -> then overwrite with Photo Values.
|
||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_TITLE)
|
||||
{
|
||||
titleLabel->setText(QString::fromUtf8(mAlbumDetails.mMeta.mGroupName.c_str()));
|
||||
}
|
||||
|
||||
// This needs to be fixed!! TODO
|
||||
fromLabel->setText(QString::fromStdString(mAlbumDetails.mMeta.mGroupId));
|
||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_AUTHOR)
|
||||
{
|
||||
// This needs to be fixed!! TODO
|
||||
fromLabel->setText(QString::fromStdString(mAlbumDetails.mMeta.mGroupId));
|
||||
}
|
||||
|
||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHERE)
|
||||
{
|
||||
statusLabel->setText(QString::fromUtf8(mAlbumDetails.mWhere.c_str()));
|
||||
}
|
||||
|
||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHEN)
|
||||
{
|
||||
dateLabel->setText(QString::fromUtf8(mAlbumDetails.mWhen.c_str()));
|
||||
}
|
||||
|
||||
// NOW Photo Bits.
|
||||
if (mIsPhoto)
|
||||
{
|
||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_TITLE)
|
||||
{
|
||||
titleLabel->setText(QString::fromUtf8(mPhotoDetails.mMeta.mMsgName.c_str()));
|
||||
}
|
||||
|
||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_AUTHOR)
|
||||
{
|
||||
// This needs to be fixed!! TODO
|
||||
fromLabel->setText(QString::fromStdString(mPhotoDetails.mMeta.mAuthorId));
|
||||
}
|
||||
|
||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHERE)
|
||||
{
|
||||
statusLabel->setText(QString::fromUtf8(mPhotoDetails.mWhere.c_str()));
|
||||
}
|
||||
|
||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHEN)
|
||||
{
|
||||
dateLabel->setText(QString::fromUtf8(mPhotoDetails.mWhen.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PhotoItem::updateImage(const RsPhotoThumbnail &thumbnail)
|
||||
{
|
||||
if (thumbnail.data != NULL)
|
||||
{
|
||||
QPixmap qtn;
|
||||
qtn.loadFromData(thumbnail.data, thumbnail.size, thumbnail.type.c_str());
|
||||
imgLabel->setPixmap(qtn);
|
||||
}
|
||||
}
|
||||
|
||||
bool PhotoItem::getPhotoThumbnail(RsPhotoThumbnail &nail)
|
||||
{
|
||||
const QPixmap *tmppix = imgLabel->pixmap();
|
||||
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
if(!tmppix->isNull())
|
||||
{
|
||||
// send chan image
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
|
||||
RsPhotoThumbnail tmpnail;
|
||||
tmpnail.data = (uint8_t *) ba.data();
|
||||
tmpnail.size = ba.size();
|
||||
|
||||
nail.copyFrom(tmpnail);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nail.data = NULL;
|
||||
nail.size = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "PhotoItem::removeItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
hide();
|
||||
if (mParent)
|
||||
{
|
||||
mParent->deletePhotoItem(this, mType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::setSelected(bool on)
|
||||
{
|
||||
mSelected = on;
|
||||
if (mSelected)
|
||||
{
|
||||
mParent->notifySelection(this, mType);
|
||||
frame->setStyleSheet("QFrame#frame{border: 2px solid #55CC55;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #55EE55, stop: 1 #CCCCCC);\nborder-radius: 10px}");
|
||||
}
|
||||
else
|
||||
{
|
||||
frame->setStyleSheet("QFrame#frame{border: 2px solid #CCCCCC;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);\nborder-radius: 10px}");
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
bool PhotoItem::isSelected()
|
||||
{
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
/* We can be very cunning here?
|
||||
* grab out position.
|
||||
* flag ourselves as selected.
|
||||
* then pass the mousePressEvent up for handling by the parent
|
||||
*/
|
||||
|
||||
QPoint pos = event->pos();
|
||||
|
||||
std::cerr << "PhotoItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
setSelected(true);
|
||||
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
|
||||
const QPixmap *PhotoItem::getPixmap()
|
||||
{
|
||||
return imgLabel->pixmap();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "ui_PostedItem.h"
|
||||
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
class RsPostedPost;
|
||||
class PostedItem;
|
||||
|
@ -25,8 +25,7 @@
|
||||
|
||||
#include "gui/gxs/PostedGroupDialog.h"
|
||||
|
||||
//#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@ -69,7 +68,7 @@ PostedListDialog::PostedListDialog(QWidget *parent)
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Setup Queue */
|
||||
mPostedQueue = new TokenQueueVEG(rsPostedVEG, this);
|
||||
mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this);
|
||||
|
||||
connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) );
|
||||
|
||||
@ -144,12 +143,6 @@ void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ )
|
||||
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnreadAll()));
|
||||
//action->setEnabled (!mCurrTopicId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
||||
|
||||
#ifdef DEBUG_FORUMS
|
||||
contextMnu.addSeparator();
|
||||
action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData()));
|
||||
action->setEnabled (!mCurrTopicId.empty() && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
||||
#endif
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
@ -157,12 +150,12 @@ void PostedListDialog::updateDisplay()
|
||||
{
|
||||
std::list<std::string> groupIds;
|
||||
std::list<std::string>::iterator it;
|
||||
if (!rsPostedVEG)
|
||||
if (!rsPosted)
|
||||
return;
|
||||
|
||||
// TODO groupsChanged... HACK XXX.
|
||||
#if 0
|
||||
if ((rsPostedVEG->groupsChanged(groupIds)) || (rsPostedVEG->updated()))
|
||||
if ((rsPosted->groupsChanged(groupIds)) || (rsPosted->updated()))
|
||||
{
|
||||
/* update Forums List */
|
||||
insertGroups();
|
||||
@ -176,7 +169,7 @@ void PostedListDialog::updateDisplay()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rsPostedVEG->updated())
|
||||
if (rsPosted->updated())
|
||||
{
|
||||
/* update Forums List */
|
||||
insertGroups();
|
||||
@ -244,8 +237,6 @@ void PostedListDialog::sortButtonClicked( QAbstractButton *button )
|
||||
} else if (button == ui.topSortButton) {
|
||||
sortMode = RSPOSTED_VIEWMODE_TOP;
|
||||
}
|
||||
|
||||
rsPostedVEG->setViewMode(sortMode);
|
||||
}
|
||||
|
||||
|
||||
@ -275,7 +266,6 @@ void PostedListDialog::periodChanged( int index )
|
||||
periodMode = RSPOSTED_PERIOD_YEAR;
|
||||
break;
|
||||
}
|
||||
rsPostedVEG->setViewPeriod(periodMode);
|
||||
}
|
||||
|
||||
|
||||
@ -342,7 +332,7 @@ void PostedListDialog::requestGroupSummary()
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<std::string> ids;
|
||||
RsTokReqOptionsVEG opts;
|
||||
RsTokReqOptions opts;
|
||||
uint32_t token;
|
||||
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, ids, POSTEDDIALOG_LISTING);
|
||||
}
|
||||
@ -353,7 +343,7 @@ void PostedListDialog::loadGroupSummary(const uint32_t &token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
rsPostedVEG->getGroupSummary(token, groupInfo);
|
||||
rsPosted->getGroupSummary(token, groupInfo);
|
||||
|
||||
if (groupInfo.size() > 0)
|
||||
{
|
||||
@ -373,7 +363,7 @@ void PostedListDialog::loadGroupSummary(const uint32_t &token)
|
||||
|
||||
void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
|
||||
{
|
||||
RsTokReqOptionsVEG opts;
|
||||
RsTokReqOptions opts;
|
||||
|
||||
std::list<std::string> grpIds;
|
||||
grpIds.push_back(forumId);
|
||||
@ -391,7 +381,7 @@ void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
rsPostedVEG->getGroupSummary(token, groupInfo);
|
||||
rsPosted->getGroupSummary(token, groupInfo);
|
||||
|
||||
if (groupInfo.size() == 1)
|
||||
{
|
||||
@ -452,7 +442,7 @@ void PostedListDialog::loadCurrentForumThreads(const std::string &forumId)
|
||||
|
||||
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId)
|
||||
{
|
||||
RsTokReqOptionsVEG opts;
|
||||
RsTokReqOptions opts;
|
||||
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
||||
|
||||
@ -466,7 +456,7 @@ void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &g
|
||||
//mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS);
|
||||
|
||||
// Do specific Posted Request....
|
||||
if (rsPostedVEG->requestRanking(token, groupId))
|
||||
if (rsPosted->requestRanking(token, groupId))
|
||||
{
|
||||
// get the Queue to handle response.
|
||||
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_DATA, POSTEDDIALOG_INSERTTHREADS);
|
||||
@ -484,9 +474,9 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
|
||||
{
|
||||
RsPostedPost post;
|
||||
// Old Format.
|
||||
//if (rsPostedVEG->getPost(token, post))
|
||||
//if ()
|
||||
|
||||
if (rsPostedVEG->getRankedPost(token, post))
|
||||
if (/*rsPosted->getPost(token, post)*/false)
|
||||
{
|
||||
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
@ -559,7 +549,7 @@ void PostedListDialog::clearPosts()
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void PostedListDialog::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
|
||||
void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "PostedListDialog::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
@ -600,78 +590,11 @@ void PostedListDialog::loadRequest(const TokenQueueVEG *queue, const TokenReques
|
||||
void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
|
||||
{
|
||||
|
||||
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId);
|
||||
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
|
||||
//groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc);
|
||||
groupItemInfo.popularity = groupInfo.mPop;
|
||||
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
|
||||
|
||||
if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) {
|
||||
groupItemInfo.name += " (" + tr("AUTHD") + ")";
|
||||
groupItemInfo.icon = QIcon(IMAGE_FORUMAUTHD);
|
||||
} else {
|
||||
groupItemInfo.icon = QIcon(IMAGE_FORUM);
|
||||
}
|
||||
}
|
||||
|
||||
void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList)
|
||||
{
|
||||
std::list<RsGroupMetaData>::const_iterator it;
|
||||
|
||||
QList<GroupItemInfo> adminList;
|
||||
QList<GroupItemInfo> subList;
|
||||
QList<GroupItemInfo> popList;
|
||||
QList<GroupItemInfo> otherList;
|
||||
std::multimap<uint32_t, GroupItemInfo> popMap;
|
||||
|
||||
for (it = groupList.begin(); it != groupList.end(); it++) {
|
||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||
uint32_t flags = it->mSubscribeFlags;
|
||||
|
||||
GroupItemInfo groupItemInfo;
|
||||
groupInfoToGroupItemInfo(*it, groupItemInfo);
|
||||
|
||||
if (flags & RSGXS_GROUP_SUBSCRIBE_ADMIN) {
|
||||
adminList.push_back(groupItemInfo);
|
||||
} else if (flags & RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED) {
|
||||
/* subscribed forum */
|
||||
subList.push_back(groupItemInfo);
|
||||
} else {
|
||||
/* rate the others by popularity */
|
||||
popMap.insert(std::make_pair(it->mPop, groupItemInfo));
|
||||
}
|
||||
}
|
||||
|
||||
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
||||
uint32_t popCount = 5;
|
||||
if (popCount < popMap.size() / 10)
|
||||
{
|
||||
popCount = popMap.size() / 10;
|
||||
}
|
||||
|
||||
uint32_t i = 0;
|
||||
uint32_t popLimit = 0;
|
||||
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
|
||||
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ;
|
||||
if (rit != popMap.rend()) {
|
||||
popLimit = rit->first;
|
||||
}
|
||||
|
||||
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
|
||||
if (rit->second.popularity < (int) popLimit) {
|
||||
otherList.append(rit->second);
|
||||
} else {
|
||||
popList.append(rit->second);
|
||||
}
|
||||
}
|
||||
|
||||
/* now we can add them in as a tree! */
|
||||
ui.groupTreeWidget->fillGroupItems(yourTopics, adminList);
|
||||
ui.groupTreeWidget->fillGroupItems(subscribedTopics, subList);
|
||||
ui.groupTreeWidget->fillGroupItems(popularTopics, popList);
|
||||
ui.groupTreeWidget->fillGroupItems(otherTopics, otherList);
|
||||
|
||||
// updateMessageSummaryList("");
|
||||
}
|
||||
|
||||
/**************************************************************************************/
|
||||
|
@ -27,18 +27,18 @@
|
||||
#include "retroshare-gui/mainpage.h"
|
||||
#include "ui_PostedListDialog.h"
|
||||
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "gui/Posted/PostedItem.h"
|
||||
#include "gui/common/GroupTreeWidget.h"
|
||||
|
||||
#include "util/TokenQueueVEG.h"
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||
|
||||
class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponseVEG
|
||||
class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -90,7 +90,7 @@ void loadGroupThreadData_InsertThreads(const uint32_t &token);
|
||||
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
|
||||
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
|
||||
|
||||
void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
|
||||
QTreeWidgetItem *yourTopics;
|
||||
@ -103,7 +103,7 @@ void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &
|
||||
bool mThreadLoading;
|
||||
std::string mCurrTopicId;
|
||||
|
||||
TokenQueueVEG *mPostedQueue;
|
||||
TokenQueue *mPostedQueue;
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::PostedListDialog ui;
|
||||
|
@ -36,7 +36,7 @@
|
||||
#define GXSCOMMENTS_LOADTHREAD 1
|
||||
|
||||
// Temporarily make this specific.
|
||||
#include "retroshare/rspostedVEG.h"
|
||||
#include "retroshare/rsposted.h"
|
||||
|
||||
|
||||
GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
|
||||
@ -46,10 +46,10 @@ GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
|
||||
return;
|
||||
}
|
||||
|
||||
void GxsCommentTreeWidget::setup(RsTokenServiceVEG *service)
|
||||
void GxsCommentTreeWidget::setup(RsTokenService *service)
|
||||
{
|
||||
mRsService = service;
|
||||
mTokenQueue = new TokenQueueVEG(service, this);
|
||||
mTokenQueue = new TokenQueue(service, this);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -72,11 +72,11 @@ void GxsCommentTreeWidget::service_requestComments(std::string threadId)
|
||||
std::cerr << "GxsCommentTreeWidget::service_requestComments(" << threadId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsTokReqOptionsVEG opts;
|
||||
RsTokReqOptions opts;
|
||||
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
||||
opts.mFlagsFilter = RSPOSTED_MSGTYPE_COMMENT;
|
||||
opts.mFlagsMask = RSPOSTED_MSGTYPE_COMMENT;
|
||||
// opts.mFlagsFilter = RSPOSTED_MSGTYPE_COMMENT;
|
||||
// opts.mFlagsMask = RSPOSTED_MSGTYPE_COMMENT;
|
||||
|
||||
std::list<std::string> msgIds;
|
||||
msgIds.push_back(threadId);
|
||||
@ -84,7 +84,7 @@ void GxsCommentTreeWidget::service_requestComments(std::string threadId)
|
||||
mThreadId = threadId;
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSCOMMENTS_LOADTHREAD);
|
||||
// mTokenQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSCOMMENTS_LOADTHREAD);
|
||||
}
|
||||
|
||||
|
||||
@ -211,49 +211,49 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
|
||||
std::cerr << "GxsCommentTreeWidget::service_loadThread() ERROR must be overloaded!";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsPostedComment comment;
|
||||
while(rsPostedVEG->getComment(token, comment))
|
||||
{
|
||||
/* convert to a QTreeWidgetItem */
|
||||
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment;
|
||||
std::cerr << std::endl;
|
||||
// RsPostedComment comment;
|
||||
// while(rsPosted->getComment(token, comment))
|
||||
// {
|
||||
// /* convert to a QTreeWidgetItem */
|
||||
// std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment;
|
||||
// std::cerr << std::endl;
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
QString text;
|
||||
// QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
// QString text;
|
||||
|
||||
{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(comment.mMeta.mPublishTs);
|
||||
// {
|
||||
// QDateTime qtime;
|
||||
// qtime.setTime_t(comment.mMeta.mPublishTs);
|
||||
|
||||
text = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
item->setText(PCITEM_COLUMN_DATE, text);
|
||||
}
|
||||
// text = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
// item->setText(PCITEM_COLUMN_DATE, text);
|
||||
// }
|
||||
|
||||
text = QString::fromUtf8(comment.mComment.c_str());
|
||||
item->setText(PCITEM_COLUMN_COMMENT, text);
|
||||
// text = QString::fromUtf8(comment.mComment.c_str());
|
||||
// item->setText(PCITEM_COLUMN_COMMENT, text);
|
||||
|
||||
text = QString::fromUtf8(comment.mMeta.mAuthorId.c_str());
|
||||
if (text.isEmpty())
|
||||
{
|
||||
item->setText(PCITEM_COLUMN_AUTHOR, tr("Anonymous"));
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setText(PCITEM_COLUMN_AUTHOR, text);
|
||||
}
|
||||
// text = QString::fromUtf8(comment.mMeta.mAuthorId.c_str());
|
||||
// if (text.isEmpty())
|
||||
// {
|
||||
// item->setText(PCITEM_COLUMN_AUTHOR, tr("Anonymous"));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// item->setText(PCITEM_COLUMN_AUTHOR, text);
|
||||
// }
|
||||
|
||||
|
||||
text = QString::fromUtf8(comment.mMeta.mMsgId.c_str());
|
||||
item->setText(PCITEM_COLUMN_MSGID, text);
|
||||
// text = QString::fromUtf8(comment.mMeta.mMsgId.c_str());
|
||||
// item->setText(PCITEM_COLUMN_MSGID, text);
|
||||
|
||||
text = QString::fromUtf8(comment.mMeta.mParentId.c_str());
|
||||
item->setText(PCITEM_COLUMN_PARENTID, text);
|
||||
// text = QString::fromUtf8(comment.mMeta.mParentId.c_str());
|
||||
// item->setText(PCITEM_COLUMN_PARENTID, text);
|
||||
|
||||
text = QString::fromUtf8(comment.mMeta.mServiceString.c_str());
|
||||
item->setText(PCITEM_COLUMN_SERVSTRING, text);
|
||||
// text = QString::fromUtf8(comment.mMeta.mServiceString.c_str());
|
||||
// item->setText(PCITEM_COLUMN_SERVSTRING, text);
|
||||
|
||||
addItem(comment.mMeta.mMsgId, comment.mMeta.mParentId, item);
|
||||
}
|
||||
// addItem(comment.mMeta.mMsgId, comment.mMeta.mParentId, item);
|
||||
// }
|
||||
|
||||
return;
|
||||
}
|
||||
@ -286,7 +286,7 @@ QTreeWidgetItem *GxsCommentTreeWidget::service_createMissingItem(std::string par
|
||||
}
|
||||
|
||||
|
||||
void GxsCommentTreeWidget::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
|
||||
void GxsCommentTreeWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "GxsCommentTreeWidget::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "util/TokenQueueVEG.h"
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
/* indicies for search results item columns SR_ = Search Result */
|
||||
#define SR_NAME_COL 0
|
||||
@ -39,17 +39,17 @@
|
||||
|
||||
#define SR_ROLE_LOCAL Qt::UserRole
|
||||
|
||||
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponseVEG
|
||||
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsCommentTreeWidget(QWidget *parent = 0);
|
||||
void setup(RsTokenServiceVEG *service);
|
||||
void setup(RsTokenService *service);
|
||||
|
||||
void requestComments(std::string threadId);
|
||||
|
||||
void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
|
||||
@ -73,8 +73,8 @@ protected:
|
||||
std::map<std::string, QTreeWidgetItem *> mLoadingMap;
|
||||
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
|
||||
|
||||
TokenQueueVEG *mTokenQueue;
|
||||
RsTokenServiceVEG *mRsService;
|
||||
TokenQueue *mTokenQueue;
|
||||
RsTokenService *mRsService;
|
||||
|
||||
protected:
|
||||
//virtual QMimeData * mimeData ( const QList<QTreeWidgetItem *> items ) const;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "util/misc.h"
|
||||
#include "GxsGroupDialog.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "gxs/rsgxsflags.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -31,17 +32,31 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// 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
|
||||
|
||||
#define GXSGROUP_NEWGROUPID 1
|
||||
#define GXSGROUP_LOADGROUP 2
|
||||
|
||||
/** Constructor */
|
||||
GxsGroupDialog::GxsGroupDialog(RsTokenServiceVEG *service, QWidget *parent)
|
||||
GxsGroupDialog::GxsGroupDialog(RsTokenService *service, QWidget *parent)
|
||||
: QDialog(parent), mRsService(service)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
mTokenQueue = new TokenQueueVEG(service, this);
|
||||
mTokenQueue = new TokenQueue(service, this);
|
||||
|
||||
// connect up the buttons.
|
||||
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelDialog( ) ) );
|
||||
@ -289,7 +304,7 @@ void GxsGroupDialog::existingGroup(std::string groupId, uint32_t mode)
|
||||
|
||||
/* request data */
|
||||
{
|
||||
RsTokReqOptionsVEG opts;
|
||||
RsTokReqOptions opts;
|
||||
|
||||
std::list<std::string> grpIds;
|
||||
grpIds.push_back(groupId);
|
||||
@ -391,7 +406,7 @@ void GxsGroupDialog::createGroup()
|
||||
meta.mSignFlags = getGroupSignFlags();
|
||||
|
||||
// These ones shouldn't be needed here - but will be used, until we have fully functional backend.
|
||||
meta.mSubscribeFlags = RSGXS_GROUP_SUBSCRIBE_ADMIN;
|
||||
meta.mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_ADMIN;
|
||||
meta.mPublishTs = time(NULL);
|
||||
|
||||
if (service_CreateGroup(token, meta))
|
||||
@ -528,19 +543,7 @@ void GxsGroupDialog::addGroupLogo()
|
||||
|
||||
void GxsGroupDialog::sendShareList(std::string groupId)
|
||||
{
|
||||
if (!mRsService)
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::sendShareList() GXS Service not active";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui.pubKeyShare_cb->isChecked())
|
||||
{
|
||||
std::list<std::string> shareList;
|
||||
ui.keyShareList->selectedSslIds(shareList, false);
|
||||
mRsService->groupShareKeys(groupId, shareList);
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
@ -566,7 +569,6 @@ void GxsGroupDialog::loadNewGroupId(const uint32_t &token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
mRsService->getGroupSummary(token, groupInfo);
|
||||
|
||||
if (groupInfo.size() == 1)
|
||||
{
|
||||
@ -605,7 +607,7 @@ void GxsGroupDialog::service_loadExistingGroup(const uint32_t &token)
|
||||
}
|
||||
|
||||
|
||||
void GxsGroupDialog::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
|
||||
void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "ui_GxsGroupDialog.h"
|
||||
|
||||
#include "util/TokenQueueVEG.h"
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
|
||||
/********
|
||||
@ -90,12 +90,12 @@ public:
|
||||
#define GXS_GROUP_DIALOG_SHOW_MODE 2
|
||||
#define GXS_GROUP_DIALOG_EDIT_MODE 3
|
||||
|
||||
class GxsGroupDialog : public QDialog, public TokenResponseVEG
|
||||
class GxsGroupDialog : public QDialog, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsGroupDialog(RsTokenServiceVEG *service, QWidget *parent = 0);
|
||||
GxsGroupDialog(RsTokenService *service, QWidget *parent = 0);
|
||||
|
||||
void setFlags(uint32_t enabledFlags, uint32_t readonlyFlags, uint32_t defaultFlags);
|
||||
void setMode(uint32_t mode);
|
||||
@ -105,7 +105,7 @@ public:
|
||||
void existingGroup(std::string groupId, uint32_t mode);
|
||||
|
||||
// Callback for all Loads.
|
||||
virtual void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
|
||||
// Functions that can be overloaded for specific stuff.
|
||||
@ -159,8 +159,8 @@ private:
|
||||
|
||||
QPixmap picture;
|
||||
|
||||
RsTokenServiceVEG *mRsService;
|
||||
TokenQueueVEG *mTokenQueue;
|
||||
RsTokenService *mRsService;
|
||||
TokenQueue *mTokenQueue;
|
||||
|
||||
uint32_t mMode;
|
||||
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
#include "PostedGroupDialog.h"
|
||||
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
#include <iostream>
|
||||
|
||||
PostedGroupDialog::PostedGroupDialog(QWidget *parent)
|
||||
:GxsGroupDialog(rsPostedVEG, parent)
|
||||
:GxsGroupDialog(rsPosted->getTokenService(), parent)
|
||||
{
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
@ -70,7 +70,7 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa
|
||||
grp.mMeta = meta;
|
||||
//grp.mDescription = std::string(desc.toUtf8());
|
||||
|
||||
rsPostedVEG->submitGroup(token, grp, true);
|
||||
rsPosted->submitGroup(token, grp);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ void PostedGroupDialog::service_loadExistingGroup(const uint32_t &token)
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsPostedGroup group;
|
||||
if (!rsPostedVEG->getGroup(token, group))
|
||||
if (!rsPosted->getGroup(token, group))
|
||||
{
|
||||
std::cerr << "PostedGroupDialog::service_loadExistingGroup() ERROR Getting Group";
|
||||
std::cerr << std::endl;
|
||||
|
@ -86,10 +86,6 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||
//ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages),
|
||||
// createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp));
|
||||
|
||||
//PhotoDialog *photoDialog = NULL;
|
||||
//ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
|
||||
// createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
|
||||
|
||||
//GamesDialog *gamesDialog = NULL;
|
||||
//ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
|
||||
// createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
|
||||
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "util/TokenQueueV2.h"
|
||||
#include "util/TokenQueue.h"
|
||||
#include <iostream>
|
||||
|
||||
#include <QTimer>
|
||||
@ -32,13 +32,13 @@
|
||||
*****/
|
||||
|
||||
/** Constructor */
|
||||
TokenQueueV2::TokenQueueV2(RsTokenService *service, TokenResponseV2 *resp)
|
||||
TokenQueue::TokenQueue(RsTokenService *service, TokenResponse *resp)
|
||||
:QWidget(NULL), mService(service), mResponder(resp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, std::list<RsGxsGroupId>& ids, uint32_t usertype)
|
||||
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, std::list<RsGxsGroupId>& ids, uint32_t usertype)
|
||||
{
|
||||
uint32_t basictype = TOKENREQ_GROUPINFO;
|
||||
mService->requestGroupInfo(token, anstype, opts, ids);
|
||||
@ -48,7 +48,7 @@ bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsT
|
||||
}
|
||||
|
||||
|
||||
bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, uint32_t usertype)
|
||||
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, uint32_t usertype)
|
||||
{
|
||||
uint32_t basictype = TOKENREQ_GROUPINFO;
|
||||
mService->requestGroupInfo(token, anstype, opts);
|
||||
@ -57,7 +57,7 @@ bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsT
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, const GxsMsgReq& ids, uint32_t usertype)
|
||||
bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, const GxsMsgReq& ids, uint32_t usertype)
|
||||
{
|
||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||
mService->requestMsgInfo(token, anstype, opts, ids);
|
||||
@ -67,7 +67,7 @@ bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTok
|
||||
}
|
||||
|
||||
|
||||
bool TokenQueueV2::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair &msgId, uint32_t usertype)
|
||||
bool TokenQueue::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair &msgId, uint32_t usertype)
|
||||
{
|
||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||
uint32_t anstype = RS_TOKREQ_ANSTYPE_LIST; // always a list answer
|
||||
@ -78,7 +78,7 @@ bool TokenQueueV2::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV
|
||||
}
|
||||
|
||||
|
||||
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
||||
bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
|
||||
{
|
||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||
@ -89,13 +89,13 @@ bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTok
|
||||
}
|
||||
|
||||
|
||||
void TokenQueueV2::queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype)
|
||||
void TokenQueue::queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype)
|
||||
{
|
||||
std::cerr << "TokenQueueV2::queueRequest() Token: " << token << " Type: " << basictype;
|
||||
std::cerr << "TokenQueue::queueRequest() Token: " << token << " Type: " << basictype;
|
||||
std::cerr << " AnsType: " << anstype << " UserType: " << usertype;
|
||||
std::cerr << std::endl;
|
||||
|
||||
TokenRequestV2 req;
|
||||
TokenRequest req;
|
||||
req.mToken = token;
|
||||
req.mType = basictype;
|
||||
req.mAnsType = anstype;
|
||||
@ -113,7 +113,7 @@ void TokenQueueV2::queueRequest(uint32_t token, uint32_t basictype, uint32_t ans
|
||||
}
|
||||
}
|
||||
|
||||
void TokenQueueV2::doPoll(float dt)
|
||||
void TokenQueue::doPoll(float dt)
|
||||
{
|
||||
/* single shot poll */
|
||||
//mTrigger->singlesshot(dt * 1000);
|
||||
@ -121,11 +121,11 @@ void TokenQueueV2::doPoll(float dt)
|
||||
}
|
||||
|
||||
|
||||
void TokenQueueV2::pollRequests()
|
||||
void TokenQueue::pollRequests()
|
||||
{
|
||||
double pollPeriod = 1.0; // max poll period.
|
||||
|
||||
TokenRequestV2 req;
|
||||
TokenRequest req;
|
||||
|
||||
if(mRequests.size() > 0){
|
||||
req = mRequests.front();
|
||||
@ -148,7 +148,7 @@ void TokenQueueV2::pollRequests()
|
||||
}
|
||||
|
||||
|
||||
bool TokenQueueV2::checkForRequest(uint32_t token)
|
||||
bool TokenQueue::checkForRequest(uint32_t token)
|
||||
{
|
||||
/* check token */
|
||||
uint32_t status = mService->requestStatus(token);
|
||||
@ -157,9 +157,9 @@ bool TokenQueueV2::checkForRequest(uint32_t token)
|
||||
}
|
||||
|
||||
|
||||
void TokenQueueV2::loadRequest(const TokenRequestV2 &req)
|
||||
void TokenQueue::loadRequest(const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "TokenQueueV2::loadRequest(): ";
|
||||
std::cerr << "TokenQueue::loadRequest(): ";
|
||||
std::cerr << "Token: " << req.mToken << " Type: " << req.mType;
|
||||
std::cerr << " AnsType: " << req.mAnsType << " UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
@ -170,12 +170,12 @@ void TokenQueueV2::loadRequest(const TokenRequestV2 &req)
|
||||
}
|
||||
|
||||
|
||||
bool TokenQueueV2::cancelRequest(const uint32_t token)
|
||||
bool TokenQueue::cancelRequest(const uint32_t token)
|
||||
{
|
||||
/* cancel at lower level first */
|
||||
mService->cancelRequest(token);
|
||||
|
||||
std::list<TokenRequestV2>::iterator it;
|
||||
std::list<TokenRequest>::iterator it;
|
||||
|
||||
for(it = mRequests.begin(); it != mRequests.end(); it++)
|
||||
{
|
||||
@ -183,14 +183,14 @@ bool TokenQueueV2::cancelRequest(const uint32_t token)
|
||||
{
|
||||
mRequests.erase(it);
|
||||
|
||||
std::cerr << "TokenQueueV2::cancelRequest() Cleared Request: " << token;
|
||||
std::cerr << "TokenQueue::cancelRequest() Cleared Request: " << token;
|
||||
std::cerr << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "TokenQueueV2::cancelRequest() Failed to Find Request: " << token;
|
||||
std::cerr << "TokenQueue::cancelRequest() Failed to Find Request: " << token;
|
||||
std::cerr << std::endl;
|
||||
|
||||
return false;
|
@ -41,9 +41,9 @@
|
||||
#define TOKENREQ_MSGRELATEDINFO 3
|
||||
|
||||
|
||||
class TokenQueueV2;
|
||||
class TokenQueue;
|
||||
|
||||
class TokenRequestV2
|
||||
class TokenRequest
|
||||
{
|
||||
public:
|
||||
uint32_t mToken;
|
||||
@ -54,12 +54,12 @@ class TokenRequestV2
|
||||
struct timeval mPollTs;
|
||||
};
|
||||
|
||||
class TokenResponseV2
|
||||
class TokenResponse
|
||||
{
|
||||
public:
|
||||
//virtual ~TokenResponse() { return; }
|
||||
// These Functions are overloaded to get results out.
|
||||
virtual void loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &req) = 0;
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req) = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -67,12 +67,12 @@ class TokenResponseV2
|
||||
* An important thing to note is that all requests are stacked (so FIFO)
|
||||
* This is to prevent overlapped loads on GXS UIs
|
||||
*/
|
||||
class TokenQueueV2: public QWidget
|
||||
class TokenQueue: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TokenQueueV2(RsTokenService *service, TokenResponseV2 *resp);
|
||||
TokenQueue(RsTokenService *service, TokenResponse *resp);
|
||||
|
||||
/* generic handling of token / response update behaviour */
|
||||
|
||||
@ -81,25 +81,25 @@ public:
|
||||
* @token the token to be redeem is assigned here
|
||||
*
|
||||
*/
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
std::list<RsGxsGroupId>& ids, uint32_t usertype);
|
||||
|
||||
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, uint32_t usertype);
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, uint32_t usertype);
|
||||
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
const std::list<RsGxsGroupId>& grpIds, uint32_t usertype);
|
||||
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
const GxsMsgReq& grpIds, uint32_t usertype);
|
||||
|
||||
bool requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair& msgId, uint32_t usertype);
|
||||
bool requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptions &opts, const RsGxsGrpMsgIdPair& msgId, uint32_t usertype);
|
||||
|
||||
bool cancelRequest(const uint32_t token);
|
||||
|
||||
void queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype);
|
||||
bool checkForRequest(uint32_t token);
|
||||
void loadRequest(const TokenRequestV2 &req);
|
||||
void loadRequest(const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
void doPoll(float dt);
|
||||
@ -109,10 +109,10 @@ private slots:
|
||||
|
||||
private:
|
||||
/* Info for Data Requests */
|
||||
std::list<TokenRequestV2> mRequests;
|
||||
std::list<TokenRequest> mRequests;
|
||||
|
||||
RsTokenService *mService;
|
||||
TokenResponseV2 *mResponder;
|
||||
TokenResponse *mResponder;
|
||||
|
||||
QTimer *mTrigger;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user