Display bouncer network status

This commit is contained in:
Simon Ser 2021-03-10 11:48:58 +01:00
parent 6524dc5dd2
commit 1b21f5f076
2 changed files with 23 additions and 3 deletions

View file

@ -1099,7 +1099,7 @@ export default class App extends Component {
}
render() {
var activeBuffer = null, activeNetwork = null;
var activeBuffer = null, activeNetwork = null, activeBouncerNetwork = null;
var isBouncer = false;
if (this.state.buffers.get(this.state.activeBuffer)) {
activeBuffer = this.state.buffers.get(this.state.activeBuffer);
@ -1107,6 +1107,11 @@ export default class App extends Component {
var activeClient = this.clients.get(activeBuffer.network);
isBouncer = activeClient && activeClient.enabledCaps["soju.im/bouncer-networks"];
var bouncerNetID = activeNetwork.isupport.get("BOUNCER_NETID");
if (bouncerNetID) {
activeBouncerNetwork = this.state.bouncerNetworks.get(bouncerNetID);
}
}
if (!activeNetwork || (activeNetwork.status !== NetworkStatus.REGISTERED && !activeBuffer)) {
@ -1132,6 +1137,7 @@ export default class App extends Component {
buffer=${activeBuffer}
network=${activeNetwork}
isBouncer=${isBouncer}
bouncerNetwork=${activeBouncerNetwork}
onClose=${() => this.close(activeBuffer)}
onJoin=${() => this.handleJoinClick(activeBuffer.network)}
onAddNetwork=${this.handleAddNetworkClick}

View file

@ -50,8 +50,22 @@ export default function BufferHeader(props) {
description = "Logging in...";
break;
case NetworkStatus.REGISTERED:
var serverInfo = props.buffer.serverInfo;
description = `Connected to ${serverInfo.name}`;
if (props.bouncerNetwork) {
switch (props.bouncerNetwork.state) {
case "disconnected":
description = "Bouncer disconnected from network";
break;
case "connecting":
description = "Bouncer connecting to network...";
break;
case "connected":
description = `Connected to ${props.bouncerNetwork.host}`;
break;
}
} else {
var serverInfo = props.buffer.serverInfo;
description = `Connected to ${serverInfo.name}`;
}
break;
}
} else if (props.buffer.topic) {