Mpj5zddlmZdgZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZmZddlmZmZddlmZmZddlmZdd lmZdd lmZdd lmZe rdd lm Z ejBe"Z#e#jIejJed Z&edejNZ(Gdde e(Z)y)) annotations RecipientN) AnyGenericListOptionalTuple TYPE_CHECKINGTypeTypeVarUnion)MSG_PATHOVERRIDE_CLASS) ErrorBehaviorPropertiesType)StandardViolationError)PropertiesStore)PermanentEntryID)msgPathToString)MSGFile_T_RT)boundceZdZdZd dZd!dZd!dZd"d#dZd$dZd%dZ d&d Z d"d'd Z d(d Z d)d Z d*d Zd+dZd,dZd+dZd-d.dZd-d/dZej*d0dZed0dZej*d1dZed2dZej*d3dZed0dZed4dZej*d3dZej*d3dZej*d0dZ ej*d0dZ!ed5dZ"ed6dZ#y)7rzD Contains the data of one of the recipients in an MSG file. ctj||_||_|j ds>t j |jvrtjdn tddt|jdtj|_|j!d|_|j"s|j!d|_|j!d|_|jj'dd|_|d|j(z|_|j$d |j"d |_y) Nz__properties_version1.0z'Recipients MUST have a property stream.__substg1.0_39FEz__substg1.0_3003z__substg1.0_30010C150003rz <>)weakrefref_Recipient__msg_Recipient__direxistsrSTANDARDS_VIOLATION errorBehaviorloggererrorrr getStreamr RECIPIENT_Recipient__propsgetStringStream_Recipient__email_Recipient__namegetValue_Recipient__typeFlags_Recipient__type_Recipient__formatted)self_dirmsgrecipientTypeClasss c/mnt/ssd/data/Dropbox/adrian/scripts/msg_venv/lib/python3.12/site-packages/extract_msg/recipient.py__init__zRecipient.__init__)s[[%  {{4500C4E4EE FG,-VW]aa&t~~6O'PR`RjRjk ++,>? ||//0BCDL**+=> <<00Q?(t/?/?)?@ "kk]"T\\N!<c|jx} td|j|jt |gS)z Checks if stream exists inside the recipient folder. :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. CThe MSGFile for this Recipient instance has been garbage collected.)r#ReferenceErrorr%r$rr4filenamer6s r8r%zRecipient.exists:s>::< C ( !fg gzz4::x'@ABBr:c|jx} td|j|jt |gS)z Checks if the string stream exists inside the recipient folder. :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. r<)r#r=sExistsr$rr>s r8rAzRecipient.sExistsEs>::< C ( !fg g{{DJJ(ABCCr:Nc|jx} td|j||j|d|jS)aE Determines if the stream with the provided id exists. The return of this function is 2 values, the first being a boolean for if anything was found, and the second being how many were found. :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. r<T)r#r=existsTypedPropertyr$r,)r4id_typer6s r8rCzRecipient.existsTypedPropertyPsB::< C ( !fg g&&r4::udDLLQQr:c|jx} td|j|jt |gS)a Gets a multiple binary property as a list of bytes objects. Like :meth:`getStringStream`, the 4 character type suffix should be omitted. So if you want the stream "__substg1.0_00011102" then the filename would simply be "__substg1.0_0001". :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. r<)r#r=getMultipleBinaryr$rr>s r8rGzRecipient.getMultipleBinary]@::< C ( !fg g$$djj/(2K%LMMr:c|jx} td|j|jt |gS)a Gets a multiple string property as a list of str objects. Like :meth:`getStringStream`, the 4 character type suffix should be omitted. So if you want the stream "__substg1.0_00011102" then the filename would simply be "__substg1.0_0001". :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. r<)r#r=getMultipleStringr$rr>s r8rJzRecipient.getMultipleStringlrHr:c<|j|}|||}|S)a Returns the property, setting the class if found. :param overrideClass: Class/function to use to morph the data that was read. The data will be the first argument to the class's ``__init__`` method or the function itself, if that is what is provided. If the value is ``None``, this function is not called. If you want it to be called regardless, you should handle the data directly. )getPropertyVal)r4 propertyName overrideClassvalues r8 getPropertyAszRecipient.getPropertyAs{s)##L1  !%(E r:c:|jj||S)zo ``instance.props.getValue(name, default)`` Can be overridden to create new behavior. )propsr0)r4namedefaults r8rLzRecipient.getPropertyVals zz""411r:c|jx} td|j|jt |gS)a# A combination of :meth:`getStringStream` and :meth:`getMultipleString`. Checks to see if a single binary stream exists to return, otherwise tries to return the multiple binary stream of the same ID. Like :meth:`getStringStream`, the 4 character type suffix should be omitted. So if you want the stream "__substg1.0_00010102" then the filename would simply be "__substg1.0_0001". :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. r<)r#r=getSingleOrMultipleBinaryr$rr>s r8rVz#Recipient.getSingleOrMultipleBinary@::< C ( !fg g,,djj/(:S-TUUr:c|jx} td|j|jt |gS)a# A combination of :meth:`getStringStream` and :meth:`getMultipleString`. Checks to see if a single string stream exists to return, otherwise tries to return the multiple string stream of the same ID. Like :meth:`getStringStream`, the 4 character type suffix should be omitted. So if you want the stream "__substg1.0_0001001F" then the filename would simply be "__substg1.0_0001". :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. r<)r#r=getSingleOrMultipleStringr$rr>s r8rYz#Recipient.getSingleOrMultipleStringrWr:c|jx} td|j|jt |gS)a Gets a binary representation of the requested stream. This should ALWAYS return a ``bytes`` object if it was found, otherwise returns ``None``. :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. r<)r#r=r*r$rr>s r8r*zRecipient.getStreams>::< C ( !fg g}}djj/(*CDEEr:c<|j|}|||}|S)a Returns the specified stream, modifying it to the specified class if it is found. :param overrideClass: Class/function to use to morph the data that was read. The data will be the first argument to the class's ``__init__`` method or the function itself, if that is what is provided. If the value is ``None``, this function is not called. If you want it to be called regardless, you should handle the data directly. r*r4streamIDrNrOs r8 getStreamAszRecipient.getStreamAs'x(  !%(E r:c|jx} td|j|jt |gS)a Gets a string representation of the requested stream. Rather than the full filename, you should only feed this function the filename sans the type. So if the full name is "__substg1.0_001A001F", the filename this function should receive should be "__substg1.0_001A". This should ALWAYS return a string if it was found, otherwise returns None. :raises ReferenceError: The associated ``MSGFile`` instance has been garbage collected. r<)r#r=r-r$rr>s r8r-zRecipient.getStringStreams@::< C ( !fg g""DJJ0I#JKKr:c<|j|}|||}|S)a Returns the specified string stream, modifying it to the specified class if it is found. :param overrideClass: Class/function to use to morph the data that was read. The data will be the first argument to the class's ``__init__`` method or the function itself, if that is what is provided. If the value is ``None``, this function is not called. If you want it to be called regardless, you should handle the data directly. r\r]s r8getStringStreamAszRecipient.getStringStreamAsr`r:c|jx} td|j||dDcgc]'}t|dkDr|d|jk(r|dd)c}Scc}w)z Lists the streams and or storages that exist in the recipient directory. :returns: The paths *excluding* the recipient directory, allowing the paths to be directly used for accessing a file. Nr<Frr)r#r=listDirlenr$)r4streamsstoragesr6paths r8rezRecipient.listDirsm::< C ( !fg g%([[(E%J