diff options
-rw-r--r-- | src/connection.py | 5 | ||||
-rw-r--r-- | src/logging.py | 8 | ||||
-rw-r--r-- | src/multiuserchat.py | 6 |
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') |