summaryrefslogtreecommitdiff
path: root/handlers.js
diff options
context:
space:
mode:
Diffstat (limited to 'handlers.js')
-rw-r--r--handlers.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/handlers.js b/handlers.js
index 9b956c3..ffbb4f4 100644
--- a/handlers.js
+++ b/handlers.js
@@ -2,8 +2,8 @@ var linkify = require("linkifyjs");
var linkifyHtml = require('linkifyjs/html');
var util = require("./util.js")
var commands = require("./commands.js")
-
-var numChans = 1;
+var globals = require("./globals.js")
+var numChans = globals.channels.length + globals.pms.length;
var channels;
var client;
var myNick = ""
@@ -69,7 +69,7 @@ function receiveMsg(target, from, message) {
// target: "_blank"
// });
// console.log(message.autoLink());
-
+ numChans = globals.channels.length
console.log(from + ' => '+ target +': ' + message);
if (target === client.user.nick) {
@@ -84,6 +84,7 @@ function receiveMsg(target, from, message) {
chanTab.append("<div class='ui segment chat' data-id='"+numChans+"' data-tab='"+target+"'></div>");
$('.menu .item').tab({history:false});
+ global.channels.push(target)
numChans++;
chatTab = $("[data-tab="+ target +"].chat");
}