Commit Graph

498 Commits

Author SHA1 Message Date
James Bunton
8cd2bdf7f5 Allow keepalive to be overridden by user if imapfolders is set 2009-02-10 15:57:03 +11:00
James Bunton
3847d0ba9d Implementation of IMAP IDLE
- Use a newer version of imaplib
 - Hijack the keepalive process to send IDLE instead of NOOP
2009-02-10 11:27:48 +11:00
John Goerzen
8db951ed61 Fix missing import for pre/postsynchook
Apply synchook-import.patch from Graham D
fixes #125
2009-01-14 00:05:00 -06:00
Paul Hinze
c5886074ee Fix md5 import error
Paul Hinze <paul.t.hinze@gmail.com> on 2008-12-22 at 19:16:
> I did a bit of debugging and asking around in #python and it turns out
> that because Maildir.py uses a conditional import of md5 from either
> hashlib or the md5 module, the md5.new() call is not always correct.
> The attached patch should fix this problem.

Thanks to Daniel Rall for pointing out that the attachment got stripped
off my last message.  Patch follows.

Paul

----

From e01fdfbf62c61c31b514e826e6cc00fb98d88808 Mon Sep 17 00:00:00 2001
From: Paul Hinze <paul.t.hinze@gmail.com>
Date: Mon, 22 Dec 2008 18:42:44 -0600
Subject: [PATCH] Fixing md5 import when hashlib is available

Thanks to habnabit and Rhamphoryncus in #python for help debugging
2009-01-09 15:46:38 -06:00
Loui Chang
c6d95bd471 Import md5 from hashlib if available.
The md5 module is deprecated and hashlib is available
since python 2.5.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-12-11 00:28:09 -06:00
John Goerzen
75af76b70f Patch from Jim Pryor to support /etc/netrc in addition to ~/.netrc 2008-12-02 13:15:44 -06:00
John Goerzen
147265ac39 Apply remainder of Jim Pryor's patch 2008-12-02 13:12:36 -06:00
John Goerzen
e1fb9492f8 Patch for signal handling to start a sync by Jim Pryor
Here's the way I'd like to use offlineimap on my laptop:
    1. Have a regular cron job running infrequently. The cron job
    checks to see
if I'm online, plugged in, and that no other copy of offlineimap is
running. If
all of these conditions are satisfied, it runs offlineimap just once:
"offlineimap -o -u Noninteractive.Quiet"

    2. When I start up mutt, I do it by calling a wrapper script that
    delays
until cron-started copies of offlineimap have finished, then starts
    offlineimap
on its regular, stay-alive and keep checking schedule. When I quit
    mutt, the
wrapper script tells offlineimap to stop.

This way I get frequent regular checks while I have mutt running, but
I don't
waste my battery/cpu checking frequently for mail when I'm not
interested in
it.

To make this work, though, it'd be nicer if it were easier to tell
offlineimap,
from the outside, things like "terminate cleanly now" and "when you've
finished
synching, then terminate instead of sleeping and synching again."

OK, to put my money where my mouth is, I attach two patches against
offlineimap
6.0.3.

The first, "cleanup.patch", cleans up a few spots that tend to throw
exceptions
for me as offlineimap is exiting from a KeyboardInterrupt.

The second adds signaling capabilities to offlineimap.

* sending a SIGTERM tells offlineimap to terminate immediately but
  cleanly,
  just as if "q" had been pressed in the GUI interface

* sending a SIGUSR1 tells every account to do a full sync asap: if
  it's
  sleeping, then wake up and do the sync now. If it's mid-sync, then
  re-synch
  any folders whose syncing has already been started or completed, and
  continue
  to synch the other, queued but not-yet-synched folders.

