Default filters apply to all channels (#97)

This commit is contained in:
calzoneman 2013-05-09 10:11:25 -04:00
parent 05d6d5b120
commit 5bb9ba7c61
3 changed files with 9 additions and 7 deletions

View file

@ -59,6 +59,7 @@ var Channel = function(name) {
new Filter("monospace", "`([^`]+)`", "g", "<code>$1</code>"),
new Filter("bold", "\\*([^\\*]+)\\*", "g", "<strong>$1</strong>"),
new Filter("italic", "(^| )_([^_]+)_", "g", "$1<em>$2</em>"),
new Filter("inline spoiler", "\\[spoiler\\](.*)\\[\\/spoiler\\]", "ig", "<span class=\"spoiler\">$1</span>")
];
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();

View file

@ -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"
},

View file

@ -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");