diff --git a/libretroshare/src/gxs/gxscoreserver.cc b/libretroshare/src/gxs/gxscoreserver.cc index c4068164c..749f96063 100644 --- a/libretroshare/src/gxs/gxscoreserver.cc +++ b/libretroshare/src/gxs/gxscoreserver.cc @@ -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() diff --git a/libretroshare/src/gxs/gxscoreserver.h b/libretroshare/src/gxs/gxscoreserver.h index b0534e38d..664a93f8a 100644 --- a/libretroshare/src/gxs/gxscoreserver.h +++ b/libretroshare/src/gxs/gxscoreserver.h @@ -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(); diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc index 932da998f..23d64333c 100644 --- a/libretroshare/src/gxs/rsdataservice.cc +++ b/libretroshare/src/gxs/rsdataservice.cc @@ -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 #include "rsdataservice.h" @@ -782,7 +809,7 @@ int RsDataService::updateMessageMetaData(MsgLocMetaData *metaData) } -int RsDataService::removeMsgs(const std::string grpId, const std::vector &msgIds) +int RsDataService::removeMsgs(const GxsMsgReq& msgIds) { return 0; } diff --git a/libretroshare/src/gxs/rsdataservice.h b/libretroshare/src/gxs/rsdataservice.h index 13bc26bf3..e7553683e 100644 --- a/libretroshare/src/gxs/rsdataservice.h +++ b/libretroshare/src/gxs/rsdataservice.h @@ -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& grp); + int retrieveGxsGrpMetaData(std::map& 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& grpIds, GxsMsgMetaResult& msgMeta); + int retrieveGxsMsgMetaData(const std::vector& 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& 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& grpIds); + int removeGroups(const std::vector& grpIds); /*! * @return the cache size set for this RsGeneralDataService in bytes @@ -117,11 +142,11 @@ private: void retrieveMessages(RetroCursor* c, std::vector& 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& 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& grps, bool withMeta = false); /*! * extracts a msg meta item from a cursor at its diff --git a/libretroshare/src/gxs/rsgds.h b/libretroshare/src/gxs/rsgds.h index 4a178f575..1a34747c0 100644 --- a/libretroshare/src/gxs/rsgds.h +++ b/libretroshare/src/gxs/rsgds.h @@ -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& grpIds, GxsMsgMetaResult& msgMeta) = 0; + virtual int retrieveGxsMsgMetaData(const std::vector& grpIds, GxsMsgMetaResult& msgMeta) = 0; /*! * remove msgs in data store listed in msgIds param diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 0337ce5a9..5f809e1e7 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -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::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& metaV = mit->second; - //msgInfo[mit->first] = metaV; + + msgInfo[mit->first] = std::vector(); + std::vector& msgInfoV = msgInfo[mit->first]; std::vector::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::vectorgrp; RsItem* item = mSerialiser->deserialise(data.bin_data, &data.bin_len); - RsGxsGrpItem* gItem = dynamic_cast(item); - grpItem.push_back(gItem); - delete *lit; + + if(item != NULL){ + RsGxsGrpItem* gItem = dynamic_cast(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(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 &groups) } -void RsGenExchange::notifyNewMessages(std::vector messages) +void RsGenExchange::notifyNewMessages(std::vector& messages) { std::vector::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() +{ +} diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index 4ef50131b..55bc08622 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -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 messages); + void notifyNewMessages(std::vector& messages); /*! * @param messages messages are deleted after function returns @@ -192,7 +192,12 @@ protected: */ virtual void notifyChanges(std::vector& changes) = 0; -public: + + void publishGrps(); + + void publishMsgs(); + +private: void processRecvdData(); @@ -200,10 +205,6 @@ public: void processRecvdGroups(); - void publishGrps(); - - void publishMsgs(); - private: RsMutex mGenMtx; diff --git a/libretroshare/src/gxs/rsgxs.h b/libretroshare/src/gxs/rsgxs.h index 9c70c8759..c7d74eff1 100644 --- a/libretroshare/src/gxs/rsgxs.h +++ b/libretroshare/src/gxs/rsgxs.h @@ -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 #include +/* data types used throughout Gxs from netservice to genexchange */ typedef std::map > GxsMsgReq; typedef std::map > GxsMsgIdResult; diff --git a/libretroshare/src/gxs/rsgxsdata.cc b/libretroshare/src/gxs/rsgxsdata.cc index f8f733fb0..7c6e57b3d 100644 --- a/libretroshare/src/gxs/rsgxsdata.cc +++ b/libretroshare/src/gxs/rsgxsdata.cc @@ -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" diff --git a/libretroshare/src/gxs/rsgxsdata.h b/libretroshare/src/gxs/rsgxsdata.h index 8eb686e6b..88f8d0241 100644 --- a/libretroshare/src/gxs/rsgxsdata.h +++ b/libretroshare/src/gxs/rsgxsdata.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 #include "serialiser/rsserial.h" diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 5b113b285..41ab19f1b 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -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 &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 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& metaM = + mit->second; + std::map::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) diff --git a/libretroshare/src/gxs/rsgxsdataaccess.h b/libretroshare/src/gxs/rsgxsdataaccess.h index 27904d749..83177112a 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.h +++ b/libretroshare/src/gxs/rsgxsdataaccess.h @@ -51,7 +51,7 @@ public: * @param groupIds * @return */ - bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list &groupIds); + bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list &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 &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: diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index ee6429e4a..80c6353aa 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -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 diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index 6d12d5119..c4c0b9b40 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -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 #include diff --git a/libretroshare/src/gxs/rsgxsrequesttypes.h b/libretroshare/src/gxs/rsgxsrequesttypes.h index 293584ab2..4ed5ede01 100644 --- a/libretroshare/src/gxs/rsgxsrequesttypes.h +++ b/libretroshare/src/gxs/rsgxsrequesttypes.h @@ -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; }; diff --git a/libretroshare/src/gxs/rsnxs.h b/libretroshare/src/gxs/rsnxs.h index 67a3f4279..0c201a737 100644 --- a/libretroshare/src/gxs/rsnxs.h +++ b/libretroshare/src/gxs/rsnxs.h @@ -2,7 +2,7 @@ #define RSGNP_H /* - * libretroshare/src/gxs: rsgnp.h + * libretroshare/src/gxs: rsnxs.h * * Network Exchange Service interface for RetroShare. * diff --git a/libretroshare/src/gxs/rsnxsobserver.h b/libretroshare/src/gxs/rsnxsobserver.h index 67ff2f799..627080ae7 100644 --- a/libretroshare/src/gxs/rsnxsobserver.h +++ b/libretroshare/src/gxs/rsnxsobserver.h @@ -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 * diff --git a/libretroshare/src/gxs/rstokenservice.h b/libretroshare/src/gxs/rstokenservice.h index ee8835b11..4d4dc1843 100644 --- a/libretroshare/src/gxs/rstokenservice.h +++ b/libretroshare/src/gxs/rstokenservice.h @@ -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 &groupIds) = 0; + virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list &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; diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 0e5c67fa3..8c579dee9 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -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 } diff --git a/libretroshare/src/retroshare/rsgxsservice.h b/libretroshare/src/retroshare/rsgxsservice.h index 96ba495af..d9df811c1 100644 --- a/libretroshare/src/retroshare/rsgxsservice.h +++ b/libretroshare/src/retroshare/rsgxsservice.h @@ -17,6 +17,7 @@ class RsGxsNotify { public: RsGxsNotify(){ return; } + virtual ~RsGxsNotify() {return; } }; diff --git a/libretroshare/src/retroshare/rsphotoV2.h b/libretroshare/src/retroshare/rsphotoV2.h index 1ae59bed9..80ad2ca72 100644 --- a/libretroshare/src/retroshare/rsphotoV2.h +++ b/libretroshare/src/retroshare/rsphotoV2.h @@ -30,6 +30,7 @@ #include #include #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); diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 9ee634604..ebc9241bb 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -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; diff --git a/libretroshare/src/serialiser/rsnxsitems.h b/libretroshare/src/serialiser/rsnxsitems.h index 02a5fdafe..629468b89 100644 --- a/libretroshare/src/serialiser/rsnxsitems.h +++ b/libretroshare/src/serialiser/rsnxsitems.h @@ -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); diff --git a/libretroshare/src/serialiser/rsphotov2items.cc b/libretroshare/src/serialiser/rsphotov2items.cc index 921deca22..4b64a363e 100644 --- a/libretroshare/src/serialiser/rsphotov2items.cc +++ b/libretroshare/src/serialiser/rsphotov2items.cc @@ -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) { diff --git a/libretroshare/src/services/p3photoservice.cc b/libretroshare/src/services/p3photoservice.cc index e1dd0a50d..ce37ec59a 100644 --- a/libretroshare/src/services/p3photoservice.cc +++ b/libretroshare/src/services/p3photoservice.cc @@ -639,6 +639,7 @@ bool RsPhotoThumbnail::deleteImage() free(data); data = NULL; size = 0; + type.clear(); } return true; } diff --git a/libretroshare/src/services/p3photoserviceV2.cc b/libretroshare/src/services/p3photoserviceV2.cc index 31ec27ec0..e8c747b88 100644 --- a/libretroshare/src/services/p3photoserviceV2.cc +++ b/libretroshare/src/services/p3photoserviceV2.cc @@ -11,16 +11,37 @@ p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeS bool p3PhotoServiceV2::updated() { - return false; + bool changed = (!mGroupChange.empty() || !mMsgChange.empty()); + + std::list gL; + std::map > msgs; + + groupsChanged(gL); + msgsChanged(msgs); + + return changed; } -void p3PhotoServiceV2::groupsChanged(std::list& grpIds) { + +void p3PhotoServiceV2::groupsChanged(std::list& grpIds) +{ + while(!mGroupChange.empty()) + { + RsGxsGroupChange* gc = mGroupChange.back(); + std::list& gList = gc->grpIdList; + std::list::iterator lit = gList.begin(); + for(; lit != gList.end(); lit++) + grpIds.push_back(*lit); + + mGroupChange.pop_back(); + delete gc; + } } void p3PhotoServiceV2::msgsChanged( - std::map >& msgs) + std::map >& msgs) { } @@ -33,7 +54,7 @@ RsTokenServiceV2* p3PhotoServiceV2::getTokenService() { bool p3PhotoServiceV2::getGroupList(const uint32_t& token, - std::list& groupIds) + std::list& groupIds) { return RsGenExchange::getGroupList(token, groupIds); } @@ -74,6 +95,7 @@ bool p3PhotoServiceV2::getAlbum(const uint32_t& token, std::vector { RsGxsPhotoAlbumItem* item = dynamic_cast(*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& changes) +{ + std::vector::iterator vit = changes.begin(); + + for(; vit != changes.end(); vit++) + { + RsGxsNotify* n = *vit; + RsGxsGroupChange* gc; + RsGxsMsgChange* mc; + if((mc = dynamic_cast(n)) != NULL) + { + mMsgChange.push_back(mc); + } + else if((gc = dynamic_cast(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); } diff --git a/libretroshare/src/services/p3photoserviceV2.h b/libretroshare/src/services/p3photoserviceV2.h index d92317c91..e2057550c 100644 --- a/libretroshare/src/services/p3photoserviceV2.h +++ b/libretroshare/src/services/p3photoserviceV2.h @@ -43,20 +43,23 @@ public: */ bool updated(); +protected: + + void notifyChanges(std::vector& changes); public: /** Requests **/ - void groupsChanged(std::list& grpIds); + void groupsChanged(std::list& grpIds); - void msgsChanged(std::map >& msgs); + void msgsChanged(std::map >& msgs); RsTokenServiceV2* getTokenService(); bool getGroupList(const uint32_t &token, - std::list &groupIds); + std::list &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 mGroupChange; + std::vector mMsgChange; }; #endif // P3PHOTOSERVICEV2_H diff --git a/libretroshare/src/tests/serialiser/rsphotoitem_test.cc b/libretroshare/src/tests/serialiser/rsphotoitem_test.cc new file mode 100644 index 000000000..fafd1650d --- /dev/null +++ b/libretroshare/src/tests/serialiser/rsphotoitem_test.cc @@ -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(); REPORT("Serialise/Deserialise RsGxsPhotoAlbumItem"); + test_RsItem(); REPORT("Serialise/Deserialise RsGxsPhotoPhotoItem"); + + FINALREPORT("RsPhotoItem Tests"); + + return TESTRESULT(); +} diff --git a/libretroshare/src/tests/serialiser/rsphotoitem_test.h b/libretroshare/src/tests/serialiser/rsphotoitem_test.h new file mode 100644 index 000000000..cd726198e --- /dev/null +++ b/libretroshare/src/tests/serialiser/rsphotoitem_test.h @@ -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_ */ diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoAddDialog.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoAddDialog.cpp index 4786c10b2..9dc756666 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoAddDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoAddDialog.cpp @@ -476,9 +476,9 @@ void PhotoAddDialog::loadAlbum(const std::string &albumId) clearDialog(); mAlbumEdit = true; - RsTokReqOptions opts; + RsTokReqOptionsV2 opts; uint32_t token; - std::list albumIds; + std::list 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& photoV = mit->second; + std::vector::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 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 albumIds; - albumIds.push_back(album.mMeta.mGroupId); - GxsMsgReq req; - req[album.mMeta.mGroupId] = std::vector(); - mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0); - } - else - { - moreData = false; - } - } - return true; + std::vector albums; + rsPhotoV2->getAlbum(token, albums); + + std::vector::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 albumIds; + albumIds.push_back(album.mMeta.mGroupId); + req[album.mMeta.mGroupId] = std::vector(); + + } + 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) diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp index 044e13eae..ddea51908 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp @@ -431,7 +431,7 @@ void PhotoDialog::requestAlbumList() { std::list 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 &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 albums; - if (rsPhotoV2->getAlbum(token, albums)) - { - std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl; + std::vector albums; + rsPhotoV2->getAlbum(token, albums); - PhotoItem *item = new PhotoItem(this, album); - QLayout *alayout = ui.scrollAreaWidgetContents->layout(); - alayout->addWidget(item); - } - else - { - moreData = false; - } - } + std::vector::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 ids; GxsMsgReq req; req[albumId] = std::vector(); - 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& photoV = mit->second; + std::vector::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; + } + } } diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp index c2fad4ef1..7330796e3 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp @@ -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 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& photoV = mit->second; + std::vector::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 res; - if (rsPhotoV2->getAlbum(token, res)) - { - std::cerr << " PhotoSlideShow::loadAlbumData() AlbumId: " << album.mMeta.mGroupId << std::endl; - //updateAlbumDetails(album); + std::vector albums; + rsPhotoV2->getAlbum(token, albums); - RsTokReqOptions opts; - opts.mOptions = RS_TOKREQOPT_MSG_LATEST; - uint32_t token; - std::list albumIds; - albumIds.push_back(album.mMeta.mGroupId); - GxsMsgReq req; - req[album.mMeta.mGroupId] = std::vector(); - mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0); - } - else - { - moreData = false; - } - } + std::vector::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 albumIds; + albumIds.push_back(album.mMeta.mGroupId); + req[album.mMeta.mGroupId] = std::vector(); + + } + + RsTokReqOptionsV2 opts; + opts.mOptions = RS_TOKREQOPT_MSG_LATEST; + uint32_t t; + mPhotoQueue->requestMsgInfo(t, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0); return true; } diff --git a/retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp b/retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp index 69fe7f92c..d3002dc7c 100644 --- a/retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp +++ b/retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp @@ -32,7 +32,7 @@ #include -//#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), diff --git a/retroshare-gui/src/util/TokenQueueV2.cpp b/retroshare-gui/src/util/TokenQueueV2.cpp index 934c4b2c1..4dd444465 100644 --- a/retroshare-gui/src/util/TokenQueueV2.cpp +++ b/retroshare-gui/src/util/TokenQueueV2.cpp @@ -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& ids, uint32_t usertype) +bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, std::list& 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); diff --git a/retroshare-gui/src/util/TokenQueueV2.h b/retroshare-gui/src/util/TokenQueueV2.h index 40ed5d1da..aa85ac135 100644 --- a/retroshare-gui/src/util/TokenQueueV2.h +++ b/retroshare-gui/src/util/TokenQueueV2.h @@ -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 #include @@ -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& 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);