Commit Graph

175 Commits

Author SHA1 Message Date
Joseph Ishac
259bf83607 Fixing up the rest of the parsing and IMAP functions, and GMAIL classes as well. Also adding is_debugging() to the UI to allow us to quickly determine if we should build some of the expensive debug objects 2021-02-23 16:17:54 -05:00
Joseph Ishac
1d2478bcb6 Series of *UNTESTED* changes that should move the internal structure of
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.
2021-02-09 14:58:30 -05:00
Rodolfo García Peñas (kix)
fefe69c0e9 ui/UIBase.py do not use builtin object as variable
Renamed from object to mobject.
2020-08-30 18:12:17 +02:00
Rodolfo García Peñas (kix)
d5ab101cf4 ui/UIBase.py do not use builtin type as variable
Renamed from type to rtype.
2020-08-30 18:10:51 +02:00
Rodolfo García Peñas (kix)
833816cf62 ui/UIBase.py split the if
This patch splits the if to avoid multiple commands in the same line.
2020-08-30 18:09:32 +02:00
Rodolfo García Peñas (kix)
b1a719ad9e ui/UIBase.py changed not var in
This patch changes:

if not var1 in var2

with

if var1 not in var2
2020-08-30 18:07:59 +02:00
Rodolfo García Peñas (kix)
5ad87efb84 ui/UIBase.py removed extra characters
These chars could be removed.
2020-08-30 18:06:14 +02:00
Rodolfo García Peñas (kix)
d4f9d101c4 ui/Machine.py Removed extra parenthesys
This parsys should be removed.
2020-08-30 18:00:49 +02:00
Rodolfo García Peñas (kix)
f78c8e1ef4 ui/Machine.py Renamed list argument
The list is a standard word for list. This variable should have other
name.
2020-08-30 17:58:53 +02:00
Rodolfo García Peñas (kix)
edb6563a11 ui/Machine.py changed argument s to self
The standard name is self, not s.

I reformat the file after this change.
2020-08-30 17:57:46 +02:00
Rodolfo García Peñas (kix)
7634ce10d1 ui/debuglock.py Removed extra backslashes
These backslashes could be removed.
2020-08-30 17:47:18 +02:00
Rodolfo García Peñas (kix)
cfce5c8500 BUG: Do not sort accounts
Is not possible to sort acounts on this way. We need make the comparison
using their names, not their keys.
2020-08-30 17:42:52 +02:00
Rodolfo García Peñas (kix)
6bf45233bb ui/Curses.py avoid multiple statements in one line 2020-08-30 15:59:21 +02:00
Rodolfo García Peñas (kix)
5ebbba2995 ui/Curses.py updated docstring
This patch includes a param in docstring.
2020-08-30 15:56:49 +02:00
Rodolfo García Peñas (kix)
10c37cf7a4 ui/Curses.py unused variable
This variable is not used.
2020-08-30 15:54:20 +02:00
Rodolfo García Peñas (kix)
a69ef4325a ui/Curses.py removed extra characters
These characters could be removed.
2020-08-30 15:50:01 +02:00
Rodolfo García Peñas (kix)
229aa59dba offlineimap/ui files singleton-comparison
This patch change these errors in the ui folder

C0121: Comparison to None should be 'expr is None' (singleton-comparison)
C0121: Comparison to None should be 'expr is not None' (singleton-comparison)
2020-08-30 11:07:59 +02:00
Rodolfo García Peñas (kix)
e77440552c Do not make object inheritance
This patch removes these lintian warnings:

Warning R0205: Class 'X' inherits from object,
can be safely removed from bases in python3 (useless-object-inheritance)
2020-08-29 21:44:18 +02:00
Rodolfo García Peñas (kix)
ee236ec987 Reformat offlineimap/ui/UIBase.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 19:59:05 +02:00
Rodolfo García Peñas (kix)
6e0647de1a Reformat offlineimap/ui/TTY.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 19:58:32 +02:00
Rodolfo García Peñas (kix)
8bae38ed93 Reformat offlineimap/ui/noninteractive.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 19:57:49 +02:00
Rodolfo García Peñas (kix)
d31c5891ba Reformat offlineimap/ui/Machine.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 19:56:37 +02:00
Rodolfo García Peñas (kix)
9aa2344fd4 Reformat offlineimap/ui/debuglock.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 19:55:52 +02:00
Rodolfo García Peñas (kix)
1b385dfafb Reformat offlineimap/ui/Curses.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 19:55:07 +02:00
Rodolfo García Peñas (kix)
a88a9cf28e ui init is lintian clean
This patch only adds an space between the hash and the first character.
2020-08-29 09:51:31 +02:00
Rodolfo García Peñas (kix)
1618505d3b Machine imports withou try except
Python 2 is not supported now. The import is the same in try and except.
2020-08-29 09:00:30 +02:00
Rodolfo García Peñas (kix)
46c677151a UIBase imports without try except
Python 2 is not supported now. The import is the same in try and except.
2020-08-29 08:58:53 +02:00
Rodolfo García Peñas (kix)
6ec6111896 2to3 main 2020-08-28 03:32:43 +02:00
Mart Lubbers
c9f71b0c64 add checks in curses ui for small windows
addch() and addstr() throw an exception if text has to be printed
outside of the window. This may occur if the terminal is very small.
Such erroneous prints are no-ops now.

