diff --git a/libretroshare/src/rsiface/rsstatus.h b/libretroshare/src/rsiface/rsstatus.h index 2b53e0ec5..baaa7db14 100644 --- a/libretroshare/src/rsiface/rsstatus.h +++ b/libretroshare/src/rsiface/rsstatus.h @@ -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: diff --git a/libretroshare/src/services/p3status.cc b/libretroshare/src/services/p3status.cc index a2bbd1dd8..731dd4be8 100644 --- a/libretroshare/src/services/p3status.cc +++ b/libretroshare/src/services/p3status.cc @@ -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()