ó
    �®žj  ã                  óÄ   • S r SSKJr  SSKrSSKrSSKrSSKrSSK	r	SSK
JrJr  SSKJrJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr   " S S5      rg)a  The `Message` object is the primary interface object in `python-oxmsg`.

This object is returned by the `Message.load()` classmethod:

```python
>>> from oxmsg import Message

>>> msg = Message.load("message.msg")
>>> msg.subject
'Agenda for the Acme meeting'
```
é    )ÚannotationsN)ÚIOÚIterator)Ú	OleFileIOÚ	isOleFile©Ú
Attachment)Ú	constants)Úmodel)Ú
Properties©Ú	Recipient)ÚStorage)Úlazypropertyc                  ól  • \ rS rSrSrSS jr\SS j5       r\SS j5       r	\SS j5       r
\SS j5       r\SS j5       r\SS	 j5       r\SS
 j5       r\SS j5       r\S S j5       r\SS j5       r\S!S j5       r\SS j5       r\S"S j5       rS#S jrS$S jr\S%S j5       r\SS j5       rS&S jrSrg)'ÚMessageé"   zAAn Outlook email message loaded from an OXMSG format (.msg) file.c                ó   • Xl         g ©N©Ú_storage)ÚselfÚstorages     ÚJ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/oxmsg/message.pyÚ__init__ÚMessage.__init__%   s   € Ø�ó    c                ó”  • [        U[        5      (       a	  [        US9O
[        U5      nU(       dD  [        U[        5      (       a  [        R
                  R                  U5      OSn[        U S35      e[        U5       n[        R                  " U5      nSSS5        U " W5      nUR                  5         U$ ! , (       d  f       N(= f)ztLoad an instance from `msg_file`.

`msg_file` can be a file-path, a file-like object, or the bytes of the MSG file.
)ÚdataÚmsg_filez is not an Outlook MSG fileN)Ú
isinstanceÚbytesr   ÚstrÚosÚpathÚbasenameÚ
ValueErrorr   r   Úfrom_oleÚ	_validate)Úclsr    Ú
is_olefileÚfilenameÚoleÚroot_storager   s          r   ÚloadÚMessage.load(   s£   € ô )3°8¼U×(CÑ(CŒI˜8Ò$ÌÐS[ÓI\ð 	ö Ü5?ÀÌ#×5NÑ5N”r—w‘w×'Ñ'¨Ô1ÐT^ˆHÜ ˜zÐ)DÐEÓFÐFä�xÔ  CÜ"×+Ò+¨CÓ0ˆL÷ !ñ �<Ó ˆØ�‰ÔØˆ÷ !Õ ús   Â B9Â9
Cc                ó    • U R                   S   $ )z&Number of attachments on this message.é   )Ú_header_prop_values©r   s    r   Úattachment_countÚMessage.attachment_count=   s   € ð ×'Ñ'¨Ñ*Ð*r   c                ó4   • [        U R                  5       5      $ )z6Attachment object for each attachment in this message.)ÚtupleÚ_iter_attachmentsr4   s    r   ÚattachmentsÚMessage.attachmentsB   s   € ô �T×+Ñ+Ó-Ó.Ð.r   c                óT   • U R                   R                  [        R                  5      $ )z;The plain-text body of this message; `None` if not present.)Ú
propertiesÚstr_prop_valueÚcÚPID_BODYr4   s    r   ÚbodyÚMessage.bodyG   s   € ð �‰×-Ñ-¬a¯j©jÓ9Ð9r   c                ó  • U R                   R                  [        R                  5      =n(       a%  UR	                  U R                   R
                  5      $ U R                   R                  [        R                  5      =n(       a  U$ g)z;The HTML body of this message if present, `None` otherwise.N)r=   Úbinary_prop_valuer?   ÚPID_HTMLÚdecodeÚbody_encodingr>   ÚPID_BODY_HTML)r   Ú
html_bytesÚhtml_strs      r   Ú	html_bodyÚMessage.html_bodyL   sc   € ð Ÿ™×:Ñ:¼1¿:¹:ÓFÐFˆ:ÕFØ×$Ñ$ T§_¡_×%BÑ%BÓCÐCà—‘×5Ñ5´a·o±oÓFÐFˆ8ÕFØˆOØr   c                ó,   • [        U R                  5      $ )zOFrom, To, Content-Type, etc. headers for this message as {name: value} mapping.)ÚdictÚ_message_headersr4   s    r   Úmessage_headersÚMessage.message_headersW   s   € ô �D×)Ñ)Ó*Ð*r   c                óf   • U R                   R                  [        R                  5      =(       d    S$ )zBOutlook Message Class identifier like "IPM.Note" for this message.Ú )r=   r>   r?   ÚPID_MESSAGE_CLASSr4   s    r   Úmessage_classÚMessage.message_class\   s$   € ð �‰×-Ñ-¬a×.AÑ.AÓB×HÀbÐHr   c                ó   • U R                   $ )z7Provides access to the properties of this OXMSG object.)Ú_propertiesr4   s    r   r=   ÚMessage.propertiesa   s   € ð ×ÑÐr   c                ó4   • [        U R                  5       5      $ )z6`Recipient` object for each recipient of this message.)r8   Ú_iter_recipientsr4   s    r   Ú
recipientsÚMessage.recipientsf   s   € ô �T×*Ñ*Ó,Ó-Ð-r   c                óº  • U R                   S   =n(       a  U$ U R                  nUR                  [        R                  5      =(       d    SR                  5       nU(       a  SU S3OSnUR                  [        R                  5      =(       d    UR                  [        R                  5      nU(       a  U SU S3$ UR                  [        R                  5      $ )ao  Name and email address of the message sender.

Like '"John Doe" <john@bigisp.com>'.

None if it is not recorded in the message. This may occur when the message is a draft or
system-generated or perhaps in other cases.

Note that the value of the From: message header is returned when present (usually I expect)
and may contain multiple addresses separated by commas.
ÚfromrS   Ú"z" Ú<Ú>)	rO   r=   r>   r?   ÚPID_SENDER_NAMEÚstripÚPID_SENDER_EMAIL_ADDRESSÚPID_SENDER_SMTP_ADDRESSÚPID_SENT_REPRESENTING_NAME)r   Úfrom_header_valueÚpropsÚraw_nameÚnameÚemails         r   ÚsenderÚMessage.senderk   s¿   € ð !%× 5Ñ 5°fÑ =Ð=ÐÕ=Ø$Ð$à—‘ˆØ×(Ñ(¬×):Ñ):Ó;×A¸r×HÑHÓJˆÞ#+��8�*˜BÑ°ˆØ×$Ñ$¤Q×%?Ñ%?Ó@÷ 
ÀE×DXÑDXÜ×%Ñ%óE
ˆö &+�$��q˜˜˜qÐ!Ðb°×0DÑ0DÄQ×EaÑEaÓ0bÐbr   c                óT   • U R                   R                  [        R                  5      $ )zˆWhen this message was submitted by the sender.

This value will be `None` if the message has not been sent and possibly in other cases.
)r=   Údate_prop_valuer?   ÚPID_CLIENT_SUBMIT_TIMEr4   s    r   Ú	sent_dateÚMessage.sent_dateƒ   s   € ð �‰×.Ñ.¬q×/GÑ/GÓHÐHr   c                óf   • U R                   R                  [        R                  5      =(       d    S$ )zSubject line of this message.rS   )r=   r>   r?   ÚPID_SUBJECTr4   s    r   ÚsubjectÚMessage.subject‹   s"   € ð �‰×-Ñ-¬a¯m©mÓ<×BÀÐBr   c                ó^   • [         R                  " SU R                  R                  SS 5      $ )z°The property values in the MSG-root properties header.

It is a tuple of the four int values:
 - next_recipient_id
 - next_attachment_id
 - recipient_count
 - attachment_count
z<8x4INé   )ÚstructÚunpackr   Úproperties_stream_bytesr4   s    r   r3   ÚMessage._header_prop_values�   s&   € ô �}Š}˜W d§m¡m×&KÑ&KÈCÈRÐ&PÓQÐQr   c                óD   • S U R                   R                  5        5       $ )zjGenerate `Attachment` object for each attachment in this message.

Should need to be called at most once.
c              3  ó8   #   • U  H  n[        U5      v •  M     g 7fr   r   ©Ú.0r   s     r   Ú	<genexpr>Ú,Message._iter_attachments.<locals>.<genexpr>¡   s   é € Ð\Ò3[¨”
˜7×#Ð#Ò3[ùó   ‚)r   Úiter_attachment_storagesr4   s    r   r9   ÚMessage._iter_attachmentsœ   s   € ñ
 ]°4·=±=×3YÑ3YÔ3[Ó\Ð\r   c                óD   • S U R                   R                  5        5       $ )zhGenerate `Recipient` object for each recipient in this message.

Should need to be called at most once.
c              3  ó8   #   • U  H  n[        U5      v •  M     g 7fr   r   r€   s     r   r‚   Ú+Message._iter_recipients.<locals>.<genexpr>¨   s   é € ÐZÒ2Y w”	˜'×"Ð"Ò2Yùr„   )r   Úiter_recipient_storagesr4   s    r   r[   ÚMessage._iter_recipients£   s   € ñ
 [°$·-±-×2WÑ2WÔ2YÓZÐZr   c                óÀ   • U R                   R                  [        R                  5      =(       d    Sn[        R
                  R                  5       R                  U5      $ )z¸From, To, Content-Type, etc. headers for this message as Message object.

This provides case-insensitive access along with some other convenient behaviors not
available from a `dict`.
rS   )r=   r>   r?   ÚPID_TRANSPORT_MESSAGE_HEADERSrl   ÚparserÚHeaderParserÚparsestr)r   Úheaderss     r   rO   ÚMessage._message_headersª   sB   € ð —/‘/×0Ñ0´×1PÑ1PÓQ×WÐUWˆÜ�|‰|×(Ñ(Ó*×3Ñ3°GÓ<Ð<r   c                óF   • [        U R                  [        R                  S9$ )N)Úproperties_header_offset)r   r   ÚmÚMSG_HDR_OFFSETr4   s    r   rX   ÚMessage._properties´   s   € ä˜$Ÿ-™-Ä!×BRÑBRÑSÐSr   c                ó   • g)zJRaise if this message is invalid for one of a variety of possible reasons.N© r4   s    r   r)   ÚMessage._validate¸   s   � r   r   N)r   z
m.StorageT)r    zstr | IO[bytes] | bytesÚreturnr   )r›   Úint)r›   ztuple[Attachment, ...])r›   z
str | None)r›   zdict[str, str])r›   r#   )r›   r   )r›   ztuple[Recipient, ...])r›   zdt.datetime | None)r›   ztuple[int, int, int, int])r›   zIterator[Attachment])r›   zIterator[Recipient])r›   zemail.message.Message)r›   ÚNone)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úclassmethodr/   Úpropertyr5   r:   rA   rK   rP   rU   r=   r\   rm   rr   rv   r   r3   r9   r[   rO   rX   r)   Ú__static_attributes__r™   r   r   r   r   "   sT  † ÙKô ð óó ðð( ó+ó ð+ð ó/ó ð/ð ó:ó ð:ð óó ðð ó+ó ð+ð óIó ðIð ó ó ð ð ó.ó ð.ð ócó ðcð. óIó ðIð óCó ðCð ó	Ró ð	Rô]ô[ð ó=ó ð=ð óTó ðT÷Yr   r   ) r¢   Ú
__future__r   ÚdatetimeÚdtÚemail.messagerl   Úemail.parserr$   rz   Útypingr   r   Úolefiler   r   Úoxmsg.attachmentr	   Úoxmsg.domainr
   r?   r   r•   Úoxmsg.propertiesr   Úoxmsg.recipientr   Úoxmsg.storager   Ú
oxmsg.utilr   r   r™   r   r   Ú<module>r³      sG   ðñõ #ã Û Û Û 	Û ß ç (å 'Ý 'Ý #Ý 'Ý %Ý !Ý #÷WYò WYr   