mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 14:31:11 +01:00
ircd:Ⓜ️ Additional pretty_msgline() opts for time ago / body delim.
This commit is contained in:
parent
f931912f3e
commit
7a90776056
2 changed files with 13 additions and 2 deletions
|
@ -46,9 +46,11 @@ struct ircd::m::pretty_opts
|
|||
bool show_event_idx {true};
|
||||
bool show_depth {true};
|
||||
bool show_origin_server_ts {true};
|
||||
bool show_origin_server_ts_ago {false};
|
||||
bool show_event_id {true};
|
||||
bool show_sender {true};
|
||||
bool show_state_key {true};
|
||||
bool show_content {true};
|
||||
bool show_msgtype {true};
|
||||
char body_delim {':'};
|
||||
};
|
||||
|
|
|
@ -638,6 +638,14 @@ ircd::m::pretty_msgline(std::ostream &s,
|
|||
s << smalldate(sdbuf, json::get<"origin_server_ts"_>(event) / 1000L) << ' ';
|
||||
}
|
||||
|
||||
if(opts.show_origin_server_ts_ago)
|
||||
{
|
||||
char buf[48];
|
||||
const system_point p(milliseconds(json::get<"origin_server_ts"_>(event)));
|
||||
if(json::get<"origin_server_ts"_>(event) != json::undefined_number)
|
||||
s << ago(buf, p, 0x3) << ' ';
|
||||
}
|
||||
|
||||
if(opts.show_event_id)
|
||||
s << event.event_id << ' ';
|
||||
|
||||
|
@ -685,8 +693,9 @@ ircd::m::pretty_msgline(std::ostream &s,
|
|||
|
||||
if(opts.show_msgtype)
|
||||
s << type << ' ';
|
||||
else if(type != "m.text")
|
||||
break;
|
||||
|
||||
if(opts.body_delim)
|
||||
s << opts.body_delim;
|
||||
|
||||
s << msg.body();
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue