Hello Alvin,

Thanks, MSNP8 should be enough for a chat bot. I'll have a look at the twisted.im module, it seems to contain a basic multi-protocol chat client.

I had another question about the Jabber example (xmpp_client.py) in Twisted words. When I quit the application with Ctrl+C, it throws an exception:

Disconnected.
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 228, in mainLoop
    self.runUntilCurrent()
  File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 561, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 414, in _continueSystemEvent
    callable(*args, **kw)
  File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 375, in disconnectAll
    failure.Failure(main.CONNECTION_LOST))
--- <exception caught here> ---
  File "/usr/lib/python2.5/site-packages/twisted/python/log.py", line 48, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.5/site-packages/twisted/python/log.py", line 33, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.5/site-packages/twisted/python/context.py", line 59, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.5/site-packages/twisted/python/context.py", line 37, in callWithContext
    return func(*args,**kw)
  File "/usr/lib/python2.5/site-packages/twisted/internet/tcp.py", line 576, in connectionLost
    Connection.connectionLost(self, reason)
  File "/usr/lib/python2.5/site-packages/twisted/internet/tcp.py", line 416, in connectionLost
    protocol.connectionLost(reason)
  File "/usr/lib/python2.5/site-packages/twisted/words/xish/xmlstream.py", line 82, in connectionLost
    self.dispatch(self, STREAM_END_EVENT)
  File "/usr/lib/python2.5/site-packages/twisted/words/xish/utility.py", line 227, in dispatch
    self._eventObservers[(priority, event)].callback(object)
  File "/usr/lib/python2.5/site-packages/twisted/words/xish/utility.py", line 37, in callback
    methodwrapper(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/twisted/words/xish/utility.py", line 21, in __call__
    self.method(*nargs, **nkwargs)
  File "xmpp_client.py", line 58, in disconnected
    reactor.stop()
  File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 342, in stop
    raise RuntimeError, "can't stop reactor that isn't running"
exceptions.RuntimeError: can't stop reactor that isn't running

Is there any way to modify this example so that it stops gracefully when Ctrl+C is pressed? Embedding the main script code in a try-except statement that catches KeyboardInterrupt doesn't help since Twisted seems to catch all exceptions itself.

I read about deferred's and errbacks, but I don't know where to add an errback to in the XMPP example. To the client? The XmlStream? The reactor?

Any pointers would be greatly appreciated ...

Thanks!

-- Jo

On Mon, May 26, 2008 at 2:37 PM, Alvin Delagon <adelagon@gmail.com> wrote:
There's a twisted MSNP8 (or is it MSNP9) implementation. It's experimental but it works. I managed to write an MSN gateway for XMPP deriving most of the codes from it.

----
Alvin Delagon

On Mon, May 26, 2008 at 6:49 PM, Jo Vermeulen <jo.vermeulen@gmail.com> wrote:
Hello,

I am trying to create a chat bot that can work over both the XMPP and the MSN protocol using Twisted words. I have a couple of questions as a Twisted newbie :-)

Is there any documentation on how to create a protocol-agnostic chatbot with Twisted words? Or are there applications using Twisted words that offer multiple front-ends?

I have a XMPP version working, but had some problems finding my way around a few features. I don't know how to get a list of contacts, or initiatiate a group chat. Even if I succeed in doing this, would it be possible to generalize this for both XMPP and MSN?

Finally, I was wondering how mature Twisted words is. It seems to work well for XMPP, but how mature is the MSN support? Are there other libraries I could consider, or is it possible to generalize other libraries within Twisted?

Thanks in advance!

-- Jo Vermeulen

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python




--
http://www.alvinatorsplayground.blogspot.com/

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python