fixed a traceback
This commit is contained in:
parent
c3b81346d9
commit
2bed6a522a
|
@ -508,7 +508,6 @@ class ChatControlBase(MessageControl):
|
||||||
if not message or message == '\n':
|
if not message or message == '\n':
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
if not self._process_command(message):
|
if not self._process_command(message):
|
||||||
ret = MessageControl.send_message(self, message, keyID, type = type,
|
ret = MessageControl.send_message(self, message, keyID, type = type,
|
||||||
chatstate = chatstate, msg_id = msg_id,
|
chatstate = chatstate, msg_id = msg_id,
|
||||||
|
@ -1495,7 +1494,7 @@ class ChatControl(ChatControlBase):
|
||||||
toggle_gpg_menuitem.set_property('sensitive', is_sensitive)
|
toggle_gpg_menuitem.set_property('sensitive', is_sensitive)
|
||||||
|
|
||||||
# TODO: check that the remote client supports e2e
|
# 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)
|
toggle_e2e_menuitem.set_active(isactive)
|
||||||
|
|
||||||
# If we don't have resource, we can't do file transfer
|
# 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())
|
tb.set_active(not tb.get_active())
|
||||||
|
|
||||||
def _on_toggle_e2e_menuitem_activate(self, widget):
|
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()
|
self.session.terminate_e2e()
|
||||||
|
|
||||||
jid = str(self.session.jid)
|
jid = str(self.session.jid)
|
||||||
|
@ -1955,6 +1954,9 @@ class ChatControl(ChatControlBase):
|
||||||
gajim.connections[self.account].delete_session(jid, self.session.thread_id)
|
gajim.connections[self.account].delete_session(jid, self.session.thread_id)
|
||||||
self.session = gajim.connections[self.account].make_new_session(jid)
|
self.session = gajim.connections[self.account].make_new_session(jid)
|
||||||
else:
|
else:
|
||||||
|
if not self.session:
|
||||||
|
self.session = gajim.connections[self.account].make_new_session(self.contact.jid)
|
||||||
|
|
||||||
self.session.negotiate_e2e()
|
self.session.negotiate_e2e()
|
||||||
|
|
||||||
def got_connected(self):
|
def got_connected(self):
|
||||||
|
|
|
@ -1582,7 +1582,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
||||||
if bare_jid != jid:
|
if bare_jid != jid:
|
||||||
session = self.find_session(bare_jid, thread_id, type)
|
session = self.find_session(bare_jid, thread_id, type)
|
||||||
if session:
|
if session:
|
||||||
print repr(bare_jid), repr(thread_id), repr(jid.split("/")[1])
|
|
||||||
self.move_session(bare_jid, thread_id, jid.split("/")[1])
|
self.move_session(bare_jid, thread_id, jid.split("/")[1])
|
||||||
return session
|
return session
|
||||||
|
|
||||||
|
|
|
@ -1726,6 +1726,7 @@ class Interface:
|
||||||
if form.getField('terminate'):
|
if form.getField('terminate'):
|
||||||
if form.getField('terminate').getValue() in ('1', 'true'):
|
if form.getField('terminate').getValue() in ('1', 'true'):
|
||||||
session.acknowledge_termination()
|
session.acknowledge_termination()
|
||||||
|
|
||||||
gajim.connections[account].delete_session(str(jid), session.thread_id)
|
gajim.connections[account].delete_session(str(jid), session.thread_id)
|
||||||
|
|
||||||
ctrl = gajim.interface.msg_win_mgr.get_control(str(jid), account)
|
ctrl = gajim.interface.msg_win_mgr.get_control(str(jid), account)
|
||||||
|
|
|
@ -113,9 +113,10 @@ class MessageControl:
|
||||||
def set_session(self, session):
|
def set_session(self, session):
|
||||||
if session == self.session:
|
if session == self.session:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.session:
|
if self.session:
|
||||||
print "starting a new session, forgetting about the old one!"
|
print "starting a new session, dropping the old one!"
|
||||||
gajim.connections[self.account].delete_session(self.contact.jid, self.session.thread_id)
|
gajim.connections[self.account].delete_session(self.contact.get_full_jid(), self.session.thread_id)
|
||||||
|
|
||||||
self.session = session
|
self.session = session
|
||||||
|
|
||||||
|
@ -126,6 +127,9 @@ class MessageControl:
|
||||||
'''
|
'''
|
||||||
jid = self.contact.jid
|
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
|
# Send and update history
|
||||||
return gajim.connections[self.account].send_message(jid, message, keyID,
|
return gajim.connections[self.account].send_message(jid, message, keyID,
|
||||||
type = type, chatstate = chatstate, msg_id = msg_id,
|
type = type, chatstate = chatstate, msg_id = msg_id,
|
||||||
|
|
|
@ -3488,9 +3488,6 @@ class RosterWindow:
|
||||||
if resource:
|
if resource:
|
||||||
fjid += '/' + resource
|
fjid += '/' + resource
|
||||||
|
|
||||||
if not session:
|
|
||||||
session = gajim.connections[account].make_new_session(fjid)
|
|
||||||
|
|
||||||
mw = gajim.interface.msg_win_mgr.get_window(fjid, account)
|
mw = gajim.interface.msg_win_mgr.get_window(fjid, account)
|
||||||
if not mw:
|
if not mw:
|
||||||
mw = gajim.interface.msg_win_mgr.create_window(contact, account, type_)
|
mw = gajim.interface.msg_win_mgr.create_window(contact, account, type_)
|
||||||
|
|
Loading…
Reference in New Issue