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

Gmail and Labels: label correspondig to folder not added to header? #672

Open
rionda opened this issue Jun 25, 2020 · 0 comments
Open

Gmail and Labels: label correspondig to folder not added to header? #672

rionda opened this issue Jun 25, 2020 · 0 comments

Comments

@rionda
Copy link

rionda commented Jun 25, 2020

General informations

  • system/distribution (with version): MacOS 10.15.6
  • offlineimap version (offlineimap -V): offlineimap v7.2.1, imaplib2 v2.57 (bundled), Python v2.7.18, OpenSSL 1.1.1g 21 Apr 2020 (that's what comes with MacPorts)
  • Python version: Python 2.7.18
  • server name or domain: Gmail
  • CLI options: none

Configuration file offlineimaprc

[general]
accounts = MyAcct
ui=ttyui

[Account MyAcct]
localrepository = MyAcctlocal
remoterepository = MyAcctserver
# Sync the labels
synclabels = yes
# Header where labels go (X-Keywords is the default, but mutt uses X-Label)
labelsheader = X-Label
# Ignore some Gmail labels
ignorelabels = \Sent, \Draft, \Spam, \Trash, \Important
# Update notmuch database after syncing
postsynchook = notmuch new

# This is the remote repository
[Repository MyAcctserver]
type = Gmail
# Private auth info removed
# Ignore some folders
folderfilter = lambda foldername : foldername not in [ '[Gmail]/Important', '[Gmail]/All Mail'] and foldername[:3] != "Old"
# Remap some labels. It must match with the entry in the local repository
nametrans = lambda folder: {'[Gmail]/Drafts':    'drafts',
                            '[Gmail]/Sent Mail': 'sent',
                            '[Gmail]/Starred':   'starred',
                            '[Gmail]/Important':   'important',
                            '[Gmail]/Spam':   'spam',
                            '[Gmail]/Trash':     'trash',
                            '[Gmail]/All Mail':  'archive',
                            }.get(folder, folder)

# This is the 'local' repository
[Repository MyAcctlocal]
type = GmailMaildir
localfolders = ~/Mail/MyAcct
# Put different IMAP folders in separate directories
sep = /
# Ignore some folders
folderfilter = lambda foldername : foldername not in [ '[Gmail]/Important', '[Gmail]/All Mail'] and foldername[:3] != "Old"
# Remap some labels. It must match with the entry in the remote repository
nametrans = lambda folder: {'drafts':   '[Gmail]/Drafts',
                            'sent':     '[Gmail]/Sent Mail',
                            'important':'[Gmail]/Important',
                            'spam':     '[Gmail]/Spam',
                            'starred':  '[Gmail]/Starred',
                            'trash':    '[Gmail]/Trash',
                            'archive':  '[Gmail]/All Mail',
                            }.get(folder, folder

Steps to reproduce the error

  • Add two labels, A and B to a message in inbox.
  • After syncing
    • a copy (?) of the message is present in the folder A. The X-Label header contains only the labels B and \Inbox (to be precise it's X-Label: B \Inbox);
    • another copy (?) of the message is present in the folder B. The X-Label header contains only the labels A and \Inbox (to be precise, its X-Label A \Inbox);
    • a third copy (?) of the message is present in the inbox. The X-Label header contains only the labels A and \Inbox (to be precies, it's X-Label A B);

I would be expecting the header (of all copies?) to contain all the labels. I believe I expect this behavior because folders are labels in Gmail, and viceversa, so it just seems more natural to have all the labels in it. On the other hand, I understand that what seems to be stored are the "additional" labels: the fact that the message is in this folder implies that it has the label corresponding to the folder.

Is this expected behavior from the program or is it a bug? Perhaps it could be tunable? (I couldn't find in the code where the "folder" label may be removed).

Thanks.

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

1 participant