2012-07-05 17:26:14 -04:00
|
|
|
#ifndef P3PHOTOSERVICEV2_H
|
|
|
|
#define P3PHOTOSERVICEV2_H
|
|
|
|
|
2012-07-22 17:38:15 -04:00
|
|
|
/*
|
|
|
|
* libretroshare/src/retroshare: rsphoto.h
|
|
|
|
*
|
|
|
|
* RetroShare C++ Interface.
|
|
|
|
*
|
|
|
|
* Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-07-05 17:26:14 -04:00
|
|
|
#include "gxs/rsgenexchange.h"
|
|
|
|
#include "retroshare/rsphotoV2.h"
|
2012-07-22 17:38:15 -04:00
|
|
|
|
2012-07-05 17:26:14 -04:00
|
|
|
|
|
|
|
class p3PhotoServiceV2 : public RsPhotoV2, public RsGenExchange
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2012-11-10 18:42:38 -05:00
|
|
|
p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs,
|
|
|
|
uint32_t authenPolicy);
|
2012-07-05 17:26:14 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2012-07-26 17:48:54 -04:00
|
|
|
/*!
|
2012-09-13 18:58:42 -04:00
|
|
|
* @return true if a change has occured
|
2012-07-26 17:48:54 -04:00
|
|
|
*/
|
2012-07-05 17:26:14 -04:00
|
|
|
bool updated();
|
|
|
|
|
2012-10-15 14:52:47 -04:00
|
|
|
/*!
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void service_tick();
|
|
|
|
|
2012-08-06 17:00:38 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
void notifyChanges(std::vector<RsGxsNotify*>& changes);
|
2012-07-05 17:26:14 -04:00
|
|
|
public:
|
|
|
|
|
|
|
|
/** Requests **/
|
|
|
|
|
2012-08-06 17:00:38 -04:00
|
|
|
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
2012-07-05 17:26:14 -04:00
|
|
|
|
|
|
|
|
2012-08-06 17:00:38 -04:00
|
|
|
void msgsChanged(std::map<RsGxsGroupId,
|
|
|
|
std::vector<RsGxsMessageId> >& msgs);
|
2012-07-05 17:26:14 -04:00
|
|
|
|
2012-10-05 14:12:52 -04:00
|
|
|
RsTokenService* getTokenService();
|
2012-07-05 17:26:14 -04:00
|
|
|
|
|
|
|
bool getGroupList(const uint32_t &token,
|
2012-08-06 17:00:38 -04:00
|
|
|
std::list<RsGxsGroupId> &groupIds);
|
2012-07-05 17:26:14 -04:00
|
|
|
bool getMsgList(const uint32_t &token,
|
2012-07-26 17:48:54 -04:00
|
|
|
GxsMsgIdResult& msgIds);
|
2012-07-05 17:26:14 -04:00
|
|
|
|
|
|
|
/* Generic Summary */
|
|
|
|
bool getGroupSummary(const uint32_t &token,
|
|
|
|
std::list<RsGroupMetaData> &groupInfo);
|
|
|
|
|
|
|
|
bool getMsgSummary(const uint32_t &token,
|
|
|
|
MsgMetaResult &msgInfo);
|
|
|
|
|
|
|
|
/* Specific Service Data */
|
2012-07-26 17:48:54 -04:00
|
|
|
bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &albums);
|
|
|
|
bool getPhoto(const uint32_t &token, PhotoResult &photos);
|
2012-09-25 17:04:04 -04:00
|
|
|
bool getPhotoComment(const uint32_t &token, PhotoCommentResult &comments);
|
2012-07-05 17:26:14 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/** Modifications **/
|
|
|
|
|
2012-09-13 18:58:42 -04:00
|
|
|
/*!
|
|
|
|
* submits album, which returns a token that needs
|
|
|
|
* to be acknowledge to get album grp id
|
|
|
|
* @param token token to redeem for acknowledgement
|
|
|
|
* @param album album to be submitted
|
|
|
|
*/
|
2012-08-18 06:01:35 -04:00
|
|
|
bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album);
|
2012-09-13 18:58:42 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* submits photo, which returns a token that needs
|
|
|
|
* to be acknowledge to get photo msg-grp id pair
|
|
|
|
* @param token token to redeem for acknowledgement
|
|
|
|
* @param photo photo to be submitted
|
|
|
|
*/
|
2012-08-18 06:01:35 -04:00
|
|
|
bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo);
|
|
|
|
|
2012-09-17 18:08:23 -04:00
|
|
|
/*!
|
|
|
|
* submits photo comment, which returns a token that needs
|
|
|
|
* to be acknowledged to get photo msg-grp id pair
|
|
|
|
* The mParentId needs to be set to an existing msg for which
|
|
|
|
* commenting is enabled
|
|
|
|
* @param token token to redeem for acknowledgement
|
|
|
|
* @param comment comment to be submitted
|
|
|
|
*/
|
|
|
|
bool submitComment(uint32_t& token, RsPhotoComment &photo);
|
|
|
|
|
2012-09-13 18:58:42 -04:00
|
|
|
/*!
|
|
|
|
* subscribes to group, and returns token which can be used
|
|
|
|
* to be acknowledged to get group Id
|
|
|
|
* @param token token to redeem for acknowledgement
|
|
|
|
* @param grpId the id of the group to subscribe to
|
|
|
|
*/
|
2012-09-17 18:08:23 -04:00
|
|
|
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
|
2012-09-13 18:58:42 -04:00
|
|
|
|
2012-08-18 06:01:35 -04:00
|
|
|
/*!
|
|
|
|
* This allows the client service to acknowledge that their msgs has
|
|
|
|
* been created/modified and retrieve the create/modified msg ids
|
|
|
|
* @param token the token related to modification/create request
|
|
|
|
* @param msgIds map of grpid->msgIds of message created/modified
|
|
|
|
* @return true if token exists false otherwise
|
|
|
|
*/
|
|
|
|
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* This allows the client service to acknowledge that their grps has
|
|
|
|
* been created/modified and retrieve the create/modified grp ids
|
|
|
|
* @param token the token related to modification/create request
|
|
|
|
* @param msgIds vector of ids of groups created/modified
|
|
|
|
* @return true if token exists false otherwise
|
|
|
|
*/
|
|
|
|
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
|
2012-08-06 17:00:38 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
std::vector<RsGxsGroupChange*> mGroupChange;
|
|
|
|
std::vector<RsGxsMsgChange*> mMsgChange;
|
2012-09-25 17:04:04 -04:00
|
|
|
|
|
|
|
RsMutex mPhotoMutex;
|
2012-07-05 17:26:14 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // P3PHOTOSERVICEV2_H
|