CIRCDCCChat.performTabMatch Member

Syntax

object.performTabMatch(line, wordStart, wordEnd, word, cursorpos, lcFn);

Arguments

ArgumentSummary
line
wordStart
wordEnd
word
cursorpos
lcFn

Returns

Remarks

See Also

Source Code

function gettabmatch_other (line, wordStart, wordEnd, word, cursorpos, lcFn)
{
if (wordStart == 0 && line[0] == client.COMMAND_CHAR)
{
return client.performTabMatch(line, wordStart, wordEnd, word,
cursorpos);
}
var matchList = new Array();
var users;
var channels;
var userIndex = -1;
var details = getObjectDetails(this);
if (details.channel && word == details.channel.unicodeName[0])
{
/* When we have #<tab>, we just want the current channel,
if possible. */
matchList.push(details.channel.unicodeName);
}
else
{
/* Ok, not #<tab> or no current channel, so get the full list. */
if (details.channel)
users = details.channel.users;
if (details.server)
{
channels = details.server.channels;
for (var c in channels)
matchList.push(channels[c].unicodeName);
if (!users)
users = details.server.users;
}
if (users)
{
userIndex = matchList.length;
for (var n in users)
matchList.push(users[n].unicodeName);
}
}
var matches = matchEntry(word, matchList, lcFn);
var list = new Array();
for (var i = 0; i < matches.length; i++)
list.push(matchList[matches[i]]);
if (list.length == 1)
{
if (users && (userIndex >= 0) && (matches[0] >= userIndex))
{
if (wordStart == 0)
list[0] += client.prefs["nickCompleteStr"];
}
if (wordEnd == line.length)
{
/* add a space if the word is at the end of the line. */
list[0] += " ";
}
}
return list;
}