Python and JabberCOM
John Sands
wonkowatson at yahoo.com
Thu Feb 8 08:46:54 EST 2001
I'm trying to use JabberCOM from Python and it isn't working. Here's
some code:
import win32com.client
import pythoncom
class JabberEvents:
def OnAuthError(self, ErrorText):
print "OnAuthError", ErrorText
def OnCommError(self, ErrorText):
print "OnCommError", ErrorText
def OnConnect(self):
print "OnConnect"
def test1():
jabber = win32com.client.DispatchWithEvents
("JabberCOM.JabberSession", JabberEvents)
jabber.Server = "jabber.org"
jabber.Username = "WonkoWatson"
jabber.Password = "pass"
jabber.Resource = "sync"
print jabber.Active
jabber.DoConnect(0 , 0)
pythoncom.PumpWaitingMessages()
win32api.Sleep(10000)
print jabber.Active
test1()
print "end"
I get no events firing, and the jabber.Active shows 0 both times.
If I comment out any of the Server,Username,Password or Resource
properties then I get an OnAuthError, so I know the event hook is
working. I can execute exactly the same code from VB and I get the
OnConnect event in a few seconds:
Public WithEvents JSession As JabberSession
...
Set JSession = New JabberSession
JSession.server = server
JSession.username = username
JSession.password = password
JSession.Resource = "VBJC_Tester"
JSession.DoConnect False, jatPlainText
Thanks for any advice.
More information about the Python-list
mailing list