* sending a SIGHUP tells every account to die as soon as it can (but
  not
  immediately: only after finishing any synch it's now engaged in)

* sending a SIGUSR2 tells every account to do a full sync asap (as
  with
  SIGUSR1), then die

It's tricky to mix signals with threads, but I think I've done this
correctly.
I've been using it now for a few weeks without any obvious
problems. But I'm passing it
on so that others can review the code and test it out on their
systems. I developed the
patch when I was running Python 2.5.2, but to my knowledge I don't use
any Python 2.5-specific
code. Now I'm using the patch with Python 2.6.

Although I said "without any obvious problems," let me confess that
I'm
seeing offlineimap regularly choke when I do things like this: start
up
my offlineimap-wrapped copy of mutt, wait a while, put the machine to
sleep (not sure if offlineimap is active in the background or idling),
move to a different spot, wake the machine up again and it acquires a
new network, sometimes a wired network instead of wifi. Offlineimap
doesn't like that so much. I don't yet have any reason to think the
problems here come from my patches. But I'm just acknowledging them,
so
that if others are able to use offlineimap without any difficulty in
situations like I described, then maybe the fault is with my patches.
2008-12-01 16:13:16 -06:00
John Goerzen
5db24303b7 Patch to make exit on Ctrl-C cleaner
From Jim Pryor

The first, "cleanup.patch", cleans up a few spots that tend to throw
exceptions for me as offlineimap is exiting from a KeyboardInterrupt.
2008-12-01 16:10:49 -06:00
John Goerzen
d69176090c New option to only work with subscribed folders
Patch from Sean Finney, slightly modified by John Goerzen to change
name of config file option

fixes deb#499588
2008-10-01 00:33:57 -05:00
John Goerzen
ab43d74549 Applied pre/post sync hooks
Patch from Sylvain FORET in refs #71
2008-10-01 00:03:04 -05:00
John Goerzen
c886987a5b Merge branch 'master' of ssh://jpgarch@complete.org/~jpgarch/git/offlineimap 2008-09-29 18:04:50 -05:00
Michael Witten
5fe379f66d imaplibutil: Remove flagrantly bad use of private attribute
Frankly, the original code doesn't even make much sense, and
moreover it's not forward compatible with python 2.6, and
furthermore:

    DeprecationWarning: socket.ssl() is deprecated.

So, this commit is just a temporary fix.

Signed-off-by: Michael Witten <mfwitten@mit.edu>
2008-09-29 17:50:50 -05:00
John Goerzen
10c2b6fbaa Apply new darwin.patch from Vincent Beffara
fixes #20
patch dated 5/27/2008
2008-09-18 09:23:37 -05:00
John Goerzen
d097da005e Prepping 6.0.3 2008-08-13 00:05:17 -05:00
Henning Glawe
140be81efd make the trash and spam folder names in Gmail accounts configurable 2008-08-13 00:03:13 -05:00
John Goerzen
9551e9d38e task_done wasn't in Python before 2.5 2008-08-11 20:38:33 -05:00
John Goerzen
1d91fb7a96 Merge branch 'master' of ssh://jpgarch@complete.org/~jpgarch/git/offlineimap 2008-08-08 13:08:08 -05:00
Ben Willard
04a6270058 Fix a bug preventing the pid file from being empty.
Convert os.getpid() to a string before writing it to the pid file in
order to avoid generating an empty pid file.
2008-08-07 21:09:11 -05:00
John Goerzen
1b9f04a564 Removed debug statements 2008-08-05 00:07:26 -05:00
John Goerzen
fe57342448 Yet another Python threading workaround.
module threading should be taken out back and shot.

Condition.wait() is a busywait loop that has negative implications for
battery consumption on laptops.

Queue.get() in blocking mode blocks SIGINT from being delivered.

Argh, argh, argh.

Closes: #493801.
2008-08-05 00:05:29 -05:00
John Goerzen
0a801457df Bump version to 6.0.2 2008-08-02 17:44:20 -05:00
John Goerzen
2a852a8f48 Rework keepalive to use time.sleep() instead of event.wait()
This should improve power-management abilities some more

The catch is that we can't wait any longer for the kathread to
terminate.  We were waiting for this in some cases.  This is probably
not a big deal.

fixes deb#434074
fixes #66
2008-08-02 17:44:03 -05:00
John Goerzen
0da6bedaa0 Eliminate one more fsync 2008-08-02 15:31:43 -05:00
John Goerzen
a5dc9a331d Bump version to 6.0.1 2008-08-02 15:13:43 -05:00
John Goerzen
fbcb157ca4 Fix syntax error in nofsync support 2008-08-02 15:11:23 -05:00
John Goerzen
8114877fae Rework threadutil to use Queue for simplification and power-friendliness
Removes code and should avoid weird Python situation that causes cpu
wakeups

fixes deb#434074
fixes #66
2008-08-02 15:10:11 -05:00
John Goerzen
2b23657db0 Added ability to disable fsync()
Passed config to LocalStatus and Maildir folders so they can look
up the fsync status
2008-08-02 14:55:08 -05:00
John Goerzen
0754bdef6a Slightly more debug info 2008-08-02 14:37:55 -05:00
John Goerzen
bd1d1010e7 Now create cur,new,tmp in '.' even if existsok is false
Otherwise, there was a race where sometimes subfolders would get created
first in the sep = '.' scneario

fixes #64
2008-08-02 14:34:51 -05:00
John Goerzen
1a15b6964f Fix for keys with -1
fixes #83
2008-07-16 14:12:38 -05:00
Mark Hymers
ca08c1e553 Add support for ssl client certificates
This patch adds sslclientcert and sslclientkey configuration
  options which are passed through to imaplib in order to allow
  the use of client certificates for authentication.

Tue Nov 13 14:44:17 CST 2007  Mark Hymers <mhy@debian.org>
2008-05-23 14:58:18 -05:00
John Goerzen
3c7edc2e4d Revert "Initial stab at showing list of folders that aren't being synced"
This reverts commit fa766b61bc.

Not going to follow this path right now
2008-05-20 01:38:42 -05:00
John Goerzen
6790c94869 Revert "Checkpointing work on mailbox deletion"
This reverts commit f58ebe390d.

Not going to follow this path right now
2008-05-20 01:38:32 -05:00
John Goerzen
f58ebe390d Checkpointing work on mailbox deletion 2008-05-20 01:38:15 -05:00
John Goerzen
fa766b61bc Initial stab at showing list of folders that aren't being synced
This isn't working right yet because two accounts could sync into one
destination
2008-05-20 01:13:36 -05:00
John Goerzen
3862c8e1a0 Poof, this is 6.0.0. 2008-05-20 00:01:51 -05:00
John Goerzen
c18f8b9fad Prepping 5.99.15; fixes: #63 2008-05-12 09:03:08 -05:00
John Goerzen
3ff37143b5 Finally fix the stupid LocalStatus folder bug, I really hope!
Noted thie code:

    statusfolder =
    statusrepos.getfolder(remotefolder.getvisiblename().\
                                         replace(remoterepos.getsep(),
                                                 statusrepos.getsep()))

in accounts.py.  Should have been using the sep of the LocalStatus all
along.

refs deb#479798, #68
2008-05-10 21:08:05 -05:00
John Goerzen
5dc33409e3 Prepping 5.99.14 2008-05-09 20:44:19 -05:00
John Goerzen
fe1d92f00e Revert some previous attempts at localstatus creation
refs deb#479798

Reverts cf080844ac
and 031e018ead
2008-05-06 18:23:48 -05:00
John Goerzen
f103c54801 Bump to 5.99.13 2008-05-06 08:51:58 -05:00
John Goerzen
5749247382 Revert "Apply darwin.patch from Vincent Beffara"
This reverts commit 9f5c8d708b.

Several people were complaining about problems.  See
http://bugs.debian.org/479677.

Closes: #479677.

refs #20.
2008-05-06 08:12:54 -05:00
John Goerzen
70a09c3a89 Version 5.99.12 2008-05-05 00:48:55 -05:00
John Goerzen
553158a81b Finally fix problem with making new folders
fixes deb#478990.  fixes #63.

Patch from Martin F. Krafft.
2008-05-05 00:08:01 -05:00
John Goerzen
9f5c8d708b Apply darwin.patch from Vincent Beffara
fixes #20

 04/27/2008 09:34 AM - Vincent Beffara

    * File darwin.patch added

OK, I finally installed an IMAPS server on my iMac, so I could test a
little further. For some reason, fixing the read() method in
imaplibutil.py did not seem to work (it hung on connecting to the
server) - however, modifying the file imapserver.py similarly to the
non-SSL case fixed the crash.

I also reduced the chunk size to 100k instead of 1M, as 1M seemed to
still trigger the memory error in some cases. Ah, and I added a
platform test, so that the patch does essentially nothing on
non-Darwin machines ...

So, still no guarantee, but the attached patch works for me. Any
comments ?

(If noone here screams in horror at my code, I will include the patch
into the Fink package and see what happens there.)
2008-05-01 15:20:56 -05:00
John Goerzen
1b0788cb24 Rev versions 2008-04-17 09:53:20 -05:00
John Goerzen
031e018ead Fixed a braino introduced in last patch
Fixes #63
2008-04-17 09:52:09 -05:00
John Goerzen
145f18ac25 5.99.10 prep 2008-04-17 00:11:15 -05:00
John Goerzen
cf080844ac Make parent dirs of localstatus folders.
fixes #63
2008-04-17 00:09:32 -05:00
John Goerzen
c046383dc2 Unify LocalStatus.py repository code with folder code
refs #63
2008-04-17 00:09:11 -05:00
John Goerzen
6fd4962b4c Version to 5.99.9 2008-03-27 00:36:32 -05:00
John Goerzen
3af221f99b Automatically create top-level localfolder for Maildirs
this is the folder Maildirs will put messages in.

Closes: #286967
2008-03-27 00:35:05 -05:00
Florian Friesdorf
7a70878ed6 typo in previous 2008-03-20 12:08:57 -05:00
Florian Friesdorf
b18f55a7e2 Ignore empty LocalStatus files
I created new IMAP folders on my server. In some moment I found offlineimap
crashed. The reason were empty LocalStatus files. From looking at the code I
have no explanation how those files came into existence.
2008-03-20 12:08:49 -05:00
Eric Dorland
f7b5aa4ba3 Bug#359213: Kerberos
* John Goerzen (jgoerzen@complete.org) wrote:
> tages 359213 help
> thanks
>
> Hi folks,
>
> Unfortunately, I lack both the expertise to add Kerberos
> authentication and a way to test this.  A patch would be very welcome
> :-)

