+
    üÐj@1  ã                  ó¤  € R t ^ RIHt ^ RIHtHt ^ RIHt ^ RIH	t	 ^ RI
HtHt ^ RIHt ^ RIHtHt ^ RIHtHtHt ^ R	IHt ]'       d   ^ R
IHt ]! ]P4                  4       ! R R4      4       t ! R R]4      t ! R R]4      t ! R R]P<                  4      t ! R R]4      t ! R R]P@                  4      t! ! R R]PD                  4      t#R# )z
Mail protocol support.
)Úannotations)ÚTYPE_CHECKINGÚCallable)Úimplementer)Úlongversion)ÚCramMD5CredentialsÚUsernamePassword)ÚUnauthorizedLogin)ÚdeferÚprotocol)Úpop3ÚrelayÚsmtp)Úlog)ÚMailServicec                  ó`   € ] tR t^t$ RtRtRtR]R&   ]P                  3R lt
R tR tR	 tR
tR# )ÚDomainDeliveryBasea.  
A base class for message delivery using the domains of a mail service.

@ivar service: See L{__init__}
@ivar user: See L{__init__}
@ivar host: See L{__init__}

@type protocolName: L{bytes}
@ivar protocolName: The protocol being used to deliver the mail.
    Sub-classes should set this appropriately.
Ns   not-implemented-protocolÚbytesÚprotocolNamec                ó*   € Wn         W n        W0n        R# )z»
@type service: L{MailService}
@param service: A mail service.

@type user: L{bytes} or L{None}
@param user: The authenticated SMTP user.

@type host: L{bytes}
@param host: The hostname.
N)ÚserviceÚuserÚhost)Úselfr   r   r   s   &&&&Ú8/usr/lib/python3/dist-packages/twisted/mail/protocols.pyÚ__init__ÚDomainDeliveryBase.__init__*   s   € ð ŒØŒ	ØŽ	ó    c                ó¢  € R;rEV P                   '       d#   RV P                   P                  R4      ,           pV^ ,          '       d   RV^ ,          ,           pRV^ ,          ,           R,           V^,          ,           R,           V,           V,           pRV P                  ,           R	,           V P                  ,           R
,           \        P                  ! R4      ,           R,           pRRP                  \        \        V4      4      ,           R,           \        P                  ! 4       ,           pRV,           R,           V,           R,           V,           # )a£  
Generate a received header string for a message.

@type helo: 2-L{tuple} of (L{bytes}, L{bytes})
@param helo: The client's identity as sent in the HELO command and its
    IP address.

@type origin: L{Address}
@param origin: The origination address of the message.

@type recipients: L{list} of L{User}
@param recipients: The destination addresses for the message.

@rtype: L{bytes}
@return: A received header string.
r   s    auth=Úxtexts    helo=s   from s    ([ó   ]s   by s    with s    (Úasciió   )s   for <ó    s   > s
   Received: s   
	)
r   Úencoder   r   r   ÚjoinÚmapr   r   Ú
rfc822date)	r   ÚheloÚoriginÚ
recipientsÚauthStrÚheloStrÚfromUserÚbyÚforUsers	   &&&&     r   ÚreceivedHeaderÚ!DomainDeliveryBase.receivedHeader9   s  € ð"  ÐˆØ�9�9ˆ9Ø $§)¡)×"2Ñ"2°7Ó";Õ;ˆGØ��7Œ7Ø $ q¥'Õ)ˆGØ˜d 1�gÕ%¨Õ.°°aµÕ8¸4Õ?À'ÕIÈGÕSˆàØ�i‰iõàõð ×Ñõ ð õ	ô
 × Ò  Ó)õ*ð õð 	ð �t—y‘y¤¤U¨JÓ!7Ó8Õ8¸5Õ@Ä4Ç?Â?ÓCTÕTð 	ð ˜xÕ'¨'Õ1°BÕ6¸Õ@À7ÕJÐJr   c                óÂ  € V P                   '       d}   V P                  P                  '       da   V P                  P                  P	                  VP
                  P                  R4      pVf"   \        P                  ! V P                  R4      pM1V P                  P                  VP
                  P                  ,          p\        P                  ! VP                  V4      # )aá  
Validate the address for which a message is destined.

@type user: L{User}
@param user: The destination address.

@rtype: L{Deferred <defer.Deferred>} which successfully fires with
    no-argument callable which returns L{IMessage <smtp.IMessage>}
    provider.
@return: A deferred which successfully fires with a no-argument
    callable which returns a message receiver for the destination.

@raise SMTPBadRcpt: When messages cannot be accepted for the
    destination address.
NT)r   r   ÚqueueÚdomainsÚgetÚdestÚdomainr   ÚDomainQueuerr
   ÚmaybeDeferredÚexists)r   r   Úds   && r   Ú
validateToÚDomainDeliveryBase.validateTo^   s“   € ð" �9�9ˆ9˜Ÿ™×+×+Ð+Ø—‘×$Ñ$×(Ñ(¨¯©×)9Ñ)9¸4Ó@ˆAØŠyÜ×&Ò& t§|¡|°TÓ:�øà—‘×$Ñ$ T§Y¡Y×%5Ñ%5Õ6ˆAÜ×"Ò" 1§8¡8¨TÓ2Ð2r   c                óº   € V'       g   \         P                  ! VRR4      hVP                  R8w  d*   VP                  R8X  d   \         P                  ! VRR4      hV# )aŸ  
Validate the address from which a message originates.

@type helo: 2-L{tuple} of (L{bytes}, L{bytes})
@param helo: The client's identity as sent in the HELO command and its
    IP address.

@type origin: L{Address}
@param origin: The origination address of the message.

@rtype: L{Address}
@return: The origination address.

@raise SMTPBadSender: When messages cannot be accepted from the
    origination address.
i÷  zWho are you?  Say HELO first.r   iõ  z#Sender address must contain domain.)r   ÚSMTPBadSenderÚlocalr7   )r   r(   r)   s   &&&r   ÚvalidateFromÚDomainDeliveryBase.validateFromw   sO   € ÷" Ü×$Ò$ V¨SÐ2QÓRÐRØ�<‰<˜3Ô 6§=¡=°CÔ#7Ü×$Ò$ V¨SÐ2WÓXÐXØˆr   )r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__annotations__r   ÚDNSNAMEr   r0   r<   rA   Ú__static_attributes__© r   r   r   r      s5   ‡ ñ
ð €GØ5€L�%Ó5à+/¯<©<ô ò#KòJ3ö2r   r   c                  ó   € ] tR t^�tRtRtRtR# )ÚSMTPDomainDeliveryz9
A domain delivery base class for use in an SMTP server.
s   smtprK   N©rC   rD   rE   rF   rG   r   rJ   rK   r   r   rM   rM   �   s   † ñð „Lr   rM   c                  ó   € ] tR t^—tRtRtRtR# )ÚESMTPDomainDeliveryz:
A domain delivery base class for use in an ESMTP server.
s   esmtprK   NrN   rK   r   r   rP   rP   —   s   † ñð „Lr   rP   c                  óF   € ] tR t^ŸtRt]P                  tRtRR lt	R t
RtR# )ÚSMTPFactorya  
An SMTP server protocol factory.

@ivar service: See L{__init__}
@ivar portal: See L{__init__}

@type protocol: no-argument callable which returns a L{Protocol
    <protocol.Protocol>} subclass
@ivar protocol: A callable which creates a protocol.  The default value is
    L{SMTP}.
Nc                ó\   € \         P                  P                  V 4       Wn        W n        R# )z¹
@type service: L{MailService}
@param service: An email service.

@type portal: L{Portal <twisted.cred.portal.Portal>} or
    L{None}
@param portal: A portal to use for authentication.
N)r   rR   r   r   Úportal)r   r   rT   s   &&&r   r   ÚSMTPFactory.__init__¯   s"   € ô 	×Ñ×!Ñ! $Ô'ØŒØŽr   c                óº   € \         P                  ! RV 24       \        P                  P	                  W4      pV P
                  Vn        V P                  Vn        V# )zÒ
Create an instance of an SMTP server protocol.

@type addr: L{IAddress <twisted.internet.interfaces.IAddress>} provider
@param addr: The address of the SMTP client.

@rtype: L{SMTP}
@return: An SMTP protocol.
zConnection from )r   Úmsgr   rR   ÚbuildProtocolr   rT   ©r   ÚaddrÚps   && r   rX   ÚSMTPFactory.buildProtocol¼   sI   € ô 	�ŠÐ" 4 &Ð)Ô*Ü×Ñ×*Ñ*¨4Ó6ˆØ—L‘LˆŒ	Ø—;‘;ˆŒØˆr   )rT   r   )N)rC   rD   rE   rF   rG   r   ÚSMTPr   rT   r   rX   rJ   rK   r   r   rR   rR   Ÿ   s!   † ñ
ð �y‰y€HØ€Fôör   rR   c                  óB   € ] tR t^ÍtRt]P                  tRtR t	R t
RtR# )ÚESMTPFactoryaà  
An ESMTP server protocol factory.

@type protocol: no-argument callable which returns a L{Protocol
    <protocol.Protocol>} subclass
@ivar protocol: A callable which creates a protocol.  The default value is
    L{ESMTP}.

@type context: L{IOpenSSLContextFactory
    <twisted.internet.interfaces.IOpenSSLContextFactory>} or L{None}
@ivar context: A factory to generate contexts to be used in negotiating
    encrypted communication.

@type challengers: L{dict} mapping L{bytes} to no-argument callable which
    returns L{ICredentials <twisted.cred.credentials.ICredentials>}
    subclass provider.
@ivar challengers: A mapping of acceptable authorization mechanism to
    callable which creates credentials to use for authentication.
Nc                óP   € \         P                  ! V .VO5!   R\        /V n        R# )zS
@param args: Arguments for L{SMTPFactory.__init__}

@see: L{SMTPFactory.__init__}
s   CRAM-MD5N)rR   r   r   Úchallengers)r   Úargss   &*r   r   ÚESMTPFactory.__init__å   s%   € ô 	×Ò˜TÐ) DÔ)Ø'Ô);Ð<ˆÖr   c                ót   € \         P                  W4      pV P                  Vn        V P                  Vn        V# )zÖ
Create an instance of an ESMTP server protocol.

@type addr: L{IAddress <twisted.internet.interfaces.IAddress>} provider
@param addr: The address of the ESMTP client.

@rtype: L{ESMTP}
@return: An ESMTP protocol.
)rR   rX   ra   ÚcontextÚctxrY   s   && r   rX   ÚESMTPFactory.buildProtocolî   s1   € ô ×%Ñ% dÓ1ˆØ×(Ñ(ˆŒØ—‘ˆŒØˆr   )ra   )rC   rD   rE   rF   rG   r   ÚESMTPr   re   r   rX   rJ   rK   r   r   r_   r_   Í   s!   † ñð( �z‰z€HØ€Gò=ör   r_   c                  óV   € ] tR t^þt$ RtRtR]R&   RtR]R&   R tR	 R
 lt	R R lt
RtR# )ÚVirtualPOP3zý
A virtual hosting POP3 server.

@ivar service: The email service that created this server.  This must be
    set by the service.

@ivar domainSpecifier: The character to use to split an email address into
    local-part and domain. The default is '@'.
NzMailService | Noner   ó   @r   ÚdomainSpecifierc                ó>  € V P                  V4      w  r V P                  P                  V4      pVP                  \        P
                  ! V P                  W4      R\        P                  4      #   \         d"    \        P                  ! \        4       4      u # i ; i)a¹  
Perform APOP authentication.

Override the default lookup scheme to allow virtual domains.

@type user: L{bytes}
@param user: The name of the user attempting to log in.

@type digest: L{bytes}
@param digest: The challenge response.

@rtype: L{Deferred} which successfully results in 3-L{tuple} of
    (L{IMailbox <pop3.IMailbox>}, L{IMailbox <pop3.IMailbox>}
    provider, no-argument callable)
@return: A deferred which fires when authentication is complete.
    If successful, it returns an L{IMailbox <pop3.IMailbox>} interface,
    a mailbox and a logout function. If authentication fails, the
    deferred fails with an L{UnauthorizedLogin
    <twisted.cred.error.UnauthorizedLogin>} error.
N)ÚlookupDomainr   ÚlookupPortalÚloginr   ÚAPOPCredentialsÚmagicÚIMailboxÚKeyErrorr
   Úfailr	   )r   r   Údigestr7   rT   s   &&&  r   ÚauthenticateUserAPOPÚ VirtualPOP3.authenticateUserAPOP  s‚   € ð* ×(Ñ(¨Ó.‰ˆð	Ø—\‘\×.Ñ.¨vÓ6ˆFð —<‘<Ü×$Ò$ T§Z¡Z°Ó>ÀÄdÇmÁmóð øô ô 	3Ü—:’:Ô/Ó1Ó2Ò2ð	3ús   •A0 Á0)BÂBc               ó$   € V ^8„  d   QhRRRRRR/# )é   r   r   ÚpasswordÚreturnzMdefer.Deferred[tuple[type[pop3.IMailbox], pop3.IMailbox, Callable[[], None]]]rK   )Úformats   "r   Ú__annotate__ÚVirtualPOP3.__annotate__.  s$   € ÷ ñ ØðØ%*ðà	Vñr   c                ó@  € V P                  V4      w  rV P                  f   Q R4       h V P                  P                  V4      pVP                  \	        W4      R\
        P                  4      pV#   \         d"    \        P                  ! \        4       4      u # i ; i)a  
Perform authentication for a username/password login.

Override the default lookup scheme to allow virtual domains.

@param user: The name of the user attempting to log in.

@param password: The password to authenticate with.

@return: A deferred which fires when authentication is complete.
    If successful, it returns an L{IMailbox <pop3.IMailbox>} interface,
    a mailbox and a logout function. If authentication fails, the
    deferred fails with an L{UnauthorizedLogin
    <twisted.cred.error.UnauthorizedLogin>} error.
Nz.must have a service to be able to authenticate)rn   r   ro   rp   r   r   rs   rt   r
   ru   r	   )r   r   r{   r7   rT   Úresults   &&&   r   ÚauthenticateUserPASSÚ VirtualPOP3.authenticateUserPASS.  s•   € ð$ ×(Ñ(¨Ó.‰ˆà�L‰LÒ$ð	<à;ó	<Ø$ð	Ø—\‘\×.Ñ.¨vÓ6ˆFð —‘Ô-¨dÓ=¸tÄTÇ]Á]ÓSð ð ˆMøô ô 	3Ü—:’:Ô/Ó1Ó2Ò2ð	3ús   ªA1 Á1)BÂBc               ó    € V ^8„  d   QhRRRR/# )rz   r   r   r|   ztuple[bytes, bytes]rK   )r}   s   "r   r~   r   N  s   € ÷ ñ  ð Ð+>ñ r   c                ó2  €  VP                  V P                  ^4      w  rV P                  f   Q R4       hW P                  P                  9  d5   \
        P                  ! RP                  VP                  R4      4      4      hW3#   \         d    Rp Lui ; i)aC  
Check whether a domain part of the given email address is among the
virtual domains supported by the mail service.

@param user: An email address.

@return: a 2-tuple of (local part, domain part) of the email address if
    the domain is supported.

@raise POP3Error: When the domain is not supported by the mail service.
r   z(cannot look up domain if service not setzno such domain {}zutf-8)	Úsplitrl   Ú
ValueErrorr   r4   r   Ú	POP3Errorr}   Údecode)r   r   r7   s   && r   rn   ÚVirtualPOP3.lookupDomainN  s‰   € ð	ØŸ:™: d×&:Ñ&:¸AÓ>‰LˆDð �|‰|Ò'ÐSÐ)SÓSÐ'ØŸ™×-Ñ-Ô-Ü—.’.Ð!4×!;Ñ!;¸F¿M¹MÈ'Ó<RÓ!SÓTÐTØˆ|Ðøô ô 	ØŠFð	ús   ‚B ÂBÂBrK   )rC   rD   rE   rF   rG   r   rH   rl   rw   r‚   rn   rJ   rK   r   r   rj   rj   þ   s3   ‡ ñð #'€GÐÓ&à!€O�UÓ!òõ>÷@ñ r   rj   c                  ó.   € ] tR tRtRt]tRtR tR t	Rt
R# )ÚPOP3Factoryid  a  
A POP3 server protocol factory.

@ivar service: See L{__init__}

@type protocol: no-argument callable which returns a L{Protocol
    <protocol.Protocol>} subclass
@ivar protocol: A callable which creates a protocol.  The default value is
    L{VirtualPOP3}.
Nc                ó   € Wn         R# )zA
@type service: L{MailService}
@param service: An email service.
N©r   )r   r   s   &&r   r   ÚPOP3Factory.__init__s  s	   € ð
 Žr   c                óf   € \         P                  P                  W4      pV P                  Vn        V# )zÐ
Create an instance of a POP3 server protocol.

@type addr: L{IAddress <twisted.internet.interfaces.IAddress>} provider
@param addr: The address of the POP3 client.

@rtype: L{POP3}
@return: A POP3 protocol.
)r   ÚServerFactoryrX   r   rY   s   && r   rX   ÚPOP3Factory.buildProtocolz  s*   € ô ×"Ñ"×0Ñ0°Ó<ˆØ—L‘LˆŒ	Øˆr   rŽ   )rC   rD   rE   rF   rG   rj   r   r   r   rX   rJ   rK   r   r   rŒ   rŒ   d  s   † ñ	ð €HØ€Gòör   rŒ   N)$rG   Ú
__future__r   Útypingr   r   Úzope.interfacer   Útwisted.copyrightr   Útwisted.cred.credentialsr   r   Útwisted.cred.errorr	   Útwisted.internetr
   r   Útwisted.mailr   r   r   Útwisted.pythonr   Útwisted.mail.mailr   ÚIMessageDeliveryr   rM   rP   rR   r_   ÚPOP3rj   r‘   rŒ   rK   r   r   Ú<module>rŸ      s·   ðñ
õ #ç *å &å )ß IÝ 0ß ,ß *Ñ *Ý çÝ-ñ ˆT×"Ñ"Ó#÷rð ró $ðrôjÐ+ô ôÐ,ô ô+�$×"Ñ"ô +ô\.�;ô .ôbc�$—)‘)ô côL"�(×(Ñ(ö "r   