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"
|
#include "gxscoreserver.h"
|
||||||
|
|
||||||
GxsCoreServer::GxsCoreServer()
|
GxsCoreServer::GxsCoreServer()
|
||||||
|
@ -1,17 +1,37 @@
|
|||||||
/*
|
|
||||||
* gxscoreserver.h
|
|
||||||
*
|
|
||||||
* Created on: 24 Jul 2012
|
|
||||||
* Author: crispy
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GXSCORESERVER_H_
|
#ifndef GXSCORESERVER_H_
|
||||||
#define 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 "util/rsthreads.h"
|
||||||
#include "gxs/rsgxs.h"
|
#include "gxs/rsgxs.h"
|
||||||
|
|
||||||
class GxsCoreServer : RsThread {
|
class GxsCoreServer : public RsThread
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
GxsCoreServer();
|
GxsCoreServer();
|
||||||
~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 <fstream>
|
||||||
|
|
||||||
#include "rsdataservice.h"
|
#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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,31 @@
|
|||||||
#ifndef RSDATASERVICE_H
|
#ifndef RSDATASERVICE_H
|
||||||
#define 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 "gxs/rsgds.h"
|
||||||
#include "util/retrodb.h"
|
#include "util/retrodb.h"
|
||||||
|
|
||||||
@ -10,7 +35,7 @@ class RsDataService : public RsGeneralDataService
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
RsDataService(const std::string& serviceDir, const std::string& dbName, uint16_t serviceType, RsGxsSearchModule* mod = NULL);
|
RsDataService(const std::string& serviceDir, const std::string& dbName, uint16_t serviceType, RsGxsSearchModule* mod = NULL);
|
||||||
virtual ~RsDataService() ;
|
virtual ~RsDataService();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Retrieves all msgs
|
* Retrieves all msgs
|
||||||
@ -36,7 +61,7 @@ public:
|
|||||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||||
* @return error code
|
* @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)
|
* 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
|
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||||
* @return error code
|
* @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
|
* remove msgs in data store
|
||||||
@ -53,14 +78,14 @@ public:
|
|||||||
* @param msgIds ids of messages to be removed
|
* @param msgIds ids of messages to be removed
|
||||||
* @return error code
|
* @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
|
* remove groups in data store listed in grpIds param
|
||||||
* @param grpIds ids of groups to be removed
|
* @param grpIds ids of groups to be removed
|
||||||
* @return error code
|
* @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
|
* @return the cache size set for this RsGeneralDataService in bytes
|
||||||
@ -117,11 +142,11 @@ private:
|
|||||||
void retrieveMessages(RetroCursor* c, std::vector<RsNxsMsg*>& msgs);
|
void retrieveMessages(RetroCursor* c, std::vector<RsNxsMsg*>& msgs);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Retrieves all the msg results from a cursor
|
* Retrieves all the msg results from a cursor
|
||||||
* @param c cursor to result set
|
* @param c cursor to result set
|
||||||
* @param msgs messages retrieved from cursor are stored here
|
* @param msgs messages retrieved from cursor are stored here
|
||||||
*/
|
*/
|
||||||
void retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>& grps, bool withMeta = false);
|
void retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>& grps, bool withMeta = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* extracts a msg meta item from a cursor at its
|
* extracts a msg meta item from a cursor at its
|
||||||
|
@ -108,7 +108,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* Retrieves all groups stored
|
* Retrieves all groups stored
|
||||||
* @param grp retrieved groups
|
* @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
|
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
@ -130,7 +130,7 @@ public:
|
|||||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||||
* @return error code
|
* @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
|
* 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"
|
#include "rsgenexchange.h"
|
||||||
|
|
||||||
RsGenExchange::RsGenExchange(RsGeneralDataService *gds,
|
RsGenExchange::RsGenExchange(RsGeneralDataService *gds,
|
||||||
@ -31,6 +57,9 @@ void RsGenExchange::tick()
|
|||||||
|
|
||||||
publishMsgs();
|
publishMsgs();
|
||||||
|
|
||||||
|
notifyChanges(mNotifications);
|
||||||
|
mNotifications.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -61,10 +90,6 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list<RsGroupMetaDat
|
|||||||
delete (*lit);
|
delete (*lit);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsGxsGrpMetaData*>::iterator cit = metaL.begin();
|
|
||||||
for(; cit != metaL.end(); cit++)
|
|
||||||
delete *cit;
|
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,14 +106,20 @@ bool RsGenExchange::getMsgMeta(const uint32_t &token,
|
|||||||
for(; mit != result.end(); mit++)
|
for(; mit != result.end(); mit++)
|
||||||
{
|
{
|
||||||
std::vector<RsGxsMsgMetaData*>& metaV = mit->second;
|
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();
|
std::vector<RsGxsMsgMetaData*>::iterator vit = metaV.begin();
|
||||||
|
RsMsgMetaData meta;
|
||||||
for(; vit != metaV.end(); vit++)
|
for(; vit != metaV.end(); vit++)
|
||||||
{
|
{
|
||||||
|
RsGxsMsgMetaData& m = *(*vit);
|
||||||
|
meta = m;
|
||||||
|
msgInfoV.push_back(meta);
|
||||||
delete *vit;
|
delete *vit;
|
||||||
}
|
}
|
||||||
|
metaV.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
@ -108,9 +139,13 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
|
|||||||
{
|
{
|
||||||
RsTlvBinaryData& data = (*lit)->grp;
|
RsTlvBinaryData& data = (*lit)->grp;
|
||||||
RsItem* item = mSerialiser->deserialise(data.bin_data, &data.bin_len);
|
RsItem* item = mSerialiser->deserialise(data.bin_data, &data.bin_len);
|
||||||
RsGxsGrpItem* gItem = dynamic_cast<RsGxsGrpItem*>(item);
|
|
||||||
grpItem.push_back(gItem);
|
if(item != NULL){
|
||||||
delete *lit;
|
RsGxsGrpItem* gItem = dynamic_cast<RsGxsGrpItem*>(item);
|
||||||
|
gItem->meta = *((*lit)->metaData);
|
||||||
|
grpItem.push_back(gItem);
|
||||||
|
delete *lit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@ -139,6 +174,7 @@ bool RsGenExchange::getMsgData(const uint32_t &token,
|
|||||||
RsItem* item = mSerialiser->deserialise(msg->msg.bin_data,
|
RsItem* item = mSerialiser->deserialise(msg->msg.bin_data,
|
||||||
&msg->msg.bin_len);
|
&msg->msg.bin_len);
|
||||||
RsGxsMsgItem* mItem = dynamic_cast<RsGxsMsgItem*>(item);
|
RsGxsMsgItem* mItem = dynamic_cast<RsGxsMsgItem*>(item);
|
||||||
|
mItem->meta = *((*vit)->metaData); // get meta info from nxs msg
|
||||||
gxsMsgItems.push_back(mItem);
|
gxsMsgItems.push_back(mItem);
|
||||||
delete msg;
|
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();
|
std::vector<RsNxsMsg*>::iterator vit = messages.begin();
|
||||||
|
|
||||||
@ -180,7 +216,6 @@ bool RsGenExchange::publishGroup(RsGxsGrpItem *grpItem)
|
|||||||
{
|
{
|
||||||
|
|
||||||
RsStackMutex stack(mGenMtx);
|
RsStackMutex stack(mGenMtx);
|
||||||
|
|
||||||
mGrpsToPublish.push_back(grpItem);
|
mGrpsToPublish.push_back(grpItem);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -214,6 +249,7 @@ void RsGenExchange::publishMsgs()
|
|||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
msg->metaData = new RsGxsMsgMetaData();
|
msg->metaData = new RsGxsMsgMetaData();
|
||||||
|
*(msg->metaData) = msgItem->meta;
|
||||||
ok = mDataAccess->addMsgData(msg);
|
ok = mDataAccess->addMsgData(msg);
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
@ -223,18 +259,23 @@ void RsGenExchange::publishMsgs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if addition failed then delete nxs message
|
||||||
if(!ok)
|
if(!ok)
|
||||||
{
|
{
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#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
|
#endif
|
||||||
delete msg;
|
delete msg;
|
||||||
continue;
|
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()
|
void RsGenExchange::publishGrps()
|
||||||
@ -257,6 +298,7 @@ void RsGenExchange::publishGrps()
|
|||||||
if(ok)
|
if(ok)
|
||||||
{
|
{
|
||||||
grp->metaData = new RsGxsGrpMetaData();
|
grp->metaData = new RsGxsGrpMetaData();
|
||||||
|
*(grp->metaData) = grpItem->meta;
|
||||||
ok = mDataAccess->addGroupData(grp);
|
ok = mDataAccess->addGroupData(grp);
|
||||||
RsGxsGroupChange* gc = new RsGxsGroupChange();
|
RsGxsGroupChange* gc = new RsGxsGroupChange();
|
||||||
mNotifications.push_back(gc);
|
mNotifications.push_back(gc);
|
||||||
@ -277,15 +319,21 @@ void RsGenExchange::publishGrps()
|
|||||||
vit = mGrpsToPublish.erase(vit);
|
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
|
#define RSGENEXCHANGE_H
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* libretroshare/src/retroshare: rsphoto.h
|
* libretroshare/src/gxs: rsgenexchange.h
|
||||||
*
|
*
|
||||||
* RetroShare C++ Interface.
|
* RetroShare C++ Interface.
|
||||||
*
|
*
|
||||||
@ -81,7 +81,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* @param messages messages are deleted after function returns
|
* @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
|
* @param messages messages are deleted after function returns
|
||||||
@ -192,7 +192,12 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void notifyChanges(std::vector<RsGxsNotify*>& changes) = 0;
|
virtual void notifyChanges(std::vector<RsGxsNotify*>& changes) = 0;
|
||||||
|
|
||||||
public:
|
|
||||||
|
void publishGrps();
|
||||||
|
|
||||||
|
void publishMsgs();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
void processRecvdData();
|
void processRecvdData();
|
||||||
|
|
||||||
@ -200,10 +205,6 @@ public:
|
|||||||
|
|
||||||
void processRecvdGroups();
|
void processRecvdGroups();
|
||||||
|
|
||||||
void publishGrps();
|
|
||||||
|
|
||||||
void publishMsgs();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
RsMutex mGenMtx;
|
RsMutex mGenMtx;
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
/*
|
/*
|
||||||
* libretroshare/src/gxs : rsgxs.h
|
* libretroshare/src/gxs : rsgxs.h
|
||||||
*
|
*
|
||||||
* GXS interface for RetroShare.
|
* Copyright 2012 Christopher Evi-Parker
|
||||||
* Convenience header
|
|
||||||
*
|
|
||||||
* Copyright 2011 Christopher Evi-Parker
|
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* 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".
|
* 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 <set>
|
||||||
#include <map>
|
#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> > GxsMsgReq;
|
||||||
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgIdResult;
|
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 "rsgxsdata.h"
|
||||||
#include "serialiser/rsbaseserial.h"
|
#include "serialiser/rsbaseserial.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,31 @@
|
|||||||
#ifndef RSGXSMETA_H
|
#ifndef RSGXSMETA_H
|
||||||
#define 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 <string>
|
||||||
|
|
||||||
#include "serialiser/rsserial.h"
|
#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.
|
||||||
#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.
|
// Read Status.
|
||||||
#define RS_TOKREQOPT_READ 0x0001
|
#define RS_TOKREQOPT_READ 0x0001
|
||||||
#define RS_TOKREQOPT_UNREAD 0x0002
|
#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)
|
const std::list<std::string> &groupIds)
|
||||||
{
|
{
|
||||||
GxsRequest* req = NULL;
|
GxsRequest* req = NULL;
|
||||||
@ -117,7 +115,7 @@ void RsGxsDataAccess::generateToken(uint32_t &token)
|
|||||||
|
|
||||||
|
|
||||||
bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||||
const RsTokReqOptions &opts, const GxsMsgReq &msgIds)
|
const RsTokReqOptionsV2 &opts, const GxsMsgReq &msgIds)
|
||||||
{
|
{
|
||||||
|
|
||||||
GxsRequest* req = NULL;
|
GxsRequest* req = NULL;
|
||||||
@ -208,7 +206,7 @@ bool RsGxsDataAccess::requestSetMessageStatus(uint32_t& token, const RsGxsGrpMsg
|
|||||||
return true;
|
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->token = token;
|
||||||
req->ansType = ansType;
|
req->ansType = ansType;
|
||||||
@ -477,7 +475,7 @@ void RsGxsDataAccess::processRequests()
|
|||||||
GxsRequest* req = it->second;
|
GxsRequest* req = it->second;
|
||||||
if (req->status == GXS_REQUEST_STATUS_PENDING)
|
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: "
|
<< req->status << " ReqType: " << req->reqType << " Age: "
|
||||||
<< now - req->reqTime << std::endl;
|
<< now - req->reqTime << std::endl;
|
||||||
|
|
||||||
@ -606,13 +604,10 @@ bool RsGxsDataAccess::getGroupList(GroupIdReq* req)
|
|||||||
|
|
||||||
bool RsGxsDataAccess::getMsgData(MsgDataReq* req)
|
bool RsGxsDataAccess::getMsgData(MsgDataReq* req)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
GxsMsgResult result;
|
GxsMsgResult result;
|
||||||
mDataStore->retrieveNxsMsgs(req->mMsgIds, result, true);
|
mDataStore->retrieveNxsMsgs(req->mMsgIds, result, true);
|
||||||
|
|
||||||
req->mMsgData = result;
|
req->mMsgData = result;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +633,7 @@ bool RsGxsDataAccess::getMsgList(MsgIdReq* req)
|
|||||||
std::vector<RsGxsGroupId> groupIds;
|
std::vector<RsGxsGroupId> groupIds;
|
||||||
GxsMsgReq::iterator mit = req->mMsgIds.begin();
|
GxsMsgReq::iterator mit = req->mMsgIds.begin();
|
||||||
|
|
||||||
const RsTokReqOptions& opts = req->Options;
|
const RsTokReqOptionsV2& opts = req->Options;
|
||||||
|
|
||||||
for(; mit != req->mMsgIds.end(); mit++)
|
for(; mit != req->mMsgIds.end(); mit++)
|
||||||
groupIds.push_back(mit->first);
|
groupIds.push_back(mit->first);
|
||||||
@ -796,10 +791,35 @@ bool RsGxsDataAccess::getMsgList(MsgIdReq* req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
filterMsgList(req->mMsgIdResult, opts, metaFilter);
|
filterMsgList(req->mMsgIdResult, opts, metaFilter);
|
||||||
|
|
||||||
|
// delete the data
|
||||||
|
cleanseMetaFilter(metaFilter);
|
||||||
|
|
||||||
return true;
|
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
|
const MsgMetaFilter& msgMetas) const
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -906,7 +926,7 @@ bool RsGxsDataAccess::updateRequestStatus(const uint32_t& token,
|
|||||||
return true;
|
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;
|
bool statusMatch = false;
|
||||||
if (opts.mStatusMask)
|
if (opts.mStatusMask)
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
* @param groupIds
|
* @param groupIds
|
||||||
* @return
|
* @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
|
* For requesting info on all messages of one or more groups
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
* @param groupIds
|
* @param groupIds
|
||||||
* @return
|
* @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
|
* This sets the status of the message
|
||||||
@ -206,7 +206,7 @@ private:
|
|||||||
* @param ansType
|
* @param ansType
|
||||||
* @param opts
|
* @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
|
* Remove request for request queue
|
||||||
@ -242,6 +242,11 @@ private:
|
|||||||
*/
|
*/
|
||||||
void tokenList(std::list<uint32_t> &tokens);
|
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:
|
private:
|
||||||
|
|
||||||
@ -297,7 +302,7 @@ private:
|
|||||||
* @param opts the request options set by user
|
* @param opts the request options set by user
|
||||||
* @param meta The accompanying meta information for msg, ids
|
* @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
|
* @param meta meta containing currently defined options for msg
|
||||||
* @return true if msg meta passes all options
|
* @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:
|
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"
|
#include "rsgxsnetservice.h"
|
||||||
|
|
||||||
#define NXS_NET_DEBUG
|
#define NXS_NET_DEBUG
|
||||||
|
@ -1,6 +1,31 @@
|
|||||||
#ifndef RSGXSNETSERVICE_H
|
#ifndef RSGXSNETSERVICE_H
|
||||||
#define 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 <list>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
|
@ -1,13 +1,30 @@
|
|||||||
/*
|
|
||||||
* rsgxsrequesttypes.h
|
|
||||||
*
|
|
||||||
* Created on: 21 Jul 2012
|
|
||||||
* Author: crispy
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RSGXSREQUESTTYPES_H_
|
#ifndef RSGXSREQUESTTYPES_H_
|
||||||
#define 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
|
class GxsRequest
|
||||||
{
|
{
|
||||||
@ -21,7 +38,7 @@ public:
|
|||||||
|
|
||||||
uint32_t ansType;
|
uint32_t ansType;
|
||||||
uint32_t reqType;
|
uint32_t reqType;
|
||||||
RsTokReqOptions Options;
|
RsTokReqOptionsV2 Options;
|
||||||
|
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define RSGNP_H
|
#define RSGNP_H
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* libretroshare/src/gxs: rsgnp.h
|
* libretroshare/src/gxs: rsnxs.h
|
||||||
*
|
*
|
||||||
* Network Exchange Service interface for RetroShare.
|
* Network Exchange Service interface for RetroShare.
|
||||||
*
|
*
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#define RSNXSOBSERVER_H
|
#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
|
* Copyright 2011-2012 by Robert Fernie, Evi-Parker Christopher
|
||||||
*
|
*
|
||||||
|
@ -66,10 +66,10 @@
|
|||||||
* This class provides useful generic support for GXS style services.
|
* This class provides useful generic support for GXS style services.
|
||||||
* I expect much of this will be incorporated into the base GXS.
|
* I expect much of this will be incorporated into the base GXS.
|
||||||
*/
|
*/
|
||||||
class RsTokReqOptions
|
class RsTokReqOptionsV2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsTokReqOptions()
|
RsTokReqOptionsV2()
|
||||||
{
|
{
|
||||||
mOptions = 0;
|
mOptions = 0;
|
||||||
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 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,
|
* @param groupIds group id to request info for. Leave empty to get info on all groups,
|
||||||
* @return
|
* @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
|
* 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
|
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||||
* @return
|
* @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 {
|
debug {
|
||||||
# DEFINES *= DEBUG
|
# DEFINES *= DEBUG
|
||||||
# DEFINES *= OPENDHT_DEBUG DHT_DEBUG CONN_DEBUG DEBUG_UDP_SORTER P3DISC_DEBUG DEBUG_UDP_LAYER FT_DEBUG EXTADDRSEARCH_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 \
|
gxs/rsgxsdataaccess.h \
|
||||||
retroshare/rsgxsservice.h \
|
retroshare/rsgxsservice.h \
|
||||||
serialiser/rsgxsitems.h \
|
serialiser/rsgxsitems.h \
|
||||||
serialiser/rsphotov2items.h \
|
serialiser/rsphotov2items.h \
|
||||||
util/retrodb.h
|
util/retrodb.h \
|
||||||
|
gxs/gxscoreserver.h
|
||||||
|
|
||||||
SOURCES += serialiser/rsnxsitems.cc \
|
SOURCES += serialiser/rsnxsitems.cc \
|
||||||
gxs/rsdataservice.cc \
|
gxs/rsdataservice.cc \
|
||||||
gxs/rsgenexchange.cc \
|
gxs/rsgenexchange.cc \
|
||||||
gxs/rsgxsnetservice.cc \
|
gxs/rsgxsnetservice.cc \
|
||||||
gxs/rsgxsdata.cc \
|
gxs/rsgxsdata.cc \
|
||||||
serialiser/rsgxsitems.cc \
|
serialiser/rsgxsitems.cc \
|
||||||
services/p3photoserviceV2.cc \
|
services/p3photoserviceV2.cc \
|
||||||
gxs/rsgxsdataaccess.cc \
|
gxs/rsgxsdataaccess.cc \
|
||||||
serialiser/rsphotov2items.cc \
|
serialiser/rsphotov2items.cc \
|
||||||
util/retrodb.cc
|
util/retrodb.cc \
|
||||||
|
gxs/gxscoreserver.cc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ class RsGxsNotify
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsGxsNotify(){ return; }
|
RsGxsNotify(){ return; }
|
||||||
|
virtual ~RsGxsNotify() {return; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "rsgxsservice.h"
|
#include "rsgxsservice.h"
|
||||||
|
#include "rsphoto.h"
|
||||||
|
|
||||||
/* The Main Interface Class - for information about your Peers */
|
/* The Main Interface Class - for information about your Peers */
|
||||||
class RsPhotoV2;
|
class RsPhotoV2;
|
||||||
@ -41,20 +42,20 @@ extern RsPhotoV2 *rsPhotoV2;
|
|||||||
#define RSPHOTO_MODE_OWN 2
|
#define RSPHOTO_MODE_OWN 2
|
||||||
#define RSPHOTO_MODE_REMOTE 3
|
#define RSPHOTO_MODE_REMOTE 3
|
||||||
|
|
||||||
class RsPhotoThumbnail
|
//class RsPhotoThumbnail
|
||||||
{
|
//{
|
||||||
public:
|
// public:
|
||||||
RsPhotoThumbnail()
|
// RsPhotoThumbnail()
|
||||||
:data(NULL), size(0), type("N/A") { return; }
|
// :data(NULL), size(0), type("N/A") { return; }
|
||||||
|
//
|
||||||
bool deleteImage();
|
// bool deleteImage();
|
||||||
bool copyFrom(const RsPhotoThumbnail &nail);
|
// bool copyFrom(const RsPhotoThumbnail &nail);
|
||||||
|
//
|
||||||
// Holds Thumbnail image.
|
// // Holds Thumbnail image.
|
||||||
uint8_t *data;
|
// uint8_t *data;
|
||||||
int size;
|
// int size;
|
||||||
std::string type;
|
// std::string type;
|
||||||
};
|
//};
|
||||||
|
|
||||||
|
|
||||||
/* If these flags are no set - the Photo inherits values from the Album
|
/* 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.
|
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
||||||
|
|
||||||
|
|
||||||
class RsPhotoPhoto
|
//class RsPhotoPhoto
|
||||||
{
|
//{
|
||||||
public:
|
// 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;
|
//class RsPhotoAlbumShare
|
||||||
|
//{
|
||||||
RsPhotoPhoto();
|
// public:
|
||||||
|
//
|
||||||
// THESE ARE IN THE META DATA.
|
// uint32_t mShareType;
|
||||||
//std::string mAlbumId;
|
// std::string mShareGroupId;
|
||||||
//std::string mId;
|
// std::string mPublishKey;
|
||||||
//std::string mTitle; // only used by Album.
|
// uint32_t mCommentMode;
|
||||||
std::string mCaption;
|
// uint32_t mResizeMode;
|
||||||
std::string mDescription;
|
//};
|
||||||
std::string mPhotographer;
|
//
|
||||||
std::string mWhere;
|
//class RsPhotoAlbum
|
||||||
std::string mWhen;
|
//{
|
||||||
std::string mOther;
|
// public:
|
||||||
std::string mCategory;
|
// RsPhotoAlbum();
|
||||||
|
//
|
||||||
std::string mHashTags;
|
// RsGroupMetaData mMeta;
|
||||||
|
//
|
||||||
uint32_t mSetFlags;
|
// // THESE ARE IN THE META DATA.
|
||||||
|
// //std::string mAlbumId;
|
||||||
int mOrder;
|
// //std::string mTitle; // only used by Album.
|
||||||
|
//
|
||||||
RsPhotoThumbnail mThumbnail;
|
// std::string mCaption;
|
||||||
|
// std::string mDescription;
|
||||||
int mMode;
|
// std::string mPhotographer;
|
||||||
|
// std::string mWhere;
|
||||||
// These are not saved.
|
// std::string mWhen;
|
||||||
std::string path; // if in Mode NEW.
|
// std::string mOther;
|
||||||
uint32_t mModFlags;
|
// std::string mCategory;
|
||||||
};
|
//
|
||||||
|
// std::string mHashTags;
|
||||||
class RsPhotoAlbumShare
|
//
|
||||||
{
|
// RsPhotoThumbnail mThumbnail;
|
||||||
public:
|
//
|
||||||
|
// int mMode;
|
||||||
uint32_t mShareType;
|
//
|
||||||
std::string mShareGroupId;
|
// std::string mPhotoPath;
|
||||||
std::string mPublishKey;
|
// RsPhotoAlbumShare mShareOptions;
|
||||||
uint32_t mCommentMode;
|
//
|
||||||
uint32_t mResizeMode;
|
// // These aren't saved.
|
||||||
};
|
// uint32_t mSetFlags;
|
||||||
|
// uint32_t mModFlags;
|
||||||
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 RsPhotoPhoto &photo);
|
||||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||||
|
@ -1807,6 +1807,15 @@ RsTurtle *rsTurtle = NULL ;
|
|||||||
#include "turtle/p3turtle.h"
|
#include "turtle/p3turtle.h"
|
||||||
|
|
||||||
#define ENABLE_GXS_SERVICES 1
|
#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
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
#include "services/p3photoservice.h"
|
#include "services/p3photoservice.h"
|
||||||
#include "services/p3wikiservice.h"
|
#include "services/p3wikiservice.h"
|
||||||
@ -2256,6 +2265,36 @@ int RsServer::StartupRetroShare()
|
|||||||
mPluginsManager->registerClientServices(pqih) ;
|
mPluginsManager->registerClientServices(pqih) ;
|
||||||
mPluginsManager->registerCacheServices() ;
|
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
|
#ifdef ENABLE_GXS_SERVICES
|
||||||
// Testing New Cache Services.
|
// Testing New Cache Services.
|
||||||
p3PhotoService *mPhotos = new p3PhotoService(RS_SERVICE_TYPE_PHOTO);
|
p3PhotoService *mPhotos = new p3PhotoService(RS_SERVICE_TYPE_PHOTO);
|
||||||
@ -2543,6 +2582,7 @@ int RsServer::StartupRetroShare()
|
|||||||
// Testing of new cache system interfaces.
|
// Testing of new cache system interfaces.
|
||||||
rsIdentity = mIdentity;
|
rsIdentity = mIdentity;
|
||||||
rsPhoto = mPhotos;
|
rsPhoto = mPhotos;
|
||||||
|
rsPhotoV2 = mPhotoV2;
|
||||||
rsWiki = mWikis;
|
rsWiki = mWikis;
|
||||||
rsWire = mWire;
|
rsWire = mWire;
|
||||||
rsForumsV2 = mForumsV2;
|
rsForumsV2 = mForumsV2;
|
||||||
|
@ -259,7 +259,9 @@ class RsNxsMsg : public RsNxsItem
|
|||||||
{
|
{
|
||||||
public:
|
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 void clear();
|
||||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
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))
|
switch(getRsItemSubType(rstype))
|
||||||
{
|
{
|
||||||
|
|
||||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP:
|
case RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM:
|
||||||
return deserialiseGxsPhotoPhotoItem(data, size);
|
return deserialiseGxsPhotoPhotoItem(data, size);
|
||||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM:
|
case RS_PKT_SUBTYPE_PHOTO_ITEM:
|
||||||
return deserialiseGxsPhotoAlbumItem(data, size);
|
return deserialiseGxsPhotoAlbumItem(data, size);
|
||||||
default:
|
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.mWhen);
|
||||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere);
|
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere);
|
||||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mThumbnail.type);
|
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mThumbnail.type);
|
||||||
RsTlvBinaryData b(item->PacketService()); // TODO, need something more persisitent
|
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
|
||||||
b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size);
|
b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size);
|
||||||
b.SetTlv(item->album.mThumbnail.data, tlvsize, &offset);
|
ok &= b.SetTlv(data, tlvsize, &offset);
|
||||||
|
|
||||||
if(offset != tlvsize)
|
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.mWhen);
|
||||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere);
|
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere);
|
||||||
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mThumbnail.type);
|
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mThumbnail.type);
|
||||||
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
|
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
|
||||||
b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size);
|
b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size);
|
||||||
b.SetTlv(item->photo.mThumbnail.data, tlvsize, &offset);
|
ok &= b.SetTlv(data, tlvsize, &offset);
|
||||||
|
|
||||||
if(offset != tlvsize)
|
if(offset != tlvsize)
|
||||||
{
|
{
|
||||||
|
@ -639,6 +639,7 @@ bool RsPhotoThumbnail::deleteImage()
|
|||||||
free(data);
|
free(data);
|
||||||
data = NULL;
|
data = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
|
type.clear();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,37 @@ p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeS
|
|||||||
|
|
||||||
bool p3PhotoServiceV2::updated()
|
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(
|
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,
|
bool p3PhotoServiceV2::getGroupList(const uint32_t& token,
|
||||||
std::list<std::string>& groupIds)
|
std::list<RsGxsGroupId>& groupIds)
|
||||||
{
|
{
|
||||||
return RsGenExchange::getGroupList(token, 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);
|
RsGxsPhotoAlbumItem* item = dynamic_cast<RsGxsPhotoAlbumItem*>(*vit);
|
||||||
RsPhotoAlbum album = item->album;
|
RsPhotoAlbum album = item->album;
|
||||||
|
album.mMeta = item->album.mMeta;
|
||||||
delete item;
|
delete item;
|
||||||
albums.push_back(album);
|
albums.push_back(album);
|
||||||
}
|
}
|
||||||
@ -105,6 +127,7 @@ bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photos)
|
|||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
RsPhotoPhoto photo = item->photo;
|
RsPhotoPhoto photo = item->photo;
|
||||||
|
photo.mMeta = item->meta;
|
||||||
photos[grpId].push_back(photo);
|
photos[grpId].push_back(photo);
|
||||||
delete item;
|
delete item;
|
||||||
}else
|
}else
|
||||||
@ -121,14 +144,45 @@ bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photos)
|
|||||||
|
|
||||||
bool p3PhotoServiceV2::submitAlbumDetails(RsPhotoAlbum& album)
|
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)
|
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();
|
bool updated();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void notifyChanges(std::vector<RsGxsNotify*>& changes);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Requests **/
|
/** Requests **/
|
||||||
|
|
||||||
void groupsChanged(std::list<std::string>& grpIds);
|
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
||||||
|
|
||||||
|
|
||||||
void msgsChanged(std::map<std::string,
|
void msgsChanged(std::map<RsGxsGroupId,
|
||||||
std::vector<std::string> >& msgs);
|
std::vector<RsGxsMessageId> >& msgs);
|
||||||
|
|
||||||
RsTokenServiceV2* getTokenService();
|
RsTokenServiceV2* getTokenService();
|
||||||
|
|
||||||
bool getGroupList(const uint32_t &token,
|
bool getGroupList(const uint32_t &token,
|
||||||
std::list<std::string> &groupIds);
|
std::list<RsGxsGroupId> &groupIds);
|
||||||
bool getMsgList(const uint32_t &token,
|
bool getMsgList(const uint32_t &token,
|
||||||
GxsMsgIdResult& msgIds);
|
GxsMsgIdResult& msgIds);
|
||||||
|
|
||||||
@ -77,6 +80,11 @@ public:
|
|||||||
|
|
||||||
bool submitAlbumDetails(RsPhotoAlbum &album);
|
bool submitAlbumDetails(RsPhotoAlbum &album);
|
||||||
bool submitPhoto(RsPhotoPhoto &photo);
|
bool submitPhoto(RsPhotoPhoto &photo);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::vector<RsGxsGroupChange*> mGroupChange;
|
||||||
|
std::vector<RsGxsMsgChange*> mMsgChange;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // P3PHOTOSERVICEV2_H
|
#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();
|
clearDialog();
|
||||||
mAlbumEdit = true;
|
mAlbumEdit = true;
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptionsV2 opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
std::list<RsGxsGroupId> albumIds;
|
std::list<RsGxsGroupId> albumIds;
|
||||||
albumIds.push_back(albumId);
|
albumIds.push_back(albumId);
|
||||||
|
|
||||||
// We need both Album and Photo Data.
|
// We need both Album and Photo Data.
|
||||||
@ -493,27 +493,28 @@ bool PhotoAddDialog::loadPhotoData(const uint32_t &token)
|
|||||||
std::cerr << "PhotoAddDialog::loadPhotoData()";
|
std::cerr << "PhotoAddDialog::loadPhotoData()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
bool moreData = true;
|
PhotoResult res;
|
||||||
while(moreData)
|
rsPhotoV2->getPhoto(token, res);
|
||||||
{
|
PhotoResult::iterator mit = res.begin();
|
||||||
PhotoResult res;
|
|
||||||
RsPhotoPhoto photo;
|
|
||||||
|
for(; mit != res.end(); mit++)
|
||||||
if (rsPhotoV2->getPhoto(token, res))
|
{
|
||||||
{
|
std::vector<RsPhotoPhoto>& photoV = mit->second;
|
||||||
std::cerr << "PhotoDialog::addAddPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
|
||||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
|
||||||
std::cerr << std::endl;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,32 +522,32 @@ bool PhotoAddDialog::loadAlbumData(const uint32_t &token)
|
|||||||
{
|
{
|
||||||
std::cerr << "PhotoAddDialog::loadAlbumData()";
|
std::cerr << "PhotoAddDialog::loadAlbumData()";
|
||||||
std::cerr << std::endl;
|
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;
|
std::vector<RsPhotoAlbum> albums;
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
rsPhotoV2->getAlbum(token, albums);
|
||||||
uint32_t token;
|
|
||||||
std::list<std::string> albumIds;
|
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
|
||||||
albumIds.push_back(album.mMeta.mGroupId);
|
|
||||||
GxsMsgReq req;
|
GxsMsgReq req;
|
||||||
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
|
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
|
for(; vit != albums.end(); vit++)
|
||||||
}
|
{
|
||||||
else
|
RsPhotoAlbum& album = *vit;
|
||||||
{
|
|
||||||
moreData = false;
|
std::cerr << "PhotoAddDialog::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||||
}
|
//updateAlbumDetails(album);
|
||||||
}
|
|
||||||
return true;
|
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)
|
bool PhotoAddDialog::loadCreatedAlbum(const uint32_t &token)
|
||||||
|
@ -431,7 +431,7 @@ void PhotoDialog::requestAlbumList()
|
|||||||
{
|
{
|
||||||
|
|
||||||
std::list<std::string> ids;
|
std::list<std::string> ids;
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptionsV2 opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||||
}
|
}
|
||||||
@ -454,13 +454,12 @@ void PhotoDialog::loadAlbumList(const uint32_t &token)
|
|||||||
{
|
{
|
||||||
requestPhotoList(*it);
|
requestPhotoList(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::requestAlbumData(std::list<std::string> &ids)
|
void PhotoDialog::requestAlbumData(std::list<std::string> &ids)
|
||||||
{
|
{
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptionsV2 opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||||
}
|
}
|
||||||
@ -473,25 +472,21 @@ bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
|||||||
|
|
||||||
clearAlbums();
|
clearAlbums();
|
||||||
|
|
||||||
bool moreData = true;
|
std::vector<RsPhotoAlbum> albums;
|
||||||
while(moreData)
|
rsPhotoV2->getAlbum(token, albums);
|
||||||
{
|
|
||||||
RsPhotoAlbum album;
|
|
||||||
std::vector<RsPhotoAlbum> albums;
|
|
||||||
if (rsPhotoV2->getAlbum(token, albums))
|
|
||||||
{
|
|
||||||
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
|
||||||
|
|
||||||
PhotoItem *item = new PhotoItem(this, album);
|
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
|
||||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
|
||||||
alayout->addWidget(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
moreData = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,10 +494,9 @@ bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
|||||||
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::list<std::string> ids;
|
|
||||||
GxsMsgReq req;
|
GxsMsgReq req;
|
||||||
req[albumId] = std::vector<RsGxsMessageId>();
|
req[albumId] = std::vector<RsGxsMessageId>();
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptionsV2 opts;
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
|
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)
|
void PhotoDialog::requestPhotoData(GxsMsgReq &photoIds)
|
||||||
{
|
{
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptionsV2 opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
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 << "PhotoDialog::loadPhotoData()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
bool moreData = true;
|
PhotoResult res;
|
||||||
while(moreData)
|
rsPhotoV2->getPhoto(token, res);
|
||||||
{
|
PhotoResult::iterator mit = res.begin();
|
||||||
RsPhotoPhoto photo;
|
|
||||||
PhotoResult res;
|
|
||||||
if (rsPhotoV2->getPhoto(token, res))
|
|
||||||
{
|
|
||||||
|
|
||||||
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
|
||||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
addPhoto(photo);
|
for(; mit != res.end(); mit++)
|
||||||
}
|
{
|
||||||
else
|
std::vector<RsPhotoPhoto>& photoV = mit->second;
|
||||||
{
|
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
|
||||||
moreData = false;
|
|
||||||
}
|
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 */
|
/* much like main load fns */
|
||||||
clearDialog();
|
clearDialog();
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptionsV2 opts;
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
std::list<std::string> albumIds;
|
std::list<std::string> albumIds;
|
||||||
albumIds.push_back(albumId);
|
albumIds.push_back(albumId);
|
||||||
@ -261,31 +261,34 @@ bool PhotoSlideShow::loadPhotoData(const uint32_t &token)
|
|||||||
std::cerr << "PhotoSlideShow::loadPhotoData()";
|
std::cerr << "PhotoSlideShow::loadPhotoData()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
bool moreData = true;
|
PhotoResult res;
|
||||||
while(moreData)
|
rsPhotoV2->getPhoto(token, res);
|
||||||
{
|
PhotoResult::iterator mit = res.begin();
|
||||||
RsPhotoPhoto photo;
|
|
||||||
PhotoResult res;
|
|
||||||
|
|
||||||
if (rsPhotoV2->getPhoto(token, res))
|
|
||||||
{
|
|
||||||
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;
|
for(; mit != res.end(); mit++)
|
||||||
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
{
|
||||||
std::cerr << std::endl;
|
std::vector<RsPhotoPhoto>& photoV = mit->second;
|
||||||
}
|
std::vector<RsPhotoPhoto>::iterator vit = photoV.begin();
|
||||||
else
|
|
||||||
{
|
for(; vit != photoV.end(); vit++)
|
||||||
moreData = false;
|
{
|
||||||
}
|
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.
|
// Load and Start.
|
||||||
loadImage();
|
loadImage();
|
||||||
@ -299,30 +302,30 @@ bool PhotoSlideShow::loadAlbumData(const uint32_t &token)
|
|||||||
std::cerr << "PhotoSlideShow::loadAlbumData()";
|
std::cerr << "PhotoSlideShow::loadAlbumData()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
bool moreData = true;
|
std::vector<RsPhotoAlbum> albums;
|
||||||
while(moreData)
|
rsPhotoV2->getAlbum(token, albums);
|
||||||
{
|
|
||||||
RsPhotoAlbum album;
|
|
||||||
std::vector<RsPhotoAlbum> res;
|
|
||||||
if (rsPhotoV2->getAlbum(token, res))
|
|
||||||
{
|
|
||||||
std::cerr << " PhotoSlideShow::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
|
||||||
//updateAlbumDetails(album);
|
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
std::vector<RsPhotoAlbum>::iterator vit = albums.begin();
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
|
||||||
uint32_t token;
|
GxsMsgReq req;
|
||||||
std::list<std::string> albumIds;
|
|
||||||
albumIds.push_back(album.mMeta.mGroupId);
|
for(; vit != albums.end(); vit++)
|
||||||
GxsMsgReq req;
|
{
|
||||||
req[album.mMeta.mGroupId] = std::vector<RsGxsMessageId>();
|
RsPhotoAlbum& album = *vit;
|
||||||
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
|
|
||||||
}
|
std::cerr << " PhotoSlideShow::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||||
else
|
//updateAlbumDetails(album);
|
||||||
{
|
uint32_t token;
|
||||||
moreData = false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <retroshare/rsiface.h>
|
#include <retroshare/rsiface.h>
|
||||||
|
|
||||||
//#include "gui/PhotoShare/PhotoDialog.h"
|
#include "gui/PhotoShare/PhotoDialog.h"
|
||||||
#include "gui/WikiPoos/WikiDialog.h"
|
#include "gui/WikiPoos/WikiDialog.h"
|
||||||
#include "gui/TheWire/WireDialog.h"
|
#include "gui/TheWire/WireDialog.h"
|
||||||
#include "gui/Identity/IdDialog.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),
|
ui.stackPages->add(idDialog = new IdDialog(ui.stackPages),
|
||||||
createPageAction(QIcon(IMAGE_LIBRARY), tr("Identities"), grp));
|
createPageAction(QIcon(IMAGE_LIBRARY), tr("Identities"), grp));
|
||||||
|
|
||||||
//PhotoDialog *photoDialog = NULL;
|
PhotoDialog *photoDialog = NULL;
|
||||||
//ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
|
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
|
||||||
// createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
|
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
|
||||||
|
|
||||||
WikiDialog *wikiDialog = NULL;
|
WikiDialog *wikiDialog = NULL;
|
||||||
ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
|
ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
|
||||||
|
@ -38,7 +38,7 @@ TokenQueueV2::TokenQueueV2(RsTokenServiceV2 *service, TokenResponseV2 *resp)
|
|||||||
return;
|
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;
|
uint32_t basictype = TOKENREQ_GROUPINFO;
|
||||||
mService->requestGroupInfo(token, anstype, opts, ids);
|
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;
|
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||||
mService->requestMsgInfo(token, anstype, opts, ids);
|
mService->requestMsgInfo(token, anstype, opts, ids);
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MRK_TOKEN_QUEUE_H
|
#ifndef MRK_TOKEN_QUEUE_V2_H
|
||||||
#define MRK_TOKEN_QUEUE_H
|
#define MRK_TOKEN_QUEUE_V2_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -70,9 +70,9 @@ public:
|
|||||||
TokenQueueV2(RsTokenServiceV2 *service, TokenResponseV2 *resp);
|
TokenQueueV2(RsTokenServiceV2 *service, TokenResponseV2 *resp);
|
||||||
|
|
||||||
/* generic handling of token / response update behaviour */
|
/* 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);
|
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);
|
const GxsMsgReq& ids, uint32_t usertype);
|
||||||
|
|
||||||
bool cancelRequest(const uint32_t token);
|
bool cancelRequest(const uint32_t token);
|
||||||
|
Loading…
Reference in New Issue
Block a user