+
    lh9                        R t ^ RIt^ RIt^ RIt^ RIt ^ RItRtRR.t ! R R]	4      t
^ntRtRtR	t]],           tR
t ! R R4      t]'       d    ! R R]4      t]P'                  R4       ]R8X  Ed   ]! ]P*                  ^,          4      t]! ]P1                  4       4       ]P3                  ]P*                  ^,          4       ]P5                  ]P*                  ^,          4       ]P7                  4        ]P9                  4       w  tt]! ^]^,           4       FG  t ]PC                  ] 4      w  t"t#t$]! R] ,          4       ]# F  t%]! R]%,           4       K  	  ]! R4       KI  	  ]PM                  4        R# R#   ] d    Rt ELii ; i)z@A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
NTFPOP3error_protoc                       ] tR t^tRtR# )r    N)__name__
__module____qualname____firstlineno____static_attributes__r       lib/python3.14/poplib.pyr   r      s    dr   i        
i   c                     a  ] tR t^3t o RtRt]]P                  3R lt	R t
R tR tR tR tR	 tR
 tR tR tR tR tR tR tR"R ltR tR tR tR tR tR tR t]P@                  ! R4      t!R t"R t#R"R lt$R t%R t&R"R  lt'R!t(V t)R# )#r   a  This class supports both the minimal and optional command sets.
Arguments can be strings or integers (where appropriate)
(e.g.: retr(1) and retr('1') both work equally well.

Minimal Command Set:
        USER name               user(name)
        PASS string             pass_(string)
        STAT                    stat()
        LIST [msg]              list(msg = None)
        RETR msg                retr(msg)
        DELE msg                dele(msg)
        NOOP                    noop()
        RSET                    rset()
        QUIT                    quit()

Optional Commands (some servers support these):
        RPOP name               rpop(name)
        APOP name digest        apop(name, digest)
        TOP msg n               top(msg, n)
        UIDL [msg]              uidl(msg = None)
        CAPA                    capa()
        STLS                    stls()
        UTF8                    utf8()

Raises one exception: 'error_proto'.

Instantiate with:
        POP3(hostname, port=110)

NB:     the POP protocol locks the mailbox from user
        authorization until QUIT, so be sure to get in, suck
        the messages, and quit, each time you access the
        mailbox.

        POP is a line-based protocol, which means large mail
        messages consume lots of python cycles reading them
        line-by-line.

        If it's available on your mail server, use IMAP4
        instead, it doesn't suffer from the two problems
        above.
zUTF-8c                    Wn         W n        R V n        \        P                  ! RWV4       V P                  V4      V n        V P                  P                  R4      V n        ^ V n	        V P                  4       V n        R# )Fzpoplib.connectrbN)hostport_tls_establishedsysaudit_create_socketsockmakefilefile
_debugging_getrespwelcome)selfr   r   timeouts   &&&&r   __init__POP3.__init__b   sa    		 %		"D5''0	II&&t,	}}r   c                    Ve   V'       g   \        R4      h\        P                  ! V P                  V P                  3V4      # )Nz0Non-blocking socket (timeout=0) is not supported)
ValueErrorsocketcreate_connectionr   r   )r   r   s   &&r   r   POP3._create_socketm   s6    wOPP''DII(>HHr   c                    V P                   ^8  d   \        R\        V4      4       \        P                  ! RW4       V P
                  P                  V\        ,           4       R# )   z*put*zpoplib.putlineN)r   printreprr   r   r   sendallCRLFr   lines   &&r   _putlinePOP3._putliner   s@    ??QgtDz :		"D/		$+&r   c                    V P                   '       d   \        R \        V4      4       \        WP                  4      pV P                  V4       R# )z*cmd*N)r   r)   r*   bytesencodingr/   r-   s   &&r   _putcmdPOP3._putcmdz   s2    ???E'4:6T==)dr   c                ~   V P                   P                  \        ^,           4      p\        V4      \        8  d   \	        R4      hV P
                  ^8  d   \        R\        V4      4       V'       g   \	        R4      h\        V4      pVRR \        8X  d   VRR V3# VR,          \        8X  d   V^R V3# VRR V3# )r(   zline too longz*get*z-ERR EOFN:Nr(   N)
r   readline_MAXLINElenr   r   r)   r*   r,   CR)r   r.   octetss   &  r   _getlinePOP3._getline   s    yy!!(Q,/t9xo..??QgtDz :;z22T 99f$$8r>":v%%CRy&  r   c                    V P                  4       w  rV P                  ^8  d   \        R\        V4      4       VP	                  R4      '       g   \        V4      hV# )r(   z*resp*   +)r>   r   r)   r*   
startswithr   )r   respos   &  r   r   POP3._getresp   sG    --/??QhT
 ;t$$d##r   c                   V P                  4       p. p^ pV P                  4       w  rEVR8w  dW   VP                  R4      '       d   V^,
          pVR,          pW5,           pVP                  V4       V P                  4       w  rEK]  WV3# )       .s   ..r(   NN)r   r>   rB   append)r   rC   listr=   r.   rD   s   &     r   _getlongrespPOP3._getlongresp   sx    }}A6--/dlu%%aCBxZFKKmmoGD!6!!r   c                D    V P                  V4       V P                  4       # N)r4   r   r-   s   &&r   	_shortcmdPOP3._shortcmd   s    T}}r   c                D    V P                  V4       V P                  4       # rO   )r4   rL   r-   s   &&r   _longcmdPOP3._longcmd   s    T  ""r   c                    V P                   # rO   )r   r   s   &r   
