Syncing Folders with different names
Sebastian Spaeth
Sebastian at SSpaeth.de
Wed Jun 22 08:06:13 BST 2011
On Wed, 22 Jun 2011 02:19:07 -0400, Brock Palen <brockp at mlds-networks.com> wrote:
> I am helping a user move from one server to a comercial provider whos names for folders like Drafts etc are different than ours.
>
> Thus my normal use of IMAP->IMAP offlineimap is not working.
> Examples of the folder names on host 1 to host 2:
>
> . OK LOGIN Ok.
> . list "" "*"
> * LIST (\HasNoChildren) "." "INBOX.Trash"
> * LIST (\Marked \HasChildren) "." "INBOX"
> * LIST (\HasNoChildren) "." "INBOX.Spam"
> * LIST (\HasNoChildren) "." "INBOX.Sent Items"
> * LIST (\HasNoChildren) "." "INBOX.Drafts"
> * LIST (\HasNoChildren) "." "INBOX.Junk"
> * LIST (\HasNoChildren) "." "INBOX.Sent"
> * LIST (\HasNoChildren) "." "INBOX.Deleted Items"
> * LIST (\HasNoChildren) "." "INBOX.NotSpam"
> . OK LIST completed
>
> . OK LOGIN Ok.
> . list "" "*"
> * LIST (\NoInferiors) "/" "INBOX"
> * LIST (\NoInferiors) "/" "Bulk Mail"
> * LIST (\NoInferiors) "/" "Drafts"
> * LIST (\HasNoChildren) "/" "Email_Templates"
> * LIST (\HasNoChildren) "/" "Junk E-mail"
> * LIST (\HasNoChildren) "/" "Notes"
> * LIST (\NoInferiors) "/" "Send_Later"
> * LIST (\NoInferiors) "/" "Sent Items"
> * LIST (\NoInferiors) "/" "Trash"
> . OK Success
>
> How would one sync the INBOX.Deleted Items folder to the Trash folder on the other host as an example?
You want nametrans rules on the remote repository that "translate"
folder names.
If your needs are simple, you can do:
nametrans = lambda folder: re.sub('^INBOX\.','',folder)
to remove any preceding "INBOX."
Or
nametrans = lambda folder: {'INBOX.Deleted Messages':'Trash', 'INBOX.Moo':'Meh'}.get(folder)
to translate a small number of defined translations (untested).
If your needs are more elaborate than a
lambda function and a few regexes can do you can invoke a python
function that takes a folder name and returns a different foldername.
Make sure to post your resulting tips on our wiki, so we can integrate
them in our docs:
https://github.com/spaetz/offlineimaporg/wiki/Example%20Configurations
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110622/00a68368/attachment-0001.sig>
More information about the OfflineIMAP-project
mailing list