obj = qwebirc.ui.ChannelNameTabCompleter;
} else if(ltext.match(/^\/(q|query|msg) /i)) {
obj = qwebirc.ui.QueryTabCompleter;
+ } else if(w.type == qwebirc.ui.WINDOW_QUERY) {
+ obj = qwebirc.ui.QueryNickTabCompleter;
} else if(w.type == qwebirc.ui.WINDOW_CHANNEL) {
/* "slug[TAB]" == "slug: " */
if(preword == "") {
});
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);
+ }
+});
+
+qwebirc.ui.QueryNickTabCompleter = new Class({
+ Extends: qwebirc.ui.BaseTabCompleter,
+ initialize: function(prefix, existingText, suffix, window) {
+ var nick = window.name
+ this.parent(window.client, prefix, existingText, suffix, [nick]);
}
});
Extends: qwebirc.ui.BaseTabCompleter,
initialize: function(prefix, existingText, suffix, window) {
- /* WTB map */
- var l = [];
- var wa = window.parentObject.windows[window.client];
-
- for(var c in window.client.channels) {
- var w = wa[c];
+ var wa = window.parentObject.windows.get(window.parentObject.getClientId(window.client));
+ var l = window.client.channels.map(function(c) {
+ var w = wa.get(c);
/* redundant? */
if($defined(w))
w = w.lastSelected;
- l.push([w, c]);
- }
+ return [w, c];
+ });
l.sort(function(a, b) {
return b[0] - a[0];
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);
}
});
qwebirc.ui.ChannelUsersTabCompleter = new Class({
Extends: qwebirc.ui.BaseTabCompleter,
initialize: function(prefix, existingText, suffix, window) {
- var nc = window.client.tracker.getSortedByLastSpoke(window.name);
+ var nc = window.client.tracker.getSortedByLastSpokePrefix(window.name);
- this.parent(prefix, existingText, suffix, nc);
+ this.parent(window.client, prefix, existingText, suffix, nc);
}
});