Well it was a bit unclear but there's a patch for offlineimap attached
to Guido's message:

http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=support-GSSAPI-via-pykerberos.diff;att=1;bug=359213

I've tried it out and it works great! Except that if the Kerberos
layer throws an exception it wouldn't fail over to plain
authentication properly. Attached is a slightly reworked patch that I
tested it in the following situations:

1. python-kerberos uninstalled, with kerberos credentials.
   Prompted for password authentication as expected.

2. python-kerberos installed, with kerberos credentials.
   Keberos authentication was successful and my mail was fetched
   without password prompting. Yeehaw!

3. python-kerberos installed, with no kerberos credentials.
   Prompted for    password authentication     as expected.

I think those are all the interesting situations. So I think this is
ready to go in, with a Suggest on python-kerberos (>=
1.0+mk080218-1).

--
Eric Dorland <eric@kuroneko.ca>
ICQ: #61138586, Jabber: hooty@jabber.com
2008-03-09 20:30:23 -05:00
John Goerzen
cf1a1b31e2 Don't crash if LocalStatus file doesn't exist yet
Closes: #470174
2008-03-09 20:27:37 -05:00
John Goerzen
db805043f2 Attempt to fix a crashing bug in Gmail driver
refs deb#469598

Bug report received in Debian.  User is having occasional trouble with Gmail
driver crashing, indicates problem may have started after switching to Gmail.

