]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added (limited) compuserve error parsing
authorJack Jansen <jack.jansen@cwi.nl>
Mon, 30 Oct 1995 10:10:19 +0000 (10:10 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Mon, 30 Oct 1995 10:10:19 +0000 (10:10 +0000)
Tools/scripts/mailerdaemon.py

index b39760e4bdee11723269ea08a635d02bd82e0e3d..1240ff4e141fc8db22347e3b00b3ad8b561d7c8e 100755 (executable)
@@ -131,10 +131,34 @@ def emparse_aol(fp):
        else:
            raise Unparseable
     return errors
+    
+def emparse_compuserve(fp):
+    while 1:
+       line = fp.readline()
+       if not line:
+           raise Unparseable
+       line = line[:-1]
+       if line:
+           break
+    exp = 'Your message could not be delivered for the following reason:'
+    if line[:len(exp)] != exp:
+       raise Unparseable
+    errors = []
+    while 1:
+       line = fp.readline()
+       if not line: break
+       if line[:3] == '---': break
+       line = line[:-1]
+       if not line: continue
+       if line == 'Please resend your message at a later time.':
+           continue
+       line = 'Compuserve: ' + line
+       errors.append(line)
+    return errors
 
 
 
-EMPARSERS = [emparse_sendmail, emparse_aol, emparse_cts]
+EMPARSERS = [emparse_sendmail, emparse_aol, emparse_cts, emparse_compuserve]
 
 def parsedir(dir, modify):
     os.chdir(dir)