Signed-off-by: Mart Lubbers <mart@martlubbers.net>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/595
2019-02-13 16:32:02 +01:00
Nicolas Sebrecht
d9301254ff fix dates in copyright lines
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2018-08-13 01:15:01 +02:00
Carnë Draug
5f9474e10d Print username instead of accountname when asking for password
When asking for a password interactively, the username is never
displayed which may hide problems (typos on the configuration, or
issues on offlineimap parsing of the config file).  The hostname,
port, and account name are already displayed when establishing the
connection.  When asking for password, the account name is displayed
again.  Change it to display the username.

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/558
Signed-off-by: David Miguel Susano Pinto <carandraug+dev@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2018-06-16 15:17:35 +02:00
Musashi69
c8847ccff9 make UI output show local AND remote dirs involved
Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/525
Signed-off-by: Friedemann Schorer friedemann@schorers.org
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2018-02-24 01:13:40 +01:00
Ilias Tsitsimpis
7bc54d241c Acquire lock before updating the CursesLogHandler window
Make sure that we refresh the screen atomically, since the emit()
function may be called by more that one threads at a time.

Also, modify the draw_bannerwin() method which used to fail in case the
window would become too small. Make sure that the provided offsets to
the window.addstr() method are properly bounded.

Closes #160: blinkenlights display is broken
Tested-by: Cyril Brulebois
Tested-by: Gaudenz Steinlin
Signed-off-by: Ilias Tsitsimpis <i.tsitsimpis@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2017-04-23 12:48:12 +02:00
Ilias Tsitsimpis
0a635bd236 Fix flickering in Blinkenlights UI
Do not call resizeterm(), unless is_term_resized() returns True. This
breaks the busy-loop where resizeterm() pushes a KEY_RESIZE onto the
FIFO causing the screen to be redrawn indefinitely (Issue #290).

Also, clear and refresh the main window after it has been resized. This
hopefully fixes the problem where Blinkenlights UI becomes unreadable
after terminal resize (Issue #160).

Closes #160: blinkenlights display is broken
Closes #290: ncurses flicker with blinkenlights UI
Bug-Debian: https://bugs.debian.org/671087
Bug-Debian: https://bugs.debian.org/809676
Signed-off-by: Ilias Tsitsimpis <i.tsitsimpis@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-10-20 14:11:51 +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
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
29e06a60f9 learn to not download UIDs defined by the user
Allow users to workaround offending emails that offlineimap can't download.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-03 20:02:45 +02:00
Nicolas Sebrecht
1086d0dd69 minor: improve "Copy message" output
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-03 20:02:45 +02:00
Nicolas Sebrecht
092264c8e7 fix: when called with -a, mbnames must not erase entries of other accounts
Make mbnames to work with intermediate files, one per account, in the JSON
format. The mbnames target is built from those intermediate files.

Github-Fix: https://github.com/OfflineIMAP/offlineimap/issues/66
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-06-25 17:33:42 +02:00
Ben Boeckel
d8398ba374 Curses, UIBase: remove references to __bigversion__
__bigversion__ was removed in 281bcefb52.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-03-05 06:47:24 +01:00
Nicolas Sebrecht
1553e843b3 Revert "Don't output initial blurb in "quiet" mode"
This reverts commit a1dc76ae91.

Causes a crash when using Blinkenlights UI with -l CLI option.

  $ ./offlineimap.py -c offlineimap.conf.minimal -u blinkenlights -l foo
  Traceback (most recent call last):
    File "./offlineimap.py", line 36, in <module>
      oi.run()
    File "/tmp/offlineimap/offlineimap/init.py", line 50, in run
      options, args = self.__parse_cmd_options()
    File "/tmp/offlineimap/offlineimap/init.py", line 205, in __parse_cmd_options
      self.ui.setlogfile(options.logfile)
    File "/tmp/offlineimap/offlineimap/ui/UIBase.py", line 119, in setlogfile
      self.logger.info(msg)
    File "/usr/lib/python2.7/logging/__init__.py", line 1159, in info
      self._log(INFO, msg, args, **kwargs)
    File "/usr/lib/python2.7/logging/__init__.py", line 1278, in _log
      self.handle(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 1288, in handle
      self.callHandlers(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 1328, in callHandlers
      hdlr.handle(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 751, in handle
      self.emit(record)
    File "/tmp/offlineimap/offlineimap/ui/Curses.py", line 305, in emit
      color = self.ui.gettf().curses_color
  AttributeError: 'CursesLogHandler' object has no attribute 'ui'

Reported-by: iliastsi
Github-issue: #293
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-01-08 17:33:00 +01:00
Nicolas Sebrecht
63db8776e0 Noninteractive: add minor comment
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-10-13 00:52:43 +02:00
Ben Boeckel
e18428b25b UIBase: add a syslog ui
Rather than having an option for syslog output, make a separate UI
option.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-10-13 00:48:18 +02:00
Ben Boeckel
428bb77984 Noninteractive: fix docstring for Basic
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-10-13 00:40:27 +02:00
Ben Boeckel
585e5d5e2e logging: add a switch to log to syslog
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-09-27 04:12:33 +02:00
Alex Kapranoff
07af72081a report UID validity problem in exit code
Since skipping a folder means no new data is downloaded, the UID validity
problem is a backup failure. Make it possible to alert or work around
it in scripts by signaling with the exit code.

Signed-off-by: Alex Kapranoff <alex@kapranoff.ru>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-05-11 14:38:31 +02:00
Alex Kapranoff
a817400d76 report exceptions via exit code
Now it is possible to handle failed syncs in scripts.

Signed-off-by: Alex Kapranoff <alex@kapranoff.ru>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-05-10 12:00:23 +02:00
Nicolas Sebrecht
461554b7b1 more style consistency
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-02-10 17:25:00 +01:00
Nicolas Sebrecht
cb6790b804 minor: fix indentation
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-18 21:52:09 +01:00
Nicolas Sebrecht
8c6abc413e ui: Machine: remove offending param for a _printData() call
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-10 12:36:18 +01:00