/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
|
offlineimap (2.0.2) unstable; urgency=low
|
||||||
|
|
||||||
* Added support for remotepassfile. Closes: #151943.
|
* Added support for remotepassfile. Closes: #151943.
|
||||||
|
@ -118,6 +118,13 @@ remoteuser = username
|
|||||||
# preauthtunnel = ssh -q imaphost '/usr/bin/imapd ./Maildir'
|
# 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
|
# Specify local repository. Your IMAP folders will be synchronized
|
||||||
# to maildirs created under this path. OfflineIMAP will create the
|
# to maildirs created under this path. OfflineIMAP will create the
|
||||||
# maildirs for you as needed.
|
# maildirs for you as needed.
|
||||||
|
@ -23,7 +23,8 @@ import re, os, os.path, offlineimap, sys
|
|||||||
from ConfigParser import ConfigParser
|
from ConfigParser import ConfigParser
|
||||||
from threading import *
|
from threading import *
|
||||||
|
|
||||||
# imaplib.Debug = 5
|
if '-d' in sys.argv:
|
||||||
|
imaplib.Debug = 5
|
||||||
|
|
||||||
ui = offlineimap.ui.TTY.TTYUI()
|
ui = offlineimap.ui.TTY.TTYUI()
|
||||||
ui.init_banner()
|
ui.init_banner()
|
||||||
@ -94,16 +95,21 @@ def syncaccount(accountname, *args):
|
|||||||
port = config.getint(accountname, "remoteport")
|
port = config.getint(accountname, "remoteport")
|
||||||
ssl = config.getboolean(accountname, "ssl")
|
ssl = config.getboolean(accountname, "ssl")
|
||||||
usetunnel = config.has_option(accountname, "preauthtunnel")
|
usetunnel = config.has_option(accountname, "preauthtunnel")
|
||||||
|
reference = '""'
|
||||||
|
if config.has_option(accountname, "reference"):
|
||||||
|
reference = config.get(accountname, "reference")
|
||||||
|
|
||||||
server = None
|
server = None
|
||||||
# Connect to the remote server.
|
# Connect to the remote server.
|
||||||
if usetunnel:
|
if usetunnel:
|
||||||
server = imapserver.IMAPServer(tunnel = tunnels[accountname],
|
server = imapserver.IMAPServer(tunnel = tunnels[accountname],
|
||||||
|
reference = reference,
|
||||||
maxconnections = config.getint(accountname, "maxconnections"))
|
maxconnections = config.getint(accountname, "maxconnections"))
|
||||||
else:
|
else:
|
||||||
server = imapserver.IMAPServer(user, passwords[accountname],
|
server = imapserver.IMAPServer(user, passwords[accountname],
|
||||||
host, port, ssl,
|
host, port, ssl,
|
||||||
config.getint(accountname, "maxconnections"))
|
config.getint(accountname, "maxconnections"),
|
||||||
|
reference = reference)
|
||||||
remoterepos = repository.IMAP.IMAPRepository(config, accountname, server)
|
remoterepos = repository.IMAP.IMAPRepository(config, accountname, server)
|
||||||
|
|
||||||
# Connect to the Maildirs.
|
# Connect to the Maildirs.
|
||||||
|
@ -45,7 +45,8 @@ class UsefulIMAP4_Tunnel(UsefulIMAPMixIn, imaplib.IMAP4_Tunnel): pass
|
|||||||
|
|
||||||
class IMAPServer:
|
class IMAPServer:
|
||||||
def __init__(self, username = None, password = None, hostname = None,
|
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.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
self.hostname = hostname
|
self.hostname = hostname
|
||||||
@ -64,7 +65,7 @@ class IMAPServer:
|
|||||||
self.assignedconnections = []
|
self.assignedconnections = []
|
||||||
self.semaphore = BoundedSemaphore(self.maxconnections)
|
self.semaphore = BoundedSemaphore(self.maxconnections)
|
||||||
self.connectionlock = Lock()
|
self.connectionlock = Lock()
|
||||||
|
self.reference = reference
|
||||||
|
|
||||||
def getdelim(self):
|
def getdelim(self):
|
||||||
"""Returns this server's folder delimiter. Can only be called
|
"""Returns this server's folder delimiter. Can only be called
|
||||||
@ -116,7 +117,7 @@ class IMAPServer:
|
|||||||
|
|
||||||
if self.delim == None:
|
if self.delim == None:
|
||||||
self.delim, self.root = \
|
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.delim = imaputil.dequote(self.delim)
|
||||||
self.root = imaputil.dequote(self.root)
|
self.root = imaputil.dequote(self.root)
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class IMAPRepository(BaseRepository):
|
|||||||
retval = []
|
retval = []
|
||||||
imapobj = self.imapserver.acquireconnection()
|
imapobj = self.imapserver.acquireconnection()
|
||||||
try:
|
try:
|
||||||
listresult = imapobj.list()[1]
|
listresult = imapobj.list(directory = self.imapserver.reference)[1]
|
||||||
finally:
|
finally:
|
||||||
self.imapserver.releaseconnection(imapobj)
|
self.imapserver.releaseconnection(imapobj)
|
||||||
for string in listresult:
|
for string in listresult:
|
||||||
|
Loading…
Reference in New Issue
Block a user