Opened 9 years ago

Last modified 9 years ago

#4620 enhancement new

Introduce an IRC client API with data retrieval APIs which return Deferreds

Reported by: reiven Owned by: reiven
Priority: normal Milestone:
Component: words Keywords:
Cc: Branch:

Description (last modified by Jean-Paul Calderone)

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.whois, IRCClient.names, and IRCClient.setNick.

Changing 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/ my sandbox]. There are other examples out there as well, though I don't have links handy.

Change History (1)

comment:1 Changed 9 years ago by Jean-Paul Calderone

Description: modified (diff)
Milestone: Python-2.6
Owner: changed from Jean-Paul Calderone to reiven
Summary: whois is not returning dataIntroduce an IRC client API with data retrieval APIs which return Deferreds

Changing ticket description to something resolveable.

Also changing assignment, as I have no near-term plans to work on this.

Note: See TracTickets for help on using tickets.