Gmail driver merged to tree in 81b86fb74 on 2008-01-03 and recently released
in beta tarballs.

BT shows:

  File "/var/lib/python-support/python2.4/offlineimap/folder/Gmail.py", line 102, in processmessagesflags
    attributehash = imaputil.flags2hash(imaputil.imapsplit(result)[1])
  File "/var/lib/python-support/python2.4/offlineimap/imaputil.py", line 88, in imapsplit
    for i in range(len(imapstring)):
TypeError: len() of unsized object

imap debug log shows:

imap:   29:58.16 > BEAL75 UID STORE 4887 +FLAGS (\Deleted)
imap:   29:58.47 < BEAL75 OK Success
imap:   29:58.47        matched r'(?P<tag>BEAL\d+) (?P<type>[A-Z]+) (?P<data>.*)' => ('BEAL75', 'OK', 'Success')
imap: imapsplit() called with input: None
imap: imapsplit() got a non-string input; working around.

looking at code for Gmail.py processmessagesflags, comments from Ricardo
indicate it was copied from the same function in folder/IMAP.py.

However, folder/IMAP.py has checks for this, added 2002-07-12 in
5342dacc & 817a10ce.  Suspect that Gmail author believed those checks
superfluous for Gmail.

Copied checks from folder/IMAP.py to folder/Gmail.py.
2008-03-08 07:47:53 -06:00
John Goerzen
6e6720d1b0 Update for 5.99.7 2008-03-04 08:32:29 -06:00
John Goerzen
3cb3a675b8 Revert "completed: * fixes behaviour when changing flags, without corresp. rights (s,d,w)"
This reverts commit 08f22be8ea.

