emergency commit, computer acting up bad!

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5565 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-09-17 22:08:23 +00:00
parent 4f470090b2
commit eaa7342165
39 changed files with 1835 additions and 2080 deletions

View file

@ -632,9 +632,6 @@ void RsGenExchange::publishGrps()
size = grp->metaData->serial_size();
char mData[size];
grp->metaData->mGroupId = grp->grpId;
// indicate user is admin through local subscribe flag
grp->metaData->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_ADMIN;
ok = grp->metaData->serialise(mData, size);
grp->meta.setBinData(mData, size);

View file

@ -153,6 +153,13 @@ protected:
*/
bool getMsgData(const uint32_t &token, GxsMsgDataMap& msgItems);
/*!
* @param grpItem
* @deprecated only here to temporarily to testing
*/
void createDummyGroup(RsGxsGrpItem* grpItem);
public:
/*!
@ -259,6 +266,13 @@ private:
void createGroup(RsNxsGrp* grp);
bool createMessage(RsNxsMsg* msg);
/*!
* check meta change is legal
* @return false if meta change is not legal
*/
bool locked_validateGrpMetaChange(GrpLocMetaData&);
private:
RsMutex mGenMtx;

View file

@ -98,7 +98,7 @@ void RsGxsNetService::syncWithPeers()
{
RsGxsGrpMetaData* meta = mit->second;
if(meta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_MASK)
if(meta->mSubscribeFlags & GXS_SERV::RSGXS_GROUP_SUBSCRIBE_MASK)
grpIds.push_back(mit->first);
}

View file

@ -59,6 +59,8 @@
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
@ -72,7 +74,8 @@ public:
RsTokReqOptionsV2()
{
mOptions = 0;
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
mMsgFlagMask = 0; mMsgFlagFilter = 0;
mBefore = 0; mAfter = 0; mReqType = 0;
}
@ -83,6 +86,8 @@ uint32_t mOptions;
uint32_t mStatusFilter;
uint32_t mStatusMask;
uint32_t mMsgFlagMask, mMsgFlagFilter;
uint32_t mReqType;
uint32_t mSubscribeFilter; // Only for Groups.

View file

