qwebirc.irc.IgnoreController = new Class({\r
initialize: function(toIRCLower) {\r
this.toIRCLower = toIRCLower;\r
- this.ignored = {};\r
+ this.ignored = new QHash();\r
},\r
__toHostKey: function(host) {\r
if(host.indexOf("!") == -1 && host.indexOf("@") == -1)\r
return false;\r
\r
var hostKey = this.__toHostKey(host);\r
- this.ignored[hostKey] = [host, new RegExp("^" + RegExp.fromIRCPattern(hostKey) + "$")];\r
+ this.ignored.put(hostKey, [host, new RegExp("^" + RegExp.fromIRCPattern(hostKey) + "$")]);\r
\r
return hostKey;\r
},\r
return null;\r
\r
var hostKey = this.__toHostKey(host);\r
- delete this.ignored[hostKey];\r
+ this.ignored.remove(hostKey);\r
\r
return hostKey;\r
},\r
get: function() {\r
- var l = [];\r
- for(var key in this.ignored)\r
- if(this.ignored.hasOwnProperty(key))\r
- l.push(this.ignored[key][0]);\r
- return l;\r
+ return this.ignored.map(function(k, v) {\r
+ return v[0];\r
+ });\r
},\r
isIgnored: function(nick, host) {\r
- if(host === undefined) {\r
- return this.ignored[this.__toHostKey(nick)] !== undefined;\r
- }\r
+ if(host === undefined)\r
+ return this.ignored.contains(this.__toHostKey(nick));\r
\r
var mask = this.toIRCLower(nick + "!" + host);\r
- for(var key in this.ignored) {\r
- if(!this.ignored.hasOwnProperty(key))\r
- continue;\r
\r
- var r = this.ignored[key][1];\r
- if(mask.match(r)) {\r
-// console.log(key + " (" + this.ignored[key][0] + ")" + " matched against " + mask);\r
+ return this.ignored.each(function(k, v) {\r
+// console.log(k + " (" + v[0] + ")" + " matched against " + mask);\r
+ if(mask.match(v[1]))\r
return true;\r
- }\r
- }\r
- return false;\r
+ }) === true;\r
}\r
});
\ No newline at end of file