mò _z-Dc @s·dZddddddddd d g Zd kZd kZd kZd kZd kZd kZd kZd k Z d k Z d k Td k Td k Td kTd klZlZd kTd"Zdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZei d!jo eZ!neZ!d S(#sÀBase and mix-in classes implementing retrievers (message sources getmail can retrieve mail from). None of these classes can be instantiated directly. In this module: Mix-in classes for SSL/non-SSL initialization: POP3initMixIn Py23POP3SSLinitMixIn Py24POP3SSLinitMixIn IMAPinitMixIn IMAPSSLinitMixIn Base classes: RetrieverSkeleton POP3RetrieverBase MultidropPOP3RetrieverBase IMAPRetrieverBase MultidropIMAPRetrieverBase t IMAPinitMixIntIMAPRetrieverBasetIMAPSSLinitMixIntMultidropPOP3RetrieverBasetMultidropIMAPRetrieverBaset POP3_ssl_portt POP3initMixIntPOP3RetrieverBasetPOP3SSLinitMixIntRetrieverSkeletonN(t*(sPOP3SSLs POP3_ssl_portttotcctbcctreceiveds resent-tos resent-ccs resent-bcccBstZdZd„ZRS(s4Mix-In class to do POP3 non-SSL initialization. cCsÖ|iiƒy'ti|id|idƒ|_Wn}tij o}t d|ƒ‚nWt i j ot dƒ‚n6t i j o&}t d|id|fƒ‚nX|iid|it iƒdS(NtservertportsPOP error (%s)stimeout during connects+error resolving name %s during connect (%s)sPOP3 connection %s established(tselftlogttracetpoplibtPOP3tconftconnt error_protototgetmailOperationErrortsocketttimeouttgaierrortostlinesep(RR((t?/usr/lib/python2.4/site-packages/getmailcore/_retrieverbases.pyt_connectHs '"(t__name__t __module__t__doc__R!(((R REs tPy24POP3SSLinitMixIncBstZdZd„ZRS(saMix-In class to do POP3 over SSL initialization with Python 2.4's poplib.POP3_SSL class. cCs¶|iiƒttdƒptdƒ‚nt|iƒ\}}y¿|ob|iid|id|id||ft i ƒt i |id|id||ƒ|_nS|iid|id|idft i ƒt i |id|idƒ|_Wn}t ij o}td|ƒ‚nWtij otdƒ‚n6tij o&}td |id|fƒ‚nX|iiid ƒ|iid |it i ƒdS( Ntssls0SSL not supported by this installation of PythonsFestablishing POP3 SSL connection to %s:%d with keyfile %s, certfile %sRRs)establishing POP3 SSL connection to %s:%dsPOP error (%s)stimeout during connects+error resolving name %s during connect (%s)isPOP3 connection %s established(RRRthasattrRtgetmailConfigurationErrortcheck_ssl_key_and_certRtkeyfiletcertfileRRRtPOP3_SSLRRRRRRtsockt setblocking(RR+RR*((R R!\s& 5/'"(R"R#R$R!(((R R%Xs tPy23POP3SSLinitMixIncBstZdZd„ZRS(s‰Mix-In class to do POP3 over SSL initialization with custom-implemented code to support SSL with Python 2.3's poplib.POP3 class. cCs·|iiƒttdƒptdƒ‚nt|iƒ\}}y¹|o_|iid|id|id||ft i ƒt |id|id||ƒ|_ nP|iid|id|idft i ƒt |id|idƒ|_ Wn—tij o}td|ƒ‚nqtij otdƒ‚nPtij o}td |ƒ‚n)tij o}td |ƒ‚nX|iid |i t i ƒdS( NR&s0SSL not supported by this installation of PythonsFestablishing POP3 SSL connection to %s:%d with keyfile %s, certfile %sRRs)establishing POP3 SSL connection to %s:%dsPOP error (%s)stimeout during connects socket error during connect (%s)s#socket sslerror during connect (%s)s"POP3 SSL connection %s established(RRRR'RR(R)RR*R+RRtPOP3SSLRRRRRRRtsslerror(RR+RR*((R R!€s( 5/$(R"R#R$R!(((R R/|s cBstZdZd„ZRS(s4Mix-In class to do IMAP non-SSL initialization. cCsÌ|iiƒy'ti|id|idƒ|_Wnstiij o}t d|ƒ‚nJt i j ot dƒ‚n)t i j o}t d|ƒ‚nX|iid|it iƒdS(NRRsIMAP error (%s)stimeout during connects socket error during connect (%s)sIMAP connection %s established(RRRtimaplibtIMAP4RRterrorRRRRRRR(RR((R R!¤s '(R"R#R$R!(((R R¡s cBstZdZd„ZRS(s5Mix-In class to do IMAP over SSL initialization. cCsÀ|iiƒttdƒptdƒ‚nt|iƒ\}}y¿|ob|iid|id|id||ft i ƒt i |id|id||ƒ|_nS|iid|id|idft i ƒt i |id|idƒ|_Wnšt iij o}td|ƒ‚nqtij otdƒ‚nPtij o}td |ƒ‚n)tij o}td |ƒ‚nX|iid |it i ƒdS( NR&s0SSL not supported by this installation of PythonsFestablishing IMAP SSL connection to %s:%d with keyfile %s, certfile %sRRs)establishing IMAP SSL connection to %s:%dsIMAP error (%s)stimeout during connects socket error during connect (%s)s#socket sslerror during connect (%s)s"IMAP SSL connection %s established(RRRR'RR(R)RR*R+RRR2t IMAP4_SSLRR3R4RRRRR1(RR+RR*((R R!¶s* 5/(R"R#R$R!(((R R³s cBs†tZdZd„Zd„Zd„Zd„Zd„Zd„Ze d„Z d„Z d „Z d „Z d „Zd „Zd „ZRS(s& Base class for implementing message-retrieval classes. Sub-classes should provide the following data attributes and methods: _confitems - a tuple of dictionaries representing the parameters the class takes. Each dictionary should contain the following key, value pairs: - name - parameter name - type - a type function to compare the parameter value against (i.e. str, int, bool) - default - optional default value. If not preseent, the parameter is required. __str__(self) - return a simple string representing the class instance. _getmsglist(self) - retieve a list of all available messages, and store unique message identifiers in the dict self.msgnum_by_msgid. Message identifiers must be unique and persistent across instantiations. Also store message sizes (in octets) in a dictionary self.msgsizes, using the message identifiers as keys. _delmsgbyid(self, msgid) - delete a message from the message store based on its message identifier. _getmsgbyid(self, msgid) - retreive and return a message from the message store based on its message identifier. The message is returned as a Message() class object. The message will have additional data attributes "sender" and "recipient". sender should be present or "unknown". recipient should be non-None if (and only if) the protocol/method of message retrieval preserves the original message envelope. _getheaderbyid(self, msgid) - similar to _getmsgbyid() above, but only the message header should be retrieved, if possible. It should be returned in the same format. showconf(self) - should invoke self.log.info() to display the configuration of the class instance. Sub-classes may also wish to extend or over-ride the following base class methods: __init__(self, **args) __del__(self) initialize(self) checkconf(self) cKsƒh|_h|_h|_h|_h|_h|_h|_tt i ƒƒ|_ t |_ t |_ t |_ti||dS(N(Rtmsgnum_by_msgidtmsgid_by_msgnumtmsgsizest headercachetoldmailtdeletedt_RetrieverSkeleton__deliveredtintttimet timestamptFalset#_RetrieverSkeleton__oldmail_writtent_RetrieverSkeleton__initializedt gotmsglisttConfigurableBaset__init__targs(RRF((R REs          cCs|iiƒ|iƒdS(N(RRRtwrite_oldmailfile(R((R t__del__s cCs|iiƒt|iƒS(N(RRRtstrR(R((R t__str__#s cCs|iiƒt|iƒS(N(RRRtlenR6(R((R t__len__'s cCsI|iid|ƒ|iptdƒ‚nt|iiƒƒ|dS(Nsi == %dsnot initializedi( RRRtiRBRtsortedR7titems(RRM((R t __getitem__+s cCs÷|iiƒyµx„g}t|idƒD]C}|iƒdjo*d|jo||iƒiddƒq*q*~D]\}}t |ƒ|i |s0  3 %!cCsÚ|iiƒ|iƒd|ijoti|idƒntidƒti i |idd|ii ddƒi ddƒƒ|_ |i ƒd|idti|iddƒd d d f|_t|_dS( NRt getmaildirs(oldmail-%(server)s-%(port)i-%(username)st/t-t:s%s (%s)Rii(RRRt checkconfRRtsetdefaulttimeouttNoneRtpathtjointreplaceRVR]t getaddrinfot received_fromRmRB(R((R t initialize_s   + 9cCsd|i|[:]. field-number defaults to 1 and is counted from top to bottom in the message. For instance, if the envelope recipient is present in the second Delivered-To: header field of each message, envelope_recipient should be specified as "delivered-to:2". cCsù|iiƒti|ƒ|ididƒdiƒ|_|it jot dƒ‚nd|_ yUt |ididdƒdƒd|_ |i djot |idƒ‚nWn7tj on&t j o}t d|ƒ‚nXdS(Ntenvelope_recipientRqisBthe %s header field does not record the envelope recipient addressis4invalid envelope_recipient specification format (%s)(RRRRRzRRYtlowert envrecipnametNOT_ENVELOPE_RECIPIENT_HEADERSR(t envrecipnumR=t ValueErrort IndexErrorR(RR((R Rzs  # *cCsï|iiƒti||ƒ}h}xa|iƒD]S\}}|i ƒ}|i ƒ}||jo||i |ƒq2|g||[:]. field-number defaults to 1 and is counted from top to bottom in the message. For instance, if the envelope recipient is present in the second Delivered-To: header field of each message, envelope_recipient should be specified as "delivered-to:2". cCsù|iiƒti|ƒ|ididƒdiƒ|_|it jot dƒ‚nd|_ yUt |ididdƒdƒd|_ |i djot |idƒ‚nWn7tj on&t j o}t d|ƒ‚nXdS(NR§RqisBthe %s header field does not record the envelope recipient addressis4invalid envelope_recipient specification format (%s)(RRRRRzRRYR¨R©RªR(R«R=R¬R­R(RR((R Rz4s  # *cCsï|iiƒti||ƒ}h}xa|iƒD]S\}}|i ƒ}|i ƒ}||jo||i |ƒq2|g||RžR–RR2Ratgetmailcore.exceptionstgetmailcore.constantstgetmailcore.messagetgetmailcore.utilitiestgetmailcore._pop3sslR0Rtgetmailcore.baseclassesRªtobjectRR%R/RRRDR RRRRt hexversionR(RR%RRRžRRRRàR2RR>R–R/RRáRRªRRR0RaRR ((R t?s<$         $%(µ‚5á6