mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-14 19:25:26 -05:00
Parse RPL_MYINFO
This commit is contained in:
parent
57ed3a13a3
commit
1807f29d2d
3 changed files with 20 additions and 5 deletions
|
@ -122,6 +122,7 @@ export default class App extends Component {
|
|||
buffers.set(name, {
|
||||
name,
|
||||
type,
|
||||
serverInfo: null, // if server
|
||||
topic: null, // if channel
|
||||
who: null, // if nick
|
||||
members: new Map(),
|
||||
|
@ -219,6 +220,14 @@ export default class App extends Component {
|
|||
});
|
||||
}
|
||||
break;
|
||||
case irc.RPL_MYINFO:
|
||||
// TODO: parse available modes
|
||||
var serverInfo = {
|
||||
name: msg.params[1],
|
||||
version: msg.params[2],
|
||||
};
|
||||
this.setBufferState(SERVER_BUFFER, { serverInfo });
|
||||
break;
|
||||
case irc.RPL_TOPIC:
|
||||
var channel = msg.params[1];
|
||||
var topic = msg.params[2];
|
||||
|
@ -488,7 +497,7 @@ export default class App extends Component {
|
|||
}
|
||||
|
||||
var topbar = null;
|
||||
if (activeBuffer && activeBuffer.type != BufferType.SERVER) {
|
||||
if (activeBuffer) {
|
||||
topbar = html`
|
||||
<section id="topbar">
|
||||
<${BufferHeader} buffer=${activeBuffer} onClose=${() => this.close(activeBuffer.name)}/>
|
||||
|
|
|
@ -8,11 +8,14 @@ export default function BufferHeader(props) {
|
|||
}
|
||||
|
||||
var description = null;
|
||||
if (props.buffer.topic) {
|
||||
description = html`<span class="description">${props.buffer.topic}</span>`;
|
||||
if (props.buffer.serverInfo) {
|
||||
var serverInfo = props.buffer.serverInfo;
|
||||
description = `Connected to ${serverInfo.name}`;
|
||||
} else if (props.buffer.topic) {
|
||||
description = props.buffer.topic;
|
||||
} else if (props.buffer.who) {
|
||||
var who = props.buffer.who;
|
||||
description = html`<span class="description">${who.realname} (${who.username}@${who.hostname})</span>`;
|
||||
description = `${who.realname} (${who.username}@${who.hostname})`;
|
||||
}
|
||||
|
||||
var closeText = "Close";
|
||||
|
@ -26,7 +29,7 @@ export default function BufferHeader(props) {
|
|||
}
|
||||
|
||||
return html`
|
||||
${description}
|
||||
<span class="description">${description}</span>
|
||||
<span class="actions">
|
||||
<a href="#" onClick=${handlePartClick}>${closeText}</a>
|
||||
</span>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
export const RPL_WELCOME = "001";
|
||||
export const RPL_YOURHOST = "002";
|
||||
export const RPL_CREATED = "003";
|
||||
export const RPL_MYINFO = "004";
|
||||
export const RPL_ENDOFWHO = "315";
|
||||
export const RPL_TOPIC = "332";
|
||||
export const RPL_WHOREPLY = "352";
|
||||
|
|
Loading…
Reference in a new issue