@ -10,7 +10,7 @@ CONFIG += test_voip
# GXS Stuff.
CONFIG += newcache
CONFIG += newservices
#CONFIG += newservices
# Beware: All data of the stripped services are lost
DEFINES *= PQI_DISABLE_TUNNEL
@ -137,7 +137,8 @@ PUBLIC_HEADERS = retroshare/rsblogs.h \
retroshare/rstypes.h \
retroshare/rsdht.h \
retroshare/rsdsdv.h \
retroshare/rsconfig.h
retroshare/rsconfig.h \
retroshare/rsphotoV2.h
HEADERS += plugins/pluginmanager.h \
plugins/dlfcn_win32.h \
serialiser/rspluginitems.h
@ -148,65 +149,7 @@ HEADERS += retroshare/rsgame.h \
retroshare/rsphoto.h
# ################################ Linux ##########################################
linux-*:isEmpty(PREFIX) {
PREFIX = /usr \
}
isEmpty(INC_DIR) {
INC_DIR = $${PREFIX}/include/retroshare/ \
}
isEmpty(LIB_DIR) {
LIB_DIR = $${PREFIX}/lib/ \
}
# These two lines fixe compilation on ubuntu natty. Probably a ubuntu packaging error.
INCLUDEPATH *= /usr/lib/x86_64-linux-gnu/glib-2.0/include/
INCLUDEPATH *= /usr/lib/i386-linux-gnu/glib-2.0/include/
OPENPGPSDK_DIR = ../../openpgpsdk/src
INCLUDEPATH *= $${OPENPGPSDK_DIR} \
../openpgpsdk
DESTDIR = lib
QMAKE_CXXFLAGS *= -Wall \
-D_FILE_OFFSET_BITS=64
QMAKE_CC = g++
SSL_DIR = /usr/include/openssl
UPNP_DIR = /usr/include/upnp
INCLUDEPATH += . \
$${SSL_DIR} \
$${UPNP_DIR}
# gpg files
system(which gpg-error-config >/dev/null 2>&1):INCLUDEPATH += $$system(gpg-error-config --cflags | sed -e "s/-I//g")
else:message(Could not find gpg-error-config on your system, assuming gpg-error.h is in /usr/include)
system(which gpgme-config >/dev/null 2>&1):INCLUDEPATH += $$system(gpgme-config --cflags | sed -e "s/-I//g")
else:message(Could not find gpgme-config on your system, assuming gpgme.h is in /usr/include)
# libupnp implementation files
HEADERS += upnp/UPnPBase.h
SOURCES += upnp/UPnPBase.cpp
# where to put the shared library itself
target.path = $$LIB_DIR
INSTALLS *= target
# where to put the library's interface
include_rsiface.path = $${INC_DIR}
include_rsiface.files = $$PUBLIC_HEADERS
INSTALLS += include_rsiface
# CONFIG += version_detail_bash_script
DEFINES *= UBUNTU
INCLUDEPATH += /usr/include/glib-2.0/ \
/usr/lib/glib-2.0/include
LIBS *= -lgnome-keyring
linux-g++:OBJECTS_DIR = temp/linux-g++/obj
linux-g++-64:OBJECTS_DIR = temp/linux-g++-64/obj
version_detail_bash_script {
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh
}
# ################### Cross compilation for windows under Linux ####################
win32-x-g++ {
OBJECTS_DIR = temp/win32xgcc/obj
@ -262,10 +205,10 @@ linux-*:isEmpty(PREFIX) {
# miniupnp implementation files
HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c
UPNPC_DIR = ../../../miniupnpc-1.3
PTHREADS_DIR = ../../../pthreads-w32-2-8-0-release
ZLIB_DIR = ../../../zlib-1.2.3
SSL_DIR = ../../../openssl-1.0.1c
UPNPC_DIR = ../../../lib/miniupnpc-1.3
PTHREADS_DIR = ../../../lib/pthreads-w32-2-8-0-release
ZLIB_DIR = ../../../lib/zlib-1.2.3
SSL_DIR = ../../../OpenSSL
OPENPGPSDK_DIR = ../../openpgpsdk/src
INCLUDEPATH += . \
$${SSL_DIR}/include \
@ -274,7 +217,7 @@ linux-*:isEmpty(PREFIX) {
$${ZLIB_DIR} \
$${OPENPGPSDK_DIR}
newcache {
SQLITE_DIR = ../../../sqlite-autoconf-3071300
SQLITE_DIR = ../../../../Libraries/sqlite/sqlite-autoconf-3070900
INCLUDEPATH += . \
$${SQLITE_DIR}
}

View file

@ -62,9 +62,6 @@
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
#define RS_TOKREQ_ANSTYPE_ACK 0x0004

View file

@ -30,7 +30,6 @@
#include <string>
#include <list>
#include "rsgxsservice.h"
#include "rsphotoVEG.h"
/* The Main Interface Class - for information about your Peers */
class RsPhotoV2;
@ -42,21 +41,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,85 +74,95 @@ extern RsPhotoV2 *rsPhotoV2;
#define RSPHOTO_FLAGS_ATTRIB_AUTHOR 0x1000 // PUSH UP ORDER
#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;
//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;
//};
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 RsPhotoComment
{
public:
RsPhotoComment();
RsMsgMetaData mMeta;
std::string mComment;
uint32_t mCommentFlag;
};
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
@ -167,136 +175,150 @@ class RsPhotoV2
public:
static const uint32_t FLAG_MSG_TYPE_PHOTO_POST;
static const uint32_t FLAG_MSG_TYPE_PHOTO_COMMENT;
static const uint32_t FLAG_MSG_TYPE_MASK;
RsPhotoV2() { return; }
virtual ~RsPhotoV2() { return; }
RsPhotoV2() { return; }
/*!
* Use to enquire if groups or msgs have changed
* Poll regularly, particularly after a photo submission
* @return true if msgs or groups have changed
*/
virtual bool updated() = 0;
virtual ~RsPhotoV2() { return; }
/*!
*
* @param grpIds
*/
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds) = 0;
/*!
* Use to enquire if groups or msgs have changed
* Poll regularly, particularly after a photo submission
* @return true if msgs or groups have changed
*/
virtual bool updated() = 0;
/*!
*
* @param msgs
*/
virtual void msgsChanged(GxsMsgIdResult& msgs) = 0;
/*!
*
* @param grpIds
*/
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds) = 0;
/*!
* To acquire a handle to token service handler
* needed to make requests to the service
* @return handle to token service for this gxs service
*/
virtual RsTokenServiceV2* getTokenService() = 0;
/*!
*
* @param msgs
*/
virtual void msgsChanged(GxsMsgIdResult& msgs) = 0;
/* Generic Lists */
/*!
* To acquire a handle to token service handler
* needed to make requests to the service
* @return handle to token service for this gxs service
*/
virtual RsTokenServiceV2* getTokenService() = 0;
/*!
*
* @param token token to be redeemed for this request
* @param groupIds the ids return for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getGroupList(const uint32_t &token,
std::list<RsGxsGroupId> &groupIds) = 0;
/* Generic Lists */
/*!
* @param token token to be redeemed for this request
* @param msgIds the ids return for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getMsgList(const uint32_t &token,
GxsMsgIdResult &msgIds) = 0;
/*!
*
* @param token token to be redeemed for this request
* @param groupIds the ids return for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getGroupList(const uint32_t &token,
std::list<RsGxsGroupId> &groupIds) = 0;
/* Generic Summary */
/*!
* @param token token to be redeemed for this request
* @param msgIds the ids return for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getMsgList(const uint32_t &token,
GxsMsgIdResult &msgIds) = 0;
/*!
* @param token token to be redeemed for group summary request
* @param groupInfo the ids returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getGroupSummary(const uint32_t &token,
std::list<RsGroupMetaData> &groupInfo) = 0;
/* Generic Summary */
/*!
* @param token token to be redeemed for message summary request
* @param msgInfo the message metadata returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getMsgSummary(const uint32_t &token,
MsgMetaResult &msgInfo) = 0;
/*!
* @param token token to be redeemed for group summary request
* @param groupInfo the ids returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getGroupSummary(const uint32_t &token,
std::list<RsGroupMetaData> &groupInfo) = 0;
/* Specific Service Data */
/*!
* @param token token to be redeemed for message summary request
* @param msgInfo the message metadata returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getMsgSummary(const uint32_t &token,
MsgMetaResult &msgInfo) = 0;
/*!
* @param token token to be redeemed for album request
* @param album the album returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &album) = 0;
/* Specific Service Data */
/*!
* @param token token to be redeemed for photo request
* @param photo the photo returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getPhoto(const uint32_t &token,
PhotoResult &photo) = 0;
/*!
* @param token token to be redeemed for album request
* @param album the album returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &album) = 0;
/* details are updated in album - to choose Album ID, and storage path */
/*!
* @param token token to be redeemed for photo request
* @param photo the photo returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getPhoto(const uint32_t &token,
PhotoResult &photo) = 0;
/*!
* submits album, which returns a token that needs
* to be acknowledge to get album grp id
* @param token token to redeem for acknowledgement
* @param album album to be submitted
*/
virtual bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album) = 0;
/* details are updated in album - to choose Album ID, and storage path */
/*!
* submits photo, which returns a token that needs
* to be acknowledge to get photo msg-grp id pair
* @param token token to redeem for acknowledgement
* @param photo photo to be submitted
*/
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
/*!
* submits album, which returns a token that needs
* to be acknowledge to get album grp id
* @param token token to redeem for acknowledgement
* @param album album to be submitted
*/
virtual bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album) = 0;
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id
* @param token token to redeem for acknowledgement
* @param grpId the id of the group to subscribe to
*/
virtual bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId) = 0;
/*!
* submits photo, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* @param token token to redeem for acknowledgement
* @param photo photo to be submitted
*/
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
/*!
* This allows the client service to acknowledge that their msgs has
* been created/modified and retrieve the create/modified msg ids
* @param token the token related to modification/create request
* @param msgIds map of grpid->msgIds of message created/modified
* @return true if token exists false otherwise
*/
virtual bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
/*!
* submits photo comment, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* The mParentId needs to be set to an existing msg for which
* commenting is enabled
* @param token token to redeem for acknowledgement
* @param comment comment to be submitted
*/
virtual bool submitComment(uint32_t& token, RsPhotoComment &photo) = 0;
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id
* @param token token to redeem for acknowledgement
* @param grpId the id of the group to subscribe to
*/
virtual bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe) = 0;
/*!
* This allows the client service to acknowledge that their msgs has
* been created/modified and retrieve the create/modified msg ids
* @param token the token related to modification/create request
* @param msgIds map of grpid->msgIds of message created/modified
* @return true if token exists false otherwise
*/
virtual bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
/*!
* This allows the client service to acknowledge that their grps has
* been created/modified and retrieve the create/modified grp ids
* @param token the token related to modification/create request
* @param msgIds vector of ids of groups created/modified
* @return true if token exists false otherwise
*/
virtual bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) = 0;
/*!
* This allows the client service to acknowledge that their grps has
* been created/modified and retrieve the create/modified grp ids
* @param token the token related to modification/create request
* @param msgIds vector of ids of groups created/modified
* @return true if token exists false otherwise
*/
virtual bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) = 0;
};

View file

@ -30,6 +30,7 @@
#include <string>
#include <list>
#include <retroshare/rsidentityVEG.h>
#include "rsphotoV2.h"
/* The Main Interface Class - for information about your Peers */
class RsPhotoVEG;
@ -41,22 +42,6 @@ extern RsPhotoVEG *rsPhotoVEG;
#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;
};
/* If these flags are no set - the Photo inherits values from the Album
*/
@ -76,85 +61,6 @@ class RsPhotoThumbnail
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
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;
};
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);

View file

@ -1806,7 +1806,7 @@ RsTurtle *rsTurtle = NULL ;
#include "services/p3blogs.h"
#include "turtle/p3turtle.h"
#define ENABLE_GXS_VEG_SERVICES 1
#define ENABLE_GXS_SERVICES 1
#define ENABLE_GXS_CORE 1
#ifdef ENABLE_GXS_CORE
@ -1816,13 +1816,13 @@ RsTurtle *rsTurtle = NULL ;
#include "gxs/rsgxsnetservice.h"
#endif
#ifdef ENABLE_GXS_VEG_SERVICES
#include "services/p3photoserviceVEG.h"
#include "services/p3wikiserviceVEG.h"
#include "services/p3wireVEG.h"
#include "services/p3idserviceVEG.h"
#include "services/p3forumsVEG.h"
#include "services/p3postedVEG.h"
#ifdef ENABLE_GXS_SERVICES
#include "services/p3photoservice.h"
#include "services/p3wikiservice.h"
#include "services/p3wire.h"
#include "services/p3idservice.h"
#include "services/p3forumsv2.h"
#include "services/p3posted.h"
#endif
#ifndef PQI_DISABLE_TUNNEL
@ -2272,7 +2272,7 @@ int RsServer::StartupRetroShare()
// first prep the core
RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db",
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
RS_SERVICE_TYPE_PHOTO, NULL);
photo_ds->resetDataStore();
@ -2295,37 +2295,33 @@ int RsServer::StartupRetroShare()
// start up gxs core server
createThread(*mGxsCore);
// create some dummy items
#endif
#ifdef ENABLE_GXS_VEG_SERVICES
#ifdef ENABLE_GXS_SERVICES
// Testing New Cache Services.
p3PhotoServiceVEG *mPhotosVEG = new p3PhotoServiceVEG(RS_SERVICE_VEG_TYPE_PHOTO);
pqih -> addService(mPhotosVEG);
p3PhotoService *mPhotos = new p3PhotoService(RS_SERVICE_TYPE_PHOTO);
pqih -> addService(mPhotos);
// Testing New Cache Services.
p3WikiServiceVEG *mWikisVEG = new p3WikiServiceVEG(RS_SERVICE_VEG_TYPE_WIKI);
pqih -> addService(mWikisVEG);
p3WikiService *mWikis = new p3WikiService(RS_SERVICE_TYPE_WIKI);
pqih -> addService(mWikis);
// Testing New Cache Services.
p3WireVEG *mWireVEG = new p3WireVEG(RS_SERVICE_VEG_TYPE_WIRE);
pqih -> addService(mWireVEG);
p3Wire *mWire = new p3Wire(RS_SERVICE_TYPE_WIRE);
pqih -> addService(mWire);
// Testing New Cache Services.
p3IdServiceVEG *mIdentityVEG = new p3IdServiceVEG(RS_SERVICE_VEG_TYPE_IDENTITY);
pqih -> addService(mIdentityVEG);
p3IdService *mIdentity = new p3IdService(RS_SERVICE_TYPE_IDENTITY);
pqih -> addService(mIdentity);
// Testing New Cache Services.
p3ForumsVEG *mForumsVEG = new p3ForumsVEG(RS_SERVICE_VEG_TYPE_FORUMS);
pqih -> addService(mForumsVEG);
p3ForumsV2 *mForumsV2 = new p3ForumsV2(RS_SERVICE_TYPE_FORUMSV2);
pqih -> addService(mForumsV2);
// Testing New Cache Services.
p3PostedServiceVEG *mPostedVEG = new p3PostedServiceVEG(RS_SERVICE_VEG_TYPE_POSTED);
pqih -> addService(mPostedVEG);
#endif // ENABLE_GXS_VEG_SERVICES
p3PostedService *mPosted = new p3PostedService(RS_SERVICE_TYPE_POSTED);
pqih -> addService(mPosted);
#endif // ENABLE_GXS_SERVICES
#ifndef RS_RELEASE
@ -2586,18 +2582,15 @@ int RsServer::StartupRetroShare()
#ifdef ENABLE_GXS_SERVICES
// Testing of new cache system interfaces.
rsIdentityVEG = mIdentityVEG;
rsPhotoVEG = mPhotosVEG;
rsWikiVEG = mWikisVEG;
rsWireVEG = mWireVEG;
rsForumsVEG = mForumsVEG;
rsPostedVEG = mPostedVEG;
rsIdentity = mIdentity;
rsPhoto = mPhotos;
rsPhotoV2 = mPhotoV2;
rsWiki = mWikis;
rsWire = mWire;
rsForumsV2 = mForumsV2;
rsPosted = mPosted;
#endif // ENABLE_GXS_SERVICES
#ifdef ENABLE_GXS_CORE
rsPhotoV2 = mPhotoV2;
#endif // ENABLE_GXS_CORE
#ifdef RS_USE_BLOGS
rsBlogs = mBlogs;

