diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-11-13 13:25:32 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-11-13 13:25:32 -0300 |
commit | a9a3ddf1f9a3045d46670b49403cdd40e430e0fd (patch) | |
tree | fa81fbe28745bae84f479eec5325ee6f613c1126 /src/leap/mail/imap/fetch.py | |
parent | 24b78557e8a1d31971a6b8c1fcc1269d7c5e4709 (diff) | |
parent | 9d2da209f6371b38d73248490eea9fd3bc803ec9 (diff) |
Merge remote-tracking branch 'kali/bug/imap-improvements' into develop
Diffstat (limited to 'src/leap/mail/imap/fetch.py')
-rw-r--r-- | src/leap/mail/imap/fetch.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/leap/mail/imap/fetch.py b/src/leap/mail/imap/fetch.py index 4d47408..3422ed5 100644 --- a/src/leap/mail/imap/fetch.py +++ b/src/leap/mail/imap/fetch.py @@ -141,16 +141,19 @@ class LeapIncomingMail(object): """ Starts a loop to fetch mail. """ - self._loop = LoopingCall(self.fetch) - self._loop.start(self._check_period) + if self._loop is None: + self._loop = LoopingCall(self.fetch) + self._loop.start(self._check_period) + else: + logger.warning("Tried to start an already running fetching loop.") def stop(self): """ Stops the loop that fetches mail. """ - # XXX should cancel ongoing fetches too. if self._loop and self._loop.running is True: self._loop.stop() + self._loop = None # # Private methods. @@ -214,7 +217,7 @@ class LeapIncomingMail(object): Generic errback """ err = failure.value - logger.error("error!: %r" % (err,)) + logger.exception("error!: %r" % (err,)) def _decryption_error(self, failure): """ @@ -387,6 +390,8 @@ class LeapIncomingMail(object): decrdata = decrdata.encode(encoding, 'replace') decrmsg = parser.parsestr(decrdata) + # remove original message's multipart/encrypted content-type + del(origmsg['content-type']) # replace headers back in original message for hkey, hval in decrmsg.items(): try: |