1 $%ˆÆÊ „e×ÀïÉa–ß=¿JJj"Tâ�zàp.)‹FÿÍ?÷%a ´i‰¸ã@sÜdZddgZddlZddlZddlZddlmZmZddlm Z ddlm Z ddl m Z m Z dd lmZdd lmZejZd Ze d ¡Zd d„Zddd„Zdd„Zdd„ZGdd„dƒZGdd„deƒZGdd„deƒZdS)z8Basic message object for the email package object model.ÚMessageÚ EmailMessageéN)ÚBytesIOÚStringIO)Úutils)Úerrors)ÚPolicyÚcompat32©Úcharset)Údecode_bz; z[ \(\)<>@,;:\\"/\[\]\?=]cCs4t|ƒ d¡\}}}|s$| ¡dfS| ¡| ¡fS)Nú;)ÚstrÚ partitionÚstrip)ÚparamÚaÚsepÚb©rú%/usr/lib64/python3.9/email/message.pyÚ _splitparams rTcCsÆ|dur¾t|ƒdkr¾t|tƒrL|d7}t |d|d|d¡}d||fSz| d¡Wn4tyŽ|d7}t |dd ¡}d||fYS0|sžt |¡r°d |t  |¡fSd||fSn|SdS) a~Convenience function to format and return a key=value pair. This will quote the value if needed or if quote is true. If value is a three tuple (charset, language, value), it will be encoded according to RFC2231 rules. If it contains non-ascii characters it will likewise be encoded according to RFC2231 rules, using the utf-8 charset and a null language. NrÚ*ééú%s=%sÚasciizutf-8Úz%s="%s") ÚlenÚ isinstanceÚtuplerZencode_rfc2231ÚencodeÚUnicodeEncodeErrorÚ tspecialsÚsearchÚquote)rÚvaluer%rrrÚ _formatparam's    r'cCs dt|ƒ}g}d}| d|¡|k�r|d7}| d|¡}|d}}|dkr’|| d||¡| d||¡7}|ddkrzq’|| d|d¡}}qD|dkr¢t|ƒ}| d||¡}|dkrÆ|||…}n,|||… ¡ ¡d||d|… ¡}| | ¡¡|}q|S) Nr rrú"z\"rú=éÿÿÿÿ) rÚfindÚcountrÚrstripÚlowerÚlstripÚappendr)ÚsZplistÚstartÚendZindÚdiffÚiÚfrrrÚ _parseparamIs*     ,r7cCs4t|tƒr&|d|dt |d¡fSt |¡SdS)Nrrr)rr rÚunquote)r&rrrÚ _unquotevaluecs r9c@s¦eZdZdZefdd„Zdd„Zddd d „Zd d „Zded d„Z dd„Z dd„Z dd„Z dd„Z dfdd„Zdgdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zdhd1d2„Zd3d4„Zd5d6„Zdid7d8„Zd9d:„Zd;d<„Z d=d>„Z!d?d@„Z"dAdB„Z#dCdD„Z$dEdF„Z%dGdH„Z&djdKdL„Z'dkdMdN„Z(dldQdR„Z)dmdSdT„Z*dndUdV„Z+dodWdX„Z,dpdYdZ„Z-d[d\„Z.dqd]d^„Z/drd_d`„Z0dadb„Z1ddcl2m3Z3dS)sraÈBasic message object. A message object is defined as something that has a bunch of RFC 2822 headers and a payload. It may optionally have an envelope header (a.k.a. Unix-From or From_ header). If the message is a container (i.e. a multipart or a message/rfc822), then the payload is a list of Message objects, otherwise it is a string. Message objects implement part of the `mapping' interface, which assumes there is exactly one occurrence of the header per message. Some headers do in fact appear multiple times (e.g. Received) and for those headers, you must use the explicit API to set or get all the headers. Not all of the mapping methods are implemented. cCs:||_g|_d|_d|_d|_d|_|_g|_d|_dS)Nú text/plain) ÚpolicyÚ_headersÚ _unixfromÚ_payloadÚ_charsetZpreambleZepilogueÚdefectsÚ _default_type)Úselfr;rrrÚ__init__~s zMessage.__init__cCs| ¡S)z9Return the entire formatted message as a string. )Ú as_string©rBrrrÚ__str__ŠszMessage.__str__FrNcCsJddlm}|dur|jn|}tƒ}||d||d�}|j||d�| ¡S)a¾Return the entire formatted message as a string.