mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added Rs photo v2 item serialisation test, fixed subsequent bugs
Reactivated Photodialog. almost completed integration, publishing and item storage working, but data retrieval algorithm needs to be changed (request flags need to be translated, based on update call rather than client assumption) fixed bug in rsgenexchange notification. Added LGPL notices git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5387 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3948234310
commit
a715947046
@ -1,10 +1,30 @@
|
||||
|
||||
/*
|
||||
* gxscoreserver.cpp
|
||||
* libretroshare/src/gxs: gxscoreserver.cc
|
||||
*
|
||||
* General Data service, interface for RetroShare.
|
||||
*
|
||||
* Copyright 2011-2011 by Evi-Parker Christopher
|
||||
*
|
||||
* 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".
|
||||
*
|
||||
* Created on: 24 Jul 2012
|
||||
* Author: crispy
|
||||
*/
|
||||
|
||||
|
||||
#include "gxscoreserver.h"
|
||||
|
||||
GxsCoreServer::GxsCoreServer()
|
||||
|
@ -1,17 +1,37 @@
|
||||
/*
|
||||
* gxscoreserver.h
|
||||
*
|
||||
* Created on: 24 Jul 2012
|
||||
* Author: crispy
|
||||
*/
|
||||
|
||||
#ifndef GXSCORESERVER_H_
|
||||
#define GXSCORESERVER_H_
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: gxscoreserver.h
|
||||
*
|
||||
* General Data service, interface for RetroShare.
|
||||
*
|
||||
* Copyright 2011-2011 by Evi-Parker Christopher
|
||||
*
|
||||
* 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 "util/rsthreads.h"
|
||||
#include "gxs/rsgxs.h"
|
||||
|
||||
class GxsCoreServer : RsThread {
|
||||
class GxsCoreServer : public RsThread
|
||||
{
|
||||
public:
|
||||
GxsCoreServer();
|
||||
~GxsCoreServer();
|
||||
|
@ -1,3 +1,30 @@
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rsdataservice.cc
|
||||
*
|
||||
* Data Access, interface for RetroShare.
|
||||
*
|
||||
* Copyright 2011-2011 by Evi-Parker Christopher
|
||||
*
|
||||
* 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 <fstream>
|
||||
|
||||
#include "rsdataservice.h"
|
||||
@ -782,7 +809,7 @@ int RsDataService::updateMessageMetaData(MsgLocMetaData *metaData)
|
||||
}
|
||||
|
||||
|
||||
int RsDataService::removeMsgs(const std::string grpId, const std::vector<std::string> &msgIds)
|
||||
int RsDataService::removeMsgs(const GxsMsgReq& msgIds)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,31 @@
|
||||
#ifndef RSDATASERVICE_H
|
||||
#define RSDATASERVICE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rsdataservice.h
|
||||
*
|
||||
* General Data service, interface for RetroShare.
|
||||
*
|
||||
* Copyright 2011-2011 by Evi-Parker Christopher
|
||||
*
|
||||
* 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 "gxs/rsgds.h"
|
||||
#include "util/retrodb.h"
|
||||
|
||||
@ -10,7 +35,7 @@ class RsDataService : public RsGeneralDataService
|
||||
public:
|
||||
|
||||
RsDataService(const std::string& serviceDir, const std::string& dbName, uint16_t serviceType, RsGxsSearchModule* mod = NULL);
|
||||
virtual ~RsDataService() ;
|
||||
virtual ~RsDataService();
|
||||
|
||||
/*!
|
||||
* Retrieves all msgs
|
||||
@ -36,7 +61,7 @@ public:
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
int retrieveGxsGrpMetaData(std::map<std::string, RsGxsGrpMetaData*>& grp);
|
||||
int retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaData*>& grp);
|
||||
|
||||
/*!
|
||||
* Retrieves meta data of all groups stored (most current versions only)
|
||||
@ -45,7 +70,7 @@ public:
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
int retrieveGxsMsgMetaData(const std::vector<std::string>& grpIds, GxsMsgMetaResult& msgMeta);
|
||||
int retrieveGxsMsgMetaData(const std::vector<RsGxsGroupId>& grpIds, GxsMsgMetaResult& msgMeta);
|
||||
|
||||
/*!
|
||||
* remove msgs in data store
|
||||
@ -53,14 +78,14 @@ public:
|
||||
* @param msgIds ids of messages to be removed
|
||||
* @return error code
|
||||
*/
|
||||
int removeMsgs(const std::string grpId, const std::vector<std::string>& msgIds);
|
||||
int removeMsgs(const GxsMsgReq& msgIds);
|
||||
|
||||
/*!
|
||||
* remove groups in data store listed in grpIds param
|
||||
* @param grpIds ids of groups to be removed
|
||||
* @return error code
|
||||
*/
|
||||
int removeGroups(const std::vector<std::string>& grpIds);
|
||||
int removeGroups(const std::vector<RsGxsGroupId>& grpIds);
|
||||
|
||||
/*!
|
||||
* @return the cache size set for this RsGeneralDataService in bytes
|
||||
@ -117,11 +142,11 @@ private:
|
||||
void retrieveMessages(RetroCursor* c, std::vector<RsNxsMsg*>& msgs);
|
||||
|
||||
/*!
|
||||
* Retrieves all the msg results from a cursor
|
||||
* @param c cursor to result set
|
||||
* @param msgs messages retrieved from cursor are stored here
|
||||
*/
|
||||
void retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>& grps, bool withMeta = false);
|
||||
* Retrieves all the msg results from a cursor
|
||||
* @param c cursor to result set
|
||||
* @param msgs messages retrieved from cursor are stored here
|
||||
*/
|
||||
void retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>& grps, bool withMeta = false);
|
||||
|
||||
/*!
|
||||
* extracts a msg meta item from a cursor at its
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
/*!
|
||||
* Retrieves all groups stored
|
||||
* @param grp retrieved groups
|
||||
* @param withMeta this initialises the meta handles nxs grps
|
||||
* @param withMeta if true the meta handle of nxs grps is intitialised
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
@ -130,7 +130,7 @@ public:
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
virtual int retrieveGxsMsgMetaData(const std::vector<std::string>& grpIds, GxsMsgMetaResult& msgMeta) = 0;
|
||||
virtual int retrieveGxsMsgMetaData(const std::vector<RsGxsGroupId>& grpIds, GxsMsgMetaResult& msgMeta) = 0;
|
||||
|
||||
/*!
|
||||
* remove msgs in data store listed in msgIds param
|
||||
|
@ -1,3 +1,29 @@
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rsgenexchange.cc
|
||||
*
|
||||
* RetroShare Gxs exchange interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rsgenexchange.h"
|
||||
|
||||
RsGenExchange::RsGenExchange(RsGeneralDataService *gds,
|
||||
@ -31,6 +57,9 @@ void RsGenExchange::tick()
|
||||
|
||||
publishMsgs();
|
||||
|
||||
notifyChanges(mNotifications);
|
||||
mNotifications.clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -61,10 +90,6 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list<RsGroupMetaDat
|
||||
delete (*lit);
|
||||
}
|
||||
|
||||
std::list<RsGxsGrpMetaData*>::iterator cit = metaL.begin();
|
||||
for(; cit != metaL.end(); cit++)
|
||||
delete *cit;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -81,14 +106,20 @@ bool RsGenExchange::getMsgMeta(const uint32_t &token,
|
||||
for(; mit != result.end(); mit++)
|
||||
{
|
||||
std::vector<RsGxsMsgMetaData*>& metaV = mit->second;
|
||||
//msgInfo[mit->first] = metaV;
|
||||
|
||||
msgInfo[mit->first] = std::vector<RsMsgMetaData>();
|
||||
std::vector<RsMsgMetaData>& msgInfoV = msgInfo[mit->first];
|
||||
|
||||
std::vector<RsGxsMsgMetaData*>::iterator vit = metaV.begin();
|
||||
|
||||
RsMsgMetaData meta;
|
||||
for(; vit != metaV.end(); vit++)
|
||||
{
|
||||
RsGxsMsgMetaData& m = *(*vit);
|
||||
meta = m;
|
||||
msgInfoV.push_back(meta);
|
||||
delete *vit;
|
||||
}
|
||||
metaV.clear();
|
||||
}
|
||||
|
||||
return ok;
|
||||
@ -108,9 +139,13 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
|
||||
{
|
||||
RsTlvBinaryData& data = (*lit)->grp;
|
||||
RsItem* item = mSerialiser->deserialise(data.bin_data, &data.bin_len);
|
||||
RsGxsGrpItem* gItem = dynamic_cast<RsGxsGrpItem*>(item);
|
||||
grpItem.push_back(gItem);
|
||||
delete *lit;
|
||||
|
||||
if(item != NULL){
|
||||
RsGxsGrpItem* gItem = dynamic_cast<RsGxsGrpItem*>(item);
|
||||
gItem->meta = *((*lit)->metaData);
|
||||
grpItem.push_back(gItem);
|
||||
delete *lit;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
@ -139,6 +174,7 @@ bool RsGenExchange::getMsgData(const uint32_t &token,
|
||||
RsItem* item = mSerialiser->deserialise(msg->msg.bin_data,
|
||||
&msg->msg.bin_len);
|
||||
RsGxsMsgItem* mItem = dynamic_cast<RsGxsMsgItem*>(item);
|
||||
mItem->meta = *((*vit)->metaData); // get meta info from nxs msg
|
||||
gxsMsgItems.push_back(mItem);
|
||||
delete msg;
|
||||
}
|
||||
@ -165,7 +201,7 @@ void RsGenExchange::notifyNewGroups(std::vector<RsNxsGrp *> &groups)
|
||||
|
||||
}
|
||||
|
||||
void RsGenExchange::notifyNewMessages(std::vector<RsNxsMsg *> messages)
|
||||
void RsGenExchange::notifyNewMessages(std::vector<RsNxsMsg *>& messages)
|
||||
{
|
||||
std::vector<RsNxsMsg*>::iterator vit = messages.begin();
|
||||
|
||||
@ -180,7 +216,6 @@ bool RsGenExchange::publishGroup(RsGxsGrpItem *grpItem)
|
||||
{
|
||||
|
||||
RsStackMutex stack(mGenMtx);
|
||||
|
||||
mGrpsToPublish.push_back(grpItem);
|
||||
|
||||
return true;
|
||||
@ -214,6 +249,7 @@ void RsGenExchange::publishMsgs()
|
||||
if(ok)
|
||||
{
|
||||
msg->metaData = new RsGxsMsgMetaData();
|
||||
*(msg->metaData) = msgItem->meta;
|
||||
ok = mDataAccess->addMsgData(msg);
|
||||
|
||||
if(ok)
|
||||
@ -223,18 +259,23 @@ void RsGenExchange::publishMsgs()
|
||||
}
|
||||
}
|
||||
|
||||
// if addition failed then delete nxs message
|
||||
if(!ok)
|
||||
{
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << "RsGenExchange::publishMsgs() failed to publish msg " << std::endl;
|
||||
std::cerr << "RsGenExchange::publishMsgs() failed to serialise msg " << std::endl;
|
||||
#endif
|
||||
delete msg;
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
delete msgItem;
|
||||
delete msgItem; // delete msg item as we're done with it
|
||||
}
|
||||
|
||||
// clear msg list as we're done publishing them and entries
|
||||
// are invalid
|
||||
mMsgsToPublish.clear();
|
||||
}
|
||||
|
||||
void RsGenExchange::publishGrps()
|
||||
@ -257,6 +298,7 @@ void RsGenExchange::publishGrps()
|
||||
if(ok)
|
||||
{
|
||||
grp->metaData = new RsGxsGrpMetaData();
|
||||
*(grp->metaData) = grpItem->meta;
|
||||
ok = mDataAccess->addGroupData(grp);
|
||||
RsGxsGroupChange* gc = new RsGxsGroupChange();
|
||||
mNotifications.push_back(gc);
|
||||
@ -277,15 +319,21 @@ void RsGenExchange::publishGrps()
|
||||
vit = mGrpsToPublish.erase(vit);
|
||||
}
|
||||
|
||||
// clear grp list as we're done publishing them and entries
|
||||
// are invalid
|
||||
mGrpsToPublish.clear();
|
||||
}
|
||||
void RsGenExchange::processRecvdData()
|
||||
{
|
||||
}
|
||||
void RsGenExchange::processRecvdData() {
|
||||
}
|
||||
|
||||
|
||||
void RsGenExchange::processRecvdMessages() {
|
||||
}
|
||||
void RsGenExchange::processRecvdMessages()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void RsGenExchange::processRecvdGroups() {
|
||||
}
|
||||
void RsGenExchange::processRecvdGroups()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define RSGENEXCHANGE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsphoto.h
|
||||
* libretroshare/src/gxs: rsgenexchange.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
@ -81,7 +81,7 @@ public:
|
||||
/*!
|
||||
* @param messages messages are deleted after function returns
|
||||
*/
|
||||
void notifyNewMessages(std::vector<RsNxsMsg*> messages);
|
||||
void notifyNewMessages(std::vector<RsNxsMsg*>& messages);
|
||||
|
||||
/*!
|
||||
* @param messages messages are deleted after function returns
|
||||
@ -192,7 +192,12 @@ protected:
|
||||
*/
|
||||
virtual void notifyChanges(std::vector<RsGxsNotify*>& changes) = 0;
|
||||
|
||||
public:
|
||||
|
||||
void publishGrps();
|
||||
|
||||
void publishMsgs();
|
||||
|
||||
private:
|
||||
|
||||
void processRecvdData();
|
||||
|
||||
@ -200,10 +205,6 @@ public:
|
||||
|
||||
void processRecvdGroups();
|
||||
|
||||
void publishGrps();
|
||||
|
||||
void publishMsgs();
|
||||
|
||||
private:
|
||||
|
||||
RsMutex mGenMtx;
|
||||
|
@ -4,10 +4,7 @@
|
||||
/*
|
||||
* libretroshare/src/gxs : rsgxs.h
|
||||
*
|
||||
* GXS interface for RetroShare.
|
||||
* Convenience header
|
||||
*
|
||||
* Copyright 2011 Christopher Evi-Parker
|
||||
* Copyright 2012 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
|
||||
@ -25,9 +22,6 @@
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
* This is *THE* auth manager. It provides the web-of-trust via
|
||||
* gpgme, and authenticates the certificates that are managed
|
||||
* by the sublayer AuthSSL.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -39,6 +33,7 @@
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
/* data types used throughout Gxs from netservice to genexchange */
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgReq;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgIdResult;
|
||||
|
@ -1,4 +1,29 @@
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rsgxsdata.cc
|
||||
*
|
||||
* Gxs Data types used to specific services
|
||||
*
|
||||
* Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rsgxsdata.h"
|
||||
#include "serialiser/rsbaseserial.h"
|
||||
|
||||
|
@ -1,6 +1,31 @@
|
||||
#ifndef RSGXSMETA_H
|
||||
#define RSGXSMETA_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rsgxsdata.h
|
||||
*
|
||||
* Gxs Data types used to specific services
|
||||
*
|
||||
* Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "serialiser/rsserial.h"
|
||||
|
@ -41,8 +41,6 @@
|
||||
#define RS_TOKREQOPT_MSG_UPDATED 0x0200 // MSGLIST: Msg that have been updated from specified groups.
|
||||
#define RS_TOKREQOPT_MSG_UPDATED 0x0200 // MSGLIST: Msg that have been updated from specified groups.
|
||||
|
||||
|
||||
|
||||
// Read Status.
|
||||
#define RS_TOKREQOPT_READ 0x0001
|
||||
#define RS_TOKREQOPT_UNREAD 0x0002
|
||||
@ -64,7 +62,7 @@ RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds)
|
||||
}
|
||||
|
||||
|
||||
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts,
|
||||
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts,
|
||||
const std::list<std::string> &groupIds)
|
||||
{
|
||||
GxsRequest* req = NULL;
|
||||
@ -117,7 +115,7 @@ void RsGxsDataAccess::generateToken(uint32_t &token)
|
||||
|
||||
|
||||
bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||
const RsTokReqOptions &opts, const GxsMsgReq &msgIds)
|
||||
const RsTokReqOptionsV2 &opts, const GxsMsgReq &msgIds)
|
||||
{
|
||||
|
||||
GxsRequest* req = NULL;
|
||||
@ -208,7 +206,7 @@ bool RsGxsDataAccess::requestSetMessageStatus(uint32_t& token, const RsGxsGrpMsg
|
||||
return true;
|
||||
}
|
||||
|
||||
void RsGxsDataAccess::setReq(GxsRequest* req, const uint32_t& token, const uint32_t& ansType, const RsTokReqOptions& opts) const
|
||||
void RsGxsDataAccess::setReq(GxsRequest* req, const uint32_t& token, const uint32_t& ansType, const RsTokReqOptionsV2& opts) const
|
||||
{
|
||||
req->token = token;
|
||||
req->ansType = ansType;
|
||||
@ -477,7 +475,7 @@ void RsGxsDataAccess::processRequests()
|
||||
GxsRequest* req = it->second;
|
||||
if (req->status == GXS_REQUEST_STATUS_PENDING)
|
||||
{
|
||||
std::cerr << "p3GxsDataService::fakeprocessrequests() Processing Token: " << req->token << " Status: "
|
||||
std::cerr << "RsGxsDataAccess::processRequests() Processing Token: " << req->token << " Status: "
|
||||
<< req->status << " ReqType: " << req->reqType << " Age: "
|
||||
<< now - req->reqTime << std::endl;
|
||||
|
||||
@ -606,13 +604,10 @@ bool RsGxsDataAccess::getGroupList(GroupIdReq* req)
|
||||
|
||||
bool RsGxsDataAccess::getMsgData(MsgDataReq* req)
|
||||
{
|
||||
|
||||
|
||||
GxsMsgResult result;
|
||||
mDataStore->retrieveNxsMsgs(req->mMsgIds, result, true);
|
||||
|
||||
req->mMsgData = result;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -638,7 +633,7 @@ bool RsGxsDataAccess::getMsgList(MsgIdReq* req)
|
||||
std::vector<RsGxsGroupId> groupIds;
|
||||
GxsMsgReq::iterator mit = req->mMsgIds.begin();
|
||||
|
||||
const RsTokReqOptions& opts = req->Options;
|
||||
const RsTokReqOptionsV2& opts = req->Options;
|
||||
|
||||
for(; mit != req->mMsgIds.end(); mit++)
|
||||
groupIds.push_back(mit->first);
|
||||
@ -796,10 +791,35 @@ bool RsGxsDataAccess::getMsgList(MsgIdReq* req)
|
||||
}
|
||||
|
||||
filterMsgList(req->mMsgIdResult, opts, metaFilter);
|
||||
|
||||
// delete the data
|
||||
cleanseMetaFilter(metaFilter);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RsGxsDataAccess::filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptions& opts,
|
||||
void RsGxsDataAccess::cleanseMetaFilter(MsgMetaFilter& filter)
|
||||
{
|
||||
MsgMetaFilter::iterator mit = filter.begin();
|
||||
|
||||
for(; mit !=filter.end(); mit++)
|
||||
{
|
||||
std::map<RsGxsMessageId, RsGxsMsgMetaData*>& metaM =
|
||||
mit->second;
|
||||
std::map<RsGxsMessageId, RsGxsMsgMetaData*>::iterator mit2
|
||||
= metaM.begin();
|
||||
|
||||
for(; mit2 != metaM.end(); mit2++)
|
||||
{
|
||||
delete mit2->second;
|
||||
}
|
||||
}
|
||||
|
||||
filter.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
void RsGxsDataAccess::filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptionsV2& opts,
|
||||
const MsgMetaFilter& msgMetas) const
|
||||
{
|
||||
|
||||
@ -906,7 +926,7 @@ bool RsGxsDataAccess::updateRequestStatus(const uint32_t& token,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsDataAccess::checkMsgFilter(const RsTokReqOptions& opts, const RsGxsMsgMetaData* meta) const
|
||||
bool RsGxsDataAccess::checkMsgFilter(const RsTokReqOptionsV2& opts, const RsGxsMsgMetaData* meta) const
|
||||
{
|
||||
bool statusMatch = false;
|
||||
if (opts.mStatusMask)
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
* @param groupIds
|
||||
* @return
|
||||
*/
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId> &groupIds);
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &groupIds);
|
||||
|
||||
/*!
|
||||
* For requesting info on all messages of one or more groups
|
||||
@ -61,7 +61,7 @@ public:
|
||||
* @param groupIds
|
||||
* @return
|
||||
*/
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq&);
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq&);
|
||||
|
||||
/*!
|
||||
* This sets the status of the message
|
||||
@ -206,7 +206,7 @@ private:
|
||||
* @param ansType
|
||||
* @param opts
|
||||
*/
|
||||
void setReq(GxsRequest* req,const uint32_t &token, const uint32_t& ansType, const RsTokReqOptions &opts) const;
|
||||
void setReq(GxsRequest* req,const uint32_t &token, const uint32_t& ansType, const RsTokReqOptionsV2 &opts) const;
|
||||
|
||||
/*!
|
||||
* Remove request for request queue
|
||||
@ -242,6 +242,11 @@ private:
|
||||
*/
|
||||
void tokenList(std::list<uint32_t> &tokens);
|
||||
|
||||
/*!
|
||||
* Convenience function to delete the ids
|
||||
* @param filter the meta filter to clean
|
||||
*/
|
||||
void cleanseMetaFilter(MsgMetaFilter& filter);
|
||||
|
||||
private:
|
||||
|
||||
@ -297,7 +302,7 @@ private:
|
||||
* @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;
|
||||
void filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptionsV2& opts, const MsgMetaFilter& meta) const;
|
||||
|
||||
|
||||
/*!
|
||||
@ -307,7 +312,7 @@ private:
|
||||
* @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;
|
||||
bool checkMsgFilter(const RsTokReqOptionsV2& opts, const RsGxsMsgMetaData* meta) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1,3 +1,29 @@
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rsgxnetservice.cc
|
||||
*
|
||||
* Access to rs network and synchronisation service implementation
|
||||
*
|
||||
* Copyright 2012-2012 by 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 "rsgxsnetservice.h"
|
||||
|
||||
#define NXS_NET_DEBUG
|
||||
|
@ -1,6 +1,31 @@
|
||||
#ifndef RSGXSNETSERVICE_H
|
||||
#define RSGXSNETSERVICE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rsgxnetservice.h
|
||||
*
|
||||
* Access to rs network and synchronisation service implementation
|
||||
*
|
||||
* Copyright 2012-2012 by 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 <list>
|
||||
#include <queue>
|
||||
|
||||
|
@ -1,13 +1,30 @@
|
||||
/*
|
||||
* rsgxsrequesttypes.h
|
||||
*
|
||||
* Created on: 21 Jul 2012
|
||||
* Author: crispy
|
||||
*/
|
||||
|
||||
#ifndef RSGXSREQUESTTYPES_H_
|
||||
#define RSGXSREQUESTTYPES_H_
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rgxsrequesttypes.h
|
||||
*
|
||||
* Type introspect request types for data access request implementation
|
||||
*
|
||||
* Copyright 2012-2012 by 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".
|
||||
*
|
||||
*/
|
||||
|
||||
class GxsRequest
|
||||
{
|
||||
@ -21,7 +38,7 @@ public:
|
||||
|
||||
uint32_t ansType;
|
||||
uint32_t reqType;
|
||||
RsTokReqOptions Options;
|
||||
RsTokReqOptionsV2 Options;
|
||||
|
||||
uint32_t status;
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define RSGNP_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxs: rsgnp.h
|
||||
* libretroshare/src/gxs: rsnxs.h
|
||||
*
|
||||
* Network Exchange Service interface for RetroShare.
|
||||
*
|
||||
|
@ -2,9 +2,9 @@
|
||||
#define RSNXSOBSERVER_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxp: gxp.h
|
||||
* libretroshare/src/gxs: rsnxsobserver.h
|
||||
*
|
||||
* Observer, interface for RetroShare.
|
||||
* Observer interface used by nxs to transport new messages to clients
|
||||
*
|
||||
* Copyright 2011-2012 by Robert Fernie, Evi-Parker Christopher
|
||||
*
|
||||
|
@ -66,10 +66,10 @@
|
||||
* This class provides useful generic support for GXS style services.
|
||||
* I expect much of this will be incorporated into the base GXS.
|
||||
*/
|
||||
class RsTokReqOptions
|
||||
class RsTokReqOptionsV2
|
||||
{
|
||||
public:
|
||||
RsTokReqOptions()
|
||||
RsTokReqOptionsV2()
|
||||
{
|
||||
mOptions = 0;
|
||||
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
|
||||
@ -124,7 +124,7 @@ public:
|
||||
* @param groupIds group id to request info for. Leave empty to get info on all groups,
|
||||
* @return
|
||||
*/
|
||||
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId> &groupIds) = 0;
|
||||
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &groupIds) = 0;
|
||||
|
||||
/*!
|
||||
* Use this to get msg related information, store this value to pole for request completion
|
||||
@ -134,7 +134,7 @@ public:
|
||||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return
|
||||
*/
|
||||
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds) = 0;
|
||||
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds) = 0;
|
||||
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ testnetwork {
|
||||
}
|
||||
|
||||
|
||||
#CONFIG += debug
|
||||
CONFIG += debug
|
||||
debug {
|
||||
# DEFINES *= DEBUG
|
||||
# DEFINES *= OPENDHT_DEBUG DHT_DEBUG CONN_DEBUG DEBUG_UDP_SORTER P3DISC_DEBUG DEBUG_UDP_LAYER FT_DEBUG EXTADDRSEARCH_DEBUG
|
||||
@ -678,19 +678,21 @@ HEADERS += serialiser/rsnxsitems.h \
|
||||
gxs/rsgxsdataaccess.h \
|
||||
retroshare/rsgxsservice.h \
|
||||
serialiser/rsgxsitems.h \
|
||||
serialiser/rsphotov2items.h \
|
||||
util/retrodb.h
|
||||
serialiser/rsphotov2items.h \
|
||||
util/retrodb.h \
|
||||
gxs/gxscoreserver.h
|
||||
|
||||
SOURCES += serialiser/rsnxsitems.cc \
|
||||
gxs/rsdataservice.cc \
|
||||
gxs/rsgenexchange.cc \
|
||||
gxs/rsdataservice.cc \
|
||||
gxs/rsgenexchange.cc \
|
||||
gxs/rsgxsnetservice.cc \
|
||||
gxs/rsgxsdata.cc \
|
||||
serialiser/rsgxsitems.cc \
|
||||
services/p3photoserviceV2.cc \
|
||||
gxs/rsgxsdataaccess.cc \
|
||||
serialiser/rsphotov2items.cc \
|
||||
util/retrodb.cc
|
||||
serialiser/rsphotov2items.cc \
|
||||
util/retrodb.cc \
|
||||
gxs/gxscoreserver.cc
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@ class RsGxsNotify
|
||||
{
|
||||
public:
|
||||
RsGxsNotify(){ return; }
|
||||
virtual ~RsGxsNotify() {return; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "rsgxsservice.h"
|
||||
#include "rsphoto.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsPhotoV2;
|
||||
@ -41,20 +42,20 @@ extern RsPhotoV2 *rsPhotoV2;
|
||||
#define RSPHOTO_MODE_OWN 2
|
||||
#define RSPHOTO_MODE_REMOTE 3
|
||||
|
||||
class RsPhotoThumbnail
|
||||
{
|
||||
public:
|
||||
RsPhotoThumbnail()
|
||||
:data(NULL), size(0), type("N/A") { return; }
|
||||
|
||||
bool deleteImage();
|
||||
bool copyFrom(const RsPhotoThumbnail &nail);
|
||||
|
||||
// Holds Thumbnail image.
|
||||
uint8_t *data;
|
||||
int size;
|
||||
std::string type;
|
||||
};
|
||||
//class RsPhotoThumbnail
|
||||
//{
|
||||
// public:
|
||||
// RsPhotoThumbnail()
|
||||
// :data(NULL), size(0), type("N/A") { return; }
|
||||
//
|
||||
// bool deleteImage();
|
||||
// bool copyFrom(const RsPhotoThumbnail &nail);
|
||||
//
|
||||
// // Holds Thumbnail image.
|
||||
// uint8_t *data;
|
||||
// int size;
|
||||
// std::string type;
|
||||
//};
|
||||
|
||||
|
||||
/* If these flags are no set - the Photo inherits values from the Album
|
||||
@ -76,84 +77,84 @@ class RsPhotoThumbnail
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
||||
|
||||
|
||||
class RsPhotoPhoto
|
||||
{
|
||||
public:
|
||||
//class RsPhotoPhoto
|
||||
//{
|
||||
// public:
|
||||
//
|
||||
// RsMsgMetaData mMeta;
|
||||
//
|
||||
// RsPhotoPhoto();
|
||||
//
|
||||
// // THESE ARE IN THE META DATA.
|
||||
// //std::string mAlbumId;
|
||||
// //std::string mId;
|
||||
// //std::string mTitle; // only used by Album.
|
||||
// std::string mCaption;
|
||||
// std::string mDescription;
|
||||
// std::string mPhotographer;
|
||||
// std::string mWhere;
|
||||
// std::string mWhen;
|
||||
// std::string mOther;
|
||||
// std::string mCategory;
|
||||
//
|
||||
// std::string mHashTags;
|
||||
//
|
||||
// uint32_t mSetFlags;
|
||||
//
|
||||
// int mOrder;
|
||||
//
|
||||
// RsPhotoThumbnail mThumbnail;
|
||||
//
|
||||
// int mMode;
|
||||
//
|
||||
// // These are not saved.
|
||||
// std::string path; // if in Mode NEW.
|
||||
// uint32_t mModFlags;
|
||||
//};
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
RsPhotoPhoto();
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
uint32_t mSetFlags;
|
||||
|
||||
int mOrder;
|
||||
|
||||
RsPhotoThumbnail mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
// These are not saved.
|
||||
std::string path; // if in Mode NEW.
|
||||
uint32_t mModFlags;
|
||||
};
|
||||
|
||||
class RsPhotoAlbumShare
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t mShareType;
|
||||
std::string mShareGroupId;
|
||||
std::string mPublishKey;
|
||||
uint32_t mCommentMode;
|
||||
uint32_t mResizeMode;
|
||||
};
|
||||
|
||||
class RsPhotoAlbum
|
||||
{
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
RsPhotoThumbnail mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
std::string mPhotoPath;
|
||||
RsPhotoAlbumShare mShareOptions;
|
||||
|
||||
// These aren't saved.
|
||||
uint32_t mSetFlags;
|
||||
uint32_t mModFlags;
|
||||
};
|
||||
//class RsPhotoAlbumShare
|
||||
//{
|
||||
// public:
|
||||
//
|
||||
// uint32_t mShareType;
|
||||
// std::string mShareGroupId;
|
||||
// std::string mPublishKey;
|
||||
// uint32_t mCommentMode;
|
||||
// uint32_t mResizeMode;
|
||||
//};
|
||||
//
|
||||
//class RsPhotoAlbum
|
||||
//{
|
||||
// public:
|
||||
// RsPhotoAlbum();
|
||||
//
|
||||
// RsGroupMetaData mMeta;
|
||||
//
|
||||
// // THESE ARE IN THE META DATA.
|
||||
// //std::string mAlbumId;
|
||||
// //std::string mTitle; // only used by Album.
|
||||
//
|
||||
// std::string mCaption;
|
||||
// std::string mDescription;
|
||||
// std::string mPhotographer;
|
||||
// std::string mWhere;
|
||||
// std::string mWhen;
|
||||
// std::string mOther;
|
||||
// std::string mCategory;
|
||||
//
|
||||
// std::string mHashTags;
|
||||
//
|
||||
// RsPhotoThumbnail mThumbnail;
|
||||
//
|
||||
// int mMode;
|
||||
//
|
||||
// std::string mPhotoPath;
|
||||
// RsPhotoAlbumShare mShareOptions;
|
||||
//
|
||||
// // These aren't saved.
|
||||
// uint32_t mSetFlags;
|
||||
// uint32_t mModFlags;
|
||||
//};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||
|
@ -1807,6 +1807,15 @@ RsTurtle *rsTurtle = NULL ;
|
||||
#include "turtle/p3turtle.h"
|
||||
|
||||
#define ENABLE_GXS_SERVICES 1
|
||||
#define ENABLE_GXS_CORE 1
|
||||
|
||||
#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/p3photoservice.h"
|
||||
#include "services/p3wikiservice.h"
|
||||
@ -2256,6 +2265,36 @@ int RsServer::StartupRetroShare()
|
||||
mPluginsManager->registerClientServices(pqih) ;
|
||||
mPluginsManager->registerCacheServices() ;
|
||||
|
||||
#ifdef ENABLE_GXS_CORE
|
||||
|
||||
p3PhotoServiceV2 *mPhotoV2 = NULL;
|
||||
|
||||
// first prep the core
|
||||
|
||||
RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db",
|
||||
RS_SERVICE_TYPE_PHOTO, NULL);
|
||||
|
||||
// TODO need net manager
|
||||
//RsGxsNetService* photo_ns = new RsGxsNetService(
|
||||
// RS_SERVICE_TYPE_PHOTO, photo_ds, NULL, mPhotoV2);
|
||||
|
||||
|
||||
// init gxs services
|
||||
mPhotoV2 = new p3PhotoServiceV2(photo_ds, NULL);
|
||||
|
||||
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);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_GXS_SERVICES
|
||||
// Testing New Cache Services.
|
||||
p3PhotoService *mPhotos = new p3PhotoService(RS_SERVICE_TYPE_PHOTO);
|
||||
@ -2543,6 +2582,7 @@ int RsServer::StartupRetroShare()
|
||||
// Testing of new cache system interfaces.
|
||||
rsIdentity = mIdentity;
|
||||
rsPhoto = mPhotos;
|
||||
rsPhotoV2 = mPhotoV2;
|
||||
rsWiki = mWikis;
|
||||
rsWire = mWire;
|
||||
rsForumsV2 = mForumsV2;
|
||||
|
@ -259,7 +259,9 @@ class RsNxsMsg : public RsNxsItem
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsMsg(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_MSG), msg(servtype), meta(servtype) { clear(); return; }
|
||||
RsNxsMsg(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_MSG), msg(servtype), meta(servtype),
|
||||
metaData(NULL) { clear(); return; }
|
||||
~RsNxsMsg() { if(metaData) delete metaData; }
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
@ -95,9 +95,9 @@ RsItem* RsGxsPhotoSerialiser::deserialise(void* data, uint32_t* size)
|
||||
switch(getRsItemSubType(rstype))
|
||||
{
|
||||
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP:
|
||||
case RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM:
|
||||
return deserialiseGxsPhotoPhotoItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM:
|
||||
case RS_PKT_SUBTYPE_PHOTO_ITEM:
|
||||
return deserialiseGxsPhotoAlbumItem(data, size);
|
||||
default:
|
||||
{
|
||||
@ -174,9 +174,9 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoAlbumItem(RsGxsPhotoAlbumItem* item,
|
||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhen);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mThumbnail.type);
|
||||
RsTlvBinaryData b(item->PacketService()); // TODO, need something more persisitent
|
||||
b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size);
|
||||
b.SetTlv(item->album.mThumbnail.data, tlvsize, &offset);
|
||||
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
|
||||
b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size);
|
||||
ok &= b.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
if(offset != tlvsize)
|
||||
{
|
||||
@ -340,9 +340,9 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoPhotoItem(RsGxsPhotoPhotoItem* item,
|
||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhen);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mThumbnail.type);
|
||||
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
|
||||
b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size);
|
||||
b.SetTlv(item->photo.mThumbnail.data, tlvsize, &offset);
|
||||
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
|
||||
b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size);
|
||||
ok &= b.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
if(offset != tlvsize)
|
||||
{
|
||||
|
@ -639,6 +639,7 @@ bool RsPhotoThumbnail::deleteImage()
|
||||
free(data);
|
||||
data = NULL;
|
||||
size = 0;
|
||||
type.clear();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -11,16 +11,37 @@ p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeS
|
||||
|
||||
bool p3PhotoServiceV2::updated()
|
||||
{
|
||||
return false;
|
||||
bool changed = (!mGroupChange.empty() || !mMsgChange.empty());
|
||||
|
||||
std::list<RsGxsGroupId> gL;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
|
||||
groupsChanged(gL);
|
||||
msgsChanged(msgs);
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
void p3PhotoServiceV2::groupsChanged(std::list<std::string>& grpIds) {
|
||||
|
||||
void p3PhotoServiceV2::groupsChanged(std::list<RsGxsGroupId>& grpIds)
|
||||
{
|
||||
while(!mGroupChange.empty())
|
||||
{
|
||||
RsGxsGroupChange* gc = mGroupChange.back();
|
||||
std::list<RsGxsGroupId>& gList = gc->grpIdList;
|
||||
std::list<RsGxsGroupId>::iterator lit = gList.begin();
|
||||
for(; lit != gList.end(); lit++)
|
||||
grpIds.push_back(*lit);
|
||||
|
||||
mGroupChange.pop_back();
|
||||
delete gc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void p3PhotoServiceV2::msgsChanged(
|
||||
std::map<std::string, std::vector<std::string> >& msgs)
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs)
|
||||
{
|
||||
|
||||
}
|
||||
@ -33,7 +54,7 @@ RsTokenServiceV2* p3PhotoServiceV2::getTokenService() {
|
||||
|
||||
|
||||
bool p3PhotoServiceV2::getGroupList(const uint32_t& token,
|
||||
std::list<std::string>& groupIds)
|
||||
std::list<RsGxsGroupId>& groupIds)
|
||||
{
|
||||
return RsGenExchange::getGroupList(token, groupIds);
|
||||
}
|
||||
@ -74,6 +95,7 @@ bool p3PhotoServiceV2::getAlbum(const uint32_t& token, std::vector<RsPhotoAlbum>
|
||||
{
|
||||
RsGxsPhotoAlbumItem* item = dynamic_cast<RsGxsPhotoAlbumItem*>(*vit);
|
||||
RsPhotoAlbum album = item->album;
|
||||
album.mMeta = item->album.mMeta;
|
||||
delete item;
|
||||
albums.push_back(album);
|
||||
}
|
||||
@ -105,6 +127,7 @@ bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photos)
|
||||
if(item)
|
||||
{
|
||||
RsPhotoPhoto photo = item->photo;
|
||||
photo.mMeta = item->meta;
|
||||
photos[grpId].push_back(photo);
|
||||
delete item;
|
||||
}else
|
||||
@ -121,14 +144,45 @@ bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photos)
|
||||
|
||||
bool p3PhotoServiceV2::submitAlbumDetails(RsPhotoAlbum& album)
|
||||
{
|
||||
return false;
|
||||
RsGxsPhotoAlbumItem* albumItem = new RsGxsPhotoAlbumItem();
|
||||
albumItem->album = album;
|
||||
albumItem->meta = album.mMeta;
|
||||
return RsGenExchange::publishGroup(albumItem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void p3PhotoServiceV2::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
||||
{
|
||||
std::vector<RsGxsNotify*>::iterator vit = changes.begin();
|
||||
|
||||
for(; vit != changes.end(); vit++)
|
||||
{
|
||||
RsGxsNotify* n = *vit;
|
||||
RsGxsGroupChange* gc;
|
||||
RsGxsMsgChange* mc;
|
||||
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != NULL)
|
||||
{
|
||||
mMsgChange.push_back(mc);
|
||||
}
|
||||
else if((gc = dynamic_cast<RsGxsGroupChange*>(n)) != NULL)
|
||||
{
|
||||
mGroupChange.push_back(gc);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool p3PhotoServiceV2::submitPhoto(RsPhotoPhoto& photo)
|
||||
{
|
||||
return false;
|
||||
RsGxsPhotoPhotoItem* photoItem = new RsGxsPhotoPhotoItem();
|
||||
photoItem->photo = photo;
|
||||
photoItem->meta = photo.mMeta;
|
||||
|
||||
return RsGenExchange::publishMsg(photoItem);
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,20 +43,23 @@ public:
|
||||
*/
|
||||
bool updated();
|
||||
|
||||
protected:
|
||||
|
||||
void notifyChanges(std::vector<RsGxsNotify*>& changes);
|
||||
public:
|
||||
|
||||
/** Requests **/
|
||||
|
||||
void groupsChanged(std::list<std::string>& grpIds);
|
||||
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
||||
|
||||
|
||||
void msgsChanged(std::map<std::string,
|
||||
std::vector<std::string> >& msgs);
|
||||
void msgsChanged(std::map<RsGxsGroupId,
|
||||
std::vector<RsGxsMessageId> >& msgs);
|
||||
|
||||
RsTokenServiceV2* getTokenService();
|
||||
|
||||
bool getGroupList(const uint32_t &token,
|
||||
std::list<std::string> &groupIds);
|
||||
std::list<RsGxsGroupId> &groupIds);
|
||||
bool getMsgList(const uint32_t &token,
|
||||
GxsMsgIdResult& msgIds);
|
||||
|
||||
@ -77,6 +80,11 @@ public:
|
||||
|
||||
bool submitAlbumDetails(RsPhotoAlbum &album);
|
||||
bool submitPhoto(RsPhotoPhoto &photo);
|
||||
|
||||
private:
|
||||
|
||||
std::vector<RsGxsGroupChange*> mGroupChange;
|
||||
std::vector<RsGxsMsgChange*> mMsgChange;
|
||||
};
|
||||
|
||||
#endif // P3PHOTOSERVICEV2_H
|
||||
|
139
libretroshare/src/tests/serialiser/rsphotoitem_test.cc
Normal file
139
libretroshare/src/tests/serialiser/rsphotoitem_test.cc
Normal file
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* libretroshare/src/test rsphotoitem_test.cc
|
||||
*
|
||||
* Test for photo item serialisation
|
||||
*
|
||||
* Copyright 2012-2012 by 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 "rsphotoitem_test.h"
|
||||
|
||||
|
||||
RsSerialType* init_item(RsGxsPhotoAlbumItem &album)
|
||||
{
|
||||
RsPhotoAlbum& a = album.album;
|
||||
|
||||
randString(SHORT_STR, a.mCaption);
|
||||
randString(SHORT_STR, a.mCategory);
|
||||
randString(SHORT_STR, a.mDescription);
|
||||
randString(SHORT_STR, a.mHashTags);
|
||||
randString(SHORT_STR, a.mOther);
|
||||
randString(SHORT_STR, a.mPhotoPath);
|
||||
randString(SHORT_STR, a.mPhotographer);
|
||||
randString(SHORT_STR, a.mWhen);
|
||||
randString(SHORT_STR, a.mWhere);
|
||||
randString(SHORT_STR, a.mThumbnail.type);
|
||||
std::string rStr;
|
||||
randString(SHORT_STR, rStr);
|
||||
|
||||
a.mThumbnail.data = new uint8_t[SHORT_STR];
|
||||
memcpy(a.mThumbnail.data, rStr.data(), SHORT_STR);
|
||||
a.mThumbnail.size = SHORT_STR;
|
||||
|
||||
return new RsGxsPhotoSerialiser();
|
||||
}
|
||||
|
||||
RsSerialType* init_item(RsGxsPhotoPhotoItem &photo)
|
||||
{
|
||||
|
||||
RsPhotoPhoto& p = photo.photo;
|
||||
|
||||
randString(SHORT_STR, p.mCaption);
|
||||
randString(SHORT_STR, p.mCategory);
|
||||
randString(SHORT_STR, p.mDescription);
|
||||
randString(SHORT_STR, p.mHashTags);
|
||||
randString(SHORT_STR, p.mOther);
|
||||
randString(SHORT_STR, p.mPhotographer);
|
||||
randString(SHORT_STR, p.mWhen);
|
||||
randString(SHORT_STR, p.mWhere);
|
||||
randString(SHORT_STR, p.mThumbnail.type);
|
||||
std::string rStr;
|
||||
randString(SHORT_STR, rStr);
|
||||
|
||||
p.mThumbnail.data = new uint8_t[SHORT_STR];
|
||||
memcpy(p.mThumbnail.data, rStr.data(), SHORT_STR);
|
||||
p.mThumbnail.size = SHORT_STR;
|
||||
|
||||
return new RsGxsPhotoSerialiser();
|
||||
}
|
||||
|
||||
|
||||
bool operator == (RsGxsPhotoAlbumItem& l, RsGxsPhotoAlbumItem& r)
|
||||
{
|
||||
RsPhotoAlbum& la = l.album;
|
||||
RsPhotoAlbum& ra = r.album;
|
||||
|
||||
if(la.mCaption != ra.mCaption) return false;
|
||||
if(la.mCategory != ra.mCategory) return false;
|
||||
if(la.mDescription != ra.mDescription) return false;
|
||||
if(la.mHashTags != ra.mHashTags) return false;
|
||||
if(la.mOther != ra.mOther) return false;
|
||||
if(la.mPhotographer!= ra.mPhotographer) return false;
|
||||
if(la.mPhotoPath != ra.mPhotoPath) return false;
|
||||
if(la.mWhere != ra.mWhere) return false;
|
||||
if(la.mWhen != ra.mWhen) return false;
|
||||
if(!(la.mThumbnail == ra.mThumbnail)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool operator == (RsGxsPhotoPhotoItem& l, RsGxsPhotoPhotoItem& r)
|
||||
{
|
||||
RsPhotoPhoto& la = l.photo;
|
||||
RsPhotoPhoto& ra = r.photo;
|
||||
|
||||
if(la.mCaption != ra.mCaption) return false;
|
||||
if(la.mCategory != ra.mCategory) return false;
|
||||
if(la.mDescription != ra.mDescription) return false;
|
||||
if(la.mHashTags != ra.mHashTags) return false;
|
||||
if(la.mOther != ra.mOther) return false;
|
||||
if(la.mPhotographer!= ra.mPhotographer) return false;
|
||||
if(la.mWhere != ra.mWhere) return false;
|
||||
if(la.mWhen != ra.mWhen) return false;
|
||||
if(!(la.mThumbnail == ra.mThumbnail)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator == (RsPhotoThumbnail& l, RsPhotoThumbnail& r)
|
||||
{
|
||||
if(l.size != r.size) return false;
|
||||
if(l.type != r.type) return false;
|
||||
if(memcmp(l.data, r.data,l.size) != 0) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
INITTEST()
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cerr << "RsPhotoItem Tests" << std::endl;
|
||||
|
||||
test_RsItem<RsGxsPhotoAlbumItem>(); REPORT("Serialise/Deserialise RsGxsPhotoAlbumItem");
|
||||
test_RsItem<RsGxsPhotoPhotoItem>(); REPORT("Serialise/Deserialise RsGxsPhotoPhotoItem");
|
||||
|
||||
FINALREPORT("RsPhotoItem Tests");
|
||||
|
||||
return TESTRESULT();
|
||||
}
|
41
libretroshare/src/tests/serialiser/rsphotoitem_test.h
Normal file
41
libretroshare/src/tests/serialiser/rsphotoitem_test.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* libretroshare/src/test rsphotoitem_test.h
|
||||
*
|
||||
* Test for photo item serialisation
|
||||
*
|
||||
* Copyright 2012-2012 by 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".
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RSPHOTOITEM_TEST_H_
|
||||
#define RSPHOTOITEM_TEST_H_
|
||||
|
||||
#include "serialiser/rsphotov2items.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
|
||||
RsSerialType* init_item(RsGxsPhotoAlbumItem& album);
|
||||
RsSerialType* init_item(RsGxsPhotoPhotoItem& photo);
|
||||
|
||||
bool operator == (RsGxsPhotoAlbumItem& l, RsGxsPhotoAlbumItem& r);
|
||||
bool operator == (RsGxsPhotoPhotoItem& l, RsGxsPhotoPhotoItem& r);
|
||||
bool operator == (RsPhotoThumbnail& l, RsPhotoThumbnail& r);
|
||||
|
||||
#endif /* RSPHOTOITEM_TEST_H_ */
|
@ -476,9 +476,9 @@ void PhotoAddDialog::loadAlbum(const std::string &albumId)
|
||||
clearDialog();
|
||||
mAlbumEdit = true;
|
||||
|
||||
RsTokReqOptions opts;
|
||||
RsTokReqOptionsV2 opts;
|
||||
uint32_t token;
|
||||
std::list<RsGxsGroupId> albumIds;
|
||||
std::list<RsGxsGroupId> albumIds;
|
||||
albumIds.push_back(albumId);
|
||||
|
||||
// We need both Album and Photo Data.
|
||||
@ -493,27 +493,28 @@ bool PhotoAddDialog::loadPhotoData(const uint32_t &token)
|
||||
std::cerr << "PhotoAddDialog::loadPhotoData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
PhotoResult res;
|
||||
RsPhotoPhoto photo;
|
||||
|
||||
if (rsPhotoV2->getPhoto(token, res))
|
||||
{
|
||||
std::cerr << "PhotoDialog::addAddPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
PhotoResult res;
|
||||
rsPhotoV2->getPhoto(token, res);
|
||||
PhotoResult::iterator mit = res.begin();
|
||||
|
||||
|
||||
for(; mit != res.end(); mit++)
|
||||
{
|
||||
std::vector<RsPhotoPhoto>& photoV = mit->second;
|
||||
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
|
||||
|
||||
for(; vit != photoV.end(); vit++)
|
||||
{
|
||||
RsPhotoPhoto& photo = *vit;
|
||||
PhotoItem *item = new PhotoItem(NULL, photo, mAlbumData);
|
||||
ui.scrollAreaWidgetContents->addPhotoItem(item);
|
||||
|
||||
std::cerr << "PhotoAddDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
PhotoItem *item = new PhotoItem(NULL, photo, mAlbumData);
|
||||
ui.scrollAreaWidgetContents->addPhotoItem(item);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -521,32 +522,32 @@ bool PhotoAddDialog::loadAlbumData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PhotoAddDialog::loadAlbumData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
std::vector<RsPhotoAlbum> albums;
|
||||
RsPhotoAlbum album;
|
||||
if (rsPhotoV2->getAlbum(token, albums))
|
||||
{
|
||||
std::cerr << " PhotoAddDialog::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
updateAlbumDetails(album);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
std::list<std::string> albumIds;
|
||||
albumIds.push_back(album.mMeta.mGroupId);
|
||||
GxsMsgReq req;
|
||||
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
std::vector<RsPhotoAlbum> albums;
|
||||
rsPhotoV2->getAlbum(token, albums);
|
||||
|
||||
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
|
||||
|
||||
GxsMsgReq req;
|
||||
|
||||
for(; vit != albums.end(); vit++)
|
||||
{
|
||||
RsPhotoAlbum& album = *vit;
|
||||
|
||||
std::cerr << "PhotoAddDialog::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
//updateAlbumDetails(album);
|
||||
|
||||
uint32_t token;
|
||||
std::list<std::string> albumIds;
|
||||
albumIds.push_back(album.mMeta.mGroupId);
|
||||
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
|
||||
|
||||
}
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t t;
|
||||
mPhotoQueue->requestMsgInfo(t, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PhotoAddDialog::loadCreatedAlbum(const uint32_t &token)
|
||||
|
@ -431,7 +431,7 @@ void PhotoDialog::requestAlbumList()
|
||||
{
|
||||
|
||||
std::list<std::string> ids;
|
||||
RsTokReqOptions opts;
|
||||
RsTokReqOptionsV2 opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||
}
|
||||
@ -454,13 +454,12 @@ void PhotoDialog::loadAlbumList(const uint32_t &token)
|
||||
{
|
||||
requestPhotoList(*it);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::requestAlbumData(std::list<std::string> &ids)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
RsTokReqOptionsV2 opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||
}
|
||||
@ -473,25 +472,21 @@ bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
||||
|
||||
clearAlbums();
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPhotoAlbum album;
|
||||
std::vector<RsPhotoAlbum> albums;
|
||||
if (rsPhotoV2->getAlbum(token, albums))
|
||||
{
|
||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
std::vector<RsPhotoAlbum> albums;
|
||||
rsPhotoV2->getAlbum(token, albums);
|
||||
|
||||
PhotoItem *item = new PhotoItem(this, album);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
alayout->addWidget(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
|
||||
|
||||
for(; vit != albums.end(); vit++)
|
||||
{
|
||||
RsPhotoAlbum& album = *vit;
|
||||
|
||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
|
||||
PhotoItem *item = new PhotoItem(this, album);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
alayout->addWidget(item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -499,10 +494,9 @@ bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
||||
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
||||
{
|
||||
|
||||
std::list<std::string> ids;
|
||||
GxsMsgReq req;
|
||||
req[albumId] = std::vector<RsGxsMessageId>();
|
||||
RsTokReqOptions opts;
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
|
||||
@ -527,7 +521,7 @@ void PhotoDialog::loadPhotoList(const uint32_t &token)
|
||||
|
||||
void PhotoDialog::requestPhotoData(GxsMsgReq &photoIds)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
RsTokReqOptionsV2 opts;
|
||||
uint32_t token;
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
||||
}
|
||||
@ -538,25 +532,25 @@ void PhotoDialog::loadPhotoData(const uint32_t &token)
|
||||
std::cerr << "PhotoDialog::loadPhotoData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPhotoPhoto photo;
|
||||
PhotoResult res;
|
||||
if (rsPhotoV2->getPhoto(token, res))
|
||||
{
|
||||
PhotoResult res;
|
||||
rsPhotoV2->getPhoto(token, res);
|
||||
PhotoResult::iterator mit = res.begin();
|
||||
|
||||
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
addPhoto(photo);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
for(; mit != res.end(); mit++)
|
||||
{
|
||||
std::vector<RsPhotoPhoto>& photoV = mit->second;
|
||||
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
|
||||
|
||||
for(; vit != photoV.end(); vit++)
|
||||
{
|
||||
RsPhotoPhoto& photo = *vit;
|
||||
addPhoto(photo);
|
||||
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -244,7 +244,7 @@ void PhotoSlideShow::loadAlbum(const std::string &albumId)
|
||||
/* much like main load fns */
|
||||
clearDialog();
|
||||
|
||||
RsTokReqOptions opts;
|
||||
RsTokReqOptionsV2 opts;
|
||||
uint32_t token;
|
||||
std::list<std::string> albumIds;
|
||||
albumIds.push_back(albumId);
|
||||
@ -261,31 +261,34 @@ bool PhotoSlideShow::loadPhotoData(const uint32_t &token)
|
||||
std::cerr << "PhotoSlideShow::loadPhotoData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPhotoPhoto photo;
|
||||
PhotoResult res;
|
||||
|
||||
if (rsPhotoV2->getPhoto(token, res))
|
||||
{
|
||||
RsPhotoPhoto *ptr = new RsPhotoPhoto;
|
||||
*ptr = photo;
|
||||
ptr->mThumbnail.data = 0;
|
||||
ptr->mThumbnail.copyFrom(photo.mThumbnail);
|
||||
PhotoResult res;
|
||||
rsPhotoV2->getPhoto(token, res);
|
||||
PhotoResult::iterator mit = res.begin();
|
||||
|
||||
mPhotos[photo.mMeta.mMsgId] = ptr;
|
||||
mPhotoOrder[ptr->mOrder] = photo.mMeta.mMsgId;
|
||||
|
||||
std::cerr << "PhotoSlideShow::addAddPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
for(; mit != res.end(); mit++)
|
||||
{
|
||||
std::vector<RsPhotoPhoto>& photoV = mit->second;
|
||||
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
|
||||
|
||||
for(; vit != photoV.end(); vit++)
|
||||
{
|
||||
RsPhotoPhoto& photo = *vit;
|
||||
RsPhotoPhoto *ptr = new RsPhotoPhoto;
|
||||
*ptr = photo;
|
||||
ptr->mThumbnail.data = 0;
|
||||
ptr->mThumbnail.copyFrom(photo.mThumbnail);
|
||||
|
||||
mPhotos[photo.mMeta.mMsgId] = ptr;
|
||||
mPhotoOrder[ptr->mOrder] = photo.mMeta.mMsgId;
|
||||
|
||||
std::cerr << "PhotoSlideShow::addAddPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Load and Start.
|
||||
loadImage();
|
||||
@ -299,30 +302,30 @@ bool PhotoSlideShow::loadAlbumData(const uint32_t &token)
|
||||
std::cerr << "PhotoSlideShow::loadAlbumData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPhotoAlbum album;
|
||||
std::vector<RsPhotoAlbum> res;
|
||||
if (rsPhotoV2->getAlbum(token, res))
|
||||
{
|
||||
std::cerr << " PhotoSlideShow::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
//updateAlbumDetails(album);
|
||||
std::vector<RsPhotoAlbum> albums;
|
||||
rsPhotoV2->getAlbum(token, albums);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
std::list<std::string> albumIds;
|
||||
albumIds.push_back(album.mMeta.mGroupId);
|
||||
GxsMsgReq req;
|
||||
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
|
||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
|
||||
|
||||
GxsMsgReq req;
|
||||
|
||||
for(; vit != albums.end(); vit++)
|
||||
{
|
||||
RsPhotoAlbum& album = *vit;
|
||||
|
||||
std::cerr << " PhotoSlideShow::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||
//updateAlbumDetails(album);
|
||||
uint32_t token;
|
||||
std::list<std::string> albumIds;
|
||||
albumIds.push_back(album.mMeta.mGroupId);
|
||||
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
|
||||
|
||||
}
|
||||
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t t;
|
||||
mPhotoQueue->requestMsgInfo(t, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include <retroshare/rsiface.h>
|
||||
|
||||
//#include "gui/PhotoShare/PhotoDialog.h"
|
||||
#include "gui/PhotoShare/PhotoDialog.h"
|
||||
#include "gui/WikiPoos/WikiDialog.h"
|
||||
#include "gui/TheWire/WireDialog.h"
|
||||
#include "gui/Identity/IdDialog.h"
|
||||
@ -97,9 +97,9 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||
ui.stackPages->add(idDialog = new IdDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_LIBRARY), tr("Identities"), grp));
|
||||
|
||||
//PhotoDialog *photoDialog = NULL;
|
||||
//ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
|
||||
// createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
|
||||
PhotoDialog *photoDialog = NULL;
|
||||
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
|
||||
|
||||
WikiDialog *wikiDialog = NULL;
|
||||
ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
|
||||
|
@ -38,7 +38,7 @@ TokenQueueV2::TokenQueueV2(RsTokenServiceV2 *service, TokenResponseV2 *resp)
|
||||
return;
|
||||
}
|
||||
|
||||
bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, std::list<RsGxsGroupId>& ids, uint32_t usertype)
|
||||
bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &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::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, const GxsMsgReq& ids, uint32_t usertype)
|
||||
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, const GxsMsgReq& ids, uint32_t usertype)
|
||||
{
|
||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||
mService->requestMsgInfo(token, anstype, opts, ids);
|
||||
|
@ -21,8 +21,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MRK_TOKEN_QUEUE_H
|
||||
#define MRK_TOKEN_QUEUE_H
|
||||
#ifndef MRK_TOKEN_QUEUE_V2_H
|
||||
#define MRK_TOKEN_QUEUE_V2_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
@ -70,9 +70,9 @@ public:
|
||||
TokenQueueV2(RsTokenServiceV2 *service, TokenResponseV2 *resp);
|
||||
|
||||
/* generic handling of token / response update behaviour */
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
||||
std::list<RsGxsGroupId>& ids, uint32_t usertype);
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
|
||||
const GxsMsgReq& ids, uint32_t usertype);
|
||||
|
||||
bool cancelRequest(const uint32_t token);
|
||||
|
Loading…
Reference in New Issue
Block a user