ó fc@sědZddlZddlZddlZddlZddlZdZdejfd„ƒYZdd#d d$d d ddddddddgZ xŁe e e ƒƒD]Z e e Z ee ƒedƒkräeje ejƒZ nBgZx*e D]"Z ejeje ejƒƒqńWeeƒZ [e e e <[ q¤W[ ddejdejƒejdƒejdejƒgZejdejejBƒZd„ZegZd„Zd„Zd „Zed!ksŢejd"ekrčeƒndS(%s6mailerdaemon - classes to parse mailer-daemon messagesi˙˙˙˙Nsmailerdaemon.Unparseablet ErrorMessagecBs#eZd„Zd„Zd„ZRS(cCs tjj||ƒd|_dS(Nt(trfc822tMessaget__init__tsub(tselftfp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR scCsU|jdƒ}|sdS|jƒ}|jdƒr8dSd|krHdS||_dS(NtSubjectis waiting mailitwarning(t getheadertlowert startswithR(RR((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt is_warnings   cCsPxCtD];}|jƒy||j|jƒSWqtk rAqXqWt‚dS(N(t EMPARSERSt rewindbodyRRt Unparseable(Rtp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt get_errorss   (t__name__t __module__RR R(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR s  s.error: (?Punresolvable): (?P.+)s?----- The following addresses had permanent fatal errors ----- s(?P[^ ].*) ( .* )?s(remote execution.* .*rmail (?P.+)s8The following recipients did not receive your message: sK +(?P.*) (The following recipients did not receive your message: )?s?------- Failure Reasons -------- (?P.*) (?P.*)s ^<(?P.*)>: (?P.*)s=^(?PUser mailbox exceeds allowed size): (?P.+)s0^5\d{2} <(?P[^ >]+)>\.\.\. (?P.+)s)^Original-Recipient: rfc822;(?P.*)sR^did not reach the following recipient\(s\): (?P.*) on .* +(?P.*)s+^ <(?P[^ >]+)> \.\.\. (?P.*)s@^Report on your message to: (?P.*) Reason: (?P.*)s^^Your message was not delivered to +(?P.*) +for the following reason: +(?P.*)sO^ was not +(?P[^ ].*?) * .* .* .* because:.* +(?P[^ ].*?) * Rs^5\d{2} <>\.\.\. (?P.*)s<>\.\.\. (?P.*)s^<<< 5\d{2} (?P.*)s,===== stderr was ===== rmail: (?P.*)s ^Diagnostic-Code: (?P.*)s^From:c Cs|jƒ}tj|ƒ}|dkr6t|ƒ}n|jdƒ}g}g}d}x*tD]"}t|ƒtd ƒkr|dj|d|ƒ}|dk r€y|jdƒ}Wnt k rÇnXxL|dj ||j dƒ|ƒ}|dkrýPn|j |jdƒƒqËWPq€q^|j|d|ƒ}|dk r^|j |jdƒƒy|jdƒ}Wnt k r{nXPq^q^W|s“t ‚n|sŐ|}|d dkrź|d}nxtD] }t|ƒtdƒkr xśtt|ƒdddƒD]˜} || } tjtj| ƒj|jd ƒƒtjƒ} | j|ƒ}|dk rţ|j d j| jƒd |jdƒjƒƒƒ|| =qţqţWqĂn|j|ƒ}|dk rĂ|jdƒ}PqĂqĂWnx8|D]0} |j d j| jƒd |jƒƒƒqÜW|S( Nitreasonitemailisreturned mail: Ri˙˙˙˙s<>t s: ((treadtemparse_list_fromtsearchtNonetlentstarttemparse_list_listttypetgroupt IndexErrortmatchtendtappendRtemparse_list_reasontrangetretcompiletescapetjointsplitt MULTILINEtstrip( RRtdatatrest from_indexterrorstemailsRtregexptiRtexp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt emparse_list\sj     "      # 0 3   .cCs@t|ƒ}t|ƒ}||kr(dS||kr8dSdSdS(Ni˙˙˙˙ii(tint(tatb((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt sort_numeric—s    cCsĚtj|ƒtjdƒ}i}i}i}d}}}t|d„tjdƒƒ} | jtƒx˝| D]ľ} t| ƒ} t | ƒ} | j dƒ} d| | dfG| j ƒrő| j ƒdGH|d}|rntj | d | ƒqnqnny| jƒ}Wn-tk r4d GH|d}| j ƒqnnXt|ƒGd GHxŤ|D]Ł}y7| jd ƒdd!\}}dtj||f}Wn d}nX|j|ƒsČd||§Rt.tFroms %s %-40s is warning onlyt,s** Not parseableR1tdateis%s %02ds??????s%s (%s)s--------------s files parsed,sfiles warning-only,sfiles unparseables %d %s - %s %si(tostchdirR'R(tfiltertlistdirtsortR:topenRtgetaddrR tclosetrenameRRRtgetdatetcalendart month_abbrthas_keytkeysR$(tdirtmodifyR<t errordictt errorfirstt errorlasttnoktnwarntnbadtfilesR;RtmtsenderR1tetmmtddRAtlisttnumtfirsttlast((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytparsediržsj                 ) cCsd}ttjƒdkrAtjddkrAd}tjd=nttjƒdkr~x2tjdD]}t||ƒqdWn td|ƒdS(Niis-ds/ufs/jack/Mail/errorsinbox(RtsystargvRb(RQtfolder((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytmainâs( t__main__i(s?----- The following addresses had permanent fatal errors ----- s(?P[^ ].*) ( .* )?(s8The following recipients did not receive your message: sK +(?P.*) (The following recipients did not receive your message: )?(t__doc__RRLR'RBRcRRRRR&RR4txRR(R,txlR$ttupleR%t IGNORECASERR6RR:RbRfRRd(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyts`     $        9   D