a „oelã @s¸eZeZeZddlZddlmZddl m Z m Z iZ dd„Z iZdd„ZiZdd d „Zd d „Zddd„Zedƒe jedƒe jed d¡ƒe jedƒe jedƒe jiZdd„Zdd„ZdS)éN)ÚTimeTypeé)ÚmapiÚmapitagscCs*ts˜tj ¡D]ˆ\}}|dd…dkrt |¡tjksFt |¡tjkr€|dd…dksf|dd…dkrp|t|<q–|tt |¡<q|t|<|tt |¡<qz4z t|WWStyÈtt |¡YWS0WnXt�y$t t |ƒƒ}|ddk�r|dd…}|d d k�r|dd …}|YS0dS) NéZPR_éþÿÿÿZ_AZ_Wrú-réÿÿÿÿÚL) ÚprTablerÚ__dict__ÚitemsZ PROP_TYPEÚ PT_UNICODEÚ PT_STRING8ÚPROP_IDÚKeyErrorÚhexÚint)ÚptÚnameÚvalueÚret©rú:C:\Program Files\Certbot\pkgs\win32comext\mapi\mapiutil.pyÚGetPropTagNames0ÿþ       rcCsBts0tj ¡D] \}}|dd…dvr|t|<qt |t |¡¡S)Né)ZMAPI_E_ZMAPI_W_)ÚmapiErrorTablerr r ÚgetÚ pythoncomÚGetScodeString)ÚhrrrrrrrCs  rTcCs^ts:tj ¡D]*\}}|dd…dkr|dvr0q|t|<q|rJ|tj@}t |tt|ƒƒ¡S)z?Given a mapi type flag, return a string description of the typeNrZPT_)Z PT_TSTRINGZ PT_MV_TSTRING)ÚptTablerr r ZMV_FLAGrÚstrr)ZpropTypeZrawTyperrrrrÚGetMapiTypeNameNs  r#c Cs¸d}t|ƒttfvrd}|f}g}g}|D]J}t|ƒtkrjtj|ff}| |d¡}t tj t  |d¡¡}|  |¡q*|  |d¡\}} |dkr–d} dS|r¨dd„| DƒS| ddSdS)asGiven a MAPI object and a list of properties, return a list of property values. Allows a single property to be passed, and the result is a single object. Each request property can be an integer or a string. Of a string, it is automatically converted to an integer via the GetIdsFromNames function. If the property fetch fails, the result is None. rrNcSsg|] }|d‘qS)rr)Ú.0ÚvrrrÚ }óz!GetProperties..) ÚtypeÚ TupleTypeÚListTypeÚIntTyperÚPS_PUBLIC_STRINGSÚGetIDsFromNamesrÚPROP_TAGÚPT_UNSPECIFIEDrÚappendÚGetProps) ÚobjZpropListZbRetListZ realPropListÚrcÚpropÚpropsÚpropIdsr ÚdatarrrÚ GetProperties_s*    ÿ r8c Cs†| d¡}| |¡\}}g}|D]`\}}|rn| |f¡\}}}t|ddƒtdƒkrd|dd} qrt|ƒ} n|} | | |f¡q |S)NrrÚ)Z GetPropListr1ZGetNamesFromIDsr(rr0) r2Zmake_tag_namesÚtagsr r7rÚtagÚvalZarrayrrrrÚGetAllProperties‚s   r=gr9ÚasciicCs°t|ƒtkr†tj|ff}| |tj¡}|ddkks>|ddkkrFtj}n*t  t|ƒ¡}|durpt d|t|ƒfƒ‚t  |t  |d¡¡}|durœ|  |f¡n| ||ff¡dS)Nrrz&Don't know what to do with '%r' ('%s'))r(r+rr,r-Ú MAPI_CREATErZ PT_BOOLEANÚ _MapiTypeMaprÚ ValueErrorr.rZ DeletePropsÚSetProps)r2r4r<r5r6Ztype_tagrrrÚSetPropertyValueŸs  ÿrCc Csðg}| ¡D]$\}}t|ƒtkr | tj|f¡q |rD| |tj¡}d}g}| ¡D]Œ\}}t|ƒtkrÒt|ƒ}|tkr€tj }n4|t kr�tj }n$|t kr tj }ntdt|ƒ|fƒ‚t |t ||¡¡}|d}| ||f¡qT| |¡dS)a_Given a Python dictionary, set the objects properties. If the dictionary key is a string, then a property ID is queried otherwise the ID is assumed native. Coded for maximum efficiency wrt server calls - ie, maximum of 2 calls made to the object, regardless of the dictionary contents (only 1 if dictionary full of int keys) rz,The type of object %s(%s) can not be writtenrN)r r(r"r0rr,r-r?rrr+ÚPT_I4rZ PT_SYSTIMErAÚreprr.rrB) ÚmsgZpropDictZnewPropsÚkeyr<ZnewIdsZnewIdNoZtype_valZtagTyperrrÚ SetProperties³s4    ÿÿrH)T)T)Útupler)Úlistr*rr+rZ pywintypesrr9rrr rrrr!r#r8r=r(Z PT_DOUBLErDÚencoderrr/r@rCrHrrrrÚs* 2 #     û