Fix a little crash, fix the authentication process (was not working with prosody, because it was wrong), fix the sending of the vcard (was broken too, but ejabberd doesn't complain...)
This commit is contained in:
parent
31ab762ab6
commit
fc99b9e862
3 changed files with 12 additions and 7 deletions
|
@ -64,8 +64,9 @@ class Connection(threading.Thread):
|
|||
sys.exit(-1)
|
||||
# TODO, become invisible before sendInitPresence
|
||||
self.client.sendInitPresence(requestRoster=0)
|
||||
self.online = 1 # 2 when confirmation of our auth is received
|
||||
self.register_handlers()
|
||||
|
||||
self.online = 1 # 2 when confirmation of our auth is received
|
||||
while 1:
|
||||
self.process()
|
||||
|
||||
|
@ -145,7 +146,7 @@ class Connection(threading.Thread):
|
|||
if presence.getType() == 'error':
|
||||
self.error_message(presence)
|
||||
return
|
||||
if fro == toj: # own presence
|
||||
if not toj or fro == toj: # own presence
|
||||
self.online = 2
|
||||
self.jid = toj
|
||||
self.handler.emit('on-connected', jid=fro)
|
||||
|
|
|
@ -71,10 +71,14 @@ class Logger(object):
|
|||
fd = open(dir+room, 'a')
|
||||
except IOError:
|
||||
return
|
||||
try:
|
||||
msg = msg.encode('utf-8')
|
||||
except:
|
||||
pass
|
||||
if nick:
|
||||
fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+nick.encode('utf-8')+': '+msg.encode('utf-8')+'\n')
|
||||
fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+nick.encode('utf-8')+': '+msg+'\n')
|
||||
else:
|
||||
fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+'* '+msg.encode('utf-8')+'\n')
|
||||
fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+'* '+msg+'\n')
|
||||
fd.close()
|
||||
|
||||
logger = Logger()
|
||||
|
|
|
@ -74,7 +74,7 @@ class VcardSender(threading.Thread):
|
|||
if image:
|
||||
vcard['PHOTO'] = {"TYPE":mime_type,"BINVAL":image}
|
||||
iq = xmpp.Iq(typ = 'set')
|
||||
iq2 = iq.setTag(xmpp.NS_VCARD + ' vCard')
|
||||
iq2 = iq.addChild('vCard', namespace=xmpp.NS_VCARD)
|
||||
for i in vcard:
|
||||
if i == 'jid':
|
||||
continue
|
||||
|
@ -91,7 +91,7 @@ class VcardSender(threading.Thread):
|
|||
iq2.addChild(i).setData(vcard[i])
|
||||
self.connection.send(iq)
|
||||
iq = xmpp.Iq(typ = 'set')
|
||||
iq2 = iq.setTag(xmpp.NS_VCARD_UPDATE)
|
||||
iq2 = iq.addChild('vCard', namespace=xmpp.NS_VCARD_UPDATE)
|
||||
iq2.addChild('PHOTO').setData(sha1)
|
||||
self.connection.send(iq)
|
||||
|
||||
|
@ -316,7 +316,7 @@ class MultiUserChat(object):
|
|||
qp = iq_obj.getTag('query')
|
||||
if config.get('send_poezio_info', 'true') == 'true':
|
||||
qp.setTagData('name', 'Poezio')
|
||||
qp.setTagData('version', '0.7 dev')
|
||||
qp.setTagData('version', '0.6.3 dev')
|
||||
else:
|
||||
qp.setTagData('name', 'Unknown')
|
||||
qp.setTagData('version', 'Unknown')
|
||||
|
|
Loading…
Reference in a new issue