Conflicts:

	offlineimap/folder/IMAP.py
2008-03-04 08:15:48 -06:00
John Goerzen
cabd8d1735 Revert "fix behaviour for delete/expunge, when lacking rights"
This reverts commit c305d63e00.

Zak Smith reported it continued to be a problem
2008-03-04 08:13:48 -06:00
John Goerzen
4c56514381 Prepare for 5.99.6 2008-03-03 21:42:06 -06:00
John Goerzen
9a168c573e Revert "fixes behaviour when changing flags, without corresp. rights (s,d,w)"
This reverts commit 71a76d9a61.

Zak Smith reported a problem at:

      self.processmessagesflags('+', uidlist, flags)
  File "/usr/lib/python2.5/site-packages/offlineimap/folder/IMAP.py",
  line 372, in processmessagesflags
    myrights = imapobj.myrights(self.getfullname())[1][0].split()[1]
IndexError: list index out of range

Conflicts:

	offlineimap/folder/IMAP.py
2008-03-03 21:20:53 -06:00
John Goerzen
d6f4a8dab8 Make makefolder use same temporary name as folder/LocalStatus/save 2008-03-03 12:59:40 -06:00
John Goerzen
aaf9478535 Fix bug in LocalStatus so that it writes out the header line for
folder creation
2008-03-03 12:57:56 -06:00
John Goerzen
4b563c39d9 Version 5.99.5 update 2008-03-03 04:30:13 -06:00
John Goerzen
7b4e651d12 Merge branch 'netrc-integration'
Applies patches by bboisin to add netrc support

Conflicts:

	offlineimap/repository/IMAP.py

refs #14
2008-03-03 02:27:13 -06:00
John Goerzen
9b8720a4ec Apply tabspace.diff
refs #14
2008-03-03 02:23:50 -06:00
John Goerzen
50fc49bf7f Applied netrc_v2.diff from bboissin 2008-03-03 02:21:33 -06:00
John Goerzen
1ebc45d963 Fix performance for SSL
Added WrappedIMAP4_SSL class to help fix up performance of SSL

Standard imaplib.py is really bad with this, since it reads one
character at a time.

Reported by Aaron Kaplan at
http://lists.complete.org/offlineimap@complete.org/2008/01/msg00012.html.gz

He wrote:

  I just noticed that the version of offlineimap I've been using
  (3.99.17) is well over four years old.  How time flies.  I haven't
  had any problems with it, but out of curiosity I decided to pull in
  5.99.2 from the fedora repository.  It turns out to take
  consistently over twice as long as the old version to sync the same
  account.  Is this expected?

He tracked it down at
http://lists.complete.org/offlineimap@complete.org/2008/02/msg00012.html.gz

  The following changeset is the one responsible for the difference in
  speed I was noticing between the imaplib.py that was packaged with
  older versions of offlineimap and the one that comes with python:

  * /offlineimap/head: changeset 169
    More optimizations -- this time fix readline() to not work
    character-by-character!
2008-03-03 08:22:44 -06:00
John Goerzen
08a579657a Fix handling of servers that return UIDs in some FETCH responses
closes #22

from pistore in OfflineIMAP #22:

When an IMAP flag update is performed for multiple messages, some IMAP
servers (e.g. Exchange) return the UID attribute only for some of the
FETCH untagged responses, as shown in the following log:

21:19.04 > DCKF8 UID STORE 66050,50613,52164,40043,40055,25874 +FLAGS
(\Deleted)
21:19.36 < * 35 FETCH (FLAGS (\Seen \Deleted) UID 25874)
21:19.36 < * 321 FETCH (FLAGS (\Seen \Deleted))
21:19.57 < * 322 FETCH (FLAGS (\Seen \Deleted))
21:19.57 < * 560 FETCH (FLAGS (\Seen \Deleted))
21:19.57 < * 581 FETCH (FLAGS (\Seen \Deleted) UID 52164)
21:19.62 < * 1022 FETCH (FLAGS (\Seen \Deleted))
21:19.62 < DCKF8 OK STORE completed.

Function IMAPFolder.processmessagesflags is able to manage the servers
which return the UID and the servers which do not return it, but is
not able to deal with the mixed behavior shown above.

