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

More Cogent Mail updates #357

Merged
merged 84 commits into from
Oct 15, 2024
Merged

More Cogent Mail updates #357

merged 84 commits into from
Oct 15, 2024

Conversation

kkoreilly
Copy link
Member

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.

…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
@@ -92,108 +108,164 @@ func (a *App) CacheMessages() error {
// CacheMessages caches all of the messages from the server that
Copy link
Member

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 {
Copy link
Member

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.

Copy link
Member

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 {
Copy link
Member

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 {
Copy link
Member

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.

mail/send.go Show resolved Hide resolved
@rcoreilly rcoreilly merged commit 2f018e0 into main Oct 15, 2024
1 check passed
@rcoreilly rcoreilly deleted the mail branch October 15, 2024 18:04
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

Successfully merging this pull request may close these issues.

2 participants