0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

modules/m_command: Add ping room cmd; minor cleanup.

This commit is contained in:
Jason Volk 2019-07-23 23:34:17 -07:00
parent 58c83b01a7
commit 92f6d7ddb4

View file

@ -404,13 +404,13 @@ command__ping(const mutable_buffer &buf,
timer.at<nanoseconds>() timer.at<nanoseconds>()
}; };
const string_view sp{"&nbsp;"}; static const string_view
const string_view fg{"#e8e8e8"}; sp{"&nbsp;"}, fg{"#e8e8e8"}, host_bg{"#181b21"},
const string_view host_bg{"#181b21"}; online_bg{"#008000"}, offline_bg{"#A01810"};
const string_view online_bg{"#008000"};
const string_view offline_bg{"#A01810"}; const string_view
const auto bg{eptr? offline_bg : online_bg}; bg{eptr? offline_bg : online_bg},
const auto status{eptr? "FAILED" : "ONLINE"}; status{eptr? "FAILED " : "ONLINE"};
std::ostringstream out; std::ostringstream out;
pubsetbuf(out, buf); pubsetbuf(out, buf);
@ -482,20 +482,15 @@ command__ping__room(const mutable_buffer &buf,
(const auto &result) (const auto &result)
{ {
++responses; ++responses;
const auto time
{
timer.at<nanoseconds>()
};
const string_view sp{"&nbsp;"}; static const string_view
const string_view fg{"#e8e8e8"}; sp{"&nbsp;"}, fg{"#e8e8e8"}, host_bg{"#181b21"},
const string_view host_bg{"#181b21"}; online_bg{"#008000"}, offline_bg{"#A01810"};
const string_view online_bg{"#008000"};
const string_view offline_bg{"#A01810"}; const string_view
const auto bg{result.eptr? offline_bg : online_bg}; bg{result.eptr? offline_bg : online_bg},
const auto status{result.eptr? "FAILED " : "ONLINE"}; status{result.eptr? "FAILED " : "ONLINE"};
thread_local char tmbuf[32];
out out
<< " <font color=\"" << fg << "\" data-mx-bg-color=\"" << bg << "\">" << " <font color=\"" << fg << "\" data-mx-bg-color=\"" << bg << "\">"
<< " <b>" << " <b>"
@ -509,7 +504,7 @@ command__ping__room(const mutable_buffer &buf,
if(!result.eptr) if(!result.eptr)
out << " <b>" out << " <b>"
<< pretty(tmbuf, time) << pretty(tmbuf, timer.at<nanoseconds>())
<< " </b>" << " </b>"
<< " application layer round-trip time." << " application layer round-trip time."
<< "<br />"; << "<br />";