The `threadutil` module depends on the `ui` module, which cycle depends
on `threadutil` through the `Curses` module.
The `ui` module had been loaded before the `threadutil` module, breaking
the above circular dependency, but this was changed in a recent code
refactoring, preventing the `Curses` module from being loaded with the
following exception:
File "./offlineimap.py", line 23, in <module>
from offlineimap import OfflineImap
File "offlineimap/offlineimap/__init__.py", line 20, in <module>
from offlineimap.init import OfflineImap
File "offlineimap/offlineimap/init.py", line 30, in <module>
from offlineimap import globals, threadutil, accounts, folder, mbnames
File "offlineimap/offlineimap/threadutil.py", line 25, in <module>
from offlineimap.ui import getglobalui
File "offlineimap/offlineimap/ui/__init__.py", line 28, in <module>
from offlineimap.ui import Curses
File "offlineimap/offlineimap/ui/Curses.py", line 27, in <module>
from offlineimap.threadutil import ExitNotifyThread
ImportError: cannot import name ExitNotifyThread
Fix the above error by ensuring that the `ui` module gets loaded before
the `threadutil` module. Please note that the above fix is temporary,
and we should refactor the modules to not have circular dependencies.
Bug-Debian: https://bugs.debian.org/839862
Reported-by: Neil McGovern <neilm@debian.org>
Signed-off-by: Ilias Tsitsimpis <i.tsitsimpis@gmail.com>
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>
Don't pass the account name to the function returned by eval. This allows the
user to define his own arguments.
This fix the code according to the documentation provided in offlineimap.conf.
Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/372
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
To further ensure that messages are synchronized strictly in UID
order, this option can be set to cause only one thread to be used
to synchronise an individual folder, though other folders may
be synchronized simultaneously by other threads.
Signed-off-by: James E. Blair <corvus@gnu.org>
Based-on-patch-by: James E. Blair <corvus@gnu.org>
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>
It is more readable and returns a list.
This continues work done in 19c4330.
Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
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>