getwelcomePOP3.getwelcome   s    ||r   c                    Wn         R # rO   )r   )r   levels   &&r   set_debuglevelPOP3.set_debuglevel   s    r   c                2    V P                  RV,          4      # )zFSend user name, return response

(should indicate password required).
zUSER %srP   r   users   &&r   r`   	POP3.user   s    
 ~~i$.//r   c                2    V P                  RV,          4      # )zSend password, return response

(response includes message count, mailbox size).

NB: mailbox is locked by server from here to 'quit()'
zPASS %sr^   )r   pswds   &&r   pass_
POP3.pass_   s     ~~i$.//r   c                L   V P                  R4      pVP                  4       pV P                  '       d   \        R\	        V4      4       \        V4      ^8  d   \        R4      h \        V^,          4      p\        V^,          4      pW43#   \         d    \        R4      hi ; i)zMGet mailbox status.

Result is tuple of 2 ints (message count, mailbox size)
STATz*stat*zInvalid STAT response formatz.Invalid STAT response data: non-numeric values)	rP   splitr   r)   r*   r;   r   intr#   )r   retvalretsnumMessagessizeMessagess   &    r   stat	POP3.stat   s    
 '||~???E(DJ7
 t9q=<==	Pd1g,KtAw<L **  	PNOO	Ps   %$B B#Nc                \    Ve   V P                  RV,          4      # V P                  R4      # )zRequest listing, return result.

Result without a message number argument is in form
['response', ['mesg_num octets', ...], octets].

Result when a message number argument is given is a
single response: the "scan listing" for that message.
zLIST %sLISTrP   rS   r   whichs   &&r   rK   	POP3.list   s-     >>)e"344}}V$$r   c                2    V P                  RV,          4      # )z_Retrieve whole message number 'which'.

Result is in form ['response', ['line', ...], octets].
zRETR %srS   rs   s   &&r   retr	POP3.retr  s    
 }}Y.//r   c                2    V P                  RV,          4      # )z6Delete message number 'which'.

Result is 'response'.
zDELE %sr^   rs   s   &&r   dele	POP3.dele  s    
 ~~i%/00r   c                $    V P                  R4      # )zHDoes nothing.

One supposes the response indicates the server is alive.
NOOPr^   rV   s   &r   noop	POP3.noop  s    
 ~~f%%r   c                $    V P                  R4      # )z(Unmark all messages marked for deletion.RSETr^   rV   s   &r   rset	POP3.rset  s    ~~f%%r   c                H    V P                  R4      pV P                  4        V# )zDSignoff: commit changes on server, unlock mailbox, close connection.QUIT)rP   close)r   rC   s   & r   quit	POP3.quit   s    ~~f%

r   c                     V P                   pRV n         Ve   VP                  4        V P                  pRV n        Ve3    VP                  \        P
                  4       VP                  4        R# R#   \         d=   pTP                  \        P                  8w  d   \        TR^ 4      R8w  d   h  Rp?LVRp?ii ; i  TP                  4        i ; i  T P                  pRT n        Te    TP                  \        P
                  4       MJ  \         d=   pTP                  \        P                  8w  d   \        TR^ 4      R8w  d   h  Rp?MRp?ii ; iTP                  4        i   TP                  4        i ; ii ; i)z8Close the connection without assuming anything about it.Nwinerrori&'  )
r   r   r   shutdownr$   	SHUT_RDWROSErrorerrnoENOTCONNgetattr)r   r   r   excs   &   r   r   
POP3.close&  s)   	!99DDI

99DDI
!MM&"2"23 JJL     		U^^3"3
A6%? JJL 99DDI
!MM&"2"23  		U^^3"3
A6%? JJLDJJL  sq   'C A4 4B;?2B61B> 6B;;B> >CE=,DE'E2E	E'EE'E='E99E=c                2    V P                  RV,          4      # )z?Send RPOP command to access the mailbox with an alternate user.zRPOP %sr^   r_   s   &&r   rpop	POP3.rpopB  s    ~~i$.//r   s   \+OK.[^<]*(<.*>)c                D   \        W P                  4      pV P                  P                  V P                  4      pV'       g   \        R4      h^ RIpVP                  ^4      V,           pVP                  V4      P                  4       pV P                  RV: RV: 24      # )zAuthorisation

- only possible if server has supplied a timestamp in initial greeting.

Args:
        user     - mailbox user;
        password - mailbox password.

NB: mailbox is locked by server from here to 'quit()'
z!-ERR APOP not supported by serverNzAPOP  )r2   r3   	timestampmatchr   r   hashlibgroupmd5	hexdigestrP   )r   r`   passwordsecretmr   digests   &&&    r   apop	POP3.apopI  sy     x/NN  .ABBF"V$..0~~dF;<<r   c                4    V P                  RV: RV: 24      # )zRetrieve message header of message number 'which'
and first 'howmuch' lines of message body.

