diff --git a/head/offlineimap.1 b/head/offlineimap.1 new file mode 100644 index 0000000..bf5cfae --- /dev/null +++ b/head/offlineimap.1 @@ -0,0 +1,127 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH OFFLINEIMAP 1 "July 11, 2002" "quux.org" "OfflineIMAP manual" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +OfflineIMAP \- IMAP/Maildir synchronization and reader support +.SH SYNOPSIS +.B offlineimap +[ +.BI -1 +] +[ +.BI -a \ accountlist +] +[ +.BI -c \ configfile +] +.br +[ +.BI -d +] +[ +.BI -u " interface" +] + +.\".RI [ -c \ foo ] +.\".RI [ options ] " files" ... +.br +.B offlineimap +.B -h +.\".RI [ options ] " files" ... +.SH DESCRIPTION +.B OfflineIMAP +is a tool to simplify your e-mail reading. With +.B OfflineIMAP, +you can read the same mailbox from multiple computers. You get a +current copy of your messages on each computer, and changes you make +one place will be visible on all other systems. For instance, you can +delete a message on your home computer, and it will appear deleted on +your work computer as well. +.B OfflineIMAP +is also useful if you want to use a mail reader that does not have +IMAP support, has poor IMAP support, or does not provide disconnected +operation. +.PP +.B OfflineIMAP +is +.I FAST; +it synchronizes my two accounts with over 50 folders in 3 seconds. +Other similar tools might take over a minute, and achieve a +less-reliable result. Some mail readers can take over 10 minutes to +do the same thing, and some don't even support it at all. Unlike +other mail tools, +.B OfflineIMAP +features a multi-threaded synchronization algorithm that can +dramatically speed up performance in many situations by synchronizing +several different things simultaneously. +.PP +.B OfflineIMAP +is +.I FLEXIBLE; +you can customize which folders are synced via regular expressions, lists, or +Python expressions; a versatile and comprehensive configuration file +is used to control behavior; two user interfaces are built-in; +fine-tuning of synchronization performance is possible; internal or +external automation is supported; SSL and PREAUTH tunnels are both +supported; offline (or "unplugged") reading is supported; and +esoteric IMAP features are supported to ensure compatibility with the +widest variety of IMAP servers. +.PP +.B OfflineIMAP +is +.I SAFE; +it uses an algorithm designed to prevent mail loss at all costs. +Because of the design of this algorithm, even programming errors +should not result in loss of mail. I am so confident in the algorithm +that I use my own personal and work accounts for testing of +.B OfflineIMAP +pre-release, development, and beta releases. +.PP +This manual page documents briefly the +.B offlineimap +and +.B bar +commands. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +Instead, it has documentation in the GNU Info format; see below. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBofflineimap\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. +.SH AUTHOR +This manual page was written by John Goerzen , +for the Debian GNU/Linux system (but may be used by others). diff --git a/head/offlineimap.conf b/head/offlineimap.conf index d10ecb5..31e5d69 100644 --- a/head/offlineimap.conf +++ b/head/offlineimap.conf @@ -54,12 +54,12 @@ maxsyncaccounts = 1 # fails, the second, and so forth. # # The pre-defined options are: -# Tk.TKUI -- A graphical interface +# Tk.TkUI -- A graphical interface # TTY.TTYUI -- a text-based (terminal) interface # # You can override this with a command-line option -u. -ui = Tk.TKUI, TTY.TTYUI +ui = Tk.TkUI, TTY.TTYUI ################################################## diff --git a/head/offlineimap.py b/head/offlineimap.py index 2af32c6..f2c9367 100644 --- a/head/offlineimap.py +++ b/head/offlineimap.py @@ -23,13 +23,10 @@ import re, os, os.path, offlineimap, sys from ConfigParser import ConfigParser from threading import * + if '-d' in sys.argv: imaplib.Debug = 5 -ui = offlineimap.ui.TTY.TTYUI() -#ui = offlineimap.ui.Tk.TkUI() -ui.init_banner() - config = ConfigParser() configfilename = os.path.expanduser("~/.offlineimaprc") if not os.path.exists(configfilename): @@ -38,6 +35,10 @@ if not os.path.exists(configfilename): config.read(configfilename) +ui = offlineimap.ui.detector.findUI(config) +ui.init_banner() + + metadatadir = os.path.expanduser(config.get("general", "metadata")) if not os.path.exists(metadatadir): os.mkdir(metadatadir, 0700) diff --git a/head/offlineimap/ui/__init__.py b/head/offlineimap/ui/__init__.py index 72a133c..13cb3c8 100644 --- a/head/offlineimap/ui/__init__.py +++ b/head/offlineimap/ui/__init__.py @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -import TTY, UIBase, detector +import TTY, UIBase availableUIs = {'TTY': TTY, 'UIBase': UIBase} try: import Tkinter @@ -27,3 +27,4 @@ else: import Tk availableUIs['Tk'] = Tk +import detector diff --git a/head/offlineimap/ui/detector.py b/head/offlineimap/ui/detector.py index ecc98c6..e29fcd8 100644 --- a/head/offlineimap/ui/detector.py +++ b/head/offlineimap/ui/detector.py @@ -20,19 +20,21 @@ from offlineimap.ui import * import sys def findUI(config): - uistrlist = ['Tk.TKUI', 'TTY.TTYUI'] + uistrlist = ['Tk.TkUI', 'TTY.TTYUI'] if config.has_option("general", "ui"): uistrlist = config.get("general", "ui").replace(" ", "").split(",") for uistr in uistrlist: uimod = getUImod(uistr) - if uimod and uimod.isusable(): - return uimod + if uimod: + uiinstance = uimod() + if uiinstance.isusable(): + return uiinstance sys.stderr.write("ERROR: No UIs were found usable!\n") sys.exit(200) def getUImod(uistr): try: uimod = eval(uistr) - except AttributeError, NameError: + except (AttributeError, NameError): return None return uimod