-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
More Cogent Mail updates #357
Conversation
…CacheMessagesForMailbox; should fix issue where it resets the entire cache once it gets to another mailbox
…t issues with modifying a.readMessage.Labels while looping over it and checking it
…Labels saving; labeling now fully working
…er mail clients correctly
…s; improve cache file saving safety in mail
…or conversation threading
…h new conversationStart function
…y most recent date instead of first date
… any of its replies are unread
@@ -92,108 +108,164 @@ func (a *App) CacheMessages() error { | |||
// CacheMessages caches all of the messages from the server that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: match actual fname
return fmt.Errorf("authenticating: %w", err) | ||
var err error | ||
c := a.imapClient[email] | ||
if c == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be an if statement buried within the cache logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull out into separate func
} | ||
alreadyHaveSlice := []imap.UID{} | ||
alreadyHaveMap := map[imap.UID]bool{} | ||
for _, cm := range cached { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a separate func -- used at least 2x
// other given values, using an iterative batched approach that fetches the | ||
// five next most recent messages at a time, allowing for concurrent mail | ||
// modifiation operations and correct ordering. | ||
func (a *App) CacheUIDs(uids []imap.UID, c *imapclient.Client, email string, mailbox string, dir string, cached map[string]*CacheData, cacheFile string) error { | ||
func (a *App) cacheUIDs(uids []imap.UID, c *imapclient.Client, email string, mailbox string, dir string, cached map[string]*CacheMessage) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a deeply nested long function -- consider useful subroutines or other logical structure.
More improvements and features for Cogent Mail that get it almost ready for dogfooding, although not quite yet. Includes attachments and better labeling and caching support.