Commit Graph

2297 Commits

Author SHA1 Message Date
Nicolas Sebrecht cbd1a8929a folder: IMAP: change raw assert to OfflineImapError
There is not reason to block remainings actions on first error on UID STORE.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-04 02:21:22 +02:00
Christopher League c7434ea46c Fix typo in format string in machineui
This was causing the error message "not all arguments converted during
string formatting." Specifically:

```
% offlineimap -u machineui
OfflineIMAP 7.0.4
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
msg:protocol:MainThread:7.2.0
msg:initbanner:MainThread:OfflineIMAP+7.0.4%0A++Licensed+under+the+GNU+GPL+v2+or+any+later+version+%28with+an+OpenSSL+exception%29
msg:registerthread:Account+sync+MYHOST:MYHOST
msg:acct:Account+sync+MYHOST:MYHOST
error::Account+sync+MYHOST:ERROR%3A+While+attempting+to+sync+account+%27MYHOST%27%0A++not+all+arguments+converted+during+string+formatting
msg:acctdone:Account+sync+MYHOST:MYHOST
msg:threadExited:MainThread:Account+sync+MYHOST
msg:unregisterthread:MainThread:Account+sync+MYHOST
msg:terminate:MainThread:0%0A%0A
```

Signed-off-by: Christopher League <league@contrapunctus.net>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-04 02:20:10 +02:00
Nicolas Sebrecht 460fc614b6 CONTRIBUTING: add link to external page on "How to fix a bug"
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-03 13:24:41 +02:00
Nicolas Sebrecht fc54fe52a0 folder: IMAP: add 'imap' debug output before calling FETCH
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-03 01:25:39 +02:00
Nicolas Sebrecht 65331de50d README: add link to the official repository on top of the page
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-03 00:01:17 +02:00
Nicolas Sebrecht 91f13e9b03 v7.0.4
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-02 20:26:49 +02:00
Nicolas Sebrecht b19eaebad1 ConfigHelperMixin must be new-style class to not break inheritance
Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/363
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-30 04:26:25 +02:00
Nicolas Sebrecht e460228bfc v7.0.3
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-30 01:56:10 +02:00
Nicolas Sebrecht 64b733c190 make systemd service kill offlineimap as expected
Most users expects the daemon to be instantly shut down when using systemd kill.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-30 01:47:25 +02:00
Nicolas Sebrecht 203c28f21f add the repository name when connecting
Otherwise, it might be impossible to know which account is connecting when more
than one is syncing.

Code style.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-30 01:44:27 +02:00
Nicolas Sebrecht 9aa5afa951 XOAUTH2: fix the *_eval configuration options
They introduce a regression not allowing to discard the XOAUTH2 method when
expected.

The default lambda did not take the "account_name" argument.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/362
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-29 16:38:58 +02:00
Nicolas Sebrecht ddbc1426d5 github template: add system/distribution
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-28 18:47:36 +02:00
Nicolas Sebrecht b4e33eeac4 XOAUTH2: use one "public" attribute everywhere for self.oauth2_request_url
Improve documentation.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-28 18:35:33 +02:00
Nicolas Sebrecht be285e522d IMAP: don't take junk data for valid mail content
OfflineIMAP frequently delivers mail files to the Maildir consisting exclusively
of a single ASCII digit in IDLE mode. IMAPFolder.getmessage expects 'data' to be
of the form

  [(fetch-info, message-body)]

However, the imapobj.uid call in getmessage returns a list of *all* pending
untagged FETCH responses.  If any message flags were changed in the selected
IMAP folder since the last command (by another client or another thread in
OfflineIMAP itself), the IMAP server will issue unsolicited FETCH responses
indicating these flag changes (RFC3501, section 7).  When this happens, 'data'
will look like, for example

  ['1231 (FLAGS (\\Seen) UID 5300)',
   '1238 (FLAGS (\\Seen) UID 5318)',
   ('1242 (UID 5325 BODY[] {7976}', message-body)]

