summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-09 20:05:00 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-09 20:05:00 +0000
commitfc99b9e8625af9ec2916ed641de0dc3b093a7cea (patch)
tree66973641b745a8897e488be68d50517a524ae440 /src
parent31ab762ab6ced58c055b3225342f21d14cf0aafd (diff)
downloadpoezio-fc99b9e8625af9ec2916ed641de0dc3b093a7cea.tar.gz
poezio-fc99b9e8625af9ec2916ed641de0dc3b093a7cea.tar.bz2
poezio-fc99b9e8625af9ec2916ed641de0dc3b093a7cea.tar.xz
poezio-fc99b9e8625af9ec2916ed641de0dc3b093a7cea.zip
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...)
Diffstat (limited to 'src')
-rw-r--r--src/connection.py5
-rw-r--r--src/logging.py8
-rw-r--r--src/multiuserchat.py6
3 files changed, 12 insertions, 7 deletions
diff --git a/src/connection.py b/src/connection.py
index 642614dd..ffe42665 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -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)
diff --git a/src/logging.py b/src/logging.py
index d2b7e61a..f94ac466 100644
--- a/src/logging.py
+++ b/src/logging.py
@@ -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()
diff --git a/src/multiuserchat.py b/src/multiuserchat.py
index 158f7e84..8fb510f7 100644
--- a/src/multiuserchat.py
+++ b/src/multiuserchat.py
@@ -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')