Added RsStatusString() - returns a string for given status number

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@527 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
vinnyx 2008-04-28 11:50:39 +00:00
parent a5d69bee24
commit 3eafd7d00e
2 changed files with 26 additions and 1 deletions

View File

@ -39,6 +39,8 @@ const uint32_t RS_STATUS_AWAY = 0x0002;
const uint32_t RS_STATUS_BUSY = 0x0003;
const uint32_t RS_STATUS_ONLINE = 0x0004;
std::string RsStatusString(uint32_t status);
class StatusInfo
{
public:

View File

@ -29,10 +29,33 @@ std::ostream& operator<<(std::ostream& out, const StatusInfo& si)
{
out << "StatusInfo: " << std::endl;
out << "id: " << si.id << std::endl;
out << "status: " << si.status << 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()