Revamped documentation structure and some doc fixes

`make` in the `docs` dir or `make doc` in the root dir will now
create the 1) man page and 2) the user documentation using sphinx
(requiring python-doctools, and sphinx).

The resulting user docs are in `docs/html`. You can also
only create the man pages with `make man` in the `docs` dir.

Also fixed all .rst conversion errors as requested by Gentoo downstream.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth
2012-02-24 11:13:27 +01:00
parent 2800a71a28
commit 74b133c500
19 changed files with 140 additions and 118 deletions

60
docs/doc-src/API.rst Normal file
View File

@ -0,0 +1,60 @@
.. OfflineImap API documentation
.. currentmodule:: offlineimap
Welcome to :mod:`offlineimaps`'s documentation
==============================================
Within :mod:`offlineimap`, the classes :class:`OfflineImap` provides the high-level functionality. The rest of the classes should usually not needed to be touched by the user. Email repositories are represented by a :class:`offlineimap.repository.Base.BaseRepository` or derivatives (see :mod:`offlineimap.repository` for details). A folder within a repository is represented by a :class:`offlineimap.folder.Base.BaseFolder` or any derivative from :mod:`offlineimap.folder`.
This page contains the main API overview of OfflineImap |release|.
OfflineImap can be imported as::
from offlineimap import OfflineImap
The file ``SubmittingPatches.rst`` in the source distribution documents a
number of resources and conventions you may find useful. It will eventually
be merged into the main documentation.
.. TODO: merge SubmittingPatches.rst to the main documentation
:mod:`offlineimap` -- The OfflineImap module
=============================================
.. module:: offlineimap
.. autoclass:: offlineimap.OfflineImap(cmdline_opts = None)
.. automethod:: run
.. automethod:: parse_cmd_options
.. .. autoattribute:: ui
:todo: Document
:class:`offlineimap.account`
============================
An :class:`accounts.Account` connects two email repositories that are to be synced. It comes in two flavors, normal and syncable.
.. autoclass:: offlineimap.accounts.Account
.. autoclass:: offlineimap.accounts.SyncableAccount
:members:
:inherited-members:
.. autodata:: ui
Contains the current :mod:`offlineimap.ui`, and can be used for logging etc.
:exc:`OfflineImapError` -- A Notmuch execution error
--------------------------------------------------------
.. autoexception:: offlineimap.error.OfflineImapError
:members:
This execption inherits directly from :exc:`Exception` and is raised
on errors during the offlineimap execution. It has an attribute
`severity` that denotes the severity level of the error.

526
docs/doc-src/FAQ.rst Normal file
View File

@ -0,0 +1,526 @@
.. -*- coding: utf-8 -*-
.. NOTE TO MAINTAINERS: Please add new questions to the end of their
sections, so section/question numbers remain stable.
=============================================
OfflineIMAP FAQ (Frequently Asked Questions)
=============================================
:Web site: https://github.com/nicolas33/offlineimap
:Copyright: This document is licensed under GPLv2.
.. contents::
.. sectnum::
This is a work in progress.
Please feel free to ask questions and/or provide answers; send email to the
`mailing list`_.
.. _mailing list: http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project
.. _OfflineIMAP: https://github.com/nicolas33/offlineimap
.. _ssl.wrap_socket: http://docs.python.org/library/ssl.html#ssl.wrap_socket
OfflineIMAP
===========
Where do I get OfflineIMAP?
---------------------------
See the information on the Home page `OfflineIMAP`_.
How fast is it?
---------------
OfflineIMAP has a multithreaded sync, so it should have very nice performance.
OfflineIMAP versions 2.0 and above contain a multithreaded system. A good way
to experiment is by setting maxsyncaccounts to 3 and maxconnections to 3 in
each account clause.
This lets OfflineIMAP open up multiple connections simultaneously. That will
let it process multiple folders and messages at once. In most cases, this will
increase performance of the sync.
Dont set the number too high. If you do that, things might actually slow down
as your link gets saturated. Also, too many connections can cause mail servers
to have excessive load. Administrators might take unkindly to this, and the
server might bog down. There are many variables in the optimal setting; experimentation may help.
See the Performance section in the MANUAL for some tips.
What platforms does OfflineIMAP support?
----------------------------------------
It should run on most platforms supported by Python, with one exception: we do not support Windows, but some have made it work there.
The following has been reported by OfflineIMAP users. We do not test
OfflineIMAP on Windows, so we cant directly address their accuracy.
The basic answer is that its possible and doesnt require hacking OfflineIMAP
source code. However, its not necessarily trivial. The information below is
based in instructions submitted by Chris Walker::
First, you must run OfflineIMAP in the Cygwin environment. The Windows
filesystem is not powerful enough to accomodate Maildir by itself.
Next, youll need to mount your Maildir directory in a special
way. There is information for doing that at
http://barnson.org/node/295. That site gives this example::
mount -f -s -b -o managed "d:/tmp/mail" "/home/of/mail"
That URL also has more details on making OfflineIMAP work with Windows.
Does OfflineIMAP support mbox, mh, or anything else other than Maildir?
-----------------------------------------------------------------------
Not directly. Maildir was the easiest to implement. We are not planning
to write an mbox-backend, though if someone sent me well-written mbox
support and pledged to support it, it would be committed it to the tree.
However, OfflineIMAP can directly sync accounts on two different IMAP servers
together. So you could install an IMAP server on your local machine that
supports mbox, sync to it, and then instruct your mail readers to use the
mboxes.
Or you could install whatever IMAP server you like on the local machine, and
point your mail readers to that IMAP server on localhost.
What is the UID validity problem for folder?
--------------------------------------------
IMAP servers use a folders UIDVALIDITY value in combination with a
unique ID (UID) to refer to a specific message. This is guaranteed to
be unique to a particular message forever. No other message in the same
folder will ever get the same UID as long as UIDVALIDITY remains
unchanged. UIDs are an integral part of `OfflineIMAP`_'s
synchronization scheme; they are used to match up messages on your
computer to messages on the server.
Sometimes, the UIDs on the server might get reset. Usually this will
happen if you delete and then recreate a folder. When you create a
folder, the server will often start the UID back from 1. But
`OfflineIMAP`_ might still have the UIDs from the previous folder by the
same name stored. `OfflineIMAP`_ will detect this condition because of
the changed UIDVALIDITY value and skip the folder. This is GOOD,
because it prevents data loss.
In the IMAP<->Maildir case, you can fix it by removing your local folder
and cache data. For instance, if your folders are under `~/Folders` and
the folder with the problem is INBOX, you'd type this::
rm -r ~/Folders/INBOX
rm -r ~/.offlineimap/Account-AccountName/LocalStatus/INBOX
rm -r ~/.offlineimap/Repository-RemoteRepositoryName/FolderValidity/INBOX
(Of course, replace AccountName and RemoteRepositoryName with the names as
specified in `~/.offlineimaprc`).
Next time you run `OfflineIMAP`_, it will re-download the folder with the new
UIDs. Note that the procedure specified above will lose any local changes made
to the folder.
Some IMAP servers are broken and do not support UIDs properly. If you continue
to get this error for all your folders even after performing the above
procedure, it is likely that your IMAP server falls into this category.
`OfflineIMAP`_ is incompatible with such servers. Using `OfflineIMAP`_ with
them will not destroy any mail, but at the same time, it will not actually
synchronize it either. (`OfflineIMAP`_ will detect this condition and abort
prior to synchronization.)
This question comes up frequently on the `mailing list`_. You can find a detailed
discussion of the problem there
http://lists.complete.org/offlineimap@complete.org/2003/04/msg00012.html.gz.
How do I automatically delete a folder?
---------------------------------------
OfflineIMAP does not currently provide this feature. You will have to delete folders manually. See next entry too.
May I delete local folders?
---------------------------
`OfflineIMAP`_ does a two-way synchronization. That is, if you make a change
to the mail on the server, it will be propagated to your local copy, and
vise-versa. Some people might think that it would be wise to just delete all
their local mail folders periodically. If you do this with `OfflineIMAP`_,
remember to also remove your local status cache (`~/.offlineimap` by default).
Otherwise, `OfflineIMAP`_ will take this as an intentional deletion of many
messages and will interpret your action as requesting them to be deleted from
the server as well. (If you don't understand this, don't worry; you probably
won't encounter this situation.)
Can I run multiple instances?
-----------------------------
`OfflineIMAP`_ is not designed to have several instances (for instance, a cron
job and an interactive invocation) run over the same mailbox simultaneously.
It will perform a check on startup and abort if another `OfflineIMAP`_ is
already running. If you need to schedule synchronizations, you'll probably
find autorefresh settings more convenient than cron. Alternatively, you can
set a separate metadata directory for each instance.
In the future, we will lock each account individually rather than having one global lock.
Can I copy messages between folders?
---------------------------------------
Normally, when you copy a message between folders or add a new message to a
folder locally, `OfflineIMAP`_ will just do the right thing. However,
sometimes this can be tricky ― if your IMAP server does not provide the SEARCH
command, or does not return something useful, `OfflineIMAP`_ cannot determine
the new UID of the message. So, in these rare instances, OfflineIMAP will
upload the message to the IMAP server and delete it from your local folder.
Then, on your next sync, the message will be re-downloaded with the proper UID.
`OfflineIMAP`_ makes sure that the message was properly uploaded before
deleting it, so there should be no risk of data loss.
But if you try to sync between two IMAP servers, where both are unable to
provide you with UID of the new message, then this will lead to infinite loop.
`OfflineIMAP`_ will upload the message to one server and delete on second. On
next run it will upload the message to second server and delete on first, etc.
Does OfflineIMAP support POP?
-----------------------------
No.
How is OfflineIMAP conformance?
-------------------------------
* Internet Message Access Protocol version 4rev1 (IMAP 4rev1) as specified in
`2060`:RFC: and `3501`:RFC:
* CRAM-MD5 as specified in `2195`:RFC:
* Maildir as specified in the Maildir manpage and the qmail website
* Standard Python 2.6 as implemented on POSIX-compliant systems
Can I force OfflineIMAP to sync a folder right now?
---------------------------------------------------
Yes:
1) if you use the `Blinkenlights` UI. That UI shows the active
accounts as follows::
4: [active] *Control: .
3: [ 4:36] personal:
2: [ 3:37] work: .
1: [ 6:28] uni:
Simply press the appropriate digit (`3` for `personal`, etc.) to
resync that account immediately. This will be ignored if a resync is
already in progress for that account.
2) while in sleep mode, you can also send a SIGUSR1. See the :ref:`UNIX
signals` section in the MANUAL for details.
I get a "Mailbox already exists" error
--------------------------------------
**Q:** When synchronizing, I receive errors such as::
Folder 'sent'[main-remote] could not be created. Server responded:
('NO', ['Mailbox already exists.'])
**A:** IMAP folders are usually case sensitive. But some IMAP servers seem
to treat "special" folders as case insensitive (e.g. the initial
INBOX. part, or folders such as "Sent" or "Trash"). If you happen to
have a folder "sent" on one side of things and a folder called "Sent"
on the other side, offlineimap will try to create those folders on
both sides. If you server happens to treat those folders as
case-insensitive you can then see this warning.
You can solve this by excluding the "sent" folder by filtering it from
the repository settings::
folderfilter= lambda f: f not in ['sent']
Configuration Questions
=======================
Can I synchronize multiple accounts with OfflineIMAP?
-----------------------------------------------------
Of course!
Just name them all in the accounts line in the general section of the
configuration file, and add a per-account section for each one.
You can also optionally use the -a option when you run OfflineIMAP to request
that it only operate upon a subset of the accounts for a particular run.
How do I specify the names of folders?
--------------------------------------
You do not need to. OfflineIMAP is smart enough to automatically figure out
what folders are present on the IMAP server and synchronize them. You can use
the folderfilter and nametrans configuration file options to request only
certain folders and rename them as they come in if you like.
Also you can configure OfflineImap to only synchronize "subscribed" folders.
How do I prevent certain folders from being synced?
---------------------------------------------------
Use the folderfilter option. See the MANUAL for details and examples.
What is the mailbox name recorder (mbnames) for?
------------------------------------------------
Some mail readers, such as mutt, are not capable of automatically determining the names of your mailboxes. OfflineIMAP can help these programs by writing the names of the folders in a format you specify. See the example offlineimap.conf for details.
Does OfflineIMAP verify SSL certificates?
-----------------------------------------
You can verify an imapserver's certificate by specifying the CA
certificate on a per-repository basis by setting the `sslcacertfile`
option in the config file. (See the example offlineimap.conf for
details.) If you do not specify any CA certificate, you will be presented with the server's certificate fingerprint and add that to the configuration file, to make sure it remains unchanged.
No verification happens if connecting via STARTTLS.
How do I generate an `sslcacertfile` file?
------------------------------------------
The `sslcacertfile` file must contain an SSL certificate (or a concatenated
certificates chain) in PEM format. (See the documentation of
`ssl.wrap_socket`_'s `certfile` parameter for the gory details.) You can use either openssl or gnutls to create a certificate file in the required format.
#. via openssl::
openssl s_client -CApath /etc/ssl/certs -connect ${hostname}:imaps -showcerts \
| perl -ne 'print if /BEGIN/../END/; print STDERR if /return/' > $sslcacertfile
^D
#. via gnutls::
gnutls-cli --print-cert -p imaps ${host} </dev/null | sed -n \
| '/^-----BEGIN CERT/,/^-----END CERT/p' > $sslcacertfile
The path `/etc/ssl/certs` is not standardized; your system may store
SSL certificates elsewhere. (On some systems it may be in
`/usr/local/share/certs/`.)
Before using the resulting file, ensure that openssl verified the certificate
successfully. In case of problems, you can test the certificate using a command such as (credits to Daniel Shahaf for this) to verify the certificate::
% openssl s_client -CAfile $sslcacertfile -connect ${hostname}:imaps 2>&1 </dev/null
If the server uses STARTTLS, pass the -starttls option and the 'imap' port.
Also, you can test using gnutls::
gnutls-cli --x509cafile certs/mail.mydomain.eu.cert -p 993 mail.mydomain.eu
IMAP Server Notes
=================
In general, OfflineIMAP works with any IMAP server that provides compatibility
with the IMAP RFCs. Some servers provide imperfect compatibility that may be
good enough for general clients. OfflineIMAP needs more features, specifically
support for UIDs, in order to do its job accurately and completely.
Client Notes
============
What clients does OfflineIMAP work with?
----------------------------------------
Any client that supports Maildir. Popular ones include mutt, Evolution and
KMail. Thunderbird does not have maildir suppport.
With OfflineIMAPs IMAP-to-IMAP syncing, this can be even wider; see the next
question.
Evolution
---------
OfflineIMAP can work with Evolution. To do so, first configure your OfflineIMAP
account to have sep = / in its configuration. Then, configure Evolution with
the “Maildir-format mail directories” server type. For the path, you will need
to specify the name of the top-level folder inside your OfflineIMAP storage
location. Youre now set!
KMail
-----
At this time, I believe that OfflineIMAP with Maildirs is not compatible with
KMail. KMail cannot work in any mode other than to move all messages out of all
folders immediately, which (besides being annoying and fundamentally broken) is
incompatible with OfflineIMAP.
However, I have made KMail version 3 work well with OfflineIMAP by installing
an IMAP server on my local machine, having OfflineIMAP sync to that, and
pointing KMail at the same server.
Another way to see mails downloaded with offlineimap in KMail (KDE4) is to
create a local folder (e.g. Backup) and then use ``ln -s
localfolders_in_offlineimaprc ~/.kde/share/apps/kmail/mail/.Backup.directory``.
Maybe you have to rebuild the index of the new folder. Works well with KMail
1.11.4 (KDE4.x), offlineimap 6.1.2 and ArchLinux and sep = / in .offlineimaprc.
Mutt
----
* Do I need to use set maildir_trash?
Other IMAP sync programs require you to do this. OfflineIMAP does not. Youll
get the best results without it, in fact, though turning it on wont hurt
anything.
* How do I set up mbnames with mutt?
The example offlineimap.conf file has this example. In your offlineimap.conf,
youll list this::
[mbnames]
enabled = yes
filename = ~/Mutt/muttrc.mailboxes
header = "mailboxes "
peritem = "+%(accountname)s/%(foldername)s"
sep = " "
footer = "\n"
Then in your ``.muttrc``::
source ~/Mutt/muttrc.mailboxes
You might also want to set::
set mbox_type=Maildir
set folder=$HOME/Maildirpath
The OfflineIMAP manual has a more detailed example for doing this for multiple
accounts.
Miscellaneous Questions
=======================
I'm using git to install OfflineIMAP and found these branches called "master", "maint", "next", "pu" and "gh-pages". What are they?
-----------------------------------------------------------------------------------------------------------------------------------
To be brief:
* **gh-pages**: branch used to maintain the home page at github.
* **master**: classical mainline branch.
* **next**: this is the branch for recent merged patches. Used for testing OfflineIMAP.
* **pu** ("proposed updates"): patches not ready for inclusion. This should **never** be checkouted!
* **maint**: our long-living maintenance branch. We maintain this branch
(security and bugfixes) for users who don't want or can't upgrade to the
latest release.
For more information about the branching model and workflow, see the HACKING page.
Why are your Maildir message filenames so long?
-----------------------------------------------
OfflineIMAP has two relevant principles: 1) never modifying your messages in
any way and 2) ensuring 100% reliable synchronizations. In order to do a
reliable sync, OfflineIMAP must have a way to uniquely identify each e-mail.
Three pieces of information are required to do this: your account name, the
folder name, and the message UID. The account name can be calculated from the
path in which your messages are. The folder name can usually be as well, BUT
some mail clients move messages between folders by simply moving the file,
leaving the name intact.
So, OfflineIMAP must store both a message UID and a folder ID. The
folder ID is necessary so OfflineIMAP can detect a message being moved
to a different folder. OfflineIMAP stores the UID (U= number) and an
md5sum of the foldername (FMD5= number) to facilitate this.
What can I do to ensure OfflineIMAP is still running and hasnt crashed?
------------------------------------------------------------------------
This shell script will restart OfflineIMAP if it has crashed. Sorry, its
written in Korn, so youll need ksh, pdksh, or mksh to run it::
#!/bin/ksh
# remove any old instances of this shell script or offlineimap
for pid in $(pgrep offlineimap)
do
if $pid -ne $$
then
kill $pid
fi
done
# wait for compiz (or whatever) to start and setup wifi
sleep 20
# If offlineimap exits, restart it
while true
do
( exec /usr/bin/offlineimap -u Noninteractive.Quiet )
sleep 60 # prevents extended failure condition
Contributing
============
How to test OfflineIMAP?
------------------------
We don't have a testing tool, for now. As a IMAP client, we need an available
IMAP server for that purpose. But it doesn't mean you can do anything.
Recent patches are merged in the next branch before beeing in the mainline. Once
you have your own copy of the official repository, track this next branch::
git checkout -t origin/next
Update this branch in a regular basis with::
git checkout next
git pull
Notice you're not supposed to install OfflineIMAP each time. You may simply
run it like this::
./offlineimap.py
The choice is up to you. :-)
How to submit a patch?
----------------------
If you want to send regular patches, you should first subscribe to the `mailing
list`_. This is not a pre-requisite, though.
Next, you'll find documentation in the docs/ directory, especially the HACKING
page.
You'll need to get a clone from the official `OfflineIMAP`_ repository and
configure Git. Then, read the SubmittingPatches.rst page in your local
repository or at
https://github.com/nicolas33/offlineimap/blob/master/SubmittingPatches.rst#readme
.
To send a patch, we recommend using 'git send-email'.
Where from should my patches be based on?
-----------------------------------------
Depends. If you're not sure, it should start off of the master
branch. master is the branch where new patches should be based on by
default.
Obvious materials for next release (e.g. new features) start off of
current next. Also, next is the natural branch to write patches on top
of commits not already in master.
A fix for a very old bug or security issue may start off of maint. This isn't
needed since such fix are backported by the maintainer, though.
Finally, a work on very active or current development can start from a topic
next. This clearly means you **need** this topic as a base for what is intended.

