diff options
author | Kjell Braden <afflux.gajim@pentabarf.de> | 2013-06-28 11:45:26 +0400 |
---|---|---|
committer | Kjell Braden <afflux.gajim@pentabarf.de> | 2013-06-28 11:45:26 +0400 |
commit | 9599b15eb5e0b38551e3559ba992185fd7334a32 (patch) | |
tree | 9174c71b985628e3b541111186617de6b5b6b5c5 /gotr | |
parent | 69c7bf0715f4757321cbd7369a1998352d272914 (diff) |
gotr: fix messages not being encrypted due to message encoding in events
Diffstat (limited to 'gotr')
-rw-r--r-- | gotr/manifest.ini | 2 | ||||
-rw-r--r-- | gotr/otrmodule.py | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/gotr/manifest.ini b/gotr/manifest.ini index a1653ef..80397e4 100644 --- a/gotr/manifest.ini +++ b/gotr/manifest.ini @@ -1,7 +1,7 @@ [info] name: Off-The-Record Encryption short_name: gotr -version: 1.7.3 +version: 1.7.4 description: Provide OTR encryption authors: Kjell Braden <afflux.gajim@pentabarf.de> homepage: http://gajim-otr.pentabarf.de diff --git a/gotr/otrmodule.py b/gotr/otrmodule.py index 6c43980..adc9489 100644 --- a/gotr/otrmodule.py +++ b/gotr/otrmodule.py @@ -537,7 +537,7 @@ class OtrPlugin(GajimPlugin): try: ctx = self.us[account].getContext(event.fjid) - msgtxt, tlvs = ctx.receiveMessage(event.msgtxt, + msgtxt, tlvs = ctx.receiveMessage(event.msgtxt.encode('utf8'), appdata={'session':event.session}) except potr.context.NotOTRMessage, e: # received message was not OTR - pass it on @@ -583,10 +583,10 @@ class OtrPlugin(GajimPlugin): ctx.smpWindow.handle_tlv(tlvs) stripper = HTMLStripper() - stripper.feed(unicode(msgtxt or '')) + stripper.feed((msgtxt or '').decode('utf8')) event.msgtxt = stripper.stripped_data event.stanza.setBody(event.msgtxt) - event.stanza.setXHTML(msgtxt) + event.stanza.setXHTML((msgtxt or '').decode('utf8')) return PASS @@ -606,6 +606,7 @@ class OtrPlugin(GajimPlugin): fjid += '/' + event.resource message = event.xhtml or escape(event.message) + message = message.encode('utf8') try: newmsg = self.us[event.account].getContext(fjid).sendMessage( @@ -624,7 +625,7 @@ class OtrPlugin(GajimPlugin): event.xhtml = newmsg stripper = HTMLStripper() - stripper.feed(unicode(newmsg or '')) + stripper.feed((newmsg or '').decode('utf8')) event.message = stripper.stripped_data return PASS |