about summary refs log tree commit diff stats
path: root/worker/imap/fetch.go
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-07-07 22:43:57 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-08 16:06:26 -0400
commit88c379dcbaaf9fd549cd271817e79fe634b1dd84 (patch)
tree5b12c811aa5a96ebe8debc1cb4067e32ea237698 /worker/imap/fetch.go
parentcce7cb48081ca090ac2d3a0e781dfbc25d581946 (diff)
downloadaerc-88c379dcbaaf9fd549cd271817e79fe634b1dd84.tar.gz
Use []uint32 instead of imap.SeqSet
A sequence-set is an IMAP-specific implementation detail. Throughout the
UI, aerc simply operates using lists of opaque identifiers. In order to
loosen the coupling between the UI and IMAP in particular, replace most
usages of imap.SeqSet with []uint32, leaving the translation to a SeqSet
to the IMAP backend as needed.
Diffstat (limited to 'worker/imap/fetch.go')
-rw-r--r--worker/imap/fetch.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go
index d5bb9aa..fe25977 100644
--- a/worker/imap/fetch.go
+++ b/worker/imap/fetch.go
@@ -31,8 +31,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders(
 		imap.FetchUid,
 		section.FetchItem(),
 	}
-
-	imapw.handleFetchMessages(msg, &msg.Uids, items, section)
+	imapw.handleFetchMessages(msg, msg.Uids, items, section)
 }
 
 func (imapw *IMAPWorker) handleFetchMessageBodyPart(
@@ -46,9 +45,7 @@ func (imapw *IMAPWorker) handleFetchMessageBodyPart(
 		imap.FetchUid,
 		section.FetchItem(),
 	}
-	uids := imap.SeqSet{}
-	uids.AddNum(msg.Uid)
-	imapw.handleFetchMessages(msg, &uids, items, section)
+	imapw.handleFetchMessages(msg, []uint32{msg.Uid}, items, section)
 }
 
 func (imapw *IMAPWorker) handleFetchFullMessages(
@@ -61,11 +58,11 @@ func (imapw *IMAPWorker) handleFetchFullMessages(
 		imap.FetchUid,
 		section.FetchItem(),
 	}
-	imapw.handleFetchMessages(msg, &msg.Uids, items, section)
+	imapw.handleFetchMessages(msg, msg.Uids, items, section)
 }
 
 func (imapw *IMAPWorker) handleFetchMessages(
-	msg types.WorkerMessage, uids *imap.SeqSet, items []imap.FetchItem,
+	msg types.WorkerMessage, uids []uint32, items []imap.FetchItem,
 	section *imap.BodySectionName) {
 
 	messages := make(chan *imap.Message)
@@ -132,7 +129,8 @@ func (imapw *IMAPWorker) handleFetchMessages(
 		done <- nil
 	}()
 
-	if err := imapw.client.UidFetch(uids, items, messages); err != nil {
+	set := toSeqSet(uids)
+	if err := imapw.client.UidFetch(set, items, messages); err != nil {
 		imapw.worker.PostMessage(&types.Error{
 			Message: types.RespondTo(msg),
 			Error:   err,