Ñò §ÚêLc @sdZdZdZdZddkZddkZeidedƒdd d d gZei d ei ƒZ ei d ei ƒZ ei dei ei BƒZei dei ei BƒZei dƒZei dei ƒZei dei ƒZei dei ƒZdd0d„ƒYZdd1d„ƒYZd„Zd„Zdd„Zdd„Zei dƒZei dƒZd„Zei d ƒZd!„Zei d"ei ƒZei d#ei ƒZ ei d$ƒZ!d%„Z"d&„Z#ddk$Z$e%d'jp*e&e$i'ƒdjoõe$i'ddjoáddk(Z(d(Z)dZ*e(i(e$i'd)d*ƒ\Z+Z,e&e,ƒd2joe)GHe$i-d)ƒnd3e+jd4e+jjpd5e+jo#d6e+joe)GHe$i-d)ƒnx¨e+D] \Z.Z/e.d+jo e#Z0qÒe.d-jo eZ0qÒe.d/joBye1e/ƒZWqre2e3fj oe)GHe$i-d)ƒqrXqÒe.d.jo d)Z*qÒqÒWe&e,ƒdjoe$i4e$i5fZ6n?e&e,ƒd)joe,de$i5fZ6ne,de,d)fZ6e*oe6e*fZ6ne0e6ŒndS(7s¾Mimification and unmimification of mail messages. Decode quoted-printable parts of a mail message or encode using quoted-printable. Usage: mimify(input, output) unmimify(input, output, decode_base64 = 0) to encode and decode respectively. Input and output may be the name of a file or an open file object. Only a readline() method is used on the input file, only a write() method is used on the output file. When using file names, the input and output file names may be the same. Interactive usage: mimify.py -e [infile [outfile]] mimify.py -d [infile [outfile]] to encode and decode respectively. Infile defaults to standard input and outfile to standard output. iÈs ISO-8859-1s> iÿÿÿÿNs>the mimify module is deprecated; use the email package insteaditmimifytunmimifytmime_encode_headertmime_decode_headers.^content-transfer-encoding:\s*quoted-printables$^content-transfer-encoding:\s*base64s0^content-type:.*multipart/.*boundary="?([^;" ]*)s:^(content-type:.*charset=")(us-ascii|iso-8859-[0-9]+)(".*)s^-* s=([0-9a-f][0-9a-f])s=\?iso-8859-1\?q\?([^? ]+)\?=s^subject:\s+re: tFilecBs eZdZd„Zd„ZRS(s{A simple fake file object that knows about limited read-ahead and boundaries. The only supported method is readline().cCs||_||_d|_dS(N(tfiletboundarytNonetpeek(tselfRR((s/usr/lib64/python2.6/mimify.pyt__init__3s  cCs†|idj odS|iiƒ}|p|S|ioH||idjo||_dS||idjo||_dSn|S(Nts s-- (RRRtreadlineR(R tline((s/usr/lib64/python2.6/mimify.pyR 8s    (t__name__t __module__t__doc__R R (((s/usr/lib64/python2.6/mimify.pyR/s t HeaderFilecBseZd„Zd„ZRS(cCs||_d|_dS(N(RRR(R R((s/usr/lib64/python2.6/mimify.pyR Hs cCsË|idj o|i}d|_n|iiƒ}|p|Sti|ƒo|Sxn|iiƒ|_t|iƒdjp(|iddjo|iddjo|S||i}d|_qYdS(Nit s (RRRR thetmatchtlen(R R ((s/usr/lib64/python2.6/mimify.pyR Ls  ( (RRR R (((s/usr/lib64/python2.6/mimify.pyRGs cCs‡d}d}xlti||ƒ}|djoPn||||idƒ!tt|idƒdƒƒ}|idƒ}q|||S(s6Decode a single line of quoted-printable text to 8bit.R iiiN(t mime_codetsearchRtstarttchrtinttgrouptend(R tnewlinetpostres((s/usr/lib64/python2.6/mimify.pyt mime_decode^s cCsœd}d}xti||ƒ}|djoPn|idƒ}di|idƒƒ}||||idƒ!t|ƒ}|idƒ}q|||S(sDecode a header line to 8bit.R iiRt_N( t mime_headRRRtjointsplitRR R(R RRRR((s/usr/lib64/python2.6/mimify.pyRks $ic Cswd}d}d}d}|io|id tjo t}nd}t|ƒ}x|iƒ} | pdS|o1| t|ƒ |jo| t|ƒ} |} nd} t| ƒ} ti| ƒo d}qUn|ot i| ƒo d}qUn|i | | ƒ| ot i| ƒo d}nt i| ƒ} | od| i dƒ}nti| ƒoPqUqU|o|p|o d}nxá|iƒ} | pdStitd| ƒ} |o1| t|ƒ |jo| t|ƒ} |} nd} x|o•| |djo"|i | | ƒd}d} Pn| |d joL|i | | ƒt||ƒ} t| ||ƒ| i} | pPqqnPqW| o{|otxa| d d joO| d } |iƒ} | ttƒ tjo| ttƒ} n| | } q®Wt| ƒ} n| o.|o'| od dk}|i| ƒ} n| o|i | | ƒq’q’dS( s?Convert a quoted-printable part of a MIME mail message to 8bit.iiR Nis--s\1s-- s iþÿÿÿs= iÿÿÿÿ(RRtQUOTERR RRtqpRt base64_retwritetrepltmpRRtretsubR"Rt unmimify_partRR tbase64t decodestring(tifiletofilet decode_base64t multiparttquoted_printablet is_base64tis_repltprefixthfileR tpreftmp_restnifileRR.((s/usr/lib64/python2.6/mimify.pyR-zs             c Csÿt|ƒtdƒjot|ƒ}t|ƒtdƒjoX||joKddk}|ii|ƒ\}}|i||ii|d|ƒƒq n|}t|ƒtdƒjot|dƒ}n|}t|dƒ}t |||ƒ|i ƒdS(s>Convert quoted-printable parts of a MIME mail message to 8bit.R iÿÿÿÿNt,tw( ttypetopentostpathR$trenameR#RRR-tflush( tinfiletoutfileR2R0R@tdtfR1R;((s/usr/lib64/python2.6/mimify.pyRÏs & +s[=-ÿ]s[=?-ÿ]cCsr|o t}nt}d}d}t|ƒdjo1|d djo dtdƒiƒ}d}nxm|i||ƒ}|d joPn||||idƒ!dt|idƒƒiƒ}|i dƒ}qj|||}d}x|t|ƒdjohd }x5||d jp||dd jo|d}q W|d}||| d }||}qîW||S( sZCode a single line as quoted-printable. If header is set, quote some extra characters.R iisFrom s=%02xtFiiKiIt=s= N( tmime_header_chart mime_charRtordtupperRRRRR(R theadertregRRRti((s/usr/lib64/python2.6/mimify.pyt mime_encodeäs6 $   & s<([ (]|^)([-a-zA-Z0-9_+]*[-ÿ][-a-zA-Z0-9_+-ÿ]*)(?=[ )]| )c Cs•d}d}xzti||ƒ}|djoPnd||||idƒ!|idƒtt|idƒdƒf}|idƒ}q|||S(s.Code a single header line as quoted-printable.R is%s%s%s=?%s?Q?%s?=iiN(t mime_headerRRRRtCHARSETRQR(R RRR((s/usr/lib64/python2.6/mimify.pyRs "s^mime-version:s^content-transfer-encoding:s[-ÿ]cCs‚d}}}d}d}}} g} d} g} d} t|ƒ}xú|iƒ}|pPn| oti|ƒo d}nti|ƒo d}nti|ƒo>d}ti|ƒo d}qët i|ƒo d}qënt i|ƒ}|od|i dƒ}nt i|ƒo |} Pn| i |ƒqIxR|iƒ}|pPn|o<||djo |} Pn||djo |} Pq¡n|o| i |ƒqFn|otxa|ddjoO|d }|iƒ}|ttƒ tjo|ttƒ}n||}qÆWt|ƒ}n| i |ƒ| p"ti|ƒod} }qmn|p!t|ƒtjo d}q•qFqFx| D]ÿ}|ot|ƒ}nti|ƒ}|oj| oI|i d ƒiƒd jo)d |i dƒt|i d ƒf}q8q<d |i dd ƒ}n|oNti|ƒo>d}|o|d}q‘|o|d}q‘|d}n|i|ƒqŸW|p|oO| oG|idƒ|idƒ| o|idtƒqÿ|idƒn|o| o|idƒn|i| ƒx5| D]-}|ot|dƒ}n|i|ƒq3W|i| ƒ| }x|oü||djoIxF|iƒ}|pdS|ot|dƒ}n|i|ƒq•n||djoHt||ƒ}t||dƒ|i}|pPn|i|ƒqznxB|iƒ}|pdS|ot|dƒ}n|i|ƒq7qzWdS(s@Convert an 8bit part of a MIME mail message to quoted-printable.iR is--s-- s iþÿÿÿs= isus-asciis%s%s%sis %sus-ascii%ssContent-Transfer-Encoding: sbase64 squoted-printable s7bit sMime-Version: 1.0 sContent-Type: text/plain; s charset="%s" scharset="us-ascii" s,Content-Transfer-Encoding: quoted-printable N(RRR tiso_charRtmvRtcteR&R'R*RRtappendRR%R tMAXLENRtchrsettlowerRSR(RQRt mimify_partR(R0R1tis_mimethas_ctetis_qpR5R3tmust_quote_bodytmust_quote_headert has_iso_charsRNt header_endtmessaget message_endR8R R:Rt chrset_resR;((s/usr/lib64/python2.6/mimify.pyR[sð                   cCsÿt|ƒtdƒjot|ƒ}t|ƒtdƒjoX||joKddk}|ii|ƒ\}}|i||ii|d|ƒƒq n|}t|ƒtdƒjot|dƒ}n|}t|dƒ}t ||dƒ|i ƒdS(s>Convert 8bit parts of a MIME mail message to quoted-printable.R iÿÿÿÿNR<R=i( R>R?R@RAR$RBR#RRR[RC(RDRER0R@RFRGR1R;((s/usr/lib64/python2.6/mimify.pyRŸs & +t__main__s/Usage: mimify [-l len] -[ed] [infile [outfile]]isl:edbs-eR s-ds-bs-l(((iii(s-eR (s-dR (s-bR (s-dR (7RRXRSR%R+twarningstwarntDeprecationWarningt__all__tcompiletIR&R'tSR*RYRRR"R)RRR RR-RRKRJRQRRRRURVRTR[RtsysRRtargvtgetopttusageR2toptstargstexittotatencodeRt ValueErrort OverflowErrortstdintstdoutt encode_args(((s/usr/lib64/python2.6/mimify.pyts†      U    ‡  7