Syncing Back Locally Created Folders -- Pointers on implementation?

Sebastian Spaeth Sebastian at
Thu May 5 01:35:23 BST 2011

On Wed, 04 May 2011 17:02:22 -0700, creole.sleepr at wrote:
> I have been looking around the internet and this list for quite some
> time, and I can't seem to figure out why this feature (a folder is
> created locally, offlineimap detects this and then creates the folder
> with those contents on the IMAP server).

Hi, so it was you in the IRC channel? I always tried to ping you right
after you had left :-).

Let me explain what I believe is the biggest difficulty (note that I had
no part in any initial design of this thing):

The problems is with the "folderfilter" and "nametrans" options. Those
options make it possible to suppress folders (so only a few are synced)
and to transpose names from the remote IMAP server to the local

a) folderfilter: If I mask folders on the REMOTE IMAP, offlineimap
currently treats them as non-existent. So when those folders are on the
LOCAL side, we would then try to create the folder and sync mails
there. E.g. I mask out all my email archives from before 2011 but they
exist on both the REMOTE and the LOCAL side. It's a complication, but
it's solvable (check if the remote folder exists and don't create it

b) nametrans: With the nametrans function you can transpose a folder
name on REMOTE IMAP to the LOCAL repository. So what happens when you
create a local filter? What name should it get on the REMOTE side? The
nametrans function is like a hash function, it works one-way only. So
you would need to start handing it nametrans functions for both ways
(and write the documentation so users get it).

> I am willing to implement this feature, 
> because sorting emails into
> folders is an essential component of my email workflow with mutt. The
> lack of this feature is blocking my adoption of offlineimap, which
> otherwise looks like a fantastic package. Would the feature be very hard
> to implement?
> Any pointers on where to get started? calls remoterepository.syncfolders(...) which does the
folder creation on the local side.

The implementation is in

    def syncfoldersto(self, dest, copyfolders): 

Have a look and feel free to ask questions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the OfflineIMAP-project mailing list