#4620 enhancement new
Introduce an IRC client API with data retrieval APIs which return Deferreds
|Reported by:||reiven||Owned by:||reiven|
Description (last modified by )
The present IRC client API,
twisted.words.protocols.irc.IRCClient, exposes a number of methods for retrieving data from an IRC server. However, these methods all operate by sending the necessary request bytes and then expecting the application developer to override the necessary methods to learn when the response arrives.
This is significantly less convenient than APIs which return Deferreds which fire with the result, as it is more in line with other client APIs in Twisted, avoids the need for the application developer to subclass the protocol class to override methods in a particular way (making their code more reusable), and puts the complexity of matching up logical groupings of responses into a single place rather than forcing it to be replicated in each application.
Several APIs which
IRCClient provides which would benefit greatly from this treatment are
IRCClient itself to provide such APIs may be infeasible, as the obvious approaches would break many or most existing users.
It's also important to remember, however, that many IRC messages which may be responses to requests may also be sent by the server unsolicited. It does not make sense to associate this data with any particular Deferred, and so applications interested in such data will still likely need to override some callback method to get it.
There is some prior art in this area in [browser:/sandbox/exarkun/irc2.py my sandbox]. There are other examples out there as well, though I don't have links handy.