diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2006-04-27 13:23:23 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2006-04-27 13:23:23 +0000 |
commit | aab7826cfed53f3a104037e7e50735f67f82fea9 (patch) | |
tree | 42e31f4b7cbae99396c0ba2ef6ac7383d921fa18 /contrib | |
parent | aa6897a1898e8979064c26d648cd31e7d9160ed4 (diff) | |
download | fetchmail-aab7826cfed53f3a104037e7e50735f67f82fea9.tar.gz fetchmail-aab7826cfed53f3a104037e7e50735f67f82fea9.tar.bz2 fetchmail-aab7826cfed53f3a104037e7e50735f67f82fea9.zip |
PopDel.py was revised by Joshua Crawford to display the From: address and
list every email, even if it has no Subject: header; and not delete the wrong
message in the presence of mail without Subject: headers.
svn path=/branches/BRANCH_6-3/; revision=4809
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/PopDel.manual | 2 | ||||
-rw-r--r-- | contrib/PopDel.py | 61 | ||||
-rw-r--r-- | contrib/README | 5 |
3 files changed, 42 insertions, 26 deletions
diff --git a/contrib/PopDel.manual b/contrib/PopDel.manual index fa5afc8d..523c4568 100644 --- a/contrib/PopDel.manual +++ b/contrib/PopDel.manual @@ -40,4 +40,4 @@ virus anyway. But who cares, Linux is tougher than viruses. -------------caveats - +(PopDel.manual ends here -- this line added by Matthias Andree, 04/2006) diff --git a/contrib/PopDel.py b/contrib/PopDel.py index 346d0809..d1558dea 100644 --- a/contrib/PopDel.py +++ b/contrib/PopDel.py @@ -5,30 +5,40 @@ # license. See COPYING for specifics. # # See PopDel.manual for the use of this Python class. -# (this isn't currently available) # -# created: 01 May 02 +# created: 01 May 2002 +# last modified: 27 Apr 2006 # # change log: +# Matthias Andree, April 2006: +# Bump version to 0.1+jc2 and mark Joshua Crawford +# as additional author. +# Reformat ESR's change log entry +# Note: emptydog.com is currently not registered. +# Joshua Crawford, April 2006: +# Display From: address. +# List every email, even if it has no Subject: header. # Joshua Crawford, November 2004: -# Out of range error fixed -# Allow for all caps SUBJECT: -# Display email address -# Don't prompt for save if no changes -# Don't clear the screen until we're displaying a menu -# Check for invalid choice -# Check all arguments exist -# Check for errors in POP -# Return 1 on errors, 0 otherwise -# Hacked to support message ranges by ESR, January 2003. +# Out of range error fixed. +# Allow for all caps "SUBJECT:". +# Display user and server name in messages. +# Don't prompt for save if no changes. +# Don't clear the screen until we're displaying a menu. +# Check for invalid choice. +# Check all arguments exist. +# Check for errors in POP. +# Return 1 on errors, 0 otherwise. +# Eric S. Raymond, January 2003: +# Hacked to support message ranges. # -import os, poplib, string, sys +import os, poplib, re, string, sys class PopDel: - HDR = "\nPopDel - Delete messages from popmail - Ver. 0.1" - BYE = "\n PopDel Ver.0.1 by Richard Harris\n" +\ - " site - http://emptydog.com\n" +\ - " email - rover@emptydog.com\n" + HDR = "\nPopDel - Delete messages from popmail - Ver. 0.1+jc2" + BYE = "\n PopDel Ver.0.1+jc2 by Richard Harris and Joshua Crawford\n" +\ +# " site - http://emptydog.com/\n" +\ + " email - Richard Harris <rover@emptydog.com>\n" +\ + " email - Joshua Crawford <mortarn@softhome.net>\n" PROMPT1 = "Choose message number to delete or 'q' to quit: " PROMPT2 = "Quit or abort: " CHOICES = ["Save changes and quit.", @@ -101,6 +111,8 @@ class PopDel: else: for entry in list: tokens = string.split(entry) + subject = '(no subject)' + address = '(no address)' try: head = M.top(int(tokens[0]), 32) except: @@ -111,11 +123,14 @@ class PopDel: return 1 for line in head[1]: if (string.find(string.upper(line), 'SUBJECT:') == 0): - subject = string.replace(line, 'Subject:','') - subject = string.replace(subject, 'SUBJECT:','') - subject = subject + ' - ' + tokens[1] + ' octets' - subjects.append(subject) - break + subject = line[9:] + if (string.find(string.upper(line), 'FROM:') == 0): + line = line[6:] + result = re.search(r'([^\t <>]*@[^\t <>]*)', line) + if (result != None): + address = result.expand(r'\1') + subj = address[:40] + ' [' + tokens[1] + 'o] ' + subject + subjects.append(subj) while not self.done: os.system('clear') @@ -148,11 +163,9 @@ class PopDel: M.rset() M.quit() - print self.BYE return - #-----------------main obj = PopDel() sys.exit(obj.run()) diff --git a/contrib/README b/contrib/README index d81ebbf2..65d8a4ac 100644 --- a/contrib/README +++ b/contrib/README @@ -109,7 +109,7 @@ downloads it and (if the rpm's not broken) rebuilds it. With fairly simple changes it can be used to download the latest i386 rpm or tar.gz. - + Those who are addicted to having the latest of everything could filter mail from fetchmail announce through it and get new versions as they're announced. However, if we all did that, Eric's ftp server might feel a @@ -176,4 +176,7 @@ A short python script to remove old read mail from a pop3 mailserver. Dovetails with fetchmail with keep option. Run it as a cron job... +PopDel.py +PopDel stands for Pop Delete; this program deletes selected email from a +pop mail server. (By Richard Harris, improved by Joshua Crawford.) |