Unfortunately, getmessage retrieves the message body as data[0][1], which in
this example is just the string "2", and this is what gets stored in the mail
file.

Multi-threaded OfflineIMAP with IDLE or holdconnectionopen is particularly
susceptible to this problem because flag changes synced back to the IMAP server
on one thread will appear as unsolicited FETCH responses on another thread if it
happens to have the same folder selected.  This can also happen without IDLE or
holdconnectionopen or even in single-threaded OfflineIMAP with concurrent access
from other IMAP clients (webmail clients, etc.), though the window for the bug
is much smaller.

Ideally, either imaplib2 or getmessage would parse the fetch responses to find
the response for the requested UID.  However, since IMAP only specifies
unilateral FETCH responses for flag changes, it's almost certainly safe to
simply find the element of 'data' that is a tuple (perhaps aborting if there is
more than one tuple) and use that.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/162
Based-on-patch-by: Austin Clements <amdragon@MIT.EDU>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-28 07:18:23 +02:00
Nicolas Sebrecht 0ef11a8392 folder/IMAP: code style
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-28 06:51:47 +02:00
Nicolas Sebrecht 894745e657 manual: add known issue about netrc
Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/295
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-28 04:18:18 +02:00
Nicolas Sebrecht 0b824bdc49 offlineimap.conf: allow non-spaces in the account list
Commit c992f58530 pretends to fix this bug it doesn't.

Regression introduced in v7.0.0.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/355
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-28 04:06:52 +02:00
Nicolas Sebrecht 88e8a4895e minor code enhancements
- More class inherit from object.
- Initialize all attributes.
- Code style.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-28 00:42:35 +02:00
Nicolas Sebrecht 7fe90b8e0d properly ignore folders with invalid characters (sep) in their name
Commit 6b28071b0f makes the check once nametrans is applied. This is wrong
because separators are valid characters in names returned by nametrans. E.g:

  "Sent" -> "[Gmail]/Sent"

Make the check against the raw name of the folder, instead.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/353
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-27 18:45:18 +02:00
Nicolas Sebrecht ce1de85157 v7.0.2
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-27 16:38:55 +02:00
Philipp Meier 560d631706 GmailMaildir: don't add a tuple to syncmessagesto_passes
Regression introduced by 59b712ecbc.

Fix-found-by: Abdo Roig-Maranges <abdo.roig@gmail.com>
Signed-off-by: Philipp Meier <github@philipp.meier.name>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-27 16:29:34 +02:00
Nicolas Sebrecht b521b98d99 offlineimap.conf: learn to evaluate oauth2 related options
Introduce:
- oauth2_client_id_eval
- oauth2_client_secret_eval
- oauth2_access_token_eval
- oauth2_refresh_token_eval

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/307
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-27 04:25:18 +02:00
Ævar Arnfjörð Bjarmason a1efae0703 Remove double import of "six"
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-27 03:19:14 +02:00
Nicolas Sebrecht 65295b01ef v7.0.1
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-26 08:53:18 +02:00
Nicolas Sebrecht 2f060aa269 Merge tag 'v6.7.0.3' into next
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-26 08:47:19 +02:00
Nicolas Sebrecht ecef22a16c v6.7.0.3
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-26 08:46:22 +02:00
Nicolas Sebrecht 77a6f9a7ba LocalStatusSQLite: code refactoring around database lock
Backported-from: 05e5b9c6bb
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-26 02:58:09 +02:00
Nicolas Sebrecht 05e5b9c6bb LocalStatusSQLite: code refactoring around database lock
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-26 02:56:36 +02:00
Nicolas Sebrecht 038a433f69 backport: sqlite: properly serialize operations on the databases
1. There is one database per folder and sqlite requires to serialize the
writings. Instead of locking at LocalStatusSQLiteFolder object level, introduce
a new DatabaseFileLock object which is shared across threads. This fixes the
concurrent writes issues that some users might experience by duplications or
flags restored to the previous state.

