From 5bb9ba7c616bce593b47353f8fe9e0c32b97061a Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 9 May 2013 10:11:25 -0400 Subject: [PATCH] Default filters apply to all channels (#97) --- channel.js | 12 +++++++----- package.json | 2 +- server.js | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/channel.js b/channel.js index d92806c0..9cf1afbd 100644 --- a/channel.js +++ b/channel.js @@ -59,6 +59,7 @@ var Channel = function(name) { new Filter("monospace", "`([^`]+)`", "g", "$1"), new Filter("bold", "\\*([^\\*]+)\\*", "g", "$1"), new Filter("italic", "(^| )_([^_]+)_", "g", "$1$2"), + new Filter("inline spoiler", "\\[spoiler\\](.*)\\[\\/spoiler\\]", "ig", "$1") ]; this.motd = { motd: "", @@ -122,17 +123,18 @@ Channel.prototype.loadDump = function() { } this.broadcastOpts(); if(data.filters) { - this.filters = new Array(data.filters.length); for(var i = 0; i < data.filters.length; i++) { var f = data.filters[i]; // Backwards compatibility if(f[0] != undefined) { - this.filters[i] = new Filter("", f[0], "g", f[1]); - this.filters[i].active = f[2]; + var filt = new Filter("", f[0], "g", f[1]); + filt.active = f[2]; + this.updateFilter(filt); } else { - this.filters[i] = new Filter(f.name, f.source, f.flags, f.replace); - this.filters[i].active = f.active; + var filt = new Filter(f.name, f.source, f.flags, f.replace); + filt.active = f.active; + this.updateFilter(filt); } } this.broadcastChatFilters(); diff --git a/package.json b/package.json index 427b51f3..c5da52a2 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "1.6.1", + "version": "1.6.2", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/server.js b/server.js index a1ccbcad..aa5f2b31 100644 --- a/server.js +++ b/server.js @@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -const VERSION = "1.6.1"; +const VERSION = "1.6.2"; var fs = require("fs"); var Logger = require("./logger.js");