[Twisted-Python] implementing NAMES in IRC

Tristan Seligmann mithrandi at mithrandi.net
Tue Sep 11 12:12:22 EDT 2012

On Tue, Sep 11, 2012 at 3:43 PM,  <exarkun at twistedmatrix.com> wrote:
> This is the excuse that is always given for not implementing a new
> feature on `IRCClient`.  However, here's another equivalent way of
> stating the objection:
>   IRC is a terrible protocol and it is very difficult to implement a
>   method like `names` reliably, due to the various vague and obscure
>   corner cases presented.  Therefore, instead of Twisted tackling this
>   problem and providing a single (perhaps imperfect) implementation,
>   every single IRC application developer should instead rediscover this
>   sad reality for themselves and then implement their own uniquely buggy
>   version of this functionality.

Actually, my recommendation would be to avoid trying to implement
functionality of this nature in any application at all. The only way
to reliably use the NAMES command is the way
twisted.words.im.ircsupport and real IRC clients do: handle
RPL_NAMREPLY / RPL_ENDOFNAMES without regard to any NAMES command you
may or may not have issued, and then issue a NAMES command at certain
points without any regard for a response that may or may not be sent
to you by the IRC server. Having said that, I guess IRCClient could
handle the parsing of RPL_NAMREPLY / RPL_ENDOFNAMES messages into a
single list of names, which could then be delivered as a single event.

My main concern with most of the more complex implementation
strategies is that they impose a non-zero cost on users of IRCClient,
as well as encouraging the implementation of unreliable features; at
the very least, I think "anti-IRC" code like this should be an extra
layer on top of the basic IRC protocol implementation.
mithrandi, i Ainil en-Balandor, a faer Ambar

More information about the Twisted-Python mailing list