/head: changeset 82
Modified to allow specifying a reference
This commit is contained in:
parent
55d56b8bde
commit
8d9d218832
@ -1,3 +1,10 @@
|
||||
offlineimap (2.0.3) unstable; urgency=low
|
||||
|
||||
* Added support for specifying references. Closes: #151960.
|
||||
* Added -d command-line option to enable imaplib debugging.
|
||||
|
||||
-- John Goerzen <jgoerzen@complete.org> Thu, 4 Jul 2002 20:39:29 -0500
|
||||
|
||||
offlineimap (2.0.2) unstable; urgency=low
|
||||
|
||||
* Added support for remotepassfile. Closes: #151943.
|
||||
|
@ -118,6 +118,13 @@ remoteuser = username
|
||||
# preauthtunnel = ssh -q imaphost '/usr/bin/imapd ./Maildir'
|
||||
#
|
||||
|
||||
# Some IMAP servers need a "reference" which often refers to the
|
||||
# "folder root". This is most commonly needed with UW IMAP, where
|
||||
# you might need to specify the directory in which your mail is
|
||||
# stored. Most users will not need this.
|
||||
#
|
||||
# reference = Mail
|
||||
|
||||
# Specify local repository. Your IMAP folders will be synchronized
|
||||
# to maildirs created under this path. OfflineIMAP will create the
|
||||
# maildirs for you as needed.
|
||||
|
@ -23,7 +23,8 @@ import re, os, os.path, offlineimap, sys
|
||||
from ConfigParser import ConfigParser
|
||||
from threading import *
|
||||
|
||||
# imaplib.Debug = 5
|
||||
if '-d' in sys.argv:
|
||||
imaplib.Debug = 5
|
||||
|
||||
ui = offlineimap.ui.TTY.TTYUI()
|
||||
ui.init_banner()
|
||||
@ -94,16 +95,21 @@ def syncaccount(accountname, *args):
|
||||
port = config.getint(accountname, "remoteport")
|
||||
ssl = config.getboolean(accountname, "ssl")
|
||||
usetunnel = config.has_option(accountname, "preauthtunnel")
|
||||
reference = '""'
|
||||
if config.has_option(accountname, "reference"):
|
||||
reference = config.get(accountname, "reference")
|
||||
|
||||
server = None
|
||||
# Connect to the remote server.
|
||||
if usetunnel:
|
||||
server = imapserver.IMAPServer(tunnel = tunnels[accountname],
|
||||
reference = reference,
|
||||
maxconnections = config.getint(accountname, "maxconnections"))
|
||||
else:
|
||||
server = imapserver.IMAPServer(user, passwords[accountname],
|
||||
host, port, ssl,
|
||||
config.getint(accountname, "maxconnections"))
|
||||
config.getint(accountname, "maxconnections"),
|
||||
reference = reference)
|
||||
remoterepos = repository.IMAP.IMAPRepository(config, accountname, server)
|
||||
|
||||
# Connect to the Maildirs.
|
||||
|
@ -45,7 +45,8 @@ class UsefulIMAP4_Tunnel(UsefulIMAPMixIn, imaplib.IMAP4_Tunnel): pass
|
||||
|
||||
class IMAPServer:
|
||||
def __init__(self, username = None, password = None, hostname = None,
|
||||
port = None, ssl = 1, maxconnections = 1, tunnel = None):
|
||||
port = None, ssl = 1, maxconnections = 1, tunnel = None,
|
||||
reference = '""'):
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.hostname = hostname
|
||||
@ -64,7 +65,7 @@ class IMAPServer:
|
||||
self.assignedconnections = []
|
||||
self.semaphore = BoundedSemaphore(self.maxconnections)
|
||||
self.connectionlock = Lock()
|
||||
|
||||
self.reference = reference
|
||||
|
||||
def getdelim(self):
|
||||
"""Returns this server's folder delimiter. Can only be called
|
||||
@ -116,7 +117,7 @@ class IMAPServer:
|
||||
|
||||
if self.delim == None:
|
||||
self.delim, self.root = \
|
||||
imaputil.imapsplit(imapobj.list('""', '""')[1][0])[1:]
|
||||
imaputil.imapsplit(imapobj.list(self.reference, '""')[1][0])[1:]
|
||||
self.delim = imaputil.dequote(self.delim)
|
||||
self.root = imaputil.dequote(self.root)
|
||||
|
||||
|
@ -50,7 +50,7 @@ class IMAPRepository(BaseRepository):
|
||||
retval = []
|
||||
imapobj = self.imapserver.acquireconnection()
|
||||
try:
|
||||
listresult = imapobj.list()[1]
|
||||
listresult = imapobj.list(directory = self.imapserver.reference)[1]
|
||||
finally:
|
||||
self.imapserver.releaseconnection(imapobj)
|
||||
for string in listresult:
|
||||
|
Loading…
Reference in New Issue
Block a user