this.send = this.connection.send.bind(this.connection);
this.connect = this.connection.connect.bind(this.connection);
this.disconnect = this.connection.disconnect.bind(this.connection);
-
+
+ this.toIRCLower = qwebirc.irc.RFC1459toIRCLower;
this.setupGenericErrors();
},
dispatch: function(data) {
if(nc.prefixes.length > 0) {
var c = nc.prefixes.charAt(0);
- nx = String.fromCharCode(this.prefixes.indexOf(c)) + n.toIRCLower();
+ nx = String.fromCharCode(this.prefixes.indexOf(c)) + this.toIRCLower(n);
nh[nx] = c + n;
} else {
- nx = tff + n.toIRCLower();
+ nx = tff + this.toIRCLower(n);
nh[nx] = n;
}
names.push(nx);
w.updateNickList(sortednames);
},
getWindow: function(name) {
- return this.windows[name.toIRCLower()];
+ return this.windows[this.toIRCLower(name)];
},
newWindow: function(name, type, select) {
var w = this.getWindow(name);
if(!w) {
- w = this.windows[name.toIRCLower()] = this.ui.newWindow(this, type, name);
+ w = this.windows[this.toIRCLower(name)] = this.ui.newWindow(this, type, name);
w.addEvent("close", function(w) {
- delete this.windows[name.toIRCLower()];
+ delete this.windows[this.toIRCLower(name)];
}.bind(this));
}
/* xf8-xff */ '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff'
];
-String.prototype.toIRCLower = function() {
- var x = this;
-
+qwebirc.irc.RFC1459toIRCLower = function(x) {
var p = [];
for(var i=0;i<x.length;i++) {
var l = x.charCodeAt(i);
return p.join("");
}
+qwebirc.irc.ASCIItoIRCLower = function(x) {
+ return x.toLower(); /* does unicode too.... */
+}
+
String.prototype.hostToNick = function() {
return this.split("!", 1)[0];
}
return qwebirc.util.DaysOfWeek[d.getDay()] + " " + qwebirc.util.MonthsOfYear[d.getMonth()] + " " + pad(d.getDate()) + " " + pad(d.getHours()) + ":" + pad(d.getMinutes()) + ":" + pad(d.getSeconds()) + " " + d.getFullYear();
}
-String.prototype.toIRCCompletion = function() {
- return this.toIRCLower().replace(/[^\w]+/g, "");
+qwebirc.irc.toIRCCompletion = function(client, data) {
+ return client.toIRCLower(data).replace(/[^\w]+/g, "");
}
return client.id;
}
},
- getWindowIdentifier: function(type, name) {
+ getWindowIdentifier: function(client, type, name) {
if(type == qwebirc.ui.WINDOW_MESSAGES)
return "-M";
if(type == qwebirc.ui.WINDOW_STATUS)
return "";
- return "_" + name.toIRCLower();
+
+ if(client == qwebirc.ui.CUSTOM_CLIENT) /* HACK */
+ return "_" + name;
+
+ return "_" + client.toIRCLower(name);
},
newWindow: function(client, type, name) {
var w = this.getWindow(client, type, name);
if($defined(w))
return w;
- var wId = this.getWindowIdentifier(type, name);
+ var wId = this.getWindowIdentifier(client, type, name);
var w = this.windows[this.getClientId(client)][wId] = new this.windowClass(this, client, type, name, wId);
this.windowArray.push(w);
if(!$defined(c))
return null;
- return c[this.getWindowIdentifier(type, name)];
+ return c[this.getWindowIdentifier(client, type, name)];
},
getActiveWindow: function() {
return this.active;
},
getActiveIRCWindow: function(client) {
if(!this.active || this.active.type == qwebirc.ui.WINDOW_CUSTOM) {
- return this.windows[this.getClientId(client)][this.getWindowIdentifier(qwebirc.ui.WINDOW_STATUS)];
+ return this.windows[this.getClientId(client)][this.getWindowIdentifier(client, qwebirc.ui.WINDOW_STATUS)];
} else {
return this.active;
}
});
qwebirc.ui.TabIterator = new Class({
- initialize: function(prefix, list) {
+ initialize: function(client, prefix, list) {
this.prefix = prefix;
if(!$defined(list) || list.length == 0) {
this.list = null;
} else {
var l = [];
- var prefixl = prefix.toIRCCompletion();
+ var prefixl = qwebirc.irc.toIRCCompletion(client, prefix);
/* convert the nick list to IRC lower case, stripping all non letters
* before comparisions */
for(var i=0;i<list.length;i++) {
- var l2 = list[i].toIRCCompletion();
+ var l2 = qwebirc.irc.toIRCCompletion(client, list[i]);
if(l2.startsWith(prefixl))
l.push(list[i]);
});
qwebirc.ui.BaseTabCompleter = new Class({
- initialize: function(prefix, existingNick, suffix, list) {
+ initialize: function(client, prefix, existingNick, suffix, list) {
this.existingNick = existingNick;
this.prefix = prefix;
this.suffix = suffix;
- this.iterator = new qwebirc.ui.TabIterator(existingNick, list);
+ this.iterator = new qwebirc.ui.TabIterator(client, existingNick, list);
},
get: function() {
var n = this.iterator.next();
qwebirc.ui.QueryTabCompleter = new Class({
Extends: qwebirc.ui.BaseTabCompleter,
initialize: function(prefix, existingNick, suffix, window) {
- this.parent(prefix, existingNick, suffix, window.client.lastNicks);
+ this.parent(window.client, prefix, existingNick, suffix, window.client.lastNicks);
}
});
/* WTB map */
var l = [];
- var wa = window.parentObject.windows[window.client];
+ var wa = window.parentObject.windows[window.parentObject.getClientId(window.client)];
for(var c in window.client.channels) {
var w = wa[c];
var l2 = [];
for(var i=0;i<l.length;i++)
l2.push(l[i][1]);
- this.parent(prefix, existingText, suffix, l2);
+ this.parent(window.client, prefix, existingText, suffix, l2);
}
});
initialize: function(prefix, existingText, suffix, window) {
var nc = window.client.tracker.getSortedByLastSpoke(window.name);
- this.parent(prefix, existingText, suffix, nc);
+ this.parent(window.client, prefix, existingText, suffix, nc);
}
});