Skip to content

Commit 81299f1

Browse files
committed
Added providence mailer support
1 parent 4ec940a commit 81299f1

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

Tools/scripts/mailerdaemon.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,41 @@ def emparse_compuserve(fp):
156156
errors.append(line)
157157
return errors
158158

159+
prov_pattern = regex.compile('.* | \(.*\)')
159160

161+
def emparse_providence(fp):
162+
while 1:
163+
line = fp.readline()
164+
if not line:
165+
raise Unparseable
166+
line = line[:-1]
167+
168+
# Check that we're not in the returned message yet
169+
if string.lower(line)[:5] == 'from:':
170+
raise Unparseable
171+
exp = 'The following errors occurred'
172+
if line[:len(exp)] == exp:
173+
break
174+
175+
errors = []
176+
while 1:
177+
line = fp.readline()
178+
if not line:
179+
break
180+
line = line[:-1]
181+
if not line:
182+
continue
183+
if line[:4] == '----':
184+
break
185+
if prov_pattern.match(line) > 0:
186+
errors.append(prov_pattern.group(1))
187+
188+
if not errors:
189+
raise Unparseable
190+
return errors
160191

161-
EMPARSERS = [emparse_sendmail, emparse_aol, emparse_cts, emparse_compuserve]
192+
EMPARSERS = [emparse_sendmail, emparse_aol, emparse_cts, emparse_compuserve,
193+
emparse_providence]
162194

163195
def parsedir(dir, modify):
164196
os.chdir(dir)

0 commit comments

Comments
 (0)