]> code.delx.au - offlineimap/blobdiff - offlineimap/imapserver.py
Implement connect
[offlineimap] / offlineimap / imapserver.py
index b89f9dc06757406dd3917bb52a2ff892833bc76d..b96a4043cf6b9c523686accb3bd714d083e9de2b 100644 (file)
@@ -67,6 +67,7 @@ class IMAPServer:
         self.username = username
         self.password = password
         self.passworderror = None
+        self.goodpassword = None
         self.hostname = hostname
         self.tunnel = tunnel
         self.port = port
@@ -87,6 +88,9 @@ class IMAPServer:
         self.reference = reference
 
     def getpassword(self):
+        if self.goodpassword != None:
+            return self.goodpassword
+
         if self.password != None and self.passworderror == None:
             return self.password
 
@@ -109,6 +113,7 @@ class IMAPServer:
 
 
     def releaseconnection(self, connection):
+        """Releases a connection, returning it to the pool."""
         self.connectionlock.acquire()
         self.assignedconnections.remove(connection)
         self.availableconnections.append(connection)
@@ -192,6 +197,7 @@ class IMAPServer:
                         self.plainauth(imapobj)
                     # Would bail by here if there was a failure.
                     success = 1
+                    self.goodpassword = self.password
                 except imapobj.error, val:
                     self.passworderror = str(val)
                     self.password = None