diff --git a/components/app.js b/components/app.js
index 7ff1e36..e55ec39 100644
--- a/components/app.js
+++ b/components/app.js
@@ -1023,7 +1023,9 @@ export default class App extends Component {
}
break;
case BufferType.CHANNEL:
- client.send({ command: "PART", params: [buf.name] });
+ if (buf.joined) {
+ client.send({ command: "PART", params: [buf.name] });
+ }
// fallthrough
case BufferType.NICK:
this.switchBuffer({ name: SERVER_BUFFER });
@@ -1150,8 +1152,16 @@ export default class App extends Component {
});
}
- handleJoinClick(serverID) {
- this.openDialog("join", { server: serverID });
+ handleJoinClick(buf) {
+ switch (buf.type) {
+ case BufferType.SERVER:
+ this.openDialog("join", { server: buf.server });
+ break;
+ case BufferType.CHANNEL:
+ let client = this.clients.get(buf.server);
+ client.send({ command: "JOIN", params: [buf.name] });
+ break;
+ }
}
handleJoinSubmit(data) {
@@ -1351,7 +1361,7 @@ export default class App extends Component {
bouncerNetwork=${activeBouncerNetwork}
onChannelClick=${this.handleChannelClick}
onClose=${() => this.close(activeBuffer)}
- onJoin=${() => this.handleJoinClick(activeBuffer.server)}
+ onJoin=${() => this.handleJoinClick(activeBuffer)}
onAddNetwork=${this.handleAddNetworkClick}
onManageNetwork=${() => this.handleManageNetworkClick(activeBuffer.server)}
/>
diff --git a/components/buffer-header.js b/components/buffer-header.js
index 7fed7a0..30552a6 100644
--- a/components/buffer-header.js
+++ b/components/buffer-header.js
@@ -117,13 +117,27 @@ export default function BufferHeader(props) {
if (props.buffer.topic) {
description = linkify(stripANSI(props.buffer.topic), props.onChannelClick);
}
- actions = html`
-
- `;
+ if (props.buffer.joined) {
+ actions = html`
+
+ `;
+ } else {
+ actions = html`
+
+
+ `;
+ }
break;
case BufferType.NICK:
if (props.user) {
diff --git a/state.js b/state.js
index 95cf929..b4816f4 100644
--- a/state.js
+++ b/state.js
@@ -283,6 +283,7 @@ export const State = {
type,
server: serverID,
serverInfo: null, // if server
+ joined: false, // if channel
topic: null, // if channel
members: new irc.CaseMapMap(null, client.cm), // if channel
messages: [],
@@ -406,7 +407,10 @@ export const State = {
update = updateBuffer(channel, (buf) => {
let members = new irc.CaseMapMap(buf.members);
members.set(msg.prefix.name, "");
- return { members };
+
+ let joined = buf.joined || client.isMyNick(msg.prefix.name);
+
+ return { members, joined };
});
state = { ...state, ...update };
@@ -434,7 +438,10 @@ export const State = {
return updateBuffer(channel, (buf) => {
let members = new irc.CaseMapMap(buf.members);
members.delete(msg.prefix.name);
- return { members };
+
+ let joined = buf.joined && !client.isMyNick(msg.prefix.name);
+
+ return { members, joined };
});
case "KICK":
channel = msg.params[0];