From: Plamen Dimitrov Date: Thu, 12 Jul 2012 12:24:02 +0000 (+0200) Subject: Pylint improvement and method rename X-Git-Url: http://developer.intra2net.com/git/?p=imap-mark-seen;a=commitdiff_plain;h=7c7f439f4bd233e1d771cfdd43a19e91a72666d1 Pylint improvement and method rename --- diff --git a/imap_mark_seen.py b/imap_mark_seen.py index 732d4a6..caae2e2 100644 --- a/imap_mark_seen.py +++ b/imap_mark_seen.py @@ -38,7 +38,7 @@ def main(): logging.debug("Setting message %s from mailbox %s as seen", mid.decode('iso-8859-1'), mailbox[2]) try: - session.update_message(mid.decode('iso-8859-1'), mailbox[2]) + session.set_message_seen(mid.decode('iso-8859-1')) except UserWarning as ex: logging.error(ex) continue diff --git a/mail_iterator.py b/mail_iterator.py index 130d8ce..4fb7bc2 100644 --- a/mail_iterator.py +++ b/mail_iterator.py @@ -1,5 +1,5 @@ ''' -mail_iterator.py - The module contains the MailIterator class. +imap-mark-seen.py - Tool to mark all e-mails as seen Copyright (c) 2012 Intra2net AG Author: Plamen Dimitrov and Thomas Jarosch @@ -92,13 +92,13 @@ class MailIterator: mailid_list = data[0].split() return mailid_list - def update_message(self, mid, mailbox): + def set_message_seen(self, mid): """Sets the \\Seen flag for a message.""" try: # Work around unsolicited server responses in imaplib by clearing them self.mail_con.response('STORE') - result, data = self.mail_con.uid('STORE', mid, '+FLAGS', "(\Seen)") + _result, data = self.mail_con.uid('STORE', mid, '+FLAGS', "(\Seen)") logging.debug("New flags for message %s are %s", mid, data) except (self.mail_con.error): raise UserWarning("Could not set the flags for the e-mail " + mid.decode('iso-8859-1') + ".") diff --git a/warnings_handler.py b/warnings_handler.py index 982299d..c8fb4f6 100644 --- a/warnings_handler.py +++ b/warnings_handler.py @@ -1,18 +1,8 @@ ''' -restore-mail-inject.py - Tool to inject mails via IMAP +imap-mark-seen.py - Tool to mark all e-mails as seen Copyright (c) 2012 Intra2net AG Author: Plamen Dimitrov and Thomas Jarosch - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. ''' import logging @@ -30,6 +20,4 @@ class WarningsHandler(logging.Handler): def emit(self, record): """Increase number of warnings found""" - self.detected_problems += 1 - \ No newline at end of file