diff --git a/commands.js b/commands.js index 6c10865..694bf17 100644 --- a/commands.js +++ b/commands.js @@ -11,7 +11,7 @@ function getActiveClient(app) { function getActiveChannel(app) { var activeBuffer = app.state.buffers.get(app.state.activeBuffer); - if (!activeBuffer || !app.isChannel(activeBuffer.name)) { + if (!activeBuffer || activeBuffer.type !== BufferType.CHANNEL) { throw new Error("Not in a channel"); } return activeBuffer.name; diff --git a/components/app.js b/components/app.js index d3a604b..ca27c17 100644 --- a/components/app.js +++ b/components/app.js @@ -350,7 +350,7 @@ export default class App extends Component { if (msgUnread == Unread.HIGHLIGHT && window.Notification && Notification.permission === "granted" && !isDelivered && !irc.parseCTCP(msg)) { var title = "New " + kind + " from " + msg.prefix.name; - if (this.isChannel(bufName)) { + if (client.isChannel(bufName)) { title += " in " + bufName; } var notif = new Notification(title, { @@ -517,7 +517,7 @@ export default class App extends Component { break; case "MODE": var target = msg.params[0]; - if (this.isChannel(target)) { + if (client.isChannel(target)) { this.addMessage(serverID, target, msg); } this.handleMode(serverID, msg); @@ -536,7 +536,7 @@ export default class App extends Component { var allowedPrefixes = client.isupport.get("STATUSMSG"); if (allowedPrefixes) { var parts = irc.parseTargetPrefix(target, allowedPrefixes); - if (this.isChannel(parts.name)) { + if (client.isChannel(parts.name)) { target = parts.name; } } @@ -728,11 +728,6 @@ export default class App extends Component { this.open(nick); } - isChannel(name) { - // TODO: use the ISUPPORT token if available - return irc.STD_CHANNEL_TYPES.indexOf(name[0]) >= 0; - } - fetchBacklog(client, target, after, before) { client.fetchHistoryBetween(target, after, before, CHATHISTORY_MAX_SIZE).catch((err) => { this.setState({ error: "Failed to fetch history for '" + taregt + "': " + err }); @@ -748,7 +743,7 @@ export default class App extends Component { var client = this.clients.get(serverID); - if (this.isChannel(target)) { + if (client.isChannel(target)) { this.switchToChannel = target; client.send({ command: "JOIN", params: [target] }); } else {