
    ,h                         d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZm	Z	m
Z
mZ  ej                  e      Zej                   ej                                  G d de      Zy)    N)	constants)create_prop)dividefromTimeStampmsgEpoch	properHexc                      e Zd ZdZddZd Zd Zd Zd Ze	d        Z
d	 Zd
 Zd Zd Zd Zd Zej                  j                  e_        ej                  j                  e_        ej                   j                  e_        e	d        Ze	d        Ze	d        Ze	d        Ze	d        Ze	d        Ze	d        Ze	d        Zy)
Propertiesz*
    Parser for msg properties files.
    Nc                 f   t         j                  |        || _        d| _        t	        |      | _        i | _        d | _        d | _        d | _	        d | _
        |t        j                  | _        |t        j                  k(  rHd}t        j                  j!                  | j                  d d       \  | _        | _        | _	        | _
        n|t        j"                  k(  rHd}t        j                  j!                  | j                  d d       \  | _        | _        | _	        | _
        n0d}n-t        j$                  | _        || j
                  dz  }|dk(  rd}t'        | j                  |d  d      }|D ]&  }t)        |      }|| j                  |j*                  <   ( t	        | j                        | _        y )Nr                )object__init___Properties__stream_Properties__poslen_Properties__len_Properties__props_Properties__naid_Properties__nrid_Properties__ac_Properties__rcr   INTELLIGENCE_SMART_Properties__intelTYPE_MESSAGEST1unpackTYPE_MESSAGE_EMBEDINTELLIGENCE_DUMBr   r   name_Properties__pl)selfstreamtypeskipstreamsstas          X/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/extract_msg/properties.pyr   zProperties.__init__   sr   
[
		$77DLy---AJAUAUVZVcVcdgegVhAi>T[$)TY555AJAUAUVZVcVcdgegVhAi>T[$)TY$66DL| zzB19Dtu-r2 	%BBA#$DLL 	% %	    c                 :    | j                   j                  |       y N)r   __contains__r$   keys     r+   r/   zProperties.__contains__:   s    !!#&r,   c                 8    | j                   j                  |      S r.   )r   __getitem__r0   s     r+   r3   zProperties.__getitem__=   s    ||'',,r,   c                 6    | j                   j                         S r.   )r   __iter__r$   s    r+   r5   zProperties.__iter__@   s    ||$$&&r,   c                     | j                   S )z3
        Returns the number of properties.
        )r#   r6   s    r+   __len__zProperties.__len__C   s     yyr,   c                 .    | j                   j                  S r.   )r   __repr__r6   s    r+   r:   zProperties.__repr__I   s    ||$$$r,   c                     	 | j                   |   S # t        $ r^ t        j                  d       t        j                  t	        | j
                               t        j                  | j                           w xY w)z8
        Retrieve the property of :param name:.
        zKeyError exception.)r   KeyErrorloggerdebugr   r   )r$   r"   s     r+   getzProperties.getM   sZ    	<<%% 	LL./LL4==12LL&	s
    A'A8c                     || j                   v S )zN
        Checks if :param key: is a key in the properties dictionary.
        )r   r0   s     r+   has_keyzProperties.has_keyZ   s     dll""r,   c                 6    | j                   j                         S r.   )r   itemsr6   s    r+   rC   zProperties.items`   s    ||!!##r,   c                 6    | j                   j                         S r.   )r   keysr6   s    r+   rE   zProperties.keysc   s    ||  ""r,   c                     t        j                   t        t        | j                  j	                                            y)zD
        Uses the pprint function on a sorted list of keys.
        N)pprintsortedtupler   rE   r6   s    r+   
pprintKeyszProperties.pprintKeysf   s'     	fU4<<#4#4#6789r,   c                 6    | j                   j                         S r.   )r   valuesr6   s    r+   rL   zProperties.valuesm   s    ||""$$r,   c                 H    | j                   t        d      | j                   S )NzYProperties instance must be intelligent and of type TYPE_MESSAGE to get attachment count.)r   	TypeErrorr6   s    r+   attachment_countzProperties.attachment_countt   s"    99wxxyyr,   c                    	 | j                   S # t        $ rN | j                  d      r0| j                  d      j                  j                  d      | _         n| j                  d      r0| j                  d      j                  j                  d      | _         n| j                  d      r0| j                  d      j                  j                  d      | _         n|t        j                  d       t        j                  t        | j                               t        j                  | j                                t        j                  d       d| _         | j                   cY S w xY w)zI
        Returns the send date contained in the Properties file.
        00390040z%a, %d %b %Y %H:%M:%S %z3008004030070040znError retrieving date. Setting as "Unknown". Please send the following data to developer:
--------------------z--------------------Unknown)_Properties__dateAttributeErrorrA   r?   value
__format__r=   warningr   r   rE   r6   s    r+   datezProperties.datez   s   
	;; 	||J'"hhz288CCD^_j)"hhz288CCD^_j)"hhz288CCD^_  FGy78tyy{+56';;	s    EE&%E&c                     | j                   S )zK
        Returns the inteligence level of the Properties instance.
        )r   r6   s    r+   intelligencezProperties.intelligence   s    
 ||r,   c                 H    | j                   t        d      | j                   S )Nz[Properties instance must be intelligent and of type TYPE_MESSAGE to get next attachment id.)r   rN   r6   s    r+   next_attachment_idzProperties.next_attachment_id   s(    ;;mo o{{r,   c                 H    | j                   t        d      | j                   S )NzZProperties instance must be intelligent and of type TYPE_MESSAGE to get next recipient id.)r   rN   r6   s    r+   next_recipient_idzProperties.next_recipient_id   s(    ;;ln n{{r,   c                 @    t        j                  | j                        S )zA
        Returns a copy of the internal properties dict.
        )copydeepcopyr   r6   s    r+   propszProperties.props   s    
 }}T\\**r,   c                 H    | j                   t        d      | j                   S )NzXProperties instance must be intelligent and of type TYPE_MESSAGE to get recipient count.)r   rN   r6   s    r+   recipient_countzProperties.recipient_count   s"    99vwwyyr,   c                     | j                   S )zT
        Returns the data stream used to generate this Properties instance.
        )r   r6   s    r+   r%   zProperties.stream   s    
 }}r,   )NN)__name__
__module____qualname____doc__r   r/   r3   r5   r8   propertyr:   r?   rA   rC   rE   rJ   rL   dictrO   rZ   r\   r^   r`   rd   rf   r%    r,   r+   r
   r
      s&   &&P'-' % %#$#:% JJ&&EM99$$DL[[((FN 
  .       + +  
  r,   r
   )rb   loggingrG   extract_msgr   extract_msg.propr   extract_msg.utilsr   r   r   r   	getLoggerrh   r=   
addHandlerNullHandlerr   r
   rn   r,   r+   <module>rv      sT       ! ( H H			8	$   %'%%' (l lr,   