diff --git a/components/app.js b/components/app.js index fbeaa97..7bf3574 100644 --- a/components/app.js +++ b/components/app.js @@ -1020,7 +1020,7 @@ export default class App extends Component { return html`
- <${BufferList} buffers=${this.state.buffers} activeBuffer=${this.state.activeBuffer} onBufferClick=${this.handleBufferListClick}/> + <${BufferList} buffers=${this.state.buffers} networks=${this.state.networks} activeBuffer=${this.state.activeBuffer} onBufferClick=${this.handleBufferListClick}/>
Join channel
diff --git a/components/buffer-list.js b/components/buffer-list.js index 689e8ae..8914b53 100644 --- a/components/buffer-list.js +++ b/components/buffer-list.js @@ -1,6 +1,24 @@ +import * as irc from "/lib/irc.js"; import { html, Component } from "/lib/index.js"; import { BufferType, Unread, getBufferURL } from "/state.js"; +function getNetworkName(network) { + var bouncerStr = network.isupport.get("BOUNCER"); + if (bouncerStr) { + var bouncerProps = irc.parseTags(bouncerStr); + if (bouncerProps["network"]) { + return bouncerProps["network"]; + } + } + + var netName = network.isupport.get("NETWORK"); + if (netName) { + return netName; + } + + return "server"; +} + function BufferItem(props) { function handleClick(event) { event.preventDefault(); @@ -9,7 +27,7 @@ function BufferItem(props) { var name = props.buffer.name; if (props.buffer.type == BufferType.SERVER) { - name = "server"; + name = getNetworkName(props.network); } var activeClass = props.active ? "active" : ""; @@ -31,7 +49,7 @@ export default function BufferList(props) { return html` `; diff --git a/lib/irc.js b/lib/irc.js index 8e648d2..0d90a8f 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -50,7 +50,7 @@ function unescapeTag(s) { return s.replace(/\\[:s\\rn]/, (seq) => tagUnescapeMap[seq]); } -function parseTags(s) { +export function parseTags(s) { var tags = {}; s.split(";").forEach(function(s) { if (!s) { @@ -70,7 +70,7 @@ function parseTags(s) { return tags; } -function formatTags(tags) { +export function formatTags(tags) { var l = []; for (var k in tags) { var v = escapeTag(tags[k]);