cache stuff does not compile. just saving lots of coding i've done.

Completed most of the coding for first new cache service, need to fix compile errors and test. 

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5330 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-07-26 21:48:54 +00:00
parent b2c74a045f
commit d50ecd145f
20 changed files with 775 additions and 263 deletions

View file

@ -2,7 +2,142 @@
#include "serialiser/rsphotov2items.h"
p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser())
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_TYPE_PHOTO)
{
}
bool p3PhotoServiceV2::updated()
{
return false;
}
void p3PhotoServiceV2::groupsChanged(std::list<std::string>& grpIds) {
}
void p3PhotoServiceV2::msgsChanged(
std::map<std::string, std::vector<std::string> >& msgs)
{
}
RsTokenService* p3PhotoServiceV2::getTokenService() {
return RsGenExchange::getTokenService();
}
bool p3PhotoServiceV2::getGroupList(const uint32_t& token,
std::list<std::string>& groupIds)
{
return RsGenExchange::getGroupList(token, groupIds);
}
bool p3PhotoServiceV2::getMsgList(const uint32_t& token,
GxsMsgIdResult& msgIds)
{
return RsGenExchange::getMsgList(token, msgIds);
}
bool p3PhotoServiceV2::getGroupSummary(const uint32_t& token,
std::list<RsGroupMetaData>& groupInfo)
{
return RsGenExchange::getGroupMeta(token, groupInfo);
}
bool p3PhotoServiceV2::getMsgSummary(const uint32_t& token,
MsgMetaResult& msgInfo)
{
return RsGenExchange::getMsgMeta(token, msgInfo);
}
bool p3PhotoServiceV2::getAlbum(const uint32_t& token, std::vector<RsPhotoAlbum>& albums)
{
std::vector<RsGxsGrpItem*> grpData;
bool ok = RsGenExchange::getGroupData(token, grpData);
if(ok)
{
std::vector<RsGxsGrpItem*>::iterator vit = grpData.begin();
for(; vit != grpData.end(); vit++)
{
RsGxsGrpItem* item = *vit;
RsPhotoAlbum album = *item;
albums.push_back(album);
}
}
return ok;
}
bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photo)
{
GxsMsgDataMap msgData;
bool ok = RsGenExchange::getMsgData(token, msgData);
if(ok)
{
GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); mit++)
{
RsGxsGroupId grpId = mit->first;
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
for(; vit != msgItems.end(); vit++)
{
RsGxsPhotoPhotoItem* item = dynamic_cast<RsGxsPhotoPhotoItem*>(*vit);
if(item)
{
RsPhotoPhoto photo = *item;
photo[grpId] = photo;
delete item;
}else
{
delete *vit;
}
}
}
}
return ok;
}
bool p3PhotoServiceV2::submitAlbumDetails(RsPhotoAlbum& album)
{
return false;
}
void p3PhotoServiceV2::operator =(RsPhoto& lPhotos,
const RsGxsPhotoPhotoItem& rPhoto)
{
lPhotos = rPhoto.photo;
}
void p3PhotoServiceV2::operator =(RsPhotoAlbum& lAlbum,
const RsGxsPhotoAlbumItem& rAlbum)
{
lAlbum = rAlbum.album;
}
bool p3PhotoServiceV2::submitPhoto(RsPhotoPhoto& photo)
{
return false;
}

View file

@ -38,6 +38,9 @@ public:
public:
/*!
* @return
*/
bool updated();
public:
@ -55,7 +58,7 @@ public:
bool getGroupList(const uint32_t &token,
std::list<std::string> &groupIds);
bool getMsgList(const uint32_t &token,
std::list<std::string> &msgIds);
GxsMsgIdResult& msgIds);
/* Generic Summary */
bool getGroupSummary(const uint32_t &token,
@ -65,18 +68,20 @@ public:
MsgMetaResult &msgInfo);
/* Specific Service Data */
bool getAlbum(const uint32_t &token, RsPhotoAlbum &album);
bool getPhoto(const uint32_t &token, PhotoResult &photo);
bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &albums);
bool getPhoto(const uint32_t &token, PhotoResult &photos);
private:
void operator=(RsPhoto& lPhotos, const RsGxsPhotoPhotoItem& rPhoto);
void operator=(RsPhotoAlbum& lAlbum, const RsGxsPhotoAlbumItem& rAlbum);
public:
/** Modifications **/
bool submitAlbumDetails(RsPhotoAlbum &album, bool isNew);
bool submitPhoto(RsPhotoPhoto &photo, bool isNew);
bool subscribeToAlbum(const std::string& grpId, bool subscribe);
bool submitAlbumDetails(RsPhotoAlbum &album);
bool submitPhoto(RsPhotoPhoto &photo);
};
#endif // P3PHOTOSERVICEV2_H