-
Notifications
You must be signed in to change notification settings - Fork 2
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
Exclude specific label? #2
Comments
Hmm. Oddly, I'm not sure that's trivial--worse, now that I think about how the API works, I think the whole label feature (which I don't use myself; I can't remember why I added it) may not even work right! It's been a while since I even looked at this code, but what we do is call history.list(labels): https://developers.google.com/gmail/api/v1/reference/users/history/list. There are two problems here:
The latter makes me wonder: if we only sync history for messages with a given label, what happens if we have a label filter ("X"), we sync a message with label "X", and then label "X" is removed from the message on the server side? What happens next time we sync? One possible behavior (which is not clear to me from the documentation) is that we would not see the "remove label Y" action (#3) when we sync in step #4. Which may or may not be desirable behavior. Anyway, to solve #1 and implement negative filters, we could easily just add a filter about here https://github.com/danmarg/outtake/blob/master/lib/gmail/gmail.go#L299 which would apply an "exclusion" filter. This is a bit less efficient than filtering on the server-side, but since the API seems not to support that... So something like:
Wanna send me a PR? ;) |
@nickchappell Does this do what you want? #3 I haven't tried running it, to be honest. Maybe you'd be willing to try it out so I don't have to. :) |
Is there a way to exclude a specific label or set of labels from being downloaded? My use case is to download all of my email, but not with the All label (I'd also like to exclude Trash/, Drafts/, Spam and some others).
The text was updated successfully, but these errors were encountered: