diff options
author | Brendan Taylor <bct@diffeq.com> | 2007-07-03 22:00:09 +0400 |
---|---|---|
committer | Brendan Taylor <bct@diffeq.com> | 2007-07-03 22:00:09 +0400 |
commit | 2bed6a522a248f94d54386e692da18fb82c47bbb (patch) | |
tree | d3b4537b0f7d828d889c327a88bbdde9b1fae71c | |
parent | c3b81346d9db45f72f6c36442cc79a7ca0343310 (diff) |
fixed a traceback
-rw-r--r-- | src/chat_control.py | 8 | ||||
-rw-r--r-- | src/common/connection_handlers.py | 1 | ||||
-rwxr-xr-x | src/gajim.py | 1 | ||||
-rw-r--r-- | src/message_control.py | 8 | ||||
-rw-r--r-- | src/roster_window.py | 3 |
5 files changed, 12 insertions, 9 deletions
diff --git a/src/chat_control.py b/src/chat_control.py index 5e3e30774..ec04c7bb7 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -508,7 +508,6 @@ class ChatControlBase(MessageControl): if not message or message == '\n': return 1 - if not self._process_command(message): ret = MessageControl.send_message(self, message, keyID, type = type, chatstate = chatstate, msg_id = msg_id, @@ -1495,7 +1494,7 @@ class ChatControl(ChatControlBase): toggle_gpg_menuitem.set_property('sensitive', is_sensitive) # TODO: check that the remote client supports e2e - isactive = self.session.enable_encryption + isactive = int(self.session != None and self.session.enable_encryption) toggle_e2e_menuitem.set_active(isactive) # If we don't have resource, we can't do file transfer @@ -1947,7 +1946,7 @@ class ChatControl(ChatControlBase): tb.set_active(not tb.get_active()) def _on_toggle_e2e_menuitem_activate(self, widget): - if self.session.enable_encryption: + if self.session and self.session.enable_encryption: self.session.terminate_e2e() jid = str(self.session.jid) @@ -1955,6 +1954,9 @@ class ChatControl(ChatControlBase): gajim.connections[self.account].delete_session(jid, self.session.thread_id) self.session = gajim.connections[self.account].make_new_session(jid) else: + if not self.session: + self.session = gajim.connections[self.account].make_new_session(self.contact.jid) + self.session.negotiate_e2e() def got_connected(self): diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index c96354ca1..b6fc50f1f 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1582,7 +1582,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, if bare_jid != jid: session = self.find_session(bare_jid, thread_id, type) if session: - print repr(bare_jid), repr(thread_id), repr(jid.split("/")[1]) self.move_session(bare_jid, thread_id, jid.split("/")[1]) return session diff --git a/src/gajim.py b/src/gajim.py index 3ba655e16..8f2537b20 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1726,6 +1726,7 @@ class Interface: if form.getField('terminate'): if form.getField('terminate').getValue() in ('1', 'true'): session.acknowledge_termination() + gajim.connections[account].delete_session(str(jid), session.thread_id) ctrl = gajim.interface.msg_win_mgr.get_control(str(jid), account) diff --git a/src/message_control.py b/src/message_control.py index d8f4fa0d6..bca808837 100644 --- a/src/message_control.py +++ b/src/message_control.py @@ -113,9 +113,10 @@ class MessageControl: def set_session(self, session): if session == self.session: return + if self.session: - print "starting a new session, forgetting about the old one!" - gajim.connections[self.account].delete_session(self.contact.jid, self.session.thread_id) + print "starting a new session, dropping the old one!" + gajim.connections[self.account].delete_session(self.contact.get_full_jid(), self.session.thread_id) self.session = session @@ -126,6 +127,9 @@ class MessageControl: ''' jid = self.contact.jid + if not self.session: + self.session = gajim.connections[self.account].make_new_session(self.contact.get_full_jid()) + # Send and update history return gajim.connections[self.account].send_message(jid, message, keyID, type = type, chatstate = chatstate, msg_id = msg_id, diff --git a/src/roster_window.py b/src/roster_window.py index f9e85debc..cc7c89364 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -3488,9 +3488,6 @@ class RosterWindow: if resource: fjid += '/' + resource - if not session: - session = gajim.connections[account].make_new_session(fjid) - mw = gajim.interface.msg_win_mgr.get_window(fjid, account) if not mw: mw = gajim.interface.msg_win_mgr.create_window(contact, account, type_) |