Introduce per-server user map

This allows us to store information about users in a signle place,
instead of putting it in user buffers. This is required to display
metadata about users in the channel members list.
This commit is contained in:
Simon Ser 2021-09-21 13:33:15 +02:00
parent e7f8620933
commit c66ce61029
3 changed files with 49 additions and 40 deletions

View file

@ -125,23 +125,25 @@ export default function BufferHeader(props) {
`;
break;
case BufferType.NICK:
if (props.buffer.who) {
let who = props.buffer.who;
let realname = stripANSI(who.realname || "");
if (props.user) {
let status = UserStatus.HERE;
if (who.away) {
if (props.user.offline) {
status = UserStatus.OFFLINE;
} else if (props.user.away) {
status = UserStatus.GONE;
}
if (props.buffer.offline) {
status = UserStatus.OFFLINE;
let realname = props.buffer.name;
if (props.user.realname) {
realname = stripANSI(props.user.realname || "");
}
description = html`<${NickStatus} status=${status}/> ${realname} (${who.username}@${who.hostname})`;
} else if (props.buffer.offline) {
// User is offline, but we don't have WHO information
description = html`<${NickStatus} status=${UserStatus.OFFLINE}/> ${props.buffer.name}`;
let mask = null;
if (props.user.username && props.user.hostname) {
mask = `(${props.user.username}@${props.user.hostname})`;
}
description = html`<${NickStatus} status=${status}/> ${realname} ${mask}`;
}
actions = html`