fixed to allow compilation. but photodialog slightly less usable. issue with retroshare-nogui still needs fixing

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5567 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-09-18 21:19:29 +00:00
parent eaa7342165
commit 33d001898f
8 changed files with 137 additions and 16 deletions

View File

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

View File

@ -1806,7 +1806,7 @@ RsTurtle *rsTurtle = NULL ;
#include "services/p3blogs.h"
#include "turtle/p3turtle.h"
#define ENABLE_GXS_SERVICES 1
//#define ENABLE_GXS_SERVICES 1
#define ENABLE_GXS_CORE 1
#ifdef ENABLE_GXS_CORE
@ -2272,7 +2272,7 @@ int RsServer::StartupRetroShare()
// first prep the core
RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db",
RS_SERVICE_TYPE_PHOTO, NULL);
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
photo_ds->resetDataStore();
@ -2580,11 +2580,11 @@ int RsServer::StartupRetroShare()
rsForums = mForums;
rsChannels = mChannels;
rsPhotoV2 = mPhotoV2;
#ifdef ENABLE_GXS_SERVICES
// Testing of new cache system interfaces.
rsIdentity = mIdentity;
rsPhoto = mPhotos;
rsPhotoV2 = mPhotoV2;
rsWiki = mWikis;
rsWire = mWire;
rsForumsV2 = mForumsV2;

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_TYPE_PHOTO != getRsItemService(rstype)))
(RS_SERVICE_GXSV1_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_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_GXSV1_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_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_SERVICE_GXSV1_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_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_GXSV1_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_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_GXSV1_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_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_SERVICE_GXSV1_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_TYPE_PHOTO); // TODO, need something more persisitent
RsTlvBinaryData b(RS_SERVICE_GXSV1_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;
@ -443,6 +443,21 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
return item;
}
uint32_t RsGxsPhotoSerialiser::sizeGxsPhotoCommentItem(RsGxsPhotoCommentItem *item)
{
}
bool RsGxsPhotoSerialiser::serialiseGxsPhotoCommentItem (RsGxsPhotoCommentItem *item, void *data, uint32_t *size)
{
return false;
}
RsGxsPhotoCommentItem * RsGxsPhotoSerialiser::deserialiseGxsPhotoCommentItem(void *data, uint32_t *size)
{
return NULL;
}
void RsGxsPhotoAlbumItem::clear()
{
album.mCaption.clear();
@ -457,6 +472,17 @@ void RsGxsPhotoAlbumItem::clear()
album.mThumbnail.deleteImage();
}
void RsGxsPhotoCommentItem::clear()
{
}
std::ostream& RsGxsPhotoCommentItem::print(std::ostream& out, uint16_t indent)
{
return out;
}
std::ostream& RsGxsPhotoAlbumItem::print(std::ostream& out, uint16_t indent)
{
printRsItemBase(out, "RsGxsPhotoAlbumItem", indent);

View File

@ -1,10 +1,81 @@
#include "p3photoserviceV2.h"
#include "serialiser/rsphotov2items.h"
#include "gxs/rsgxsflags.h"
RsPhotoV2 *rsPhotoV2 = NULL;
bool RsPhotoThumbnail::copyFrom(const RsPhotoThumbnail &nail)
{
if (data)
{
deleteImage();
}
if ((!nail.data) || (nail.size == 0))
{
return false;
}
size = nail.size;
type = nail.type;
data = (uint8_t *) malloc(size);
memcpy(data, nail.data, size);
return true;
}
bool RsPhotoThumbnail::deleteImage()
{
if (data)
{
free(data);
data = NULL;
size = 0;
type.clear();
}
return true;
}
RsPhotoPhoto::RsPhotoPhoto()
:mSetFlags(0), mOrder(0), mMode(0), mModFlags(0)
{
return;
}
RsPhotoAlbum::RsPhotoAlbum()
:mMode(0), mSetFlags(0), mModFlags(0)
{
return;
}
RsPhotoComment::RsPhotoComment()
: mComment(""), mCommentFlag(0) {
}
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo)
{
out << "RsPhotoPhoto [ ";
out << "Title: " << photo.mMeta.mMsgName;
out << "]";
return out;
}
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album)
{
out << "RsPhotoAlbum [ ";
out << "Title: " << album.mMeta.mGroupName;
out << "]";
return out;
}
p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_TYPE_PHOTO)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXSV1_TYPE_PHOTO)
{
}
@ -182,6 +253,16 @@ bool p3PhotoServiceV2::submitPhoto(uint32_t& token, RsPhotoPhoto& photo)
return true;
}
bool p3PhotoServiceV2::submitComment(uint32_t &token, RsPhotoComment &comment)
{
RsGxsPhotoCommentItem* commentItem = new RsGxsPhotoCommentItem();
commentItem->comment = comment;
commentItem->meta = comment.mMeta;
RsGenExchange::publishMsg(token, commentItem);
return true;
}
bool p3PhotoServiceV2::acknowledgeMsg(const uint32_t& token,
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
{
@ -195,5 +276,14 @@ bool p3PhotoServiceV2::acknowledgeGrp(const uint32_t& token,
return RsGenExchange::acknowledgeTokenGrp(token, grpId);
}
bool p3PhotoServiceV2::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId, bool subscribe)
{
if(subscribe)
RsGenExchange::setGroupSubscribeFlag(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
else
RsGenExchange::setGroupSubscribeFlag(token, grpId, ~GXS_SERV::GROUP_SUBSCRIBE_MASK);
return true;
}

View File

@ -31,3 +31,8 @@ void PhotoDialog::loadRequest(const TokenQueueV2 *queue, const TokenRequestV2 &r
{
}
void PhotoDialog::addComment()
{
}

View File

@ -95,7 +95,6 @@ PhotoShare::PhotoShare(QWidget *parent)
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
timer->start(1000);
/* setup TokenQueue */
mPhotoQueue = new TokenQueueV2(rsPhotoV2->getTokenService(), this);
requestAlbumData();

View File

@ -66,11 +66,11 @@ bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTok
return true;
}
bool TokenQueueV2::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
bool TokenQueueV2::requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds, uint32_t usertype)
{
uint32_t basictype = TOKENREQ_MSGINFO;
uint32_t anstype = RS_TOKREQ_ANSTYPE_LIST; // always a list answer
mService->requestMsgRelatedInfo(token, anstype, opts, ids);
mService->requestMsgRelatedInfo(token, anstype, opts, msgIds);
queueRequest(token, basictype, anstype, usertype);
return true;

View File

@ -85,6 +85,7 @@ public:
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
std::list<RsGxsGroupId>& ids, uint32_t usertype);
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, uint32_t usertype);
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
@ -93,7 +94,7 @@ public:
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
const GxsMsgReq& grpIds, uint32_t usertype);
bool requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& grpIds, uint32_t usertype);
bool requestMsgRelatedInfo(uint32_t &token, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds, uint32_t usertype);
bool cancelRequest(const uint32_t token);