Implement connect
This commit is contained in:
parent
8200864f25
commit
9bee28cb13
@ -67,6 +67,7 @@ class IMAPServer:
|
|||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
self.passworderror = None
|
self.passworderror = None
|
||||||
|
self.goodpassword = None
|
||||||
self.hostname = hostname
|
self.hostname = hostname
|
||||||
self.tunnel = tunnel
|
self.tunnel = tunnel
|
||||||
self.port = port
|
self.port = port
|
||||||
@ -87,6 +88,9 @@ class IMAPServer:
|
|||||||
self.reference = reference
|
self.reference = reference
|
||||||
|
|
||||||
def getpassword(self):
|
def getpassword(self):
|
||||||
|
if self.goodpassword != None:
|
||||||
|
return self.goodpassword
|
||||||
|
|
||||||
if self.password != None and self.passworderror == None:
|
if self.password != None and self.passworderror == None:
|
||||||
return self.password
|
return self.password
|
||||||
|
|
||||||
@ -193,6 +197,7 @@ class IMAPServer:
|
|||||||
self.plainauth(imapobj)
|
self.plainauth(imapobj)
|
||||||
# Would bail by here if there was a failure.
|
# Would bail by here if there was a failure.
|
||||||
success = 1
|
success = 1
|
||||||
|
self.goodpassword = self.password
|
||||||
except imapobj.error, val:
|
except imapobj.error, val:
|
||||||
self.passworderror = str(val)
|
self.passworderror = str(val)
|
||||||
self.password = None
|
self.password = None
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base repository support
|
# Base repository support
|
||||||
# Copyright (C) 2002, 2003, 2006 John Goerzen
|
# Copyright (C) 2002-2007 John Goerzen
|
||||||
# <jgoerzen@complete.org>
|
# <jgoerzen@complete.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@ -63,6 +63,15 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
|||||||
|
|
||||||
return self.restore_folder_atimes()
|
return self.restore_folder_atimes()
|
||||||
|
|
||||||
|
def connect(self):
|
||||||
|
"""Establish a connection to the remote, if necessary. This exists
|
||||||
|
so that IMAP connections can all be established up front, gathering
|
||||||
|
passwords as needed. It was added in order to support the
|
||||||
|
error recovery -- we need to connect first outside of the error
|
||||||
|
trap in order to validate the password, and that's the point of
|
||||||
|
this function."""
|
||||||
|
pass
|
||||||
|
|
||||||
def holdordropconnections(self):
|
def holdordropconnections(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -156,6 +156,10 @@ class IMAPRepository(BaseRepository):
|
|||||||
def getfoldertype(self):
|
def getfoldertype(self):
|
||||||
return folder.IMAP.IMAPFolder
|
return folder.IMAP.IMAPFolder
|
||||||
|
|
||||||
|
def connect(self):
|
||||||
|
imapobj = self.imapserver.acquireconnection()
|
||||||
|
self.imapserver.releaseconnection(imapobj)
|
||||||
|
|
||||||
def getfolders(self):
|
def getfolders(self):
|
||||||
if self.folders != None:
|
if self.folders != None:
|
||||||
return self.folders
|
return self.folders
|
||||||
|
Loading…
Reference in New Issue
Block a user