mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-12 08:33:05 -04:00
Added Rs photo v2 item serialisation test, fixed subsequent bugs
Reactivated Photodialog. almost completed integration, publishing and item storage working, but data retrieval algorithm needs to be changed (request flags need to be translated, based on update call rather than client assumption) fixed bug in rsgenexchange notification. Added LGPL notices git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5387 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3948234310
commit
a715947046
35 changed files with 916 additions and 350 deletions
|
@ -639,6 +639,7 @@ bool RsPhotoThumbnail::deleteImage()
|
|||
free(data);
|
||||
data = NULL;
|
||||
size = 0;
|
||||
type.clear();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,16 +11,37 @@ p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeS
|
|||
|
||||
bool p3PhotoServiceV2::updated()
|
||||
{
|
||||
return false;
|
||||
bool changed = (!mGroupChange.empty() || !mMsgChange.empty());
|
||||
|
||||
std::list<RsGxsGroupId> gL;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
|
||||
groupsChanged(gL);
|
||||
msgsChanged(msgs);
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
void p3PhotoServiceV2::groupsChanged(std::list<std::string>& grpIds) {
|
||||
|
||||
void p3PhotoServiceV2::groupsChanged(std::list<RsGxsGroupId>& grpIds)
|
||||
{
|
||||
while(!mGroupChange.empty())
|
||||
{
|
||||
RsGxsGroupChange* gc = mGroupChange.back();
|
||||
std::list<RsGxsGroupId>& gList = gc->grpIdList;
|
||||
std::list<RsGxsGroupId>::iterator lit = gList.begin();
|
||||
for(; lit != gList.end(); lit++)
|
||||
grpIds.push_back(*lit);
|
||||
|
||||
mGroupChange.pop_back();
|
||||
delete gc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void p3PhotoServiceV2::msgsChanged(
|
||||
std::map<std::string, std::vector<std::string> >& msgs)
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -33,7 +54,7 @@ RsTokenServiceV2* p3PhotoServiceV2::getTokenService() {
|
|||
|
||||
|
||||
bool p3PhotoServiceV2::getGroupList(const uint32_t& token,
|
||||
std::list<std::string>& groupIds)
|
||||
std::list<RsGxsGroupId>& groupIds)
|
||||
{
|
||||
return RsGenExchange::getGroupList(token, groupIds);
|
||||
}
|
||||
|
@ -74,6 +95,7 @@ bool p3PhotoServiceV2::getAlbum(const uint32_t& token, std::vector<RsPhotoAlbum>
|
|||
{
|
||||
RsGxsPhotoAlbumItem* item = dynamic_cast<RsGxsPhotoAlbumItem*>(*vit);
|
||||
RsPhotoAlbum album = item->album;
|
||||
album.mMeta = item->album.mMeta;
|
||||
delete item;
|
||||
albums.push_back(album);
|
||||
}
|
||||
|
@ -105,6 +127,7 @@ bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photos)
|
|||
if(item)
|
||||
{
|
||||
RsPhotoPhoto photo = item->photo;
|
||||
photo.mMeta = item->meta;
|
||||
photos[grpId].push_back(photo);
|
||||
delete item;
|
||||
}else
|
||||
|
@ -121,14 +144,45 @@ bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photos)
|
|||
|
||||
bool p3PhotoServiceV2::submitAlbumDetails(RsPhotoAlbum& album)
|
||||
{
|
||||
return false;
|
||||
RsGxsPhotoAlbumItem* albumItem = new RsGxsPhotoAlbumItem();
|
||||
albumItem->album = album;
|
||||
albumItem->meta = album.mMeta;
|
||||
return RsGenExchange::publishGroup(albumItem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void p3PhotoServiceV2::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
||||
{
|
||||
std::vector<RsGxsNotify*>::iterator vit = changes.begin();
|
||||
|
||||
for(; vit != changes.end(); vit++)
|
||||
{
|
||||
RsGxsNotify* n = *vit;
|
||||
RsGxsGroupChange* gc;
|
||||
RsGxsMsgChange* mc;
|
||||
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != NULL)
|
||||
{
|
||||
mMsgChange.push_back(mc);
|
||||
}
|
||||
else if((gc = dynamic_cast<RsGxsGroupChange*>(n)) != NULL)
|
||||
{
|
||||
mGroupChange.push_back(gc);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool p3PhotoServiceV2::submitPhoto(RsPhotoPhoto& photo)
|
||||
{
|
||||
return false;
|
||||
RsGxsPhotoPhotoItem* photoItem = new RsGxsPhotoPhotoItem();
|
||||
photoItem->photo = photo;
|
||||
photoItem->meta = photo.mMeta;
|
||||
|
||||
return RsGenExchange::publishMsg(photoItem);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,20 +43,23 @@ public:
|
|||
*/
|
||||
bool updated();
|
||||
|
||||
protected:
|
||||
|
||||
void notifyChanges(std::vector<RsGxsNotify*>& changes);
|
||||
public:
|
||||
|
||||
/** Requests **/
|
||||
|
||||
void groupsChanged(std::list<std::string>& grpIds);
|
||||
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
||||
|
||||
|
||||
void msgsChanged(std::map<std::string,
|
||||
std::vector<std::string> >& msgs);
|
||||
void msgsChanged(std::map<RsGxsGroupId,
|
||||
std::vector<RsGxsMessageId> >& msgs);
|
||||
|
||||
RsTokenServiceV2* getTokenService();
|
||||
|
||||
bool getGroupList(const uint32_t &token,
|
||||
std::list<std::string> &groupIds);
|
||||
std::list<RsGxsGroupId> &groupIds);
|
||||
bool getMsgList(const uint32_t &token,
|
||||
GxsMsgIdResult& msgIds);
|
||||
|
||||
|
@ -77,6 +80,11 @@ public:
|
|||
|
||||
bool submitAlbumDetails(RsPhotoAlbum &album);
|
||||
bool submitPhoto(RsPhotoPhoto &photo);
|
||||
|
||||
private:
|
||||
|
||||
std::vector<RsGxsGroupChange*> mGroupChange;
|
||||
std::vector<RsGxsMsgChange*> mMsgChange;
|
||||
};
|
||||
|
||||
#endif // P3PHOTOSERVICEV2_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue