Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting x/y/z instead of nested labels syncing to Gmail #598

Closed
altendky opened this issue Feb 21, 2019 · 5 comments
Closed

Getting x/y/z instead of nested labels syncing to Gmail #598

altendky opened this issue Feb 21, 2019 · 5 comments

Comments

@altendky
Copy link
Contributor

altendky@lt:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.7 (stretch)
Release:        9.7
Codename:       stretch
altendky@lt:~$ offlineimap --version
7.2.2
altendky@lt:~$ head -n 1 $(which offlineimap)
#!/home/altendky/.local/share/virtualenvs/offlineimap/bin/python2
altendky@lt:~$ /home/altendky/.local/share/virtualenvs/offlineimap/bin/python2 -c 'import sys; print(sys.version)'
2.7.15 (default, Dec 11 2018, 00:01:04) 
[GCC 6.3.0 20170516]
altendky@lt:~$ cat ~/.offlineimaprc
[general]
accounts = EuMX, dad_eumx_gmail

[Account EuMX]
localrepository = EuMXLocal
remoterepository = EuMXRemote

[Repository EuMXLocal]
type = Maildir
localfolders = /data/Backups/email/eumx

[Repository EuMXRemote]
readonly = True
type = IMAP
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotehost = ssl.eumx.net
remoteuser = <snip>

[Account dad_eumx_gmail]
localrepository = dad_gmail
#localrepository = dad_actually_gmail
remoterepository = dad_eumx

[Repository dad_eumx]
readonly = True
type = IMAP
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotehost = ssl.eumx.net
remoteuser = <snip>
nametrans = lambda folder: 'EuMX/' + folder

[Repository dad_gmail]
type = IMAP
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotehost = imap.gmail.com
remoteuser = <snip>@gmail.com
sep = /

[Repository dad_actually_gmail]
type = Gmail
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteuser = <snip>@gmail.com
altendky@lt:~$ offlineimap -a dad_eumx_gmail

I am trying to sync from a (remote) IMAP server to Gmail. It's just a transfer so once all messages have been sync'ed across, we're good. There are nested folders on the IMAP server but when they get synced to Gmail they end up as just individual labels with /'s in them. I do have the nametrans to try to put all the new labels under a single common one. I tried creating the top-level EuMX label and after that the offlineimap-created labels were nested inside, but the rest of the layers were still /ed rather than nested labels.

I tried with no improvement:

  • Not specifying sep = as well as . and /
  • type = Gmail, but that's only for 'local' repositories
  • Extra leading / on the nametrans
@nicolas33
Copy link
Member

Did you try sep = / in [Repository dad_eumx]?

Some samples of debug logs (-d imap) and offlineimap --info might help to understand what's going on.

@altendky
Copy link
Contributor Author

@nicolas33 Thanks for the quick response. I did try sep = / but I'll repeat again... you never know when you might misremember something. I'll provide the other info as well.

I just had a thought though that I figured I'd mention. Perhaps there's just a lack of creating each nested layer? So create x, then create x/y, then create x/y/z seems like it might fix the issue. I haven't dug into the code yet to see how this is handled but based on the log (to be shared, as requested) it seems to be creating the whole folder path in one fell swoop rather than layer by layer.

Hopefully I'll get the requested data this evening. Cheers,

@nicolas33
Copy link
Member

You might be correct. This could be related to #212.

You could conform this by creating a small tree of labels by hand and sync again.

@altendky
Copy link
Contributor Author

I had already tried manually creating the single top level (EuMX as in the nametrans) and the result was sublabels which did not include EuMX but did still... welll. See below. My gut says that #335 would fix it, thanks for pointing there. I'll try to find some time to explore and PR. Thanks.

Without manually creating EuMX label:

  • EuMX/x/y/a
  • EuMX/x/y/b
  • EuMX/x/z/a

With a manually created EuMX label:

  • EuMX
    • x/y/a
    • x/y/b
    • x/z/a

And for completeness, desired result:

  • EuMX
    • x
      • y
        • a
        • b
      • z
        • a

altendky added a commit to altendky/offlineimap that referenced this issue Feb 24, 2019
When creating a folder in one command on Gmail you end up with
one tag such as 'x/y/z' instead of three nested tags such as 'z'
inside of 'y' inside of 'x'.  Creating each layer individually
results in the desired nested label structure.

OfflineIMAP#335
OfflineIMAP#598
altendky added a commit to altendky/offlineimap that referenced this issue Feb 27, 2019
When creating a folder in one command on Gmail you end up with
one tag such as 'x/y/z' instead of three nested tags such as 'z'
inside of 'y' inside of 'x'.  Creating each layer individually
results in the desired nested label structure.

This was tested in a personal transfer of email from a remote
IMAP server to Gmail.

OfflineIMAP#335
OfflineIMAP#598

Signed-off-by: Kyle Altendorf <sda@fstab.net>
nicolas33 pushed a commit that referenced this issue Feb 27, 2019
When creating a folder in one command on Gmail you end up with
one tag such as 'x/y/z' instead of three nested tags such as 'z'
inside of 'y' inside of 'x'.  Creating each layer individually
results in the desired nested label structure.

This was tested in a personal transfer of email from a remote
IMAP server to Gmail.

#335
#598

Signed-off-by: Kyle Altendorf <sda@fstab.net>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
@nicolas33
Copy link
Member

Patch applied. Should be in the next release (after 7.2.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants