From eaa8650c9be413664ef52c56b504e9b7fdaafc38 Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Thu, 13 Oct 2016 23:26:13 +0100 Subject: Temp fix, duplicate channel joining code --- handlers.js | 2 -- index.js | 13 ++++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/handlers.js b/handlers.js index e43a250..6769b53 100644 --- a/handlers.js +++ b/handlers.js @@ -4,7 +4,6 @@ var util = require("./util.js") var numChans = 1; var channels; -var buffers = []; var client; var myNick = "" module.exports.setChannels = function(myChannels) { @@ -50,7 +49,6 @@ function joinChannel(channel, sendJoin) { var channelObj = client.channel(channel); if (sendJoin) { - buffers.push(channelObj); channelObj.join(); channelObj.say("beep"); } diff --git a/index.js b/index.js index 1142213..ca6857d 100644 --- a/index.js +++ b/index.js @@ -114,7 +114,6 @@ $("#send-message").keypress(function(e) { if (message.length > 6) { channel = message.substring(6, message.length); } - console.log() removeChannel(channel, true); } else if (message.indexOf("/whois") == 0) { console.log("whois "+message.substring(7, message.length)); @@ -179,8 +178,11 @@ function setTopic(channel, topic) { } function joinChannel(channel, sendJoin) { + + var channelObj = client.channel(channel); if (sendJoin) { - client.join(channel); + channelObj.join(); + channelObj.say("beep"); } chanId = $(".active.chat").attr("data-id") @@ -189,7 +191,7 @@ function joinChannel(channel, sendJoin) { $(".ui.menu").append(""+channel+""); $("#chan-container").append("
"); - var chanTab = $("[data-tab="+ channel +"].tab"); + var chanTab = $("[data-tab='"+ channel +"'].tab"); chanTab.append("
"); chanTab.append("
"); @@ -197,11 +199,12 @@ function joinChannel(channel, sendJoin) { $('.menu .item').tab({history:false}); + numChans++; } function removeChannel(channel, sendPart) { - chanId = $("[data-tab="+channel+"].chat").attr("data-id"); - $("[data-tab="+channel+"]").remove(); + chanId = $("[data-tab='"+channel+"'].chat").attr("data-id"); + $("[data-tab='"+channel+"']").remove(); if (sendPart) { client.part(channel); } -- cgit v1.2.3