mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 19:12:28 -04:00
finished status service
- can be called use rs interface rstatus - does not save last rs session status yet git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2715 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2eb3d560e0
commit
300952d2a6
11 changed files with 560 additions and 19 deletions
|
@ -44,6 +44,7 @@
|
|||
#include "services/p3ranking.h"
|
||||
#include "services/p3Qblog.h"
|
||||
#include "services/p3blogs.h"
|
||||
#include "services/p3statusservice.h"
|
||||
|
||||
|
||||
/* The Main Interface Class - for controlling the server */
|
||||
|
@ -172,6 +173,7 @@ class RsServer: public RsControl, public RsThread
|
|||
p3disc *ad;
|
||||
p3MsgService *msgSrv;
|
||||
p3ChatService *chatSrv;
|
||||
p3StatusService *mStatusSrv;
|
||||
|
||||
/* caches (that need ticking) */
|
||||
p3Ranking *mRanking;
|
||||
|
|
76
libretroshare/src/rsserver/p3status.cc
Normal file
76
libretroshare/src/rsserver/p3status.cc
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* libretroshare/src/rsserver: p3msgs.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2007-2008 by Robert Fernie.
|
||||
*
|
||||
* 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 "p3status.h"
|
||||
#include "services/p3statusservice.h"
|
||||
|
||||
p3Status::p3Status(p3StatusService* statusSrv)
|
||||
: mStatusSrv(statusSrv) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
p3Status::~p3Status(){
|
||||
return;
|
||||
}
|
||||
|
||||
bool p3Status::getStatus(std::list<StatusInfo >& statusInfo){
|
||||
|
||||
return mStatusSrv->getStatus(statusInfo);
|
||||
}
|
||||
|
||||
|
||||
bool p3Status::sendStatus(StatusInfo& statusInfo){
|
||||
|
||||
return mStatusSrv->sendStatus(statusInfo);
|
||||
}
|
||||
|
||||
bool p3Status::statusAvailable(){
|
||||
|
||||
return mStatusSrv->statusAvailable();
|
||||
}
|
||||
|
||||
void p3Status::getStatusString(uint32_t status, std::string& statusString){
|
||||
|
||||
if (status == RS_STATUS_OFFLINE){
|
||||
|
||||
statusString = "Offline";
|
||||
|
||||
}else if (status == RS_STATUS_AWAY){
|
||||
|
||||
statusString = "Away";
|
||||
|
||||
}else if (status == RS_STATUS_BUSY){
|
||||
|
||||
statusString = "Busy";
|
||||
|
||||
}else if (status == RS_STATUS_ONLINE){
|
||||
|
||||
statusString = "Online";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
58
libretroshare/src/rsserver/p3status.h
Normal file
58
libretroshare/src/rsserver/p3status.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
#ifndef RS_P3STATUS_INTERFACE_H
|
||||
#define RS_P3STATUS_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsserver: p3status.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/rsstatus.h"
|
||||
|
||||
|
||||
class p3StatusService;
|
||||
|
||||
//! Implements abstract interface rsStatus
|
||||
/*!
|
||||
* Interfaces with p3StatusService
|
||||
*/
|
||||
class p3Status : public RsStatus
|
||||
{
|
||||
public:
|
||||
|
||||
p3Status(p3StatusService* statusSrv);
|
||||
virtual ~p3Status();
|
||||
|
||||
|
||||
virtual bool getStatus(std::list<StatusInfo>& statusInfo);
|
||||
virtual bool sendStatus(StatusInfo& statusInfo);
|
||||
virtual bool statusAvailable();
|
||||
|
||||
virtual void getStatusString(uint32_t status, std::string& statusString);
|
||||
|
||||
private:
|
||||
|
||||
p3StatusService* mStatusSrv;
|
||||
|
||||
};
|
||||
|
||||
#endif /* RS_P3STATUS_INTERFACE_H */
|
|
@ -1818,7 +1818,7 @@ RsTurtle *rsTurtle = NULL ;
|
|||
#include "services/p3photoservice.h"
|
||||
#include "services/p3forums.h"
|
||||
#include "services/p3channels.h"
|
||||
#include "services/p3status.h"
|
||||
#include "services/p3statusservice.h"
|
||||
#include "services/p3Qblog.h"
|
||||
#include "services/p3blogs.h"
|
||||
#include "turtle/p3turtle.h"
|
||||
|
@ -1839,6 +1839,7 @@ RsTurtle *rsTurtle = NULL ;
|
|||
#include "rsserver/p3discovery.h"
|
||||
#include "rsserver/p3photo.h"
|
||||
#include "rsserver/p3blog.h"
|
||||
#include "rsserver/p3status.h"
|
||||
#include "rsiface/rsgame.h"
|
||||
|
||||
#include "pqi/p3notify.h" // HACK - moved to pqi for compilation order.
|
||||
|
@ -1848,7 +1849,7 @@ RsTurtle *rsTurtle = NULL ;
|
|||
#define RS_RELEASE 1
|
||||
****/
|
||||
|
||||
#define RS_RELEASE 1
|
||||
//#define RS_RELEASE 1
|
||||
|
||||
|
||||
RsControl *createRsControl(RsIface &iface, NotifyBase ¬ify)
|
||||
|
@ -1975,6 +1976,7 @@ int RsServer::StartupRetroShare()
|
|||
ad = new p3disc(mConnMgr, pqih);
|
||||
msgSrv = new p3MsgService(mConnMgr);
|
||||
chatSrv = new p3ChatService(mConnMgr);
|
||||
mStatusSrv = new p3StatusService(mConnMgr);
|
||||
|
||||
p3tunnel *tn = new p3tunnel(mConnMgr, pqih);
|
||||
pqih -> addService(tn);
|
||||
|
@ -1988,6 +1990,7 @@ int RsServer::StartupRetroShare()
|
|||
pqih -> addService(ad);
|
||||
pqih -> addService(msgSrv);
|
||||
pqih -> addService(chatSrv);
|
||||
pqih ->addService(mStatusSrv);
|
||||
|
||||
/* create Cache Services */
|
||||
std::string config_dir = RsInitConfig::configDir;
|
||||
|
@ -2091,6 +2094,7 @@ int RsServer::StartupRetroShare()
|
|||
mConfigMgr->addConfiguration("channels.cfg", mChannels);
|
||||
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
||||
mConfigMgr->addConfiguration("p3disc.cfg", ad);
|
||||
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
||||
|
||||
ftserver->addConfiguration(mConfigMgr);
|
||||
|
||||
|
@ -2207,7 +2211,7 @@ int RsServer::StartupRetroShare()
|
|||
#ifndef RS_RELEASE
|
||||
rsGameLauncher = gameLauncher;
|
||||
rsPhoto = new p3Photo(photoService);
|
||||
rsStatus = new p3Status();
|
||||
rsStatus = new p3Status(mStatusSrv);
|
||||
rsQblog = new p3Blog(mQblog);
|
||||
#else
|
||||
rsGameLauncher = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue