ó x”ŝ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 ry|jdƒ}Wnt k rÇnXxK|dj ||j dƒ|ƒ}|dkrŭPn|j |jdƒƒqËPqq^|j|d|ƒ}|dk r^|j |jdƒƒy|jdƒ}Wnt k rznXPq^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||§st.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