Get rid of the UsefulIMAP4 classes
The three classes with names starting with UsefulIMAP4 were used for two purposes, to include the UsefulIMAPMixIn class and to implement various system-specific kludges. None of these kludges remain, so it is cleaner to include UsefulIMAPMixIn directly in imaplibutil and forget about them for good. Signed-off-by: Vincent Beffara <vbeffara@ens-lyon.fr> Reviewed-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
9f03f41b70
commit
bb48b6deaf
@ -59,7 +59,7 @@ class UsefulIMAPMixIn:
|
|||||||
def _mesg(self, s, tn=None, secs=None):
|
def _mesg(self, s, tn=None, secs=None):
|
||||||
new_mesg(self, s, tn, secs)
|
new_mesg(self, s, tn, secs)
|
||||||
|
|
||||||
class IMAP4_Tunnel(IMAP4):
|
class IMAP4_Tunnel(UsefulIMAPMixIn, IMAP4):
|
||||||
"""IMAP4 client class over a tunnel
|
"""IMAP4 client class over a tunnel
|
||||||
|
|
||||||
Instantiate with: IMAP4_Tunnel(tunnelcmd)
|
Instantiate with: IMAP4_Tunnel(tunnelcmd)
|
||||||
@ -107,7 +107,7 @@ def new_mesg(self, s, tn=None, secs=None):
|
|||||||
tm = time.strftime('%M:%S', time.localtime(secs))
|
tm = time.strftime('%M:%S', time.localtime(secs))
|
||||||
getglobalui().debug('imap', ' %s.%02d %s %s' % (tm, (secs*100)%100, tn, s))
|
getglobalui().debug('imap', ' %s.%02d %s %s' % (tm, (secs*100)%100, tn, s))
|
||||||
|
|
||||||
class WrappedIMAP4_SSL(IMAP4_SSL):
|
class WrappedIMAP4_SSL(UsefulIMAPMixIn, IMAP4_SSL):
|
||||||
"""Provides an improved version of the standard IMAP4_SSL
|
"""Provides an improved version of the standard IMAP4_SSL
|
||||||
|
|
||||||
It provides a better readline() implementation as impaplib's
|
It provides a better readline() implementation as impaplib's
|
||||||
@ -224,7 +224,7 @@ class WrappedIMAP4_SSL(IMAP4_SSL):
|
|||||||
|
|
||||||
return ('no matching domain name found in certificate')
|
return ('no matching domain name found in certificate')
|
||||||
|
|
||||||
class WrappedIMAP4(IMAP4):
|
class WrappedIMAP4(UsefulIMAPMixIn, IMAP4):
|
||||||
"""Improved version of imaplib.IMAP4 that can also connect to IPv6"""
|
"""Improved version of imaplib.IMAP4 that can also connect to IPv6"""
|
||||||
|
|
||||||
def open(self, host = '', port = IMAP4_PORT):
|
def open(self, host = '', port = IMAP4_PORT):
|
||||||
|
@ -38,12 +38,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class UsefulIMAP4(imaplibutil.UsefulIMAPMixIn, imaplibutil.WrappedIMAP4): pass
|
|
||||||
|
|
||||||
class UsefulIMAP4_SSL(imaplibutil.UsefulIMAPMixIn, imaplibutil.WrappedIMAP4_SSL): pass
|
|
||||||
|
|
||||||
class UsefulIMAP4_Tunnel(imaplibutil.UsefulIMAPMixIn, imaplibutil.IMAP4_Tunnel): pass
|
|
||||||
|
|
||||||
class IMAPServer:
|
class IMAPServer:
|
||||||
GSS_STATE_STEP = 0
|
GSS_STATE_STEP = 0
|
||||||
GSS_STATE_WRAP = 1
|
GSS_STATE_WRAP = 1
|
||||||
@ -202,18 +196,19 @@ class IMAPServer:
|
|||||||
# Generate a new connection.
|
# Generate a new connection.
|
||||||
if self.tunnel:
|
if self.tunnel:
|
||||||
self.ui.connecting('tunnel', self.tunnel)
|
self.ui.connecting('tunnel', self.tunnel)
|
||||||
imapobj = UsefulIMAP4_Tunnel(self.tunnel, timeout=socket.getdefaulttimeout())
|
imapobj = imaplibutil.IMAP4_Tunnel(self.tunnel,
|
||||||
|
timeout=socket.getdefaulttimeout())
|
||||||
success = 1
|
success = 1
|
||||||
elif self.usessl:
|
elif self.usessl:
|
||||||
self.ui.connecting(self.hostname, self.port)
|
self.ui.connecting(self.hostname, self.port)
|
||||||
imapobj = UsefulIMAP4_SSL(self.hostname, self.port,
|
imapobj = imaplibutil.WrappedIMAP4_SSL(self.hostname, self.port,
|
||||||
self.sslclientkey, self.sslclientcert,
|
self.sslclientkey, self.sslclientcert,
|
||||||
timeout=socket.getdefaulttimeout(),
|
timeout=socket.getdefaulttimeout(),
|
||||||
cacertfile = self.sslcacertfile)
|
cacertfile = self.sslcacertfile)
|
||||||
else:
|
else:
|
||||||
self.ui.connecting(self.hostname, self.port)
|
self.ui.connecting(self.hostname, self.port)
|
||||||
imapobj = UsefulIMAP4(self.hostname, self.port,
|
imapobj = imaplibutil.WrappedIMAP4(self.hostname, self.port,
|
||||||
timeout=socket.getdefaulttimeout())
|
timeout=socket.getdefaulttimeout())
|
||||||
|
|
||||||
imapobj.mustquote = imaplibutil.mustquote
|
imapobj.mustquote = imaplibutil.mustquote
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user