Make WHO behaviour closer to RFC
Reason
WHO
is used by some clients (such as Konversation) to check if the hostmask is changed (this happens when enabling/disabling cloacks for example at Freenode).
With the current code, the user gets an invalid WHO
reply, and in Konversation case this means:
Each 60 seconds
Fix
This fix improves the WHO command in several ways:
When no parameters are passed, return an error:
When the user looks for himself, return information about himself:
When the user looks for another user, or for a channel that do not exist, return an empty list:
TO-DO
Ideally at some point a real WHO could be implemented, but that's a more complicated PR as it would require handling masks, etc.
Still, a simple approach, that could also be valid for WHOIS could be:
- Look if the user exists at all.
- Look for the common channels before the users (the one making the request the queries at WHO/WHOIS.
- For WHO: return the information and the first common channel
- For WHOIS: return the information and all common channels. As I guess we don't have IDLE or ONLINE information, those could just be set to 0sec.
Edited by 🤖 GitLab Bot 🤖