[Twisted-Python] Where is best place to put my custom code?
lists at webcrunchers.com
Wed Dec 31 18:58:50 EST 2003
I'm open for suggestions on where I can put my customized code. I
seem to have a choice
between putting it in the "factory" or in the "protocol", and I cannot
seem to decide where the
best place would be.
My application is simple..... here is all it should do....
1) establish a connection to an IRC server.
2) send an IRC command, like a "who" command, and extract the info
3) then exit the client
I could put my code in the IRCClient's "connectionMade" method. Or I
could put it in the
factory's "startedConnecting" method. The code would be simple,
"who" command, and take it's output and return it. So, in my
I would issue the command... then call reactor.stop() which would exit
from my reactor.run().
I think the factory's "startedConnecting" might get called first, then
somewhere down in
this mess, the Client would call me back with the "connectionMade",
and I could do it there.
I just need to know the appropriate place to put my code. None of
these examples in
the 'examples' directories make this clear.
My next task is to know how to extract the 'who' data back from my
The ONLY callback I see is the "action()" method, where it has the
"msg" as the argument.
Is that the one I sub-class to read back the result of the "who"?
Which I assume is called back
from a deferred.
There are a number of other callbacks for the private messages and
such. Which one
do I use? When testing the code, I'm not getting any callbacks to
the "action()" method.
Is this because something else is fucked up.
I don't suppose anyone on this last has an Mac OS-X system, do they?
If so, I would love
to establish a VIOP meeting if anyone has the time to help me out. My
"iChat" AIM handle is
More information about the Twisted-Python