1
docs/doc-src/INSTALL.rst Symbolic link
View File

@ -0,0 +1 @@
../INSTALL.rst

1
docs/doc-src/MANUAL.rst Symbolic link
View File

@ -0,0 +1 @@
../MANUAL.rst

200
docs/doc-src/conf.py Normal file
View File

@ -0,0 +1,200 @@
# -*- coding: utf-8 -*-
#
# pyDNS documentation build configuration file, created by
# sphinx-quickstart on Tue Feb 2 10:00:47 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0,os.path.abspath('../..'))
from offlineimap import __version__,__author__
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo']
autoclass_content = "both"
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'OfflineImap'
copyright = u'2002-2010, ' + __author__
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = __version__
# The full version, including alpha/beta/rc tags.
release = __version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = []
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = False
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'
#html_style = ''
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['html']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
html_use_modindex = False
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'dev-doc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'offlineimap.tex', u'OfflineImap Documentation',
u'OfflineImap contributors', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}

66
docs/doc-src/features.rst Normal file
View File

@ -0,0 +1,66 @@
Description
===========
OfflineIMAP is a tool to simplify your e-mail reading. With 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. 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.
OfflineIMAP works on pretty much any POSIX operating system, such as Linux, BSD
operating systems, MacOS X, Solaris, etc.
OfflineIMAP is a Free Software project licensed under the GNU General Public
License. You can download it for free, and you can modify it. In fact, you are
encouraged to contribute to OfflineIMAP, and doing so is fast and easy.
OfflineIMAP is 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,
OfflineIMAP features a multi-threaded synchronization algorithm that can
dramatically speed up performance in many situations by synchronizing several
different things simultaneously.
OfflineIMAP is 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.
OfflineIMAP is 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 OfflineIMAP pre-release,
development, and beta releases. Of course, legally speaking, OfflineIMAP comes
with no warranty, so I am not responsible if this turns out to be wrong.
.. note: OfflineImap was written by John Goerzen, who retired from
maintaining. It is now maintained by Nicolas Sebrecht & Sebastian
Spaeth at https://github.com/spaetz/offlineimap. Thanks to John
for his great job and to have share this project with us.
Method of Operation
===================
OfflineIMAP traditionally operates by maintaining a hierarchy of mail folders in
Maildir format locally. Your own mail reader will read mail from this tree, and
need never know that the mail comes from IMAP. OfflineIMAP will detect changes
to the mail folders on your IMAP server and your own computer and
bi-directionally synchronize them, copying, marking, and deleting messages as
necessary.
With OfflineIMAP 4.0, a powerful new ability has been introduced ― the program
can now synchronize two IMAP servers with each other, with no need to have a
Maildir layer in-between. Many people use this if they use a mail reader on
their local machine that does not support Maildirs. People may install an IMAP
server on their local machine, and point both OfflineIMAP and their mail reader
of choice at it. This is often preferable to the mail reader's own IMAP support
since OfflineIMAP supports many features (offline reading, for one) that most
IMAP-aware readers don't. However, this feature is not as time-tested as
traditional syncing, so my advice is to stick with normal methods of operation
for the time being.

46
docs/doc-src/index.rst Normal file
View File

@ -0,0 +1,46 @@
.. OfflineImap documentation master file
.. _OfflineImap: http://offlineimap.org
Welcome to :mod:`offlineimaps`'s documentation
==============================================
`OfflineImap`_ synchronizes email between an IMAP server and a MailDir or between two IMAP servers. It offers very powerful and flexible configuration options, that allow things such as the filtering of folders, transposing of names via static configuration or python scripting. It plays well with mutt and other MailDir consuming email clients.
The documentation contains the end user documentation in a first part. It also contains use cases and example configurations. It is followed by the internal :doc:`API documentation <API>` for those interested in modifying the source code or otherwise peek into the OfflineImap internals in a second part.
If you just want to get started with minimal fuzz, have a look at our `online quick start guide <http://offlineimap.org/#ref-quick-start>`_. Do note though, that our configuration options are many and powerful. Perusing our precious documentation does often pay off!
More information on specific topics can be found on the following pages:
**User documentation**
* :doc:`Overview and features <features>`
* :doc:`installation/uninstall <INSTALL>`
* :doc:`user manual/Configuration <MANUAL>`
* :doc:`Folder filtering & name transformation guide <nametrans>`
* :doc:`command line options <offlineimap>`
* :doc:`Frequently Asked Questions <FAQ>`
**Developer documentation**
* :doc:`API documentation <API>` for internal details on the
:mod:`offlineimap` module
.. toctree::
:hidden:
features
INSTALL
MANUAL
nametrans
offlineimap
FAQ
API
repository
ui
.. moduleauthor:: John Goerzen, and many others. See AUTHORS and the git history for a full list.
:License: This module is covered under the GNU GPL v2 (or later).

