CIRCDCC.getMatches Member

Syntax

object.getMatches(nickname, filename, types, dirs, states);

Arguments

ArgumentSummary
nickname
filename
types
dirs
states

Returns

Remarks

See Also

Source Code

function dcc_getmatches(nickname, filename, types, dirs, states)
{
function matchNames(name, otherName)
{
return ((name.match(new RegExp(otherName, "i"))) ||
(name.toLowerCase().indexOf(otherName.toLowerCase()) != -1));
};
var k;
var list = new Array();
if (!types)
types = ["chat", "file"];
var n = nickname;
var f = filename;
if (arrayIndexOf(types, "chat") >= 0)
{
for (k = 0; k < this.chats.length; k++)
{
if ((!nickname || matchNames(this.chats[k].user.unicodeName, n)) &&
(!dirs || arrayIndexOf(dirs, this.chats[k].state.dir) >= 0) &&
(!states || arrayIndexOf(states, this.chats[k].state.state) >= 0))
{
list.push(this.chats[k]);
}
}
}
if (arrayIndexOf(types, "file") >= 0)
{
for (k = 0; k < this.files.length; k++)
{
if ((!nickname || matchNames(this.files[k].user.unicodeName, n)) &&
(!filename || matchNames(this.files[k].filename, f)) &&
(!dirs || arrayIndexOf(dirs, this.files[k].state.dir) >= 0) &&
(!states || arrayIndexOf(states, this.files[k].state.state) >= 0))
{
list.push(this.files[k]);
}
}
}
return list;
}