Bug 318859 - Allow substring matching for DCC commands as well as documenting the existing RegExp-based matching.

ChatZilla only.
r=silver
p=gijskruitbosch+bugs@gmail.com (Gijs Kruitbosch)
This commit is contained in:
silver%warwickcompsoc.co.uk 2005-12-04 22:32:30 +00:00
Родитель c39e622e34
Коммит f75e5978e7
2 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -154,19 +154,25 @@ function dcc_addip(ip, auth)
CIRCDCC.prototype.getMatches =
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 = new RegExp(nickname, "i");
var f = new RegExp(filename, "i");
var n = nickname;
var f = filename;
if (arrayIndexOf(types, "chat") >= 0)
{
for (k = 0; k < this.chats.length; k++)
{
if ((!nickname || this.chats[k].user.unicodeName.match(n)) &&
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))
{
@ -178,8 +184,8 @@ function dcc_getmatches(nickname, filename, types, dirs, states)
{
for (k = 0; k < this.files.length; k++)
{
if ((!nickname || this.files[k].user.unicodeName.match(n)) &&
(!filename || this.files[k].fileName.match(f)) &&
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))
{

Просмотреть файл

@ -226,16 +226,16 @@ cmd.describe.params = <target> <action>
cmd.describe.help = Performs an 'action' at the |target|, either a channel or a user.
cmd.dcc-accept.params = [<nickname> [<type> [<file>]]]
cmd.dcc-accept.help = Accepts an incoming DCC Chat or Send offer. If a |nickname| is not specified, the last offer that arrived will be accepted (for security reasons, this will not work in the first 10 seconds after an offer is received).
cmd.dcc-accept.help = Accepts an incoming DCC Chat or Send offer. If a |nickname| is not specified, the last offer that arrived will be accepted (for security reasons, this will not work in the first 10 seconds after an offer is received). You can also use a regular expression for either <nickname> or <file>.
cmd.dcc-chat.params = [<nickname>]
cmd.dcc-chat.help = Sends a DCC Chat offer to |nickname| on the current server. On a query view, |nickname| may be omitted to send the offer to the query view's user.
cmd.dcc-close.params = [<nickname> [<type> [<file>]]]
cmd.dcc-close.help = Closes an existing DCC connection. |nickname| may be omitted if run from a DCC view, in which case the DCC connection for that view will be closed. |type| and |file| may be needed to identify the connection.
cmd.dcc-close.help = Closes an existing DCC connection. |nickname| may be omitted if run from a DCC view, in which case the DCC connection for that view will be closed. |type| and |file| may be needed to identify the connection. You can also use a regular expression for either <nickname> or <file>.
cmd.dcc-decline.params = [<nickname>]
cmd.dcc-decline.help = Declines an incoming DCC Chat or Send offer. If a |nickname| is not specified, the last offer that arrived will be declined.
cmd.dcc-decline.help = Declines an incoming DCC Chat or Send offer. If a |nickname| is not specified, the last offer that arrived will be declined. You can also use a regular expression for <nickname>.
cmd.dcc-list.params = [<type>]
cmd.dcc-list.help = Lists the currently known about DCC offers and connections. This may be limited to just "chat" or "send" using the |type| parameter.