View file

@ -88,7 +88,7 @@ RsItem* RsGxsPhotoSerialiser::deserialise(void* data, uint32_t* size)
uint32_t rstype = getRsItemId(data);
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)))
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)))
{
return NULL; /* wrong type */
}
@ -175,7 +175,7 @@ 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(RS_SERVICE_GXSV1_TYPE_PHOTO); // 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);
ok &= b.SetTlv(data, tlvsize, &offset);
@ -213,7 +213,7 @@ RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* da
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_PHOTO_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
@ -251,7 +251,7 @@ RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* da
ok &= GetTlvString(data, rssize, &offset, 1, item->album.mWhere);
ok &= GetTlvString(data, rssize, &offset, 1, item->album.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
ok &= b.GetTlv(data, rssize, &offset);
item->album.mThumbnail.data = (uint8_t*)b.bin_data;
item->album.mThumbnail.size = b.bin_len;
@ -341,7 +341,7 @@ 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_GXSV1_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);
ok &= b.SetTlv(data, tlvsize, &offset);
@ -379,7 +379,7 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
@ -415,7 +415,7 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mWhere);
ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent
ok &= b.GetTlv(data, rssize, &offset);
item->photo.mThumbnail.data = (uint8_t*)(b.bin_data);
item->photo.mThumbnail.size = b.bin_len;