Result is in form ['response', ['line', ...], octets].
zTOP r   rw   )r   rt   howmuchs   &&&r   topPOP3.top^  s     }}E7;<<r   c                \    Ve   V P                  RV,          4      # V P                  R4      # )zReturn message digest (unique id) list.

If 'which', result contains unique id for that message
in the form 'response mesgnum uid', otherwise result is
the list ['response', ['mesgnum uid', ...], octets]
zUIDL %sUIDLrr   rs   s   &&r   uidl	POP3.uidlg  s-     >>)e"344}}V$$r   c                $    V P                  R4      # )zITry to enter UTF-8 mode (see RFC 6856). Returns server response.
        UTF8r^   rV   s   &r   utf8	POP3.utf8s  s     ~~f%%r   c                    R p/ p V P                  R4      pV^,          pV F  pV! V4      w  rgWrV&   K  	  V#   \         d    \        R4      hi ; i)a  Return server capabilities (RFC 2449) as a dictionary
>>> c=poplib.POP3('localhost')
>>> c.capa()
{'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'],
 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [],
 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [],
 'UIDL': [], 'RESP-CODES': []}
>>>

Really, according to RFC 2449, the cyrus folks should avoid
having the implementation split into multiple arguments...
c                 d    V P                  R 4      P                  4       pV^ ,          VR,          3# )asciirI   )decoderh   )r.   lsts   & r   	_parsecapPOP3.capa.<locals>._parsecap  s+    ++g&,,.Cq63r7?"r   CAPAz!-ERR CAPA not supported by server)rS   r   )r   r   capsrC   rawcapscaplinecapnmcapargss   &       r   capa	POP3.capay  sn    	# 	C==(D1gG"!*7!3%U #
   	CABB	Cs	   1: Ac                   \         '       g   \        R4      hV P                  '       d   \        R4      hV P                  4       pRV9   g   \        R4      hVf   \        P
                  ! 4       pV P                  R4      pVP                  V P                  V P                  R7      V n        V P                  P                  R4      V n        RV n        V# )zcStart a TLS session on the active connection as specified in RFC 2595.

context - a ssl.SSLContext
z-ERR TLS support missing$-ERR TLS session already establishedSTLSz!-ERR STLS not supported by serverserver_hostnamer   T)HAVE_SSLr   r   r   ssl_create_stdlib_contextrP   wrap_socketr   r   r   r   )r   contextr   rC   s   &&  r   stls	POP3.stls  s    
 x899   DEEyy{~ABB?002G~~f%''		8<		 ( C	II&&t,	 $r   )r   r   r   r   r   r   r   rO   )*r   r   r   r	   __doc__r3   	POP3_PORTr$   _GLOBAL_DEFAULT_TIMEOUTr    r   r/   r4   r>   r   rL   rP   rS   rW   r[   r`   rd   rn   rK   rx   r{   r   r   r   r   r   recompiler   r   r   r   r   r   r   r
   __classdictcell____classdict__s   @r   r   r   3   s     )V H"+77	'I
'!*" # 00+0%01&&
!80
 

/0I=*=	%&: r   c                   `   a  ] tR tRt o Rt]3R]P                  RR/R lltR t	R
R lt
R	tV tR# )POP3_SSLi  a  POP3 client class over SSL connection

Instantiate with: POP3_SSL(hostname, port=995, context=None)

       hostname - the hostname of the pop3 over ssl server
       port - port number
       context - a ssl.SSLContext

See the methods of the parent class POP3 for more documentation.
r   r   Nc               p    Vf   \         P                  ! 4       pW@n        \        P	                  WW#4       R # rO   )r   r   r   r   r    )r   r   r   r   r   s   &&&$$r   r    POP3_SSL.__init__  s(    446"LMM$d4r   c                ~    \         P                  W4      pV P                  P                  VV P                  R 7      pV# )r   )r   r   r   r   r   )r   r   r   s   && r   r   POP3_SSL._create_socket  s:    &&t5D<<++D<@II , GDKr   c                    \        R4      h)zThe method unconditionally raises an exception since the
STLS command doesn't make any sense on an already established
SSL/TLS session.
r   )r   )r   r   s   &&r   r   POP3_SSL.stls  s    
 DEEr   )r   rO   )r   r   r   r	   r   POP3_SSL_PORTr$   r   r    r   r   r
   r   r   s   @r   r   r     s;     		 '4 	5 & > >	5HL	5		F 	Fr   r   __main__zMessage %d:z   z-----------------------)'r   r   r   r$   r   r   r   ImportError__all__	Exceptionr   r   r   r<   LFr,   r:   r   r   rJ   r   argvar)   rW   r`   rd   rK   rn   numMsgs	totalSizerangeirx   headermsgr=   r.   r   r   r   r   <module>r      sy    	  
H -
  #) " 	  
	"u v vr F4 F@ NN:zSXXa[A	!,,.FF388A;GGCHHQKFFH668Wi1gk" !q	fma D%$, '( # FFH q  Hs   E7 7	FF