Re: folderfilter & nametrans

Nicolas Sebrecht <[email protected]>
Newsgroups gmane.mail.imap.offlineimap.general
Message-ID <[email protected]>
On Sat, Jan 19, 2019 at 03:18:24PM +0100, Francois Sauterey wrote:

> Sorry, I do not have to be the first one to ask this question (or a
> similar one), but in the absence of a search engine on the archives, I
> did not find any answer to my questions.
> 
> I just bought a new server, and I have to migrate my imap accounts from
> old to new.
> Here are the folders created by running offlineimap:
> .&AMk-l&AOk-ments envoy&AOk-s
> .&AMk-l&AOk-ments supprim&AOk-s
> .Brouillons
> .Courrier ind&AOk-sirable
> .Drafts
> .INBOX.Drafts
> .INBOX.Junk
> .INBOX.Sent
> .INBOX.Trash
> .Junk
> .Sent
> .Trash
> cur
> new
> tmp
> 
> The first one contains sent messages (which should be in .Sent)
> 
> 1) I do not want to synchonize .INBOX.[Dratf | Junk | Sent | Trash] folders
> So I addes this line in .offlineimaprc
> folderfilter = folder lambda: not re.search ('(INBOX \.)', folder)
                 ^^^^^^                         ^     ^  ^

'lambda' and 'folder' are inverted.  Why the space before the backslash?
Why the inner parenthesis?

folderfilter = lambda f: not re.search ('INBOX\.', f)

Checking your rules in your python shell:

# python2
>>> import re
>>> a = lambda f: not re.search ('INBOX\.', f)
>>> a('.INBOX.Trash')
False
>>> a('.Trash')
True
>>>

When True, the folder is synced.

> 2) I would like the messages in .&AMk-l&AOk-ments envoy&AOk-s to be
> synchronized in .Sent
> And no rule seems to work, without generating errors.
> 
> Can someone help me?

You need nametrans and reversed nametrans (in the remote and local
sections).

remote nametrans:
nametrans = lambda f: '.Sent' if f == '.&AMk-l&AOk-ments envoy&AOk-s'

local reversed nametrans:
nametrans = lambda f: '.&AMk-l&AOk-ments envoy&AOk-s' if f == '.Sent'

-- 
Nicolas Sebrecht

_______________________________________________
OfflineIMAP-project mailing list: [email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/offlineimap-project

OfflineIMAP homepages:
- https://github.com/OfflineIMAP
- http://offlineimap.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.