From 934cc5d2c82502fd6eda5e4a20f389e0fb9bb0b2 Mon Sep 17 00:00:00 2001
From: Kjell Braden <afflux.gajim@pentabarf.de>
Date: Mon, 16 Apr 2012 22:09:16 +0200
Subject: [PATCH] gotr: fixed message injection without session

---
 gotr/manifest.ini | 2 +-
 gotr/otrmodule.py | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gotr/manifest.ini b/gotr/manifest.ini
index 15cd2c63..6fcb8b9c 100644
--- a/gotr/manifest.ini
+++ b/gotr/manifest.ini
@@ -1,7 +1,7 @@
 [info]
 name: Off-The-Record Encryption
 short_name: gotr
-version: 1.5
+version: 1.6
 description: See http://www.cypherpunks.ca/otr/
 authors: Kjell Braden <afflux.gajim@pentabarf.de>
 homepage: http://gajim-otr.pentabarf.de
diff --git a/gotr/otrmodule.py b/gotr/otrmodule.py
index 4ce51997..890ef5e6 100644
--- a/gotr/otrmodule.py
+++ b/gotr/otrmodule.py
@@ -97,11 +97,11 @@ class GajimContext(potr.context.Context):
         account = self.user.accountname
 
         stanza = common.xmpp.Message(to=self.peer, body=msg, typ='chat')
-        if appdata and 'session' in appdata:
-            session = appdata['session']
-            stanza.setThread(session.thread_id)
+        if appdata is not None:
+            session = appdata.get('session', None)
+            if session is not None:
+                stanza.setThread(session.thread_id)
         gajim.connections[account].connection.send(stanza, now=True)
-        return
 
     def setState(self, newstate):
         if self.state == potr.context.STATE_ENCRYPTED:
-- 
GitLab