From 9327333813cbcb538f6757934be42d59c34f86d6 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Tue, 20 Sep 2022 17:14:55 +0200 Subject: xC/xP: show own user's info in frontends --- xP/public/xP.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'xP/public') diff --git a/xP/public/xP.js b/xP/public/xP.js index 93fe642..144647e 100644 --- a/xP/public/xP.js +++ b/xP/public/xP.js @@ -388,7 +388,7 @@ rpcEventHandlers.set(Relay.Event.ServerUpdate, e => { let s = servers.get(e.serverName) if (s === undefined) servers.set(e.serverName, (s = {})) - s.state = e.state + s.data = e.data }) rpcEventHandlers.set(Relay.Event.ServerRename, e => { @@ -693,14 +693,21 @@ let Status = { let Prompt = { view: vnode => { - // This should be handled differently, so don't mind the lookup. let b = buffers.get(bufferCurrent) if (b === undefined || b.server === undefined) return - let state = b.server.state + if (b.server.data.user !== undefined) { + let user = b.server.data.user + if (b.server.data.userMode) + user += `(${b.server.data.userMode})` + return m('.prompt', {}, `${user}`) + } + + // This might certainly be done more systematically. + let state = b.server.data.state for (const s in Relay.ServerState) - if (Relay.ServerState[s] == b.server.state) { + if (Relay.ServerState[s] == state) { state = s break } -- cgit v1.2.3-70-g09d2