From fb7abab1121ed7c43c84a4d5a7564e6556d84a73 Mon Sep 17 00:00:00 2001 From: Dustin Swan Date: Fri, 18 Apr 2014 17:42:16 -0600 Subject: [PATCH] Giving into the offlineimap nametrans for google. Spaces in my folder names were causing problems.. --- afew/config | 11 ++++++----- notmuch-post-new | 3 ++- offlineimaprc | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/afew/config b/afew/config index 66bed74..6f3ba5d 100644 --- a/afew/config +++ b/afew/config @@ -26,27 +26,27 @@ tags = -new;+inbox [Filter.8] message = Drafts -query = folder:iocom/INBOX.Drafts OR 'folder:"gmail/[Gmail].Drafts"' +query = folder:iocom/INBOX.Drafts OR folder:gmail/drafts tags = -new;+drafts [Filter.10] message = Sent -query = folder:iocom/INBOX.Sent OR 'folder:"gmail/[Gmail].Sent Mail"' +query = folder:iocom/INBOX.Sent OR folder:gmail/sent tags = -new;+sent [Filter.12] message = Spam -query = folder:iocom/INBOX.spam OR 'folder:"gmail/[Gmail].Spam"' +query = folder:iocom/INBOX.spam OR folder:gmail/spam tags = -new;+spam [Filter.14] message = Trash -query = folder:iocom/INBOX.Trash OR 'folder:"gmail/[Gmail].Trash"' +query = folder:iocom/INBOX.Trash OR folder:gmail/trash tags = -new;+trash [Filter.15] message = Archived -query = folder:iocom/INBOX.Archive OR 'folder:"gmail/[Gmail].All Mail"' +query = folder:iocom/INBOX.Archive OR folder:gmail/archive tags = -new;-inbox # IOCOM specific folders @@ -79,6 +79,7 @@ folders = iocom/INBOX/ iocom/INBOX.Archive/ iocom/INBOX/ = 'NOT tag:inbox':iocom/INBOX.Archive/ iocom/INBOX.Archive/ = 'tag:inbox':iocom/INBOX/ +gmail/INBOX = 'NOT tag:inbox':gmail/archive/ #gmail/INBOX/ = 'NOT tag:inbox':"gmail/[Gmail].All Mail" #gmail/[Gmail].Important/ = 'NOT tag:inbox':"gmail/[Gmail].All Mail" diff --git a/notmuch-post-new b/notmuch-post-new index 4c2d55d..c93da4e 100755 --- a/notmuch-post-new +++ b/notmuch-post-new @@ -2,8 +2,9 @@ # For mail my other MUAs has moved -# Look for mail in folder INBOX.Archive that have inbox. Remove inbox. +# Look for archived mail that have inbox. Remove inbox. notmuch tag -inbox -- folder:INBOX.Archive tag:inbox +notmuch tag -inbox -- tag:inbox AND tag:gmail NOT folder:gmail/INBOX # Initial tagging for new mail afew --tag --new diff --git a/offlineimaprc b/offlineimaprc index 114e1eb..85a832a 100644 --- a/offlineimaprc +++ b/offlineimaprc @@ -28,6 +28,13 @@ status_backend = sqlite [Repository GmailLocal] type = Maildir localfolders = ~/.mail/gmail +nametrans = lambda folder: re.sub('spam', '[Gmail].Spam', + re.sub('drafts', '[Gmail].Drafts', + re.sub('sent', '[Gmail].Sent Mail', + re.sub('starred', '[Gmail].Starred', + re.sub('trash', '[Gmail].Trash', + re.sub('important', '[Gmail].Important', + re.sub('archive', '[Gmail].All Mail', folder))))))) [Repository GmailRemote] type = Gmail @@ -35,3 +42,10 @@ remoteuser = dustinswan@gmail.com remotepasseval = gmail_password() realdelete = no sslcacertfile = /usr/local/opt/curl-ca-bundle/share/ca-bundle.crt +nametrans = lambda folder: re.sub('.*Spam$', 'spam', + re.sub('.*Drafts$', 'drafts', + re.sub('.*Sent Mail$', 'sent', + re.sub('.*Starred$', 'starred', + re.sub('.*Trash$', 'trash', + re.sub('.*Important$', 'important', + re.sub('.*All Mail$', 'archive', folder)))))))