Mostly connectivity code additions

* implementation of p3config, cache functionality to p3Qblog
* added peerid (pid) attribute to rsQblog item and its serialisation
* TODO: logical updating for p3Qblog
* TODO: implement tick() so can add to server 
* TODO: test p3Qblog after addition of tick with some peers



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@571 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2008-06-04 10:59:24 +00:00
parent e83a76c38a
commit d8bfc6d8b3
15 changed files with 886 additions and 139 deletions

View file

@ -11,6 +11,7 @@ RSOBJ = p3peers.o \
p3rank.o \
p3photo.o \
p3msgs.o \
p3Blog.o \
p3discovery.o \
p3face-file.o \
p3face-server.o \

View file

@ -0,0 +1,91 @@
/*
* libretroshare/src/rsserver: p3blog.cc
*
* RetroShare C++ Interface.
*
* Copyright 2007-2008 by Chris 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 "rsserver/p3Blog.h"
RsQblog* rsQblog = NULL;
p3Blog::p3Blog(p3Qblog* qblog) :
mQblog(qblog)
{
return;
}
p3Blog::~p3Blog()
{
return;
}
bool p3Blog::addToFilter(std::string &usrId)
{
return mQblog->addToFilter(usrId);
}
bool p3Blog::getBlogs(std::map< std::string, std::multimap<long int, std:: string> > &blogs)
{
return mQblog->getBlogs(blogs);
}
bool p3Blog::getFilterSwitch(void)
{
return mQblog->getFilterSwitch();
}
bool p3Blog::getProfile(std::map<std::string, std::string> &profile)
{
return mQblog->getProfile(profile);
}
bool p3Blog::getStatus(std::map<std::string, std::string> &usrStatus)
{
return mQblog->getStatus(usrStatus);
}
bool p3Blog::sendBlog(const std::string &msg)
{
return mQblog->sendBlog(msg);
}
bool p3Blog::setFilterSwitch(bool &filterSwitch)
{
return mQblog->setFilterSwitch(filterSwitch);
}
bool p3Blog::setProfile(const std::string &favSong)
{
return mQblog->setProfile(favSong);
}
bool p3Blog::setStatus(const std::string &status)
{
return mQblog->setStatus(status);
}
bool p3Blog::removeFiltFriend(std::string &usrId)
{
return mQblog->removeFiltFriend(usrId);
}

View file

@ -0,0 +1,66 @@
#ifndef P3BLOG_H_
#define P3BLOG_H_
/*
* libretroshare/src/rsserver: p3blog.h
*
* RetroShare C++ Interface.
*
* Copyright 2007-2008 by Chris 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 "rsiface/rsQblog.h"
#include "services/p3Qblog.h"
/*!
* Interface class using composition (p3Qblog is an attribute)
* See derived class for documentation of derived functions
*/
class p3Blog : public RsQblog
{
public:
p3Blog(p3Qblog* qblog);
virtual ~p3Blog();
virtual bool setStatus(const std::string &status);
virtual bool getStatus(std::map<std::string, std::string> &usrStatus);
virtual bool setFilterSwitch(bool &filterSwitch);
virtual bool getFilterSwitch(void);
virtual bool addToFilter(std::string &usrId);
virtual bool removeFiltFriend(std::string &usrId);
virtual bool getProfile(std::map<std::string, std::string> &profile);
virtual bool setProfile(const std::string &favSong);
virtual bool sendBlog(const std::string &msg);
virtual bool getBlogs(std::map< std::string, std::multimap<long int, std:: string> > &blogs);
private:
/// to make rsCore blog-service calls
p3Qblog* mQblog;
};
#endif /*P3BLOG_H_*/

View file

@ -214,6 +214,11 @@ void RsServer::run()
/* Tick slow services */
if (mRanking)
mRanking->tick();
/* TODO need to implement tick function
if(mQblog)
mQblog->tick()
*/
#if 0

View file

@ -66,8 +66,10 @@
#include "rsserver/p3msgs.h"
#include "rsserver/p3discovery.h"
#include "rsserver/p3photo.h"
#include "rsserver/p3Blog.h"
#include "rsiface/rsgame.h"
#include "pqi/p3notify.h" // HACK - moved to pqi for compilation order.
@ -569,23 +571,32 @@ int RsServer::StartupRetroShare(RsInit *config)
p3GameLauncher *gameLauncher = new p3GameLauncher(mConnMgr);
pqih -> addService(gameLauncher);
mRanking = new p3Ranking(mConnMgr, RS_SERVICE_TYPE_RANK,
mRanking = new p3Ranking(mConnMgr, RS_SERVICE_TYPE_RANK, /* declaration of cache enable service rank */
mCacheStrapper, mCacheTransfer,
localcachedir, remotecachedir, 3600 * 24 * 30);
CachePair cp(mRanking, mRanking, CacheId(RS_SERVICE_TYPE_RANK, 0));
mCacheStrapper -> addCachePair(cp);
mCacheStrapper -> addCachePair(cp); /* end of declaration */
p3PhotoService *photoService = new p3PhotoService(RS_SERVICE_TYPE_PHOTO,
p3PhotoService *photoService = new p3PhotoService(RS_SERVICE_TYPE_PHOTO, /* .... for photo service */
mCacheStrapper, mCacheTransfer,
localcachedir, remotecachedir);
CachePair cp2(photoService, photoService, CacheId(RS_SERVICE_TYPE_PHOTO, 0));
mCacheStrapper -> addCachePair(cp2);
mQblog = new p3Qblog(mConnMgr, RS_SERVICE_TYPE_QBLOG, /* ...then for Qblog */
mCacheStrapper, mCacheTransfer,
localcachedir, remotecachedir, 3600 * 24 * 30);
CachePair cp3(mQblog, mQblog, CacheId(RS_SERVICE_TYPE_QBLOG, 0));
mCacheStrapper -> addCachePair(cp3);
#else
mRanking = NULL;
mQBlog = NULL;
#endif
@ -612,6 +623,7 @@ int RsServer::StartupRetroShare(RsInit *config)
mConfigMgr->addConfiguration("cache.cfg", mCacheStrapper);
#ifndef RS_RELEASE
mConfigMgr->addConfiguration("ranklink.cfg", mRanking);
mConfigMgr->addConfiguration("qblog.cfg", mQblog);
#endif
/**************************************************************************/
@ -741,7 +753,7 @@ int RsServer::StartupRetroShare(RsInit *config)
rsRanks = new p3Rank(mRanking);
rsForums = new p3Forums();
rsStatus = new p3Status();
rsQblog = new p3Qblog();
rsQblog = new p3Blog(mQblog);
#else
rsGameLauncher = NULL;

View file

@ -41,6 +41,7 @@
#include "services/p3msgservice.h"
#include "services/p3chatservice.h"
#include "services/p3ranking.h"
#include "services/p3Qblog.h"
/* The Main Interface Class - for controlling the server */
@ -286,6 +287,7 @@ int UpdateAllConfig();
/* caches (that need ticking) */
p3Ranking *mRanking;
p3Qblog *mQblog;
/* Config */
p3ConfigMgr *mConfigMgr;