fixed a traceback

This commit is contained in:
Brendan Taylor 2007-07-03 18:00:09 +00:00
parent c3b81346d9
commit 2bed6a522a
5 changed files with 12 additions and 9 deletions

View File

@ -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):

View File

@ -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

View File

@ -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)

View File

@ -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,

View File

@ -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_)