From: Yann L. <as...@la...> - 2013-01-04 19:20:30
|
On 01/04/2013 05:05 PM, Gábor László wrote: > Hi! > > My task is to do a Python script, what is registers a new user to a > jabberd2 server and then assigns all users to this newly created user > (roster-items). These things works separately (xmpp.features.register, > ... roster.setItem ... ), but when I do a registration and right after > that authenticate and set a roster item, that will not happen. Here is > an example code: > > > import sys > import os > import time > import xmpp > > cl = xmpp.Client('jabber.digicpictures.local') > cl.connect() > > xmpp.features.register(cl, 'jabber.digicpictures.local', {'username': > 'teszt', 'password': 'teszt'}) > > cl.auth('teszt', 'teszt') > > cl.sendInitPresence() > > # This will not work, throws an exception (not authorized) > # If the "xmpp.register" line deleted (and the user is exists) this > # will NOT throw an exception > roster = cl.getRoster() > roster.setItem('teszt2@jabber.digicpictures.local', 'Teeeszt'); > > time.sleep(1) > cl.disconnect() > > > I attached the DEBUG output. The interesting lines are: > > DEBUG: dispatcher wait Waiting for ID:2 with timeout 25... > DEBUG: bind error Binding failed: timeout expired. > > Why this is happening? I tried "time.sleep(5)" after register, but nothing. > Can somebody help me, please? What is the problem or what I do wrong? > Thank you! Probably because you don't way the answer before doing next step. When you do xmpp.features.register() you don't really register, you queue a message that will request the registration. message will really be sent when you'll call proceede() -- Yann |