Mercurial > p > roundup > code
diff roundup-mailgw @ 375:2ff102523713
Fixed [SF#479511]: mailgw to pop
once engelbert gruber tested the POPgateway.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 09 Nov 2001 01:05:55 +0000 |
| parents | ee399750fa5f |
| children | 7d7cb5319fc0 |
line wrap: on
line diff
--- a/roundup-mailgw Thu Nov 08 05:18:08 2001 +0000 +++ b/roundup-mailgw Fri Nov 09 01:05:55 2001 +0000 @@ -16,9 +16,9 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup-mailgw,v 1.12 2001-11-08 05:16:55 richard Exp $ +# $Id: roundup-mailgw,v 1.13 2001-11-09 01:05:55 richard Exp $ -import sys, os, re +import sys, os, re, cStringIO if int(sys.version[0]) < 2: print "Roundup requires Python 2.0 or newer." sys.exit(1) @@ -73,11 +73,20 @@ server.user(user) server.pass_(password) numMessages = len(server.list()[1]) - for i in range(numMessages): - for j in server.retr(i+1)[1]: - s = cStringIO.StringIO('\n'.join(j)) - s.seek(0) - handler.handle_Message(Message(s)) + for i in range(1, numMessages+1): + # retr: returns + # [ pop response e.g. '+OK 459 octets', + # [ array of message lines ], + # number of octets ] + lines = server.retr(i)[1] + s = cStringIO.StringIO('\n'.join(lines)) + s.seek(0) + handler.handle_Message(Message(s)) + # delete the message + server.dele(i) + + # quit the server to commit changes. + server.quit() return 0 def usage(args, message=None): @@ -159,6 +168,10 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.12 2001/11/08 05:16:55 richard +# Rolled roundup-popgw into roundup-mailgw. Cleaned mailgw up significantly, +# tested unix mailbox some more. POP still untested. +# # Revision 1.11 2001/11/07 05:32:58 richard # More roundup-mailgw usage help. #