184
docs/doc-src/nametrans.rst Normal file
View File

@ -0,0 +1,184 @@
.. _folder_filtering_and_name_translation:
Folder filtering and Name translation
=====================================
OfflineImap provides advanced and potentially complex possibilities for
filtering and translating folder names. If you don't need any of this, you can
safely skip this section.
.. warning::
Starting with v6.4.0, OfflineImap supports the creation of folders on the remote repostory. This change means that people that only had a nametrans option on the remote repository (everyone) will need to have a nametrans setting on the local repository too that will reverse the name transformation. See section `Reverse nametrans`_ for details.
folderfilter
------------
If you do not want to synchronize all your filters, you can specify a `folderfilter`_ function that determines which folders to include in a sync and which to exclude. Typically, you would set a folderfilter option on the remote repository only, and it would be a lambda or any other python function.
The only parameter to that function is the folder name. If the filter
function returns True, the folder will be synced, if it returns False,
it. will be skipped. The folderfilter operates on the *UNTRANSLATED*
name (before any `nametrans`_ fudging takes place). Consider the
examples below to get an idea of what they do.
Example 1: synchronizing only INBOX and Sent::
folderfilter = lambda folder: folder in ['INBOX', 'Sent']
Example 2: synchronizing everything except Trash::
folderfilter = lambda folder: folder not in ['Trash']
Example 3: Using a regular expression to exclude Trash and all folders
containing the characters "Del"::
folderfilter = lambda folder: not re.search('(^Trash$|Del)', folder)
.. note::
If folderfilter is not specified, ALL remote folders will be
synchronized.
You can span multiple lines by indenting the others. (Use backslashes
at the end when required by Python syntax) For instance::
folderfilter = lambda foldername: foldername in
['INBOX', 'Sent Mail', 'Deleted Items',
'Received']
Usually it suffices to put a `folderfilter`_ setting in the remote repository section. You might want to put a folderfilter option on the local repository if you want to prevent some folders on the local repository to be created on the remote one. (Even in this case, folder filters on the remote repository will prevent that)
folderincludes
--------------
You can specify `folderincludes`_ to manually include additional folders to be synced, even if they had been filtered out by a folderfilter setting. `folderincludes`_ should return a Python list.
This can be used to 1) add a folder that was excluded by your
folderfilter rule, 2) to include a folder that your server does not specify
with its LIST option, or 3) to include a folder that is outside your basic
`reference`. The `reference` value will not be prefixed to this folder
name, even if you have specified one. For example::
folderincludes = ['debian.user', 'debian.personal']
This will add the "debian.user" and "debian.personal" folders even if you
have filtered out everything starting with "debian" in your folderfilter
settings.
nametrans
----------
Sometimes, folders need to have different names on the remote and the
local repositories. To achieve this you can specify a folder name
translator. This must be a eval-able Python expression that takes a
foldername arg and returns the new value. We suggest a lambda function,
but it could be any python function really. If you use nametrans rules, you will need to set them both on the remote and the local repository, see `Reverse nametrans`_ just below for details. The following examples are thought to be put in the remote repository section.
The below will remove "INBOX." from the leading edge of folders (great
for Courier IMAP users)::
nametrans = lambda folder: re.sub('^INBOX\.', '', folder)
Using Courier remotely and want to duplicate its mailbox naming
locally? Try this::
nametrans = lambda folder: re.sub('^INBOX\.*', '.', folder)
.. warning::
You MUST construct nametrans rules such that it NEVER returns the
same value for two folders, UNLESS the second values are filtered
out by folderfilter below. That is, two filters on one side may
never point to the same folder on the other side. Failure to follow
this rule will result in undefined behavior. See also *Sharing a
maildir with multiple IMAP servers* in the :ref:`pitfalls` section.
Reverse nametrans
+++++++++++++++++
Since 6.4.0, OfflineImap supports the creation of folders on the remote repository and that complicates things. Previously, only one nametrans setting on the remote repository was needed and that transformed a remote to a local name. However, nametrans transformations are one-way, and OfflineImap has no way using those rules on the remote repository to back local names to remote names.
Take a remote nametrans rule `lambda f: re.sub('^INBOX/','',f)` which cuts of any existing INBOX prefix. Now, if we parse a list of local folders, finding e.g. a folder "Sent", is it supposed to map to "INBOX/Sent" or to "Sent"? We have no way of knowing. This is why **every nametrans setting on a remote repository requires an equivalent nametrans rule on the local repository that reverses the transformation**.
Take the above examples. If your remote nametrans setting was::
nametrans = lambda folder: re.sub('^INBOX\.', '', folder)
then you will want to have this in your local repository, prepending "INBOX" to any local folder name::
nametrans = lambda folder: 'INBOX' + folder
Failure to set the local nametrans rule will lead to weird-looking error messages of -for instance- this type::
ERROR: Creating folder moo.foo on repository remote
Folder 'moo.foo'[remote] could not be created. Server responded: ('NO', ['Unknown namespace.'])
(This indicates that you attempted to create a folder "Sent" when all remote folders needed to be under the prefix of "INBOX.").
OfflineImap will make some sanity checks if it needs to create a new
folder on the remote side and a back-and-forth nametrans-lation does not
yield the original foldername (as that could potentially lead to
infinite folder creation cycles).
You can probably already see now that creating nametrans rules can be a pretty daunting and complex endeavour. Check out the Use cases in the manual. If you have some interesting use cases that we can present as examples here, please let us know.
Debugging folderfilter and nametrans
------------------------------------
Given the complexity of the functions and regexes involved, it is easy to misconfigure things. One way to test your configuration without danger to corrupt anything or to create unwanted folders is to invoke offlineimap with the `--info` option.
It will output a list of folders and their transformations on the screen (save them to a file with -l info.log), and will help you to tweak your rules as well as to understand your configuration. It also provides good output for bug reporting.
FAQ on nametrans
----------------
Where to put nametrans rules, on the remote and/or local repository?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If you never intend to create new folders on the LOCAL repository that
need to be synced to the REMOTE repository, it is sufficient to create a
nametrans rule on the remote Repository section. This will be used to
determine the names of new folder names on the LOCAL repository, and to
match existing folders that correspond.
*IF* you create folders on the local repository, that are supposed to be
automatically created on the remote repository, you will need to create
a nametrans rule that provides the reverse name translation.
(A nametrans rule provides only a one-way translation of names and in
order to know which names folders on the LOCAL side would have on the
REMOTE side, you need to specify the reverse nametrans rule on the local
repository)
OfflineImap will complain if it needs to create a new folder on the
remote side and a back-and-forth nametrans-lation does not yield the
original foldername (as that could potentially lead to infinite folder
creation cycles).
What folder separators do I need to use in nametrans rules?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
**Q:** If I sync from an IMAP server with folder separator '/' to a
Maildir using the default folder separator '.' which do I need to use
in nametrans rules?::
nametrans = lambda f: "INBOX/" + f
or::
nametrans = lambda f: "INBOX." + f
**A:** Generally use the folder separator as defined in the repository
you write the nametrans rule for. That is, use '/' in the above
case. We will pass in the untranslated name of the IMAP folder as
parameter (here `f`). The translated name will ultimately have all
folder separators be replaced with the destination repositories'
folder separator.
So if 'f' was "Sent", the first nametrans yields the translated name
"INBOX/Sent" to be used on the other side. As that repository uses the
folder separator '.' rather than '/', the ultimate name to be used will
be "INBOX.Sent".
(As a final note, the smart will see that both variants of the above
nametrans rule would have worked identically in this case)

