JVc @s<ddlTddlZddlZddlZddlZddlZddlZddlZgZy<ddlZej ej dfej ej dfWnnXyRddl Zej ej dfej ejdfej ejdfWnnXyRddlZej ejdfej ejdfej ejdfWnnXy&ddlZej ejd fWnnXej d dfej d dfegeD]\ZZee^qZd Zejd ZejdZejdZdZ dZ!dZ"dZ#ddddgZ$dZ%dZ&dZ'de(fdYZ)dfdYZ*dfd YZ+d!fd"YZ,d#Z-d$Z.d%Z/e.e/fZ0d&Z1d'Z2d(d)Z3d*d+d,Z4dd-Z5d.d/Z6d0Z7d1Z8d2Z9d3Z:id4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6Z;dBZ<dCZ=ddDZ>dEZ?dFZ@dGZAdHZBdIdJdKdLdMdNdOdPdQdRdSf ZCeDdTZEi e.dU6ddV6dWdX6e5dI6e6dM6e9dN6e:dO6e<dL6e=dK6e>dR6ZFeFjGZHe/eHdUlike L{formatname}, except we use the first matching componenttnicknameR(tnameparser_getfullnametget(Rt _fullname((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytnameparser_formatsimplenames cCs@d|kr|dSdjgt|D]}|r'|^q'S(s>Gets the full name, joining the first/middle/last if necessarytfullt (Rtnameparser_getparts(Rtx((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyR*s tvantvontdetdicCs |jd}|j}t|dkr:|ddfSt|dkra|dd|dfS|dg}g}|dg}|d=|d=x`t|r|ddj|ddks|djtkr|dg|}|d=qW|}dj|dj|dj|fS(NR.iRiiiR/(R+RR tlowert lastpartsR(RR!tpartsRtmtl((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytnameparser_getparts_FMLs     G cCs|jd}|jd}t|dkr=|ddfS|d}d}d}|dj}t|dkr|d}t|dkrdj|d}qn|||fS(NR.t,iRiR/(R+RR R(RR!R8t_lastt_firstt_middle((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytnameparser_getparts_LFMs   cCsxKdD]C}||kr|jdd|jdd|jddfSqWd|krs|jddddfS|jd}d|krt|St|S( sfReturns (first, middle, last) for name. If the part doesn't exist then a blank string is returnedtfirsttmiddletlastRR.R)R<(sfirstRBRC(R+tnameparser_getR@R;(RtiR!((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyR0s  5   tVFileExceptioncBseZRS((t__name__t __module__(((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyRFstVFilecBsKeZidd6ZdZdZdZdZdZdZRS(t MAC_ROMANt MACINTOSHcCs||_d|_dS(N(tsourceR&tsaved(tselfRL((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyt__init__s cCs|S(N((RN((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyt__iter__scCsxDtrF|j}|dkr-tnt|dkrPqqWt}|jd}|dkr"|| jjd}d|ksd|kr"t}x}|ddks|ddkr|ddkrd}nd}|j}|ddkr |d }n|| |}qWq"nxt|r|j }|dkrGPnt|dkr]Pn|dd kr|dd krPn||jd 7}q%W|jd}|d krt j d |t|}|d7}n|| }||d j }|j jd} g} t|tr/d} nd } x| D] }|jdrg|dp^d } q<n|jd r|dk r| j|q<nyb|dks|dkrtj|}n4|dkrtj|}d} ntd|Wq<tk rE} t| tr#| ntdt| ||fq<Xq<Wt| dkrrtd|fn| dk ry4tj|jj| | } | |\}}Wqtk rtd| |fqXn| dgks| dgkr |j }n| |fS(Nit:t;squoted-printablesencoding=quoted-printableit=is R/isFixing up bad line: %ssLATIN-1sCHARSET=is ENCODING=sQUOTED-PRINTABLEsENCODING=QUOTED-PRINTABLEs ENCODING=Bsunknown encoding: s6Exception %s while processing encoding %s on data '%s'sLine contains no property: %ss+unknown character set '%s' in parameters %stBEGINtEND(s R/(tTruet _getnextlineR&t StopIterationR tfindR6RtFalset _lookaheadtlogtdebugtstriptuppert isinstancetstrRtappendtquoprit decodestringtbase64RFt ExceptionRt getdecodert_charset_aliasesR+t LookupError(RNtlinetnormalcontinuationstcolontsREtnextltnextlinetb4titemstnewitemstcharsettetdecodert_((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyt__next__ s     #                 '  cCs3|jdk r%|j}d|_|S|jSdS(N(RMR&t_readandstripline(RNRj((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyRWs   cCsx|jj}|dk rtt|dkr1dS|ddkrI|d S|ddksi|ddkrt|d Sn|S(Niis is s (RLtreadlineR&R (RNRj((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyRxs   cCs+|jdkst|j|_|jS(N(RMR&tAssertionErrorRx(RN((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyR[s( RGRHRhRORPRwRWRxR[(((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyRIs    u tVCardscBs)eZdZdZdZdZRS(sUnderstands vcards in a vfilecCs ||_dS(N(tvfile(RNR|((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyROscCs|S(N((RN((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyRPscCsd}}x?|jD]4\}}||fdgdfkrAqnt}PqW||fdgdfkrstng}xL|jD]A\}}||fdgdfkr|j||fqnPqW||fdgdfkrtdnt|S(NRTtVCARDRUs'There is a BEGIN:VCARD but no END:VCARD(R&R|RVRXRbRFtVCard(RNtfieldtvaluetfoundtlines((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyRws"  (RGRHt__doc__RORPRw(((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyR{s  R~cBseZdZdZdZddZdZdZdZdZ e Z e Z e Z e Z e Ze Ze Ze Ze Ze Zd Zd Zd Zd Zd ZdZeZdZeZdZdZdZdZ e!dZ"e!dZ#dZ$dZ%e$Z&dZ'dZ(dZ)dZ*ddZ+dZ,dZ-d Z.d!Z/RS("sA single vcardcCsPd|_d|_i|_i|_g|_x|D]\}}t|sRt|dgkrmd|_n|djdr|dj ds|dj drd|_nt|r|dj d |dj d kodknrd|_ n|d gkrt|j d }y#g|D]}t |^q(}Wn!tk rdt|d nX||_q4n|ddkrddg|dd+nr|ddkrddg|dd+nL|ddkrddg|dd+n&|ddkr ddg|dd+n|jj||fq4W|j|j|j|j|jdS(NiisX-EVOLUTION-FILE-ASt evolutiontITEMs.X-ABADRs .X-ABLABELtapples>!$_s_$!0 then first line is this width. if equal to zero then first line is same width as rest. if <0 then first line will go immediately to continuation. iRs (R (RjtwidthtfirstlinewidthR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyR#rs    c Csd}x|| D]}|tddt||7}t|\}}}|tdd|||ddf|7}|jdd}t|r|tdd||7}qqW|S(NRtFNtNR)R(R(R&R-R0R+R ( tvalsR%tlimitRRRR9R:tnn((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyt out_namess(  RcCsKg|D]}|jd^q}t|rGt|d||ddSdS(NtcategoryR&R<R(R+R R(R&(R-R%RRtcats((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_categoriess" cCst||ddS(NRtCATEGORY(R3(R-R%((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_categories_applesc Csd}t}x|D]}|j|}|jdd}t|r}|dkr[d}n|j}|r|d}qn|rd}nt|rd|ddg|d kg}nd}|t||||7}t}qW|S( NRRRtworks,PREFRsTYPE=s ,INTERNETtEMAIL(RVR+R R_R&R(RZ( R-R%RtbpkeyRRARtvalR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_eus&       $ cCst||ddS(NR7R(R:(R-R%((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyt out_emailsscCst||ddS(NtURLR(R:(R-R%((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_urlssRRRtofficeRRRRRRRRRtnonec CsBgdgttdt|dD]}dt|^q'}d}t}d}x|D]}|jdd}|dkr|tddt|d d|fgt |d |7}nu|t||d dt|d d|fgt |d |7}|t||d dt||7}|d7}t }q\W|S(NRiiRiRRs TYPE=%s%sRs,PREFRs.TELs .X-SPEEDDIAL(Rs,PREF(Rs,PREF( RRR RaRVR+R&R(t_out_tel_mappingR(RZ( R-R%R1tphonesRRAtidxRtsp((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_tels"C   '  c Csd}t}x|D]}|jdd}t|rS|tdd||7}n|jddkrqd}nd}d|d|}|td |ggdD]}|j|d^q|7}t}qW|S(NRtcompanytORGRRRRsTYPE=s,PREFtADRRRRRRR(Rs,PREF(Nsstreet2sstreetscitysstates postalcodescountry(RVR+R R(R&RZ(R-R%RRARtoRR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_adrs   ; cCs7djg|| D]}tdd|d|^qS(NRtNOTEtmemo(RR(R&(R-R%R.R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_notesc Csd}t|dk}|r'd}nd}xO|D]G}|td|d|t|dfgt|d|7}t}q4W|S(NRisPREF,Rs TYPE=%s%sRR(R R(R@R(RZ(R-R%Rt_prefRmR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_tel_scp6600s    cCsod}xbttt|dD]E}||}|jddr"|tddg|d|7}q"q"W|S(NRiRR7s TYPE=INTERNET(RtminR R+R&R((R-R%Rt_idxR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_email_scp6600(s" cCs;|r7|djddr7tdd|dd|SdS(NiRR<R(R+R&R((R-R%((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_url_scp6604sc Csrxk|D]c}|jdddkr.d}nd}tdd|ggdD]}|j|d ^qK|SWd S(NRRRRRGsTYPE=%sRRRRRRR(Nsstreet2sstreetscitysstates postalcodescountry(R+R&R((R-R%Rt_typeR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pytout_adr_scp6600:s  "tnamest wallpaperst addressestnumbersRtemailsturlsRtflagstmemostserialsc CstrL|dk rLtg|D]}|tkr|^qdksLtn|d}|j}|jtdddd|jtdd|dd|dkrt}n%gtD]}||kr|^q}x|D]}||kr||kr||}d|jj |jj krC||||d|d}n||||}t|ru|j|quqqW|jtd dd||j S( Nit _formatterRTR}RRR.t_limitRU( t __debug__R&R t _field_orderRzRtwriteR(t__code__t co_varnamest co_argcounttgetvalue( tentrytprofilet limit_fieldsRtfmtRtfieldsRR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyt output_entryMs&:     %    R^R_s2.1Rs3.0is vCard v2.1t descriptionRhtvcard2s vCard v3.0tvcard3tAppleRsFull vCard v3.0tfullv3sSanyo SCP-6600 (Katana)tscp6600(NtgRcReRRRRtencodings.utf_64t encodingsRbtBOM64_BEtBOM64_LEtencodings.utf_32t BOM_UTF32t BOM_UTF32_BEt BOM_UTF32_LEtencodings.utf_16t BOM_UTF16t BOM_UTF16_BEt BOM_UTF16_LEtencodings.utf_8tBOM_UTF8tmaxRRR RRtcompileRR%R'R#R(R-R*R7R;R@R0RfRFRIR{R~RRRR"R R!R(R#R0R3R5R:R;R=R@RDRIRLRNRQRRRTRaR&Rltprofile_vcard2tcopytprofile_vcard3t profile_applet profile_fulltprofile_scp6600Rtprofiles(((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/vcard.pyt#s            +       *Z       2