Do you think the IRC_WHO function (in irc-info.c, at line 651) should always return the "H" flag in RPL_WHOREPLY messages? According to RFC 2812 this flag can be either "H" or "G". Unfortunately the RFC doesn't seem to suggest what this means, but I've found some pages that indicate it means "here" or "gone" (depending on the user's away status):
http://www.mishscript.de/reference/rawhelp3.htm#raw352 http://www.mircscripts.org/forums.php?cid=3&id=159227 http://gametz.com/forum/Site_Feedback/topic/234776.html#M2688608
Dana
Dana Dahlstrom dana+70@cs.ucsd.edu wrote:
Do you think the IRC_WHO function (in irc-info.c, at line 651) should always return the "H" flag in RPL_WHOREPLY messages?
No, it shouldn't. Its a Bug. Actually i am quite surprised this didn't came up before (or that i never noticed this... ).
2812 this flag can be either "H" or "G". Unfortunately the RFC doesn't seem to suggest what this means, but I've found some pages that indicate it means "here" or "gone" (depending on the user's away status):
Exactly. I'll fix this.
On 2008-02-08 at 20:27 +0100, Florian Westphal wrote:
Actually i am quite surprised this didn't came up before (or that i never noticed this... ).
Chalk it up to 50 students beating on ngIRCd while trying to implement RFC-compliant clients more or less from scratch. :)
In addition to the "H" flag issue, I think there may be some failures handling wildcards in the mask of a WHO command. I'm including a proposed test script that exercises various possibilities suggested by the description here:
http://tools.ietf.org/html/rfc2812#section-3.6.1
These tests seem to work on other IRC servers I've tried.
Dana
diff -Nau src/testsuite/who-away-test.e src/testsuite/who-away-test.e --- src/testsuite/who-away-test.e 2008-02-08 12:38:12.000000000 -0800 +++ src/testsuite/who-away-test.e 2008-02-08 12:38:12.000000000 -0800 @@ -0,0 +1,100 @@ +# $Id$ + +spawn telnet localhost 6789 +expect { + timeout { exit 1 } + "Connected" +} + +send "nick nick\r" +send "user user . . :Real Name\r" +expect { + timeout { exit 1 } + "376" +} + +send "who\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick H :0 Real Name" +} + +send "who 0\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick H :0 Real Name" +} + +send "who *\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick H :0 Real Name" +} + +send "away :testing\r" +expect { + timeout { exit 1 } + "306 nick" +} + +send "who localhost\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick G :0 Real Name" +} + +send "who ngircd.test.server\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick G :0 Real Name" +} + +send "who Real?Name\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick G :0 Real Name" +} + +send "who nick\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick G :0 Real Name" +} + +send "away\r" +expect { + timeout { exit 1 } + "305 nick" +} + +send "who *cal*ho??\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick H :0 Real Name" +} + +send "who *.server\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick H :0 Real Name" +} + +send "who Real*me\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick H :0 Real Name" +} + +send "who n?c?\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 352 nick * ~user localhost ngircd.test.server nick H :0 Real Name" +} + +send "quit\r" +expect { + timeout { exit 1 } + "Connection closed" +} + +# -eof-
Dana Dahlstrom dana+70@cs.ucsd.edu wrote:
Chalk it up to 50 students beating on ngIRCd while trying to implement RFC-compliant clients more or less from scratch. :)
In addition to the "H" flag issue, I think there may be some failures handling wildcards in the mask of a WHO command. I'm including a proposed test script that exercises various possibilities suggested by the description here:
http://tools.ietf.org/html/rfc2812#section-3.6.1
These tests seem to work on other IRC servers I've tried.
Thanks, i've applied this to my tree. ngircd now sends "G" if user is marked as being away. I'll have to think a little bit about the other stuff though, so this might take some time before it hits CVS.
I'll put your test cases into CVS as soon as ngircd passes them.
Thanks, Florian
Florian Westphal fw@strlen.de wrote: [IRC_WHO should treat argument as pattern]
ngircd now sends "G" if user is marked as being away. I'll have to think a little bit about the other stuff though, so this might take some time before it hits CVS.
Okay, first draft: http://www.strlen.de/ngircd/irc_who.diff
This is a rather huge patch due to the re-formatting and re-structuring of IRC_WHO/IRC_Send_WHO.
Provided that i didn't introduce any bugs during re-structuring, the diff that adds the actual pattern match support is much shorter: http://git.breakpoint.cc/cgi-bin/gitweb.cgi?p=fw/ngircd.git;a=commitdiff;h=8...
Florian,
Nice job! After applying the patch, it passes all tests for me. Perhaps I'll run the patched version for my students.
I was considering tackling the pattern-matching myself, but I'm glad I didn't, because you've done it much more quickly than I could have. Instead maybe I'll study your solution and write some more tests. :)
Dana
According to RFC 2812 the parameter to a WHOIS query may contain a comma-delimited list of masks---
http://tools.ietf.org/html/rfc2812#section-3.6.2
---where each mask may contain wildcards (defined in section 2.5). The RFC isn't completely explicit about what the masks are matched against, but it seems to imply they're matched against nicknames only, and this is indeed the behavior I've found on other servers.
The patch below contains tests that exercise this. I started trying to make them pass, but so far it looks like it would not be a quick task for me. I suspect someone else will accomplish it more efficiently. :)
Dana
--- ngircd-CVSHEAD/src/testsuite/whois-test.e 1969-12-31 16:00:00.000000000 -0800 +++ ngircd-WHOIS-wildcards/src/testsuite/whois-test.e 2008-02-16 14:54:21.000000000 -0800 @@ -0,0 +1,53 @@ +# $Id$ + +spawn telnet localhost 6789 +expect { + timeout { exit 1 } + "Connected" +} + +send "nick nick\r" +send "user user . . :Real Name\r" +expect { + timeout { exit 1 } + "376" +} + +send "whois nick\r" +expect { + timeout { exit 1 } + "311 nick nick ~user localhost * :Real Name\r" +} + +send "whois *\r" +expect { + timeout { exit 1 } + "311 nick nick ~user localhost * :Real Name\r" +} + +send "whois n*\r" +expect { + timeout { exit 1 } + "311 nick nick ~user localhost * :Real Name\r" +} + +send "whois ?ick\r" +expect { + timeout { exit 1 } + "311 nick nick ~user localhost * :Real Name\r" +} + +send "whois ????,n?*k\r" +expect { + timeout { exit 1 } + "311 nick nick ~user localhost * :Real Name\r" + "311 nick nick ~user localhost * :Real Name\r" +} + +send "quit\r" +expect { + timeout { exit 1 } + "ERROR" +} + +# -eof-