<DKIM> Re: Help with nametrans

Nicolas Sebrecht nicolas.s-dev at laposte.net
Sat Jul 9 13:54:10 BST 2016


On Sat, Jul 09, 2016 at 09:36:01AM +0200, Wojciech Żuk wrote:
>    offlineimap --version
>    6.3.4

>    my config look like this:

>    [Repository local]
>    folderfilter = lambda folder: folder in ['Test', 'Xpertis']
>    [Repository Gmail]
>    folderfilter = lambda folder: folder in
>    ['e-mail at wp.pl/Wys&AUI-ane', 'e-mail at wp.pl/Xpertis']
>    nametrans = lambda folder: re.sub('e-mail at wp.pl/Wys&AUI-ane',
>    'Test','Test')
>    nametrans = lambda folder: re.sub('e-mail at wp.pl/Xpertis',
>    'Xpertis','Xpertis')
> 
>    all I need to sync between (Local)[Xpertis]  <---->
>    (Gmail)[e-mail at wp.pl/Xpertis']
>    (Local)[Test]  <---->   (Gmail)[e-mail at wp.pl/Wys&AUI-ane']

>    but with this config offlineimap mix messages form these folders.

You can't duplicate configuration options in a section. There must be
only one 'nametrans' line in the remote section and another one in the
local.

You should set up a pythonfile and use a function to make things clear.

~/offlineimap-helpers.py:

 def renamefolder(foldername):
     # Xpertis.
     if foldername == 'e-mail at wp.pl/Xpertis':
         return 'Test'
     # Reversed Xpertis
     elif foldername == 'Test':
         return 'e-mail at wp.pl/Xpertis'

     # Same goes for other foldernames.
     elif foldername == '...'
         return '...'
     ...

Config:

 [General]
 pythonfile = ~/offlineimap-helpers.py

 [Repository Local]
 nametrans = renamefolder

 [Repository Gmail]
 nametrans = renamefolder

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list