2. Close the database only when we are sure no other threads will use the
connection on a *per-file* basis. Previous fix 677afb8d8f is wrong
because the same lock is shared for all the databases.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/350
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-26 02:00:17 +02:00
Nicolas Sebrecht 3c42913120 sqlite: properly serialize operations on the databases
1. There is one database per folder and sqlite requires to serialize the
writings. Instead of locking at LocalStatusSQLiteFolder instance level,
introduce a new DatabaseFileLock object which is shared across threads. This
fixes the concurrent writes issues that some users might experience by
duplications or flags restored to the previous state.

2. Close the database only when we are sure no other threads will use the
connection on a *per-file* basis. Previous fix 677afb8d8f is wrong
because the same lock is shared for all the database files.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/350
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-26 01:57:25 +02:00
Nicolas Sebrecht 5aa2a883f0 local status: deletemessagelist: remove broken code
This did not work and is not usefull since the purge() method was introduced in
1410a391bc. Actually, the purge() does what deletemessagelist() was supposed to
achieve.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-25 15:06:39 +02:00
Nicolas Sebrecht fbc3b15888 IMAP/IMAP: fix import issue about UIDMaps
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-25 05:26:57 +02:00
Nicolas Sebrecht 03859e89c3 improve error message when ssl_version must be set due to the tls_level
Improve the ssl documentation.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-25 03:29:25 +02:00
Nicolas Sebrecht c992f58530 offlineimap.conf: allow non-spaces in the account list
Regression introduced in v7.0.0.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/355
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-24 19:39:43 +02:00
Nicolas Sebrecht 436e82531b website-doc.sh: fix link in announces.yml
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 17:57:24 +02:00
Nicolas Sebrecht e02f1491c9 release.sh: don't mess the mainline Changelog with commits in maint
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 17:38:58 +02:00
Nicolas Sebrecht 63f0622d41 website-doc: order announces by date
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 17:21:13 +02:00
Nicolas Sebrecht 284c66b04a v7.0.0
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 16:56:43 +02:00
Nicolas Sebrecht 8c36806784 Merge tag 'v6.7.0.2' into next 2016-07-22 16:42:28 +02:00
Nicolas Sebrecht 41fdd4ee78 v6.7.0.2
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 16:34:04 +02:00
Nicolas Sebrecht e753766284 sqlite: close the database when no more threads need access
It's required to have more than one connection to the database for the
maxconnections configuration option to work with threads. However,
connection.close() is closing all the connections. Only close the connection
when no more thread need it.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/350
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 16:30:38 +02:00
Nicolas Sebrecht 6d0dba0d86 release.sh: learn to merge maint branch into next before releasing
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 10:15:07 +02:00
Nicolas Sebrecht 677afb8d8f sqlite: close the database when no more threads need access
It's required to have more than one connection to the database for the
maxconnections configuration option to work with threads. However,
connection.close() is closing all the connections. Only close the connection
when no more thread need it.

Backported-from: 856b74407bd7f634cae5a8c2d9b84e13d14c12d2
Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/350
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 09:19:09 +02:00
Nicolas Sebrecht 034c55a278 --info: allow user to enter a password
Change from basic UI to ttyui.

Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/352
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-22 01:44:38 +02:00
Nicolas Sebrecht 59b712ecbc remove dead code: the description of the passes is never used
Some minor style fixes.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-18 18:41:41 +02:00
Nicolas Sebrecht 2f3c01f0be offlineimap.conf: improve documentation for copy_ignore_eval
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-18 18:38:59 +02:00
Nicolas Sebrecht 80dcf76414 fix attribute name _utime_from_header
Code style.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-16 21:25:14 +02:00
Nicolas Sebrecht 59f5da5e9e Maildir: OfflineImapError is missing the severity argument
Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/350
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-16 18:02:01 +02:00
Nicolas Sebrecht 1a96d588d5 fix: configparser does not know about python types like u""
Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/347
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-13 14:02:25 +02:00
Nicolas Sebrecht 7b425d4c87 manual: offlineimapui: fix minor rendering issue
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-12 18:10:38 +02:00