summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-01-08 23:29:18 -0400
committerKali Kaneko <kali@leap.se>2014-01-08 23:29:18 -0400
commitcc01116b337d9568352bb3791694f1c68d8d7ed8 (patch)
treef525700883a89612d7a8f3066dad1dc994719a74
parentb92e0962d4ab08f450700dc9fabf2d7eab203aa7 (diff)
add a flag to be able to close the session
-rw-r--r--mail/changes/bug_4925_close_session1
-rw-r--r--mail/src/leap/mail/imap/account.py1
-rw-r--r--mail/src/leap/mail/imap/service/imap.py12
3 files changed, 5 insertions, 9 deletions
diff --git a/mail/changes/bug_4925_close_session b/mail/changes/bug_4925_close_session
new file mode 100644
index 0000000..93dab55
--- /dev/null
+++ b/mail/changes/bug_4925_close_session
@@ -0,0 +1 @@
+ o Add a flag to be able to reset the session. Closes: #4925
diff --git a/mail/src/leap/mail/imap/account.py b/mail/src/leap/mail/imap/account.py
index fd861e7..8caafef 100644
--- a/mail/src/leap/mail/imap/account.py
+++ b/mail/src/leap/mail/imap/account.py
@@ -46,6 +46,7 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB, MBoxParser):
_soledad = None
selected = None
+ closed = False
def __init__(self, account_name, soledad=None):
"""
diff --git a/mail/src/leap/mail/imap/service/imap.py b/mail/src/leap/mail/imap/service/imap.py
index 234996d..dfd4862 100644
--- a/mail/src/leap/mail/imap/service/imap.py
+++ b/mail/src/leap/mail/imap/service/imap.py
@@ -71,15 +71,6 @@ class LeapIMAPServer(imap4.IMAP4Server):
# populate the test account properly (and only once
# per session)
- # theAccount = SoledadBackedAccount(
- # user, soledad=soledad)
-
- # ---------------------------------
- # XXX pre-populate acct for tests!!
- # populate_test_account(theAccount)
- # ---------------------------------
- #self.theAccount = theAccount
-
def lineReceived(self, line):
"""
Attempt to parse a single line from the server.
@@ -88,6 +79,9 @@ class LeapIMAPServer(imap4.IMAP4Server):
:type line: str
"""
print "RECV: STATE (%s)" % self.state
+ if self.theAccount.closed is True and self.state != "unauth":
+ log.msg("Closing the session. State: unauth")
+ self.state = "unauth"
if "login" in line.lower():
# avoid to log the pass, even though we are using a dummy auth