[Twisted-Python] Another IRC patch.

screwtape at froup.com screwtape at froup.com
Sat Nov 2 16:42:07 EST 2002

On Sat, Nov 02, 2002 at 10:57:17AM -0600, Glyph Lefkowitz wrote:
> 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...

Oh, neat.

To be truthful, most of it is pretty nifty. :)

I'd be interested to see if my bot also works with AIM and
twisted.words, though - I don't have an account with either so I can't
test... is anyone working on a Jabber protocol for Twisted? :)

> > 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.

Oh. That's a right pain, that is.

> 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
> appropriately.

Heh. I was going to post 'how about I just dump it in the metadata
dict' and look into writing a patch later today. Thanks!

> 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. 

When I was doing IRC-specific things, I too have found it incredibly
useful. But, being unconcerned with low-level details of the protocol
at the moment, I find it annoying.

> 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 want?

My theory was that if a developer wanted that level of detail from
ircsupport.py, they could just go and uncomment the print statement.

 ___________ ____________________________
| Screwtape | Reply-To: munged on Usenet |________ ______ ____ __ _  _   _

More information about the Twisted-Python mailing list