UNDO: Added netrc support

thanks to bboissin plus offlineimap at gmail dot com
refs #14
This commit is contained in:
John Goerzen 2007-03-27 08:21:17 +01:00
parent 4f54887265
commit aca2a4458b

View File

@ -20,7 +20,7 @@ from Base import BaseRepository
from offlineimap import folder, imaputil, imapserver from offlineimap import folder, imaputil, imapserver
from offlineimap.folder.UIDMaps import MappedIMAPFolder from offlineimap.folder.UIDMaps import MappedIMAPFolder
from offlineimap.threadutil import ExitNotifyThread from offlineimap.threadutil import ExitNotifyThread
import re, types, os, netrc import re, types, os
from threading import * from threading import *
class IMAPRepository(BaseRepository): class IMAPRepository(BaseRepository):
@ -109,9 +109,6 @@ class IMAPRepository(BaseRepository):
user = self.getconf('remoteuser') user = self.getconf('remoteuser')
if user != None: if user != None:
return user return user
netrcentry = netrc.netrc().authentificator(self.gethost())
if netrcentry:
return netrcentry[0]
def getport(self): def getport(self):
return self.getconfint('remoteport', None) return self.getconfint('remoteport', None)
@ -149,11 +146,6 @@ class IMAPRepository(BaseRepository):
password = fd.readline().strip() password = fd.readline().strip()
fd.close() fd.close()
return password return password
netrcentry = netrc.netrc().authenticators(self.gethost())
if netrcentry:
user = self.getconf('remoteuser')
if user == None or user == netrcentry[0]:
return netrcentry[2]
return None return None
def getfolder(self, foldername): def getfolder(self, foldername):