From d1a9a6983a7f120a55a668f8165da802e43586e9 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 10 Dec 2009 17:40:48 +0100 Subject: [PATCH] EncryptedSession cannot be an ArchivingSession --- src/chat_control.py | 3 ++- src/common/stanza_session.py | 4 ++-- src/message_control.py | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 7f754081b..977214875 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -2060,7 +2060,8 @@ class ChatControl(ChatControlBase): """ Print esession settings to textview """ - archiving = bool(self.session) and self.session.archiving + archiving = bool(self.session) and isinstance(self.session, + ArchivingStanzaSession) and self.session.archiving if archiving: msg = _('This session WILL be archived on server') else: diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py index 5a4f954b9..e3e8b84a4 100644 --- a/src/common/stanza_session.py +++ b/src/common/stanza_session.py @@ -287,7 +287,7 @@ class ArchivingStanzaSession(StanzaSession): self.control.print_archiving_session_details() -class EncryptedStanzaSession(ArchivingStanzaSession): +class EncryptedStanzaSession(StanzaSession): ''' An encrypted stanza negotiation has several states. They arerepresented as the following values in the 'status' attribute of the session object: @@ -313,7 +313,7 @@ class EncryptedStanzaSession(ArchivingStanzaSession): handle_session_negotiation method. ''' def __init__(self, conn, jid, thread_id, type_='chat'): - ArchivingStanzaSession.__init__(self, conn, jid, thread_id, type_='chat') + StanzaSession.__init__(self, conn, jid, thread_id, type_='chat') self.xes = {} self.es = {} diff --git a/src/message_control.py b/src/message_control.py index e1d3f4919..ef6bc2868 100644 --- a/src/message_control.py +++ b/src/message_control.py @@ -166,11 +166,13 @@ class MessageControl: crypto_changed = bool(session and isinstance(session, EncryptedStanzaSession) and session.enable_encryption) != \ - bool(oldsession and oldsession.enable_encryption) + bool(oldsession and isinstance(oldsession, EncryptedStanzaSession) and\ + oldsession.enable_encryption) archiving_changed = bool(session and isinstance(session, ArchivingStanzaSession) and session.archiving) != \ - bool(oldsession and oldsession.archiving) + bool(oldsession and isinstance(oldsession, ArchivingStanzaSession) and\ + oldsession.archiving) if crypto_changed or archiving_changed: self.print_session_details()