Pylint improvement and method rename
authorPlamen Dimitrov <plamen.dimitrov@intra2net.com>
Thu, 12 Jul 2012 12:24:02 +0000 (14:24 +0200)
committerPlamen Dimitrov <plamen.dimitrov@intra2net.com>
Thu, 12 Jul 2012 12:24:02 +0000 (14:24 +0200)
imap_mark_seen.py
mail_iterator.py
warnings_handler.py

index 732d4a6..caae2e2 100644 (file)
@@ -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
index 130d8ce..4fb7bc2 100644 (file)
@@ -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') + ".")
index 982299d..c8fb4f6 100644 (file)
@@ -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