aboutsummaryrefslogtreecommitdiff
path: root/internal/imap
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-03 01:15:24 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-03 01:15:24 +0200
commit61d4fad5d989d5fca0ee32d8e5624fb444881efa (patch)
treecb4495b1ac4bd680b02a359cad68cca5c91a2e0a /internal/imap
parent168cce8a935de864eef95f423f128a7bf49aafda (diff)
downloadfeed2imap-go-61d4fad5d989d5fca0ee32d8e5624fb444881efa.tar.gz
feed2imap-go-61d4fad5d989d5fca0ee32d8e5624fb444881efa.tar.bz2
feed2imap-go-61d4fad5d989d5fca0ee32d8e5624fb444881efa.zip
Fix update in IMAP
Diffstat (limited to 'internal/imap')
-rw-r--r--internal/imap/connection.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/imap/connection.go b/internal/imap/connection.go
index 68b7e6b..431d1dc 100644
--- a/internal/imap/connection.go
+++ b/internal/imap/connection.go
@@ -130,10 +130,12 @@ func (conn *connection) ensureFolder(folder Folder) error {
func (conn *connection) delete(uids []uint32) error {
storeItem := imap.FormatFlagsOp(imap.AddFlags, true)
+ deleteFlag := []interface{}{imap.DeletedFlag}
+
seqSet := new(imap.SeqSet)
seqSet.AddNum(uids...)
- if err := conn.c.UidStore(seqSet, storeItem, imap.DeletedFlag, nil); err != nil {
+ if err := conn.c.UidStore(seqSet, storeItem, deleteFlag, nil); err != nil {
return fmt.Errorf("marking as deleted: %w", err)
}
@@ -189,11 +191,19 @@ func (conn *connection) replace(folder Folder, header, value, newContent string,
return err
}
+ // filter \Seen --> updating should be noted :)
+ filteredFlags := make([]string, 0, len(flags))
+ for _, f := range flags {
+ if f != imap.SeenFlag && f != imap.RecentFlag {
+ filteredFlags = append(filteredFlags, f)
+ }
+ }
+
if err = conn.delete(msgIds); err != nil {
return err
}
- if err = conn.append(folder, flags, newContent); err != nil {
+ if err = conn.append(folder, filteredFlags, newContent); err != nil {
return err
}