summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/server.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-02-20 11:28:35 -0400
committerKali Kaneko <kali@leap.se>2015-02-20 16:37:03 -0400
commit209d433d92d867b9fb6df6b444930ce96804b060 (patch)
tree01f50c3b23f8839fc5fbd182599876f74dd18eaf /src/leap/mail/imap/server.py
parent6eb1f599d49adc860efba3ccc30b15035dcaa6b0 (diff)
notify MUA on closing connection
Diffstat (limited to 'src/leap/mail/imap/server.py')
-rw-r--r--src/leap/mail/imap/server.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/leap/mail/imap/server.py b/src/leap/mail/imap/server.py
index abe16be..3e10171 100644
--- a/src/leap/mail/imap/server.py
+++ b/src/leap/mail/imap/server.py
@@ -80,6 +80,20 @@ class LEAPIMAPServer(imap4.IMAP4Server):
log.msg('rcv (%s): %s' % (self.state, msg))
imap4.IMAP4Server.lineReceived(self, line)
+ def close_server_connection(self):
+ """
+ Send a BYE command so that the MUA at least knows that we're closing
+ the connection.
+ """
+ self.sendLine(
+ '* BYE LEAP IMAP Proxy is shutting down; '
+ 'so long and thanks for all the fish')
+ self.transport.loseConnection()
+ if self.mbox:
+ self.mbox.removeListener(self)
+ self.mbox = None
+ self.state = 'unauth'
+
def authenticateLogin(self, username, password):
"""
Lookup the account with the given parameters, and deny