Sync -> Mails there. Sync -> mails gone
Matthias Beyer
mail at beyermatthias.de
Thu Jan 29 10:53:55 GMT 2015
Sorry guys, but the more I get into it, the more I get confused:
I managed to outsource the python code which does the nametrans. No
big deal.
I also inserted debug messages (simple print() calls), and it actually
prints _all_ my folders, like the folderfilter wouldn't apply _at
all_.
Here's my python code:
import re
def hfu_local_folderfilter(name):
return name.startswith("hfu.")
#
# Translate the local folder name to the remote folder name:
#
# hfu.INBOX -> INBOX
# hfu.foo -> INBOX.foo
#
def hfu_nametrans_local_to_remote(name):
if (name == "hfu.INBOX"):
ret = "INBOX"
else:
ret = "INBOX." + re.sub('^hfu\.', '', name)
print("Translated local->remote: '" + name + "' to '" + ret + "'")
return ret
#
# Translate the remote folder name to the local folder name:
#
# INBOX -> hfu.INBOX
# foo -> hfu.foo
#
def hfu_nametrans_remote_to_local(name):
ret = "hfu." + re.sub('^INBOX\.', '', name)
print("Translated remote->local: '" + name + "' to '" + ret + "'")
return ret
the hfu_local_folderfilter() should tell offlineimap that it should
only sync folders which start with my prefix, which is "hfu.". My
Maildir structure looks like this:
hfu.INBOX # Inbox for account "hfu"
hfu.foo
hfu.bar
inbox # Inbox for main account
foo
bar
I hope someone can help me with this, as this is my test-run for
offlineimap. After I configured it properly, I will use all my mail
accounts with it (using getmail with POP by now on the other accounts,
as the main account mentioned above).
Sorry for bothering you guys...
On 29-01-2015 11:20:13, Matthias Beyer wrote:
> I found the issue, but I don't know how to solve it:
>
> My nametrans renames the folders as requested, BUT the "INBOX" folder
> gets renamed to "localPREFIX.INBOX" (which is fine) when syncing
> remote->local. But on syncing local to remote, it gets renamed
> "INBOX.INBOX", which is obviousely wrong.
>
> The problem is, that I don't know how to solve this issue properly.
> Doing an if-else in the nametrans results in syntax errors, I don't
> know how much python this thing understands, so I tried solving it
> with regex only, but ... well, I can't get it working.
>
> Maybe you guys can?
>
> On 29-01-2015 10:44:49, Matthias Beyer wrote:
> > [Repository LocalFoo]
> > ...
> > nametrans = lambda foldername = "INBOX." + re.sub('^localPREFIX\.', '', foldername)
> > folderfilter = lambda foldername = foldername.startswith('localPREFIX.')
> >
> > [Repository RemoteFoo]
> > ...
> > nametrans = lambda foldername = "localPREFIX." + re.sub('^INBOX\.', '', foldername)
> >
>
> --
> Mit freundlichen Grüßen,
> Kind regards,
> Matthias Beyer
>
> Proudly sent with mutt.
> Happily signed with gnupg.
--
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer
Proudly sent with mutt.
Happily signed with gnupg.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20150129/3a7b23db/attachment-0003.sig>
More information about the OfflineIMAP-project
mailing list