Re: Mapping INBOX to a folder

Friedemann Schorer <[email protected]>
Newsgroups gmane.mail.imap.offlineimap.general
Message-ID <[email protected]>
Hi Nicolas,
thanks for the instructions - I'm not a programmer, so it's all 
trial-and-error for me ...
I read the page you mentioned and tried to fit your example to my needs 
- but although it works in the python shell it doesn't for my 
.offlineimaprc

Lets' go for the shell works:

user@host:~$ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> nametrans_test = lambda folder: re.sub('^INBOX$', 'Job/Klinik', 
>>> folder)
>>> nametrans_test('blah')
'blah'
>>> nametrans_test('INBOX')
'Job/Klinik'
>>> nametrans_test('INBOX/Calendar')
'INBOX/Calendar'
>>> nametrans_reverse = lambda folder: re.sub('^Job/Klinik/$', 'INBOX', 
>>> folder)
>>> nametrans_reverse('Job/')
'Job/'
>>> nametrans_reverse('Job/Klinik')
'Job/Klinik'
>>> nametrans_reverse('Job/Klinik/')
'INBOX'
>>> quit()

Looks like it works. :-)

Now for the offlineimaprc:

> [general]
> accounts = KLS
> 
> [Account KLS]
> remoterepository = host1
> localrepository = host2
> 
> 
> [Repository host2]
> type = IMAP
> ssl = yes
> cert_fingerprint = keykeykey
> createfolders = False
> nametrans = lambda folder: re.sub( '^INBOX$', 'Job/Klinik', folder)
> 
> [Repository host1]
> type = IMAP
> ssl = yes
> cert_fingerprint = keykeykey
> folderfilter = lambda folder: folder in ['INBOX']
> readonly = true

Now, let's try this:

user@host:~$ offlineimap --info
OfflineIMAP 7.1.5
   Licensed under the GNU GPL v2 or any later version (with an OpenSSL 
exception)
imaplib2 v2.57 (system), Python v2.7.13, OpenSSL 1.1.0f  25 May 2017
   imaplib2: 2.57 (system)
Remote repository 'host1': type 'IMAP'
Host: host1 Port: None SSL: True
Establishing connection to host1:993 (host1)
Server supports ID extension.
Server welcome string: * OK [CAPABILITY IMAP4rev1 LITERAL+ ID ENABLE 
AUTH=LOGIN AUTH=PLAIN AUTH=DIGEST-MD5 AUTH=CRAM-MD5 SASL-IR] host server 
ready
Server capabilities: ('IMAP4REV1', 'LITERAL+', 'ID', 'ENABLE', 'ACL', 
'RIGHTS=KXTE', 'QUOTA', 'MAILBOX-REFERRALS', 'NAMESPACE', 'UIDPLUS', 
'NO_ATOMIC_RENAME', 'UNSELECT', 'CHILDREN', 'MULTIAPPEND', 'BINARY', 
'CATENATE', 'CONDSTORE', 'ESEARCH', 'SORT', 'SORT=MODSEQ', 
'SORT=DISPLAY', 'THREAD=ORDEREDSUBJECT', 'THREAD=REFERENCES', 
'ANNOTATEMORE', 'LIST-EXTENDED', 'WITHIN', 'QRESYNC', 'SCAN', 'XLIST', 
'URLAUTH', 'URLAUTH=BINARY', 'X-NETSCAPE', 'X-INTRANATOR-SETTINGS-UI', 
'X-INTRANATOR-FREEBUSY-TRIGGER', 'X-SHAREDSEEN-ANNOTATION', 
'LOGINDISABLED', 'COMPRESS=DEFLATE', 'IDLE')

folderfilter= lambda folder: folder in ['INBOX']

Folderlist:
  INBOX
  INBOX/Aufgaben (disabled)
  INBOX/Drafts (disabled)
  INBOX/Entw&APw-rfe (disabled)
  INBOX/Gel&APY-schte Elemente (disabled)
  INBOX/Gesendete Elemente (disabled)
  INBOX/Junk (disabled)
  INBOX/Kalender (disabled)
  INBOX/Kontakte (disabled)
  INBOX/Notizen (disabled)
  INBOX/privat (disabled)
  INBOX/Sent (disabled)
  INBOX/Trash (disabled)

Local repository 'host2': type 'MappedIMAP'
Host: host2 Port: None SSL: True
Establishing connection to host2:993 (host2)
Server supports ID extension.
Server welcome string: * OK [CAPABILITY IMAP4rev1 LITERAL+ ID ENABLE 
AUTH=PLAIN AUTH=LOGIN SASL-IR] host Cyrus IMAP 
2.5.11-41-gd53406f3f-Debian-2.5.11.41-0~kolab2 server ready
Server capabilities: ('IMAP4REV1', 'LITERAL+', 'ID', 'ENABLE', 'ACL', 
'RIGHTS=KXTEN', 'QUOTA', 'MAILBOX-REFERRALS', 'NAMESPACE', 'UIDPLUS', 
'NO_ATOMIC_RENAME', 'UNSELECT', 'CHILDREN', 'MULTIAPPEND', 'BINARY', 
'CATENATE', 'CONDSTORE', 'ESEARCH', 'SORT', 'SORT=MODSEQ', 
'SORT=DISPLAY', 'SORT=UID', 'THREAD=ORDEREDSUBJECT', 
'THREAD=REFERENCES', 'ANNOTATEMORE', 'ANNOTATE-EXPERIMENT-1', 
'METADATA', 'LIST-EXTENDED', 'LIST-STATUS', 'LIST-MYRIGHTS', 'WITHIN', 
'QRESYNC', 'SCAN', 'XLIST', 'XMOVE', 'MOVE', 'SPECIAL-USE', 
'CREATE-SPECIAL-USE', 'URLAUTH', 'URLAUTH=BINARY', 'LOGINDISABLED', 
'X-QUOTA=STORAGE', 'X-QUOTA=MESSAGE', 'X-QUOTA=X-ANNOTATION-STORAGE', 
'X-QUOTA=X-NUM-FOLDERS', 'IDLE')

nametrans= lambda folder: re.sub( '^INBOX$', 'Job/Klinik', folder)

Folderlist:
    [ ... ]
  Hobby/Status
  Hobby/Status/Monit
  Job
  Job/Arbeitsangebote
  Job/Arbeitsangebote/Uebernommen
  INBOX -> Job/Klinik
  Job/Klinik
  Journal
  Notes
    [ ... ]

Looks to me as if the nametrans worked.
But when I try to sync the mails all mails from host1 get filed into the 
INBOX of host2.

What's my error? I'm a bit lost ...

    Thanks,


         Friedemann

P.S.: Sorry for not replying directly - I somehow don't receive the list 
mails so far and have to anwser after reading replies on the list 
archive.

-- 
Cassandra Claire : I respect your position, Professor, he said. I just 
don't share it.


_______________________________________________
OfflineIMAP-project mailing list: [email protected]
http://lists.alioth.debian.org/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.