[Twisted-Python] Another IRC patch.

Glyph Lefkowitz glyph at twistedmatrix.com
Sat Nov 2 11:57:17 EST 2002

On Sat, 2 Nov 2002 23:19:18 +1100, screwtape at froup.com wrote:

> While developing my twisted.im bot (new this week! database access and an
> infobot-style plugin!) I've come up against two seperate annoyances. This
> patch fixes both of them.

Glad you're making progress!  I'm sorry that twisted.im is annoying you :-(.
Hopefully I can give some guidance as to how it's _supposed_ to work...

> Number 1: the IRC protocol defines (among other things) two message types -
> privmsg and notice. They are identical in every respect except that a notice
> must not be automatically replied to.

Except when they should be automatically replied to.  Such as the notice that
NickServ gives you upon login, or one of the various notices that older
spambots will generate in response to a VERSION directive.

This is one of the worse excresences of the IRC protocol and I'd like to not
see promoted to the higher levels of abstractions in twisted.im.  What you're
semantically communicating is metadata about the message ("please don't
autorespond to this (unless you really want to)") and not a wholly different
type of message.  So I've committed a different fix :-).  The "metadata"
dictionary passesd to showMessage and showGroupMessage is designed to
encapsulate this sort of protocol-specific need, so IRC "notice" messages will
have an entry in the metadata dictionary of {"dontAutoRespond": 1}.

I just committed a fix that does this... if you're using CVS, your bot can now
check for that flag in the metadata dict and drop the message on the floor

For t.im's default use case (end-user chat application) whether or not robots
should automatically respond to a certain type of message is completely
irrelevant to its display.

> Number 2: [ ... ] twisted.im.ircsupport by default prints an error message
> for each unknown command it recieves. Slashnet in particular seems to like to
> send a lot of them, and it clutters up my screen. This patch simply comments
> out the print statement and adds a 'pass'.

Hmm... that behavior should at least be customizeable with a flag... I
personally have used that console output a number of times, and it has been
invaluable in debugging certain things in twisted.im on various occasions.  If
you don't want the output going to the console, there should be a separate log.
Perhaps you could specifically ignore the slashnet message types you don't

 |    <`'>    |  Glyph Lefkowitz: Traveling Sorcerer   |
 |   < _/ >   |  Lead Developer,  the Twisted project  |
 |  < ___/ >  |      http://www.twistedmatrix.com      |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20021102/b6b9f8dc/attachment.pgp 

More information about the Twisted-Python mailing list