View file

@ -68,6 +68,20 @@ public:
RsPhotoPhoto photo;
};
class RsGxsPhotoCommentItem : public RsGxsMsgItem
{
public:
RsGxsPhotoCommentItem(): RsGxsMsgItem(RS_SERVICE_GXSV1_TYPE_PHOTO,
RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM) { return; }
virtual ~RsGxsPhotoCommentItem() { return; }
void clear();
std::ostream &print(std::ostream &out, uint16_t indent = 0);
RsPhotoComment comment;
};
class RsGxsPhotoSerialiser : public RsSerialType
{
public:
@ -91,6 +105,9 @@ public:
bool serialiseGxsPhotoPhotoItem (RsGxsPhotoPhotoItem *item, void *data, uint32_t *size);
RsGxsPhotoPhotoItem * deserialiseGxsPhotoPhotoItem(void *data, uint32_t *size);
uint32_t sizeGxsPhotoCommentItem(RsGxsPhotoCommentItem *item);
bool serialiseGxsPhotoCommentItem (RsGxsPhotoCommentItem *item, void *data, uint32_t *size);
RsGxsPhotoCommentItem * deserialiseGxsPhotoCommentItem(void *data, uint32_t *size);
};

View file

@ -58,8 +58,8 @@ p3IdService::p3IdService(uint16_t type)
int p3IdService::tick()
{
//std::cerr << "p3IdService::tick()";
//std::cerr << std::endl;
std::cerr << "p3IdService::tick()";
std::cerr << std::endl;
fakeprocessrequests();
// Disable for now.

View file

@ -1,14 +1,12 @@
#include "p3photoserviceV2.h"
#include "serialiser/rsphotov2items.h"
#include "gxs/rsgxsflags.h"
RsPhotoV2 *rsPhotoV2 = NULL;
p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXSV1_TYPE_PHOTO)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_TYPE_PHOTO)
{
}
bool p3PhotoServiceV2::updated()
@ -148,13 +146,6 @@ bool p3PhotoServiceV2::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
return true;
}
bool p3PhotoServiceV2::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId)
{
RsGenExchange::setGroupSubscribeFlag(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
return true;
}
void p3PhotoServiceV2::notifyChanges(std::vector<RsGxsNotify*>& changes)

View file

@ -94,13 +94,23 @@ public:
*/
bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo);
/*!
* submits photo comment, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* The mParentId needs to be set to an existing msg for which
* commenting is enabled
* @param token token to redeem for acknowledgement
* @param comment comment to be submitted
*/
bool submitComment(uint32_t& token, RsPhotoComment &photo);
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id
* @param token token to redeem for acknowledgement
* @param grpId the id of the group to subscribe to
*/
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId);
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
/*!
* This allows the client service to acknowledge that their msgs has