Closed Bug 123970 Opened 23 years ago Closed 18 years ago

Should be able to scan user list of a channel

Categories

(Other Applications :: ChatZilla, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tessarakt, Assigned: Gijs)

Details

(Whiteboard: [cz-0.9.78])

Attachments

(1 file, 2 obsolete files)

Some clients/scripts allow the users of a channel to be scanned for a specific
mask, e.g. *@*.de.

Chatzilla should support this, too.
I'm not sure I understand this?  You want a command to list the nicks that match
an expression?
OS: Linux → All
Hardware: PC → All
Not exactly. I want to list nicks of which the hostname matches an expression.
Sorry, that's what I was asking.  You want something like: "/find *@*.de" which
would give you a list of nicks from an address that matches?  Which clients
support this and what is the command called?
rginda, what is the /who command capable of?
P&P 4.0 for mIRC supported this, via the channel context menu.

Yes, I want this "/find *@*.de".
When you select it from the context menu, does it bring up a dialog?
Status: UNCONFIRMED → NEW
Ever confirmed: true
It had a list of recently used used hostmasks, and a menu entry to enter a new
one (which then brings up a dialog, yes).
P&P has a feature connected with this: It reads in the masks at joining the
channel and whenever a new user enters.

It also uses this for clone detection.

Maybe I should file new bugs with these two functionalities.
Product: Core → Other Applications
(In reply to comment #7)
> P&P has a feature connected with this: It reads in the masks at joining the
> channel and whenever a new user enters.
> 
> It also uses this for clone detection.
> 
> Maybe I should file new bugs with these two functionalities.

I'd think that would lag a lot when joining large channels, but that's just me...

This patch adds basic functionality for /match-users <hostmask>

It doesn't implement a dialog or any of the other stuff. Especially clone detection would be a separate RFE. As for the dialog... I think it's something 99% of users don't need either, so that may still be something we wouldn't want to do. I'll leave that up to James, Robert and Samuel :-)

R? Silver
Attachment #205071 - Flags: review?(silver)
Comment on attachment 205071 [details] [diff] [review]
Patch to support basic /match-users

>Index: mozilla/extensions/irc/js/lib/irc.js

>@@ -2840,12 +2793,30 @@ CIRCChannel.prototype.invite =

>+CIRCChannel.prototype.findusers = 

I think this should really be "findUsers".

>+function chan_findusers(mask)
>+{
>+    var user;

You can actually declare the var inside the for in JS and it will work fine - the variable will still only be created once, and it saves you a line. ;)

>+    var ary = new Array();
>+    var unchecked = 0;
>+    mask = getHostmaskParts(mask);
>+    for (var nick in this.users)
>+    {
>+        user = this.users[nick];
>+        if (!user.host || !user.name)
>+            unchecked++;
>+        else if (hostmaskMatches(user, mask))
>+            ary.push(user.unicodeName);

I'm wondering if it wouldn't be better to return the actual user objects...z

>+    }
>+    return {users: ary, unchecked: unchecked};
>+}


>Index: mozilla/extensions/irc/xul/content/commands.js

>@@ -1771,12 +1772,25 @@ function cmdAttach(e)

>+function cmdMatchUsers(e)
>+{
>+    var matches = e.channel.findusers(e.mask);
>+    var uc = matches.unchecked;
>+    var nicks = matches.users.join(", ");
>+    var uncheckedStr = (uc == 0) ? "" : " " + getMsg(MSG_MATCH_UNCHECKED, uc);
>+
>+    if (matches.users.length == 0)
>+        display(MSG_NO_MATCHING_NICKS + uncheckedStr + ".");
>+    else 
>+        display(getMsg(MSG_MATCHING_NICKS, nicks) + uncheckedStr + ".");

Please don't add "." on the end like that. I'm not even sure I like you joining two locale strings.

Why not use:
  getMsg(MSG_NO_MATCHING_NICKS, getMsg(MSG_MATCH_UNCHECKED, uc))
and
  getMsg(MSG_MATCHING_NICKS, [nicks, getMsg(MSG_MATCH_UNCHECKED, uc)])
?

That way, the locale strings control where the unchecked value goes.
Attachment #205071 - Flags: review?(silver) → review-
Attached patch Better patch (obsolete) — Splinter Review
Better patch, nits addressed (hopefully).
Assignee: rginda → gijskruitbosch+bugs
Attachment #205071 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #210073 - Flags: review?(silver)
Comment on attachment 210073 [details] [diff] [review]
Better patch

>+function cmdMatchUsers(e)
>+{
>+    var matches = e.channel.findUsers(e.mask);
>+    var uc = matches.unchecked;
>+    var msgNotChecked = "";
>+
>+    // Get a pretty list of nicknames:
>+    var nicks = "";
>+    if (matches.users.length > 0)
>+        nicks = matches.users.shift().unicodeName;
>+    for (var i = 0; i < matches.users.length; i++)
>+        nicks += ", " + matches.users[i].unicodeName;

Please use arraySpeak here (with nothing for single or plural).

http://landfill.mozilla.org/mxr-test/seamonkey/source/extensions/irc/xul/content/static.js#1818

I will review the rest of the patch tomorrow or Saturday.
Attachment #210073 - Flags: review?(silver) → review-
Wonder when it's going to be good enough, if the patches really do keep getting better ;-).
Attachment #210073 - Attachment is obsolete: true
Attachment #246600 - Flags: review?(silver)
Comment on attachment 246600 [details] [diff] [review]
Even better patch

>Index: mozilla/extensions/irc/js/lib/irc.js
>+    return {users: ary, unchecked: unchecked};

Nit: spaces inside the braces.

>Index: mozilla/extensions/irc/xul/content/commands.js
>+    if (nicknameStr == "")

Check either (matches.users.length == 0) or (nicknames.length == 0) for my sanity.

>Index: mozilla/extensions/irc/xul/locale/en-US/chatzilla.properties
>+cmd.match-users.params = <mask>
>+cmd.match-users.help = Shows a list of all users whose hostmask matches <mask>.

Nit: line up the equals.

r=silver with those fixed.
Attachment #246600 - Flags: review?(silver) → review+
After fixing nits:

Checking in mozilla/extensions/irc/js/lib/irc.js;
/cvsroot/mozilla/extensions/irc/js/lib/irc.js,v  <--  irc.js
new revision: 1.102; previous revision: 1.101
done
Checking in mozilla/extensions/irc/xul/content/commands.js;
/cvsroot/mozilla/extensions/irc/xul/content/commands.js,v  <--  commands.js
new revision: 1.113; previous revision: 1.112
done
Checking in mozilla/extensions/irc/xul/locale/en-US/chatzilla.properties;
/cvsroot/mozilla/extensions/irc/xul/locale/en-US/chatzilla.properties,v  <--  chatzilla.properties
new revision: 1.125; previous revision: 1.124
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [cz-0.9.78]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: