ϪfVdZddlmZddlZddlmZddlmZmZddl m Z m Z ddlmZmZddlmZmZdd lmZd Z d Z Gd d ej,ej.Zesej2dk\r eeeeeffZneZGddeej:ZGddej:Zy)z1 Postfix mail transport agent related protocols. ) annotationsN)UserDict) TYPE_CHECKINGUnion)quoteunquote)deferprotocol)basicpolicies)logc^t|}t|tr|jd}|SNascii)_quote isinstancestrencodesquoteds ;/usr/lib/python3/dist-packages/twisted/protocols/postfix.pyrrs( AYF&#w' Mc|t|tr|jd}t|}|j dSr)rbytesdecode_unquoterrs rrrs2!U HHW  a[F == !!rcDeZdZdZdZdZdZd dZdZdZ dZ d Z d Z y ) PostfixTCPMapServera Postfix mail transport agent TCP map protocol implementation. Receive requests for data matching given key via lineReceived, asks it's factory for the data with self.factory.get(key), and returns the data to the requester. None means no entry found. You can use postfix's postmap to test the map service:: /usr/sbin/postmap -q KEY tcp:localhost:4242 iX c:|j|jyN) setTimeouttimeout)selfs rconnectionMadez"PostfixTCPMapServer.connectionMade5s  %rcb|jt|jddz|zy)z8 Send an SMTP-like code with a message. r N)sendLinerr)r%codemessages rsendCodezPostfixTCPMapServer.sendCode8s) c$i&&w/$6@Arc|j |jdd\}} t|d|j dz} ||y#t$r|}d}Y8wxYw#t $rMt tjdjd}|jdd|zdz|zYywxYw#t$r|jddYywxYw)Ndo_rsCommand s failed: sunknown command) resetTimeoutsplit ValueErrorgetattrr BaseExceptionrsysexc_inforr,AttributeError)r%linerequestparamsfexcInfos r lineReceivedz PostfixTCPMapServer.lineReceived>s  "jjq1OGV SegnnW&==>A S&  GF ! ScllnQ/077@ c;#8<#G'#QR S  3 MM#1 2 3s5AB<A# A A #AB98B9<CCc ||jddytj|jj|}|j |j |j|jtjy)Nr0s!Command 'get' takes 1 parameters.) r,r maybeDeferredfactoryget addCallbacks_cbGot_cbNot addErrbackr err)r%keyds rdo_getzPostfixTCPMapServer.do_getPsX ; MM#C D##DLL$4$4c:A NN4;; 4 LL !rcf|jjd}|jd|y)Nrr0)getErrorMessagerr,)r%failmsgs rrEzPostfixTCPMapServer._cbNotXs)""$++G4 c3rcb||jdy|jdt|y)N)r,r)r%values rrDzPostfixTCPMapServer._cbGot\s% = MM#  MM#uU| ,rc||jddy |jdd\}}|jddy#t$r|jddYywxYw)Nr0s!Command 'put' takes 2 parameters.r.rPsput is not implemented yet.)r,r2r3)r% keyAndValuerHrRs rdo_putzPostfixTCPMapServer.do_putbsf   MM#C D C(..tQ7 U c#AB I c#GH Is?AAN)r) __name__ __module__ __qualname____doc__r$ delimiterr&r,r>rJrErDrUrrrr$s9 GI&B S$" - Crr) ceZdZdZeZy)PostfixTCPMapDictServerFactoryB An in-memory dictionary factory for PostfixTCPMapServer. N)rVrWrXrYrr r[rrr_r_ts#Hrr_c"eZdZdZeZddZdZy)'PostfixTCPMapDeferringDictServerFactoryr`NcNi|_||jj|yyr")dataupdate)r%rds r__init__z0PostfixTCPMapDeferringDictServerFactory.__init__s&   II  T " rc^tj|jj|Sr")r succeedrdrB)r%rHs rrBz+PostfixTCPMapDeferringDictServerFactory.gets}}TYY]]3/00rr")rVrWrXrYrr rfrBr[rrrbrb|s#H# 1rrb) rY __future__rr6 collectionsrtypingrr urllib.parserrrrtwisted.internetr r twisted.protocolsr r twisted.pythonr LineReceiver TimeoutMixinr version_inforr_PostfixTCPMapDict ServerFactoryr_rbr[rrrus # '=,- "GC%,,h.C.CGCTC$$.!%sEz):":;!#%79O9O# 1h.D.D 1r