diff options
author | Joe Robinson <joe@lc8n.com> | 2016-10-13 23:26:13 +0100 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2016-10-13 23:26:13 +0100 |
commit | eaa8650c9be413664ef52c56b504e9b7fdaafc38 (patch) | |
tree | 23b06f2f261089778a9d23ae5978a6bb2cc73e21 | |
parent | 40b1c978b00911cf17dc1a7b45c10b82ce57641d (diff) |
Temp fix, duplicate channel joining code
-rw-r--r-- | handlers.js | 2 | ||||
-rw-r--r-- | 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"); } @@ -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("<a class='active item' data-id='"+numChans+"' data-tab='"+channel+"'>"+channel+"</a>"); $("#chan-container").append("<div class='ui active tab' data-id='"+numChans+"' data-tab='"+channel+"'></div>"); - var chanTab = $("[data-tab="+ channel +"].tab"); + var chanTab = $("[data-tab='"+ channel +"'].tab"); chanTab.append("<div class='ui selection list users' data-id='"+numChans+"' data-tab='"+channel+"'></div>"); chanTab.append("<div class='ui segment chat' data-id='"+numChans+"' data-tab='"+channel+"'></div>"); @@ -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); } |