View File

@ -0,0 +1,92 @@
The offlineimap 'binary' command line options
=============================================
Offlineimap is invoked with the following pattern: `offlineimap [args...]`.
Where [args...] are as follows:
Options:
--dry-run This mode protects us from performing any actual action.
It will not precisely give the exact information what
will happen. If e.g. it would need to create a folder,
it merely outputs "Would create folder X", but not how
many and which mails it would transfer.
--info Output information on the configured email
repositories. Useful for debugging and bug reporting.
Use in conjunction with the -a option to limit the
output to a single account.
--version show program's version number and exit
-h, --help show this help message and exit
-1 Disable all multithreading operations and use solely a
single-thread sync. This effectively sets the
maxsyncaccounts and all maxconnections configuration
file variables to 1.
-P DIR Sets OfflineIMAP into profile mode. The program will
create DIR (it must not already exist). As it runs,
Python profiling information about each thread is
logged into profiledir. Please note: This option is
present for debugging and optimization only, and
should NOT be used unless you have a specific reason
to do so. It will significantly slow program
performance, may reduce reliability, and can generate
huge amounts of data. This option implies the
singlethreading option (-1).
-a ACCOUNTS Overrides the accounts section in the config file.
Lets you specify a particular account or set of
accounts to sync without having to edit the config
file. You might use this to exclude certain accounts,
or to sync some accounts that you normally prefer not
to.
-c FILE Specifies a configuration file to use in lieu of
~/.offlineimaprc.
-d type1,[type2...] Enables debugging for OfflineIMAP. This is useful if
you are trying to track down a malfunction or figure
out what is going on under the hood. I suggest that
you use this with -1 in order to make the results more
sensible. This option requires one or more debugtypes,
separated by commas. These define what exactly will
be debugged, and so far include the options: imap,
thread,maildir or ALL. The imap option will enable
IMAP protocol stream and parsing debugging. Note that
the output may contain passwords, so take care to
remove that from the debugging output before sending
it to anyone else. The maildir option will enable
debugging for certain Maildir operations.
-l FILE Log to FILE
-f folder1,[folder2...]
Only sync the specified folders. The 'folder's are the
*untranslated* foldernames. This command-line option
overrides any 'folderfilter' and 'folderincludes'
options in the configuration file.
-k `[section:]option=value`
Override configuration file option. If"section" is
omitted, it defaults to "general". Any underscores
"_" in the section name are replaced with spaces:
for instance, to override option "autorefresh" in
the "[Account Personal]" section in the config file
one would use "-k Account_Personal:autorefresh=30".
-o Run only once, ignoring any autorefresh setting in the
configuration file.
-q Run only quick synchronizations. Ignore any flag
updates on IMAP servers.
-u INTERFACE Specifies an alternative user interface to use. This
overrides the default specified in the configuration
file. The UI specified with -u will be forced to be
used, even if checks determine that it is not usable.
Possible interface choices are: Curses.Blinkenlights,
TTY.TTYUI, Noninteractive.Basic, Noninteractive.Quiet,
Machine.MachineUI
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`

View File

@ -0,0 +1,68 @@
.. currentmodule:: offlineimap.repository
:mod:`offlineimap.repository` -- Email repositories
------------------------------------------------------------
A derivative of class
:class:`Base.BaseRepository` represents an email
repository depending on the type of storage, possible options are:
* :class:`IMAPRepository`,
* :class:`MappedIMAPRepository`
* :class:`GmailRepository`,
* :class:`MaildirRepository`, or
* :class:`LocalStatusRepository`.
Which class you need depends on your account
configuration. The helper class :class:`offlineimap.repository.Repository` is
an *autoloader*, that returns the correct class depending
on your configuration. So when you want to instanciate a new
:mod:`offlineimap.repository`, you will mostly do it through this class.
.. autoclass:: offlineimap.repository.Repository
:members:
:inherited-members:
:mod:`offlineimap.repository.Base.BaseRepository` -- Representation of a mail repository
------------------------------------------------------------------------------------------
.. autoclass:: offlineimap.repository.Base.BaseRepository
:members:
:inherited-members:
:undoc-members:
.. .. note:: :meth:`foo`
.. .. attribute:: Database.MODE
Defines constants that are used as the mode in which to open a database.
MODE.READ_ONLY
Open the database in read-only mode
MODE.READ_WRITE
Open the database in read-write mode
.. autoclass:: offlineimap.repository.IMAPRepository
.. autoclass:: offlineimap.repository.MappedIMAPRepository
.. autoclass:: offlineimap.repository.GmailRepository
.. autoclass:: offlineimap.repository.MaildirRepository
.. autoclass:: offlineimap.repository.LocalStatusRepository
:mod:`offlineimap.folder` -- Basic representation of a local or remote Mail folder
---------------------------------------------------------------------------------------------------------
.. autoclass:: offlineimap.folder.Base.BaseFolder
:members:
:inherited-members:
:undoc-members:
.. .. attribute:: Database.MODE
Defines constants that are used as the mode in which to open a database.
MODE.READ_ONLY
Open the database in read-only mode
MODE.READ_WRITE
Open the database in read-write mode

27
docs/doc-src/ui.rst Normal file
View File

@ -0,0 +1,27 @@
:mod:`offlineimap.ui` -- A flexible logging system
--------------------------------------------------------
.. currentmodule:: offlineimap.ui
OfflineImap has various ui systems, that can be selected. They offer various functionalities. They must implement all functions that the :class:`offlineimap.ui.UIBase` offers. Early on, the ui must be set using :meth:`getglobalui`
.. automethod:: offlineimap.ui.setglobalui
.. automethod:: offlineimap.ui.getglobalui
Base UI plugin
^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: offlineimap.ui.UIBase.UIBase
:members:
:inherited-members:
.. .. note:: :meth:`foo`
.. .. attribute:: Database.MODE
Defines constants that are used as the mode in which to open a database.
MODE.READ_ONLY
Open the database in read-only mode
MODE.READ_WRITE
Open the database in read-write mode