The problem is that the fragment of function
IMAPFolder.processmessagesflags that handles the responses with UID
attribute uses variable flags to store the list of flags of the
message in the IMAP format ("flags = attributehashFLAGS?"), while the
fragment that handles the responses without UID expects variable
"flags" to contain the list of modified flags passed to the function
in Maildir format ("self.messagelist[uid]flags?.append(flag)").

As a consequence, the wrong list of flags is used for the messages
without UID, leading to the addition of "strange" flags to the Maildir
messages:

Syncing messages IMAP[INBOX] -> Maildir[.]
Adding flags   to 4 messages  on Maildir[.]
Adding flags e to 4 messages  on Maildir[.]
Adding flags d to 4 messages  on Maildir[.]
Adding flags ) to 4 messages  on Maildir[.]
Adding flags ( to 4 messages  on Maildir[.]
Adding flags l to 4 messages  on Maildir[.]
Adding flags n to 4 messages  on Maildir[.]
Adding flags t to 4 messages  on Maildir[.]
Adding flags \ to 4 messages  on Maildir[.]
Adding flags D to 4 messages  on Maildir[.]
Deleting flags T to 4 messages on Maildir[.]
Adding flags   to 4 messages  on LocalStatus[.]
Adding flags e to 4 messages  on LocalStatus[.]
Adding flags d to 4 messages  on LocalStatus[.]
Adding flags ) to 4 messages  on LocalStatus[.]
Adding flags ( to 4 messages  on LocalStatus[.]
Adding flags l to 4 messages  on LocalStatus[.]
Adding flags n to 4 messages  on LocalStatus[.]
Adding flags t to 4 messages  on LocalStatus[.]
Adding flags \ to 4 messages  on LocalStatus[.]
Adding flags D to 4 messages  on LocalStatus[.]
Deleting flags T to 4 messages on LocalStatus[.]

Fix: use a different variable to store IMAP flags when managing
messages corresponding to responses with UID attribute, e.g.:

*** IMAP.py.orig        Wed Aug 22 18:23:17 2007
--- IMAP.py     Wed Aug 22 18:22:38 2007
*************** class IMAPFolder(BaseFolder):
*** 340,348 ****
              if not ('UID' in attributehash and 'FLAGS' in
              attributehash):
                  # Compensate for servers that don't return a UID
                  attribute.
                  continue
!             flags = attributehash['FLAGS']
              uid = long(attributehash['UID'])
!             self.messagelist[uid]['flags'] =
imaputil.flagsimap2maildir(flags)
              try:
                  needupdate.remove(uid)
              except ValueError:          # Let it slide if it's not
              in the list
--- 340,348 ----
              if not ('UID' in attributehash and 'FLAGS' in
              attributehash):
                  # Compensate for servers that don't return a UID
                  attribute.
                  continue
!             lflags = attributehash['FLAGS']
              uid = long(attributehash['UID'])
!             self.messagelist[uid]['flags'] =
imaputil.flagsimap2maildir(lflags)
              try:
                  needupdate.remove(uid)
              except ValueError:          # Let it slide if it's not
              in the list

02/03/08 14:04:35 changed by js

    * attachment flags-fix.patch added.

Delete 02/03/08 14:05:24 changed by js 

Unfortunately I have to fetch some of my mail from an Exchange server
(Microsoft Exchange Server 2003 IMAP4rev1 server version 6.5.7638.1)
and I can confirm that the analysis of the problem is correct, and the
patch given here fixes the problem.

Looking at the code of the processmessagesflags() method I think it
generally is a bug that the "flags" parameter is reused as a local
variable, since the final "for uid in needupdate:" loop needs the
original value of "flags". This only worked by accident.

I'm attaching a unidiff version of the patch which applies cleanly
against Debian unstable's offlineimap 5.99.4.
2008-03-02 22:25:05 -06:00
John Goerzen
2094037de1 Truncate local status folders on creation
Should help eliminate problems with old cache

refs deb#459985, refs #19
2008-03-02 22:21:10 -06:00
John Goerzen
73485475e9 Infrastructure for notifying LocalStatus of local mailbox creations
This will let us delete LocalStatus caches when we create a local
mailbox

refs deb#459985, refs #19
2008-03-02 22:17:45 -06:00
Riccardo Murri
81b86fb74c Add Gmail IMAP special support.
New repository/folder classes to support "real deletion" of messages
thorugh Gmail's IMAP interface: to really delete a message in Gmail,
one has to move it to the Trash folder, rather than EXPUNGE it.
2008-01-03 04:56:55 +01:00
Riccardo Murri
ec89c3eb53 Add option '-f' for sync'ing only selected folders 2008-01-03 04:15:11 +01:00
Riccardo Murri
2985ddc61e Add option '-k' for overriding config options 2008-01-03 04:13:04 +01:00
Florian Friesdorf
08f22be8ea completed: * fixes behaviour when changing flags, without corresp. rights (s,d,w) 2007-07-19 17:52:29 +01:00
Florian Friesdorf
71a76d9a61 fixes behaviour when changing flags, without corresp. rights (s,d,w) 2007-07-12 05:08:47 +01:00
Florian Friesdorf
c305d63e00 fix behaviour for delete/expunge, when lacking rights
This patch maneuvers around python imaplib's mysterious read-only detection
algorithm and correctly calls the UI's deletetoreadonly(), when trying to
delete/expunge in a mailbox without having the necessary rights.
2007-07-12 04:44:11 +01:00
John Goerzen
d9109bc928 Bump version number 2007-10-19 20:32:21 +01:00
John Goerzen
24cdba3221 Undo 'Fix Maildir race' patch
This was causing OfflineIMAP to hang
2007-10-19 20:29:34 +01:00
Vincent Beffara
f549baa074 UNDO: Synchronize newly created folders both ways
This involves several changes at different places:

- syncfoldersto() takes statusfolder as an argument, and returns the
  list of new folders and the list of folders that should be ingnored,
  typically those that were deleted. Warns the user about folders that
  are present only on one side and are not synced.

- syncfoldersto() is called both ways, and on folder creation
  forgetfolders() is used to rebuild the list and take the new creation
  into account. Probably not the most efficient, since it involves
  talking to the IMAP server again, but it will rarely be used anyway.

- Locally created folders are treated separately in the synchronization,
  namely the local messages are uploaded and then the normal sync still
  occurs. If the same folder is created on both sides and contains
  messages on both sides, a two-way sync occurs.
2007-09-02 01:43:15 +01:00
John Goerzen
6caaea36e0 Fix Maildir race
fixes deb#439384

From: martin f krafft
Subject: race condition in Maildir writing

The offlineimap Maildir code checks for file existence and then
opens a file. That's open to a race condition. It's better to open
the file and fail if it already exists. The following patch does
this. It catches OSError 17 (file exists) and re-raises all others.
I'll leave it up to you to decide whether this is appropriate.
2007-10-19 01:06:18 +01:00
Vincent Beffara
b925fd1296 Synchronize newly created folders both ways
This involves several changes at different places:

- syncfoldersto() takes statusfolder as an argument, and returns the
  list of new folders and the list of folders that should be ingnored,
  typically those that were deleted. Warns the user about folders that
  are present only on one side and are not synced.

- syncfoldersto() is called both ways, and on folder creation
  forgetfolders() is used to rebuild the list and take the new creation
  into account. Probably not the most efficient, since it involves
  talking to the IMAP server again, but it will rarely be used anyway.

- Locally created folders are treated separately in the synchronization,
  namely the local messages are uploaded and then the normal sync still
  occurs. If the same folder is created on both sides and contains
  messages on both sides, a two-way sync occurs.
2007-09-02 01:43:15 +01:00
John Goerzen
cdccfd83b1 Fixed locked() for noninteractive UIs
From: "Mark A. Hershberger"

https://bugs.launchpad.net/ubuntu/+source/offlineimap/+bug/96710

the locked() method isn't implemented for non-interactive UIs, so
exceptions are thrown on cron jobs.  Ubuntu's new apport catches these
and ? well, you get the idea.

patch provided.
2007-10-10 00:12:22 +01:00
John Goerzen
3305d8cd4d Daniel Jacobowitz patches
fixes deb#433732

Date: Sun, 30 Sep 2007 13:54:56 -0400
From: Daniel Jacobowitz <drow@false.org>
To: offlineimap@complete.org
Subject: Assorted patches

Here's the result of a lazy Sunday hacking on offlineimap.  Sorry for
not breaking this into multiple patches.  They're mostly logically
independent so just ask if that would make a difference.
First, a new -q (quick) option.  The quick option means to only update
folders that seem to have had significant changes.  For Maildir, any
change to any message UID or flags is significant, because checking
the flags doesn't add a significant cost.  For IMAP, only a change to
the total number of messages or a change in the UID of the most recent
message is significant.  This should catch everything except for
flags changes.

The difference in bandwidth is astonishing: a quick sync takes 80K
instead of 5.3MB, and 28 seconds instead of 90.

There's a configuration variable that lets you say every tenth sync
should update flags, but let all the intervening ones be lighter.


Second, a fix to the UID validity problems many people have been
reporting with Courier.  As discussed in Debian bug #433732, I changed
the UID validity check to use SELECT unless the server complains that
the folder is read-only.  This avoids the Courier bug (see the Debian
log for more details).  This won't fix existing validity errors, you
need to remove the local status and validity files by hand and resync.


Third, some speedups in Maildir checking.  It's still pretty slow
due to a combination of poor performance in os.listdir (never reads
more than 4K of directory entries at a time) and some semaphore that
leads to lots of futex wake operations, but at least this saves
20% or so of the CPU time running offlineimap on a single folder:

Time with quick refresh and md5 in loop: 4.75s user 0.46s system 12%
cpu 41.751 total
Time with quick refresh and md5 out of loop: 4.38s user 0.50s system
14% cpu 34.799 total
Time using string compare to check folder: 4.11s user 0.47s system 13%
cpu 34.788 total


And fourth, some display fixes for Curses.Blinkenlights.  I made
warnings more visible, made the new quick sync message cyan, and
made all not explicitly colored messages grey.  That last one was
really bugging me.  Any time OfflineIMAP printed a warning in
this UI, it had even odds of coming out black on black!


Anyway, I hope these are useful.  I'm happy to revise them if you see
a problem.

-- 
Daniel Jacobowitz
CodeSourcery
2007-10-01 22:20:37 +01:00
John Goerzen
6949a31164 Resolve conflict 2007-10-13 07:07:30 +01:00
John Goerzen
764ba74c5f Update version 2007-08-01 02:29:06 +01:00
John Goerzen
2323fdcdb3 Additional date validity check
patch from Mike Gerber

Two times today I have found my offlineimap to have died with this same
situation. It appears as if certain types of messages (both spam in my
situation), cause offlineimap to choke. When it does it cannot proceed.
This means that when I run offlineimap, it pulls in messages from some
folders, then it hits the folder with the bad message and dies, leaving
undownloaded mail on the server. The only fix to this problem is to find
the problem message on the server and remove it by hand. This isn't such
a huge deal for me, since I run the server, but other people have to
come to me to ask me to delete these messages, and until I do they
cannot download their email.

I have captured the output by running script during one of these
incidents, this has been attached. Additionally, I have also attach the 
problematic message.

The patch seems to work for me, might need some Python wizard and better 
testing, though.

fixes deb#396443
2007-08-01 02:25:05 +01:00
John Goerzen
4e19af1513 Fix non-SSL connection
fixes deb#432727
2007-07-12 11:02:19 +01:00
John Goerzen
09d71143d7 Fix version.py importing 2007-07-10 12:57:03 +01:00
John Goerzen
84d1662482 Update changelog 2007-07-11 02:50:30 +01:00
Florian Friesdorf
3e7899a9dc IMAP.py: fixed cannot concatenate 'str' and 'list' in assert
r[1] is a list. In case it contains more than one 'str' they are concatenated
using '. '. In processmessagesflags the join is tested, for savemessagesflags I
assume that it is also needed.
2007-07-07 04:51:02 +01:00
Florian Friesdorf
ed005cbbdc UIBase config variable fix
Code is probably reached for the first time, thanks to the correct readonly
handling patch
2007-07-07 02:30:42 +01:00
John Goerzen
acc597ff28 Write current PID to ~/.offlineimap/pid
fixes deb#217550
refs deb#410181
2007-07-07 01:50:43 +01:00
John Goerzen
a381ca3977 Re-scan list of remote folders on each sync
rather than just up-front.

fixes deb#396772
2007-07-06 17:46:29 +01:00
John Goerzen
f0d48365cf Added timeouts 2007-07-06 17:37:58 +01:00
John Goerzen
4370da1dcf UNDO: Checkpointing 2007-07-05 14:49:54 +01:00
John Goerzen
7a287cef57 Checkpointing 2007-07-05 14:49:54 +01:00
John Goerzen
1af12e99a1 Tweaks to machine 2007-07-05 14:22:57 +01:00