diff --git a/lib/channel-new.js b/lib/channel-new.js index e0b1851c..396fd97b 100644 --- a/lib/channel-new.js +++ b/lib/channel-new.js @@ -709,25 +709,6 @@ Channel.prototype.handleNameBan = function (actor, name, reason) { }); }; -/** - * Removes a name ban - */ -Channel.prototype.handleUnbanName = function (actor, name) { - if (!this.hasPermission(actor, "ban")) { - return; - } - - if (!this.registered) { - return; - } - - this.logger.log("*** " + actor.name + " un-namebanned " + name); - this.sendModMessage(actor.name + " unbanned " + name, this.permissions.ban); - - db.channels.unbanName(this.name, name); - // TODO send banlist? -}; - /** * Removes a ban by ID */ @@ -883,7 +864,13 @@ Channel.prototype.banIP = function (actor, ip, name, reason, range) { } // channel, ip, name, reason, ban actor - db.channels.ban(self.name, ip, name, reason, actor.name); + db.channels.ban(self.name, ip, name, reason, actor.name, function (err) { + if (err) { + actor.socket.emit("errorMsg", { + msg: "Ban failed: " + err + }); + } + }); }); }); }; @@ -1797,6 +1784,11 @@ Channel.prototype.move = function (from, after, callback) { callback = typeof callback === "function" ? callback : function () { }; var self = this; + if (from === after) { + callback("Cannot move playlist item after itself!", null); + return; + } + self.plqueue.queue(function (lock) { if (self.dead) { return; @@ -2112,6 +2104,7 @@ Channel.prototype.handleSetLock = function (user, data) { return; } + data.locked = Boolean(data.locked); this.logger.log("*** " + user.name + " set playlist lock to " + data.locked); this.setLock(data.locked); @@ -2121,7 +2114,7 @@ Channel.prototype.handleSetLock = function (user, data) { * Handles a user message to toggle the locked state of the playlist */ Channel.prototype.handleToggleLock = function (user) { - this.handleSetLock(user, { locked: !this.playlistLocked }); + this.handleSetLock(user, { locked: !this.playlistLock }); }; /** diff --git a/lib/chatcommand.js b/lib/chatcommand.js index 609b2a80..117b4365 100644 --- a/lib/chatcommand.js +++ b/lib/chatcommand.js @@ -18,10 +18,12 @@ var handlers = { meta.addClass = "action"; meta.action = true; chan.sendMessage(user, msg, meta); + return true; }, "sp": function (chan, user, msg, meta) { meta.addClass = "spoiler"; chan.sendMessage(user, msg, meta); + return true; }, "say": function (chan, user, msg, meta) { if (user.rank >= 1.5) { @@ -29,11 +31,12 @@ var handlers = { meta.addClassToNameAndTimestamp = true; meta.forceShowName = true; chan.sendMessage(user, msg, meta); + return true; } }, "a": function (chan, user, msg, meta) { if (user.global_rank < 255) { - return; + return false; } var superadminflair = { labelclass: "label-important", @@ -56,47 +59,57 @@ var handlers = { meta.superadminflair = superadminflair; meta.forceShowName = true; chan.sendMessage(user, cargs.join(" "), meta); + return true; }, "poll": function (chan, user, msg, meta) { handlePoll(chan, user, msg, false); + return true; }, "hpoll": function (chan, user, msg, meta) { handlePoll(chan, user, msg, true); + return true; }, /* commands that do not send chat messages */ "afk": function (chan, user, msg, meta) { user.setAFK(!user.meta.afk); + return true; }, "mute": function (chan, user, msg, meta) { handleMute(chan, user, msg.split(" ")); + return true; }, "smute": function (chan, user, msg, meta) { handleShadowMute(chan, user, msg.split(" ")); + return true; }, "unmute": function (chan, user, msg, meta) { handleUnmute(chan, user, msg.split(" ")); + return true; }, "kick": function (chan, user, msg, meta) { handleKick(chan, user, msg.split(" ")); + return true; }, "ban": function (chan, user, msg, meta) { handleBan(chan, user, msg.split(" ")); + return true; }, "ipban": function (chan, user, msg, meta) { handleIPBan(chan, user, msg.split(" ")); - }, - "unban": function (chan, user, msg, meta) { - handleUnban(chan, user, msg.split(" ")); + return true; }, "clear": function (chan, user, msg, meta) { handleClear(chan, user); + return true; }, "clean": function (chan, user, msg, meta) { handleClean(chan, user, msg); + return true; }, "cleantitle": function (chan, user, msg, meta) { handleCleanTitle(chan, user, msg); + return true; } }; @@ -114,7 +127,7 @@ function handle(chan, user, msg, meta) { var m = msg.match(/^\/d(-?[0-9]*)(?:\s|$)(.*)/); if (m) { handleDrink(chan, user, m[1], m[2], meta); - return; + return true; } for (var i = 0; i < handlerList.length; i++) { var h = handlerList[i]; @@ -125,8 +138,7 @@ function handle(chan, user, msg, meta) { } else { rest = ""; } - h.fn(chan, user, rest, meta); - break; + return h.fn(chan, user, rest, meta); } } } @@ -148,7 +160,7 @@ function handleDrink(chan, user, count, msg, meta) { meta.forceShowName = true; meta.addClass = "drink"; chan.drinks += count; - chan.broadcastDrinks(); + chan.sendDrinks(chan.users); if (count < 0 && msg.trim() === "") { return; } @@ -331,7 +343,7 @@ function handlePoll(chan, user, msg, hidden) { args.splice(0, 1); var poll = new Poll(user.name, title, args, hidden === true); chan.poll = poll; - chan.broadcastPoll(); + chan.sendPoll(chan.users); chan.logger.log("*** " + user.name + " Opened Poll: '" + poll.title + "'"); } } diff --git a/templates/channel.jade b/templates/channel.jade index e124673f..50bf6024 100644 --- a/templates/channel.jade +++ b/templates/channel.jade @@ -26,8 +26,8 @@ html(lang="en") #motd .clear #announcements.row - #drinkbarwrap.col-lg-12.col-md-12.row - #drinkbar + #drinkbarwrap.row + #drinkbar.col-lg-12.col-md-12 h1#drinkcount #main.row #chatwrap.col-lg-5.col-md-5 diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index fca5a7a4..380bfdf7 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -448,6 +448,24 @@ Callbacks = { formatCSBanlist(); }, + banlistRemove: function (data) { + var entries = $("#cs-banlist table").data("entries") || []; + var found = false; + for (var i = 0; i < entries.length; i++) { + if (entries[i].id === data.id) { + found = i; + break; + } + } + + if (found !== false) { + entries.splice(i, 1); + $("#cs-banlist table").data("entries", entries); + } + + formatCSBanlist(); + }, + recentLogins: function(entries) { var tbl = $("#loginhistory table"); // I originally added this check because of a race condition diff --git a/www/css/cytube.css b/www/css/cytube.css index 57f2477c..e59f9fd4 100644 --- a/www/css/cytube.css +++ b/www/css/cytube.css @@ -124,8 +124,13 @@ margin-top: 5px; } -#drinkbar { - margin-left: 0; +.drink { + margin: 10px 10px; + padding: 10px 0px; + border: 2px solid #0000cc; +} + +#drinkcount { background-color: #000000; color: #ffffff; text-align: center; @@ -250,7 +255,7 @@ } .queue_temp { - background-image: url(../img/stripe-diagonal.png); + background-image: url(/img/stripe-diagonal.png); } .queue_active { diff --git a/www/img/glyphicons-halflings-white.png b/www/img/glyphicons-halflings-white.png new file mode 100644 index 00000000..3bf6484a Binary files /dev/null and b/www/img/glyphicons-halflings-white.png differ diff --git a/www/img/glyphicons-halflings.png b/www/img/glyphicons-halflings.png new file mode 100644 index 00000000..a9969993 Binary files /dev/null and b/www/img/glyphicons-halflings.png differ diff --git a/www/img/stripe-diagonal.png b/www/img/stripe-diagonal.png new file mode 100644 index 00000000..ae44b914 Binary files /dev/null and b/www/img/stripe-diagonal.png differ