a oel @seZeZeZddlZddlmZddl m Z m Z iZ ddZ iZddZiZdd d Zd d ZdddZede jede jedde jede jede jiZddZddZdS)N)TimeType)mapimapitagscCs*tstjD]\}}|dddkrt|tjksFt|tjkr|dddksf|dddkrp|t|<q|tt|<q|t|<|tt|<qz4z t|WWStytt|YWS0WnXty$t t |}|ddkr|dd}|d d kr|dd }|YS0dS) NZPR_Z_AZ_Wr-rL) prTabler__dict__itemsZ PROP_TYPE PT_UNICODE PT_STRING8PROP_IDKeyErrorhexint)ptnamevalueretr:C:\Program Files\Certbot\pkgs\win32comext\mapi\mapiutil.pyGetPropTagNames0       rcCsBts0tjD] \}}|dddvr|t|<qt|t|S)N)ZMAPI_E_ZMAPI_W_)mapiErrorTablerr r get pythoncomGetScodeString)hrrrrrrrCs  rTcCs^ts:tjD]*\}}|dddkr|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_FLAGrstrr)ZpropTypeZrawTyperrrrrGetMapiTypeNameNs  r#c Csd}t|ttfvrd}|f}g}g}|D]J}t|tkrjtj|ff}||d}ttj t |d}| |q*| |d\}} |dkrd} dS|rdd| DS| 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|] }|dqS)rr).0vrrr }z!GetProperties..) type TupleTypeListTypeIntTyperPS_PUBLIC_STRINGSGetIDsFromNamesrPROP_TAGPT_UNSPECIFIEDrappendGetProps) objZpropListZbRetListZ realPropListrcproppropspropIdsr datarrr GetProperties_s*     r8c Cs|d}||\}}g}|D]`\}}|rn||f\}}}t|ddtdkrd|dd} qrt|} n|} || |fq |S)Nrr)Z GetPropListr1ZGetNamesFromIDsr(rr0) r2Zmake_tag_namestagsr r7rtagvalZarrayrrrrGetAllPropertiess   r=gr9asciicCst|tkrtj|ff}||tj}|ddkks>|ddkkrFtj}n*t t|}|durpt d|t|ft |t |d}|dur| |fn|||ffdS)Nrrz&Don't know what to do with '%r' ('%s'))r(r+rr,r- MAPI_CREATErZ PT_BOOLEAN _MapiTypeMapr ValueErrorr.rZ DeletePropsSetProps)r2r4r<r5r6Ztype_tagrrrSetPropertyValues  rCc Csg}|D]$\}}t|tkr |tj|fq |rD||tj}d}g}|D]\}}t|tkrt|}|tkrtj }n4|t krtj }n$|t krtj }ntdt||ft|t||}|d}|||fqT||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_SYSTIMErAreprr.rrB) msgZpropDictZnewPropskeyr<ZnewIdsZnewIdNoZtype_valZtagTyperrr SetPropertiess4    rH)T)T)tupler)listr*rr+rZ pywintypesrr9rrr rrrr!r#r8r=r(Z PT_DOUBLErDencoderrr/r@rCrHrrrrs* 2 #