Should be able to scan user list of a channel

RESOLVED FIXED

Status

Other Applications
ChatZilla
--
enhancement
RESOLVED FIXED
17 years ago
12 years ago

People

(Reporter: tessarakt, Assigned: Gijs)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [cz-0.9.78])

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

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

Chatzilla should support this, too.

Comment 1

17 years ago
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
(Reporter)

Comment 2

17 years ago
Not exactly. I want to list nicks of which the hostname matches an expression.

Comment 3

17 years ago
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?
(Reporter)

Comment 4

17 years ago
P&P 4.0 for mIRC supported this, via the channel context menu.

Yes, I want this "/find *@*.de".

Comment 5

17 years ago
When you select it from the context menu, does it bring up a dialog?
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Reporter)

Comment 6

17 years ago
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).
(Reporter)

Comment 7

16 years ago
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
(Assignee)

Comment 8

13 years ago
(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...

(Assignee)

Comment 9

13 years ago
Created attachment 205071 [details] [diff] [review]
Patch to support basic /match-users

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 10

13 years ago
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-
(Assignee)

Comment 11

13 years ago
Created attachment 210073 [details] [diff] [review]
Better patch

Better patch, nits addressed (hopefully).
Assignee: rginda → gijskruitbosch+bugs
Attachment #205071 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #210073 - Flags: review?(silver)

Comment 12

13 years ago
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-
(Assignee)

Comment 13

12 years ago
Created attachment 246600 [details] [diff] [review]
Even better patch

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 14

12 years ago
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+
(Assignee)

Comment 15

12 years ago
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
Last Resolved: 12 years ago
Resolution: --- → FIXED

Updated

12 years ago
Whiteboard: [cz-0.9.78]
You need to log in before you can comment on or make changes to this bug.