mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 10:54:22 -05:00
removed old p3status.h/cc service, replaced with p3statusservice.h/cc
- did not follow naming convention for services git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2716 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
300952d2a6
commit
7009fa36f1
@ -1,119 +0,0 @@
|
|||||||
/*
|
|
||||||
* libretroshare/src/services: p3status.cc
|
|
||||||
*
|
|
||||||
* RetroShare C++ .
|
|
||||||
*
|
|
||||||
* Copyright 2008 by Vinny Do.
|
|
||||||
*
|
|
||||||
* 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 "services/p3status.h"
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& out, const StatusInfo& si)
|
|
||||||
{
|
|
||||||
out << "StatusInfo: " << std::endl;
|
|
||||||
out << "id: " << si.id << std::endl;
|
|
||||||
out << "status: " << si.status;
|
|
||||||
out << " (" << RsStatusString(si.status) << ")" << std::endl;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string RsStatusString(uint32_t status)
|
|
||||||
{
|
|
||||||
std::string str;
|
|
||||||
if (status == RS_STATUS_OFFLINE)
|
|
||||||
{
|
|
||||||
str = "Offline";
|
|
||||||
}
|
|
||||||
else if (status == RS_STATUS_AWAY)
|
|
||||||
{
|
|
||||||
str = "Away";
|
|
||||||
}
|
|
||||||
else if (status == RS_STATUS_BUSY)
|
|
||||||
{
|
|
||||||
str = "Busy";
|
|
||||||
}
|
|
||||||
else if (status == RS_STATUS_ONLINE)
|
|
||||||
{
|
|
||||||
str = "Online";
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
RsStatus *rsStatus = NULL;
|
|
||||||
|
|
||||||
p3Status::p3Status()
|
|
||||||
{
|
|
||||||
loadDummyData();
|
|
||||||
}
|
|
||||||
|
|
||||||
p3Status::~p3Status()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/********* RsStatus ***********/
|
|
||||||
|
|
||||||
bool p3Status::getStatus(std::string id, StatusInfo& statusInfo)
|
|
||||||
{
|
|
||||||
std::map<std::string, StatusInfo>::iterator it;
|
|
||||||
it = mStatusInfoMap.find(id);
|
|
||||||
if (it == mStatusInfoMap.end())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
statusInfo.id = (it->second).id;
|
|
||||||
statusInfo.status = (it->second).status;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool p3Status::setStatus(StatusInfo& statusInfo)
|
|
||||||
{
|
|
||||||
mStatusInfoMap[statusInfo.id] = statusInfo;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************/
|
|
||||||
|
|
||||||
void p3Status::loadDummyData()
|
|
||||||
{
|
|
||||||
StatusInfo si;
|
|
||||||
|
|
||||||
si.id = "id01";
|
|
||||||
si.status = RS_STATUS_OFFLINE;
|
|
||||||
|
|
||||||
setStatus(si);
|
|
||||||
|
|
||||||
si.id = "id02";
|
|
||||||
si.status = RS_STATUS_AWAY;
|
|
||||||
|
|
||||||
setStatus(si);
|
|
||||||
|
|
||||||
si.id = "id03";
|
|
||||||
si.status = RS_STATUS_BUSY;
|
|
||||||
|
|
||||||
setStatus(si);
|
|
||||||
|
|
||||||
si.id = "id04";
|
|
||||||
si.status = RS_STATUS_ONLINE;
|
|
||||||
|
|
||||||
setStatus(si);
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
#ifndef RS_P3_STATUS_INTERFACE_H
|
|
||||||
#define RS_P3_STATUS_INTERFACE_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* libretroshare/src/services: p3status.h
|
|
||||||
*
|
|
||||||
* RetroShare C++ .
|
|
||||||
*
|
|
||||||
* Copyright 2008 by Vinny Do.
|
|
||||||
*
|
|
||||||
* 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 <map>
|
|
||||||
|
|
||||||
#include "rsiface/rsstatus.h"
|
|
||||||
|
|
||||||
class p3Status: public RsStatus
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
p3Status();
|
|
||||||
virtual ~p3Status();
|
|
||||||
|
|
||||||
/********* RsStatus ***********/
|
|
||||||
|
|
||||||
virtual bool getStatus(std::string id, StatusInfo& statusInfo);
|
|
||||||
virtual bool setStatus(StatusInfo& statusInfo);
|
|
||||||
|
|
||||||
/******************************/
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void loadDummyData();
|
|
||||||
std::map<std::string, StatusInfo> mStatusInfoMap;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user