• File: poplib.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/proc/self/root/opt/alt/python27/lib64/python2.7/poplib.pyc
  • Date Modified: 10/26/2026 8:10 PM
  • File size: 13.57 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

jc@sdZddlZddlZddgZdefdYZdZdZdZd	Z	ee	Z
d
ZdfdYZyddl
Z
Wnek
rn$Xdefd
YZejdedkrddlZeejdZejGHejejdejejdejej\ZZx[ededD]FZeje\ZZ Z!deGHxe D]Z"de"GHq~WdGHqPWej#ndS(s@A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
iNtPOP3terror_protocBseZRS((t__name__t
__module__(((s+/opt/alt/python27/lib64/python2.7/poplib.pyRsinis
s
icBseZdZeejdZdZdZdZ	dZ
dZdZdZ
d	Zd
ZdZdZd
ZddZdZdZdZdZdZdZejdZdZdZddZ RS(sThis 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)

    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.
    cCs^||_||_tj||f||_|jjd|_d|_|j|_	dS(Ntrbi(
thosttporttsockettcreate_connectiontsocktmakefiletfilet
_debuggingt_getresptwelcome(tselfRRttimeout((s+/opt/alt/python27/lib64/python2.7/poplib.pyt__init__Us			cCs?|jdkr!dGt|GHn|jjd|tfdS(Nis*put*s%s%s(RtreprR	tsendalltCRLF(Rtline((s+/opt/alt/python27/lib64/python2.7/poplib.pyt_putline_scCsM|jrdGt|GHntjd|r<tdn|j|dS(Ns*cmd*s[-]s*Control characters not allowed in commands(RRtretsearcht
ValueErrorR(RR((s+/opt/alt/python27/lib64/python2.7/poplib.pyt_putcmdfs
	cCs|jjtd}t|tkr7tdn|jdkrXdGt|GHn|smtdnt|}|dtkr|d |fS|dtkr|dd!|fS|d |fS(Nis
line too longs*get*s-ERR EOFiii(	Rtreadlinet_MAXLINEtlenRRRRtCR(RRtoctets((s+/opt/alt/python27/lib64/python2.7/poplib.pyt_getlineqscCs\|j\}}|jdkr3dGt|GHn|d }|dkrXt|n|S(Nis*resp*t+(R RRR(Rtresptotc((s+/opt/alt/python27/lib64/python2.7/poplib.pyR
s
cCs|j}g}d}|j\}}x`|dkr|d dkr`|d}|d}n||}|j||j\}}q-W|||fS(Nit.is..i(R
R tappend(RR"tlistRRR#((s+/opt/alt/python27/lib64/python2.7/poplib.pyt_getlongresps



cCs|j||jS(N(RR
(RR((s+/opt/alt/python27/lib64/python2.7/poplib.pyt	_shortcmds
cCs|j||jS(N(RR((RR((s+/opt/alt/python27/lib64/python2.7/poplib.pyt_longcmds
cCs|jS(N(R(R((s+/opt/alt/python27/lib64/python2.7/poplib.pyt
getwelcomescCs
||_dS(N(R(Rtlevel((s+/opt/alt/python27/lib64/python2.7/poplib.pytset_debuglevelscCs|jd|S(sVSend user name, return response

        (should indicate password required).
        sUSER %s(R)(Rtuser((s+/opt/alt/python27/lib64/python2.7/poplib.pyR.scCs|jd|S(sSend password, return response

        (response includes message count, mailbox size).

        NB: mailbox is locked by server from here to 'quit()'
        sPASS %s(R)(Rtpswd((s+/opt/alt/python27/lib64/python2.7/poplib.pytpass_scCs`|jd}|j}|jr6dGt|GHnt|d}t|d}||fS(s]Get mailbox status.

        Result is tuple of 2 ints (message count, mailbox size)
        tSTATs*stat*ii(R)tsplitRRtint(RtretvaltretstnumMessagestsizeMessages((s+/opt/alt/python27/lib64/python2.7/poplib.pytstats	cCs*|dk	r|jd|S|jdS(sRequest 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.
        sLIST %stLISTN(tNoneR)R*(Rtwhich((s+/opt/alt/python27/lib64/python2.7/poplib.pyR's	cCs|jd|S(soRetrieve whole message number 'which'.

        Result is in form ['response', ['line', ...], octets].
        sRETR %s(R*(RR;((s+/opt/alt/python27/lib64/python2.7/poplib.pytretrscCs|jd|S(sFDelete message number 'which'.

        Result is 'response'.
        sDELE %s(R)(RR;((s+/opt/alt/python27/lib64/python2.7/poplib.pytdelescCs
|jdS(sXDoes nothing.

        One supposes the response indicates the server is alive.
        tNOOP(R)(R((s+/opt/alt/python27/lib64/python2.7/poplib.pytnoopscCs
|jdS(s(Unmark all messages marked for deletion.tRSET(R)(R((s+/opt/alt/python27/lib64/python2.7/poplib.pytrsetscCsYy|jd}Wntk
r.}|}nX|jj|jj|`|`|S(sDSignoff: commit changes on server, unlock mailbox, close connection.tQUIT(R)RRtcloseR	(RR"tval((s+/opt/alt/python27/lib64/python2.7/poplib.pytquits


cCs|jd|S(sNot sure what this does.sRPOP %s(R)(RR.((s+/opt/alt/python27/lib64/python2.7/poplib.pytrpopss\+OK.[^<]*(<.*>)cCs|jj|j}|s*tdnddl}|j|jd|j}djt	d|}|j
d||fS(s Authorisation

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

        Args:
                user    - mailbox user;
                secret  - secret shared between client and server.

        NB: mailbox is locked by server from here to 'quit()'
        s!-ERR APOP not supported by serveriNitcSsdt|S(Ns%02x(tord(tx((s+/opt/alt/python27/lib64/python2.7/poplib.pyt<lambda>)RGs
APOP %s %s(t	timestamptmatchRRthashlibtmd5tgrouptdigesttjointmapR)(RR.tsecrettmRMRP((s+/opt/alt/python27/lib64/python2.7/poplib.pytapops"cCs|jd||fS(sRetrieve message header of message number 'which'
        and first 'howmuch' lines of message body.

        Result is in form ['response', ['line', ...], octets].
        s	TOP %s %s(R*(RR;thowmuch((s+/opt/alt/python27/lib64/python2.7/poplib.pyttop-scCs*|dk	r|jd|S|jdS(sReturn 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]
        sUIDL %stUIDLN(R:R)R*(RR;((s+/opt/alt/python27/lib64/python2.7/poplib.pytuidl6sN(!RRt__doc__t	POP3_PORTRt_GLOBAL_DEFAULT_TIMEOUTRRRR R
R(R)R*R+R-R.R0R8R:R'R<R=R?RARERFRtcompileRKRURWRY(((s+/opt/alt/python27/lib64/python2.7/poplib.pyR*s4(												
	
									tPOP3_SSLcBsDeZdZedddZdZdZdZdZ	RS(sPOP3 client class over SSL connection

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

               hostname - the hostname of the pop3 over ssl server
               port - port number
               keyfile - PEM formatted file that contains your private key
               certfile - PEM formatted certificate chain file

            See the methods of the parent class POP3 for more documentation.
        cCsR||_||_||_||_d|_d}d|_xtj|j|jdtj	D]}|\}}}	}
}y,tj|||	|_|jj
|Wn;tjk
r}|jr|jjnd|_q^nXPq^W|jstj|n|jj
d|_tj|j|j|j|_d|_|j|_dS(NRGs!getaddrinfo returns an empty listiR(RRtkeyfiletcertfiletbufferR:R	RtgetaddrinfotSOCK_STREAMtconnectterrorRCR
Rtssltwrap_sockettsslobjRR
R(RRRR_R`tmsgtrestaftsocktypetprotot	canonnametsa((s+/opt/alt/python27/lib64/python2.7/poplib.pyRTs0						(			!	cCsC|jj}t|dkr0tdn|j|7_dS(Nis-ERR EOF(RhtreadRRRa(Rtlocalbuf((s+/opt/alt/python27/lib64/python2.7/poplib.pyt_fillBuffernscCsd}tjd}|j|j}xJ|ss|jt|jtkr^tdn|j|j}q*W|jd}|j	d|jd|_|j
dkrdGt|GHnt|}|dtkr|d |fS|dt
kr
|dd!|fS|d |fS(	NRGs.*?\ns
line too longiis*get*ii(RR]RLRaRrRRRROtsubRRRR(RRt	renewlineRLR((s+/opt/alt/python27/lib64/python2.7/poplib.pyR ts$	
cCs|jdkr!dGt|GHn|t7}t|}xF|dkr|jj|}||krhPn||}||}q:WdS(Nis*put*i(RRRRRhtwrite(RRtbytestsent((s+/opt/alt/python27/lib64/python2.7/poplib.pyRs

cCsLy|jd}Wntk
r.}|}nX|jj|`|`|S(sDSignoff: commit changes on server, unlock mailbox, close connection.RB(R)RR	RCRh(RR"RD((s+/opt/alt/python27/lib64/python2.7/poplib.pyREs

N(
RRRZt
POP3_SSL_PORTR:RRrR RRE(((s+/opt/alt/python27/lib64/python2.7/poplib.pyR^Gs			t__main__iiisMessage %d:s   s-----------------------($RZRRt__all__t	ExceptionRR[RxRtLFRRRRftImportErrorR^R&RtsystargvtaR+R.R0R'R8tnumMsgst	totalSizetrangetiR<theaderRiRRRE(((s+/opt/alt/python27/lib64/python2.7/poplib.pyt<module>s@

V