a message from a string to an email object that is part of the built-in
email library. The allows for emails to be processed as bytes and
re-encoded properly if they are not UTF-8 or ascii encoded. Currently
these changes cover the Base, IMAP, and Maildir classes but not the
specialized GMAIL class yet.
This patch remves the set() mutable argument as default value,
sets the default value to None and check if the argument is none
in the code to call set().
This patch change these errors in the 'folder' folder
C0121: Comparison to None should be 'expr is None' (singleton-comparison)
C0121: Comparison to None should be 'expr is not None' (singleton-comparison)
This patch removes these lintian warnings:
Warning R0205: Class 'X' inherits from object,
can be safely removed from bases in python3 (useless-object-inheritance)
This should significantly improve performance when used to write large
amounts of messages.
This feature is enabled through the fsync configuration option.
Code refactorize around fsync.
This addresses #390 (although it doesn't necessarily fix all instances
of that problem yet).
Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/390
Originally-written-by: Giel van Schijndel <me@mortis.eu>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
BaseFolder now exposes an __unicode__ method so that function needing
unicode transcoding don't crash due to ascii encoding errors.
Signed-off-by: Stéphane Albert <sheeprine@oh.its.fake.nullplace.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Return a sorted list of UIDs in getmessageuidlist.
Some MUAs (and their users) like to display messages in UID order
(or "order received"). If offlineimap is used in IMAP<->IMAP mode,
then the order messages are received by the second IMAP server will
be different because offlineimap iterates over a UID list produced
from the keys of a dictionary, which is unsorted.
This change sorts that list of UIDs so that both IMAP servers will
have their messages in the same order (except those times where
messages are appended to folders on both repositories between
syncs).
Signed-off-by: James E. Blair <corvus@gnu.org>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This suppressing the warning generated when running offlineimap on
python2 with -3 switch:
offlineimap/folder/Base.py:29: DeprecationWarning: Overriding __eq__
blocks inheritance of __hash__ in 3.x
Since this object is mutable it should not be hashable.
From Python documentation[1]:
A class that overrides __eq__() and does not define __hash__() will
have its __hash__() implicitly set to None.
Therefore old behaviour is preserved.
[1] https://docs.python.org/3/reference/datamodel.html
Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Output a warning so that we can dig into this. For now, the patch doesn't fix
the root cause. If the server returns UID 0 as valid UID number, this must be
ignored as soon as possible.
Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/336
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
It is more readable and returns a list therefore it is compatible both
with Python 2 and 3.
Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Sometimes it might happen that you put wrong date and you except emails
to be fetched, but they are not and you do not have an idea why.
By raising exception the user will see a proper message telling that he
used the wrong date for maxage/startdate property.
If someone wants to set a future date intentionally might as well sync
in the future.
Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This enables the "append" mode feature. Configuration option is sync_deletes in
both local and remote repositories. Marked EXPERIMENTAL and UNTESTED.
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This fix does not apply when any keyword in configured which is already
harmless.
Written-by: Igor Almeida <igor.contato@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Extract the flag/keyword translation and combination logic to a
function.
Signed-off-by: Igor Almeida <igor.contato@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This uses the destination folder's keyword mapping to translate the
message's keywords into some appropriate format.
Tested only with local Maildir.
Signed-off-by: Igor Almeida <igor.contato@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
The keywords are in the flag string, so imaputil can just strip the
usual \Flags.
Signed-off-by: Igor Almeida <igor.contato@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
If this value is true, use (if possible) a timestamp based on message
Date or Delivery-date headers. The current system time is used
otherwise.
filename_use_mail_timestamp and utime_from_header are now completely
separated option that do not interfere one with other.
To handle this feature in a multithread context we use a hash to count
the number of mail with the same timestamp. This method is more accurate
than using the old lasttime and timeseq variables.
Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
When new mail arrives, this hook is triggered, allowing the user to
play a sound, or launch a popup.
Signed-off-by: Matthew Krafczyk <krafczyk.matthew@gmail.com>