summaryrefslogtreecommitdiff
path: root/internal/imap/connection.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/imap/connection.go')
-rw-r--r--internal/imap/connection.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/internal/imap/connection.go b/internal/imap/connection.go
index 431d1dc..e8d4da2 100644
--- a/internal/imap/connection.go
+++ b/internal/imap/connection.go
@@ -6,16 +6,22 @@ import (
"time"
"github.com/emersion/go-imap"
+ uidplus "github.com/emersion/go-imap-uidplus"
imapClient "github.com/emersion/go-imap/client"
"github.com/Necoro/feed2imap-go/pkg/log"
"github.com/Necoro/feed2imap-go/pkg/util"
)
+type client struct {
+ *imapClient.Client
+ *uidplus.UidPlusClient
+}
+
type connection struct {
*connConf
mailboxes *mailboxes
- c *imapClient.Client
+ c *client
}
func (conn *connection) startTls() error {
@@ -139,8 +145,14 @@ func (conn *connection) delete(uids []uint32) error {
return fmt.Errorf("marking as deleted: %w", err)
}
- if err := conn.c.Expunge(nil); err != nil {
- return fmt.Errorf("expunging: %w", err)
+ if ok, _ := conn.c.SupportUidPlus(); ok {
+ if err := conn.c.UidExpunge(seqSet, nil); err != nil {
+ return fmt.Errorf("expunging (uid): %w", err)
+ }
+ } else {
+ if err := conn.c.Expunge(nil); err != nil {
+ return fmt.Errorf("expunging: %w", err)
+ }
}
return nil
@@ -234,7 +246,7 @@ func (conn *connection) selectFolder(folder Folder) error {
func (conn *connection) append(folder Folder, flags []string, msg string) error {
reader := strings.NewReader(msg)
- if err := conn.c.Append(folder.str, flags, time.Now(), reader); err != nil {
+ if err := conn.c.Client.Append(folder.str, flags, time.Now(), reader); err != nil {
return fmt.Errorf("uploading message to %s: %w", folder, err)
}
efox to 0:ff.René 'Necoro' Neumann1-0/+1 2014-04-14Use hgview instead of hgk.René 'Necoro' Neumann1-1/+1 2013-12-09Fix start_pidgin.sh to not have lurking dbus-monitor processesRené 'Necoro' Neumann1-2/+8 2013-12-03Again one more webfont.René 'Necoro' Neumann1-0/+9 2013-12-03zsh: Make up-/down- to only use local history and Ctrl-R/-S to use globalRené 'Necoro' Neumann1-1/+13 2013-12-02One more new webfontRené 'Necoro' Neumann1-0/+9 2013-11-21IE: Remove isub/isup: they are not supported anymoreRené 'Necoro' Neumann1-1/+1 2013-11-21IE/IJ: Session logicRené 'Necoro' Neumann1-2/+15 2013-11-06Colorscheme for virtual console.René 'Necoro' Neumann1-1/+5 2013-11-01Do not try to set window title and stuff in linux consoleRené 'Necoro' Neumann1-0/+3 2013-10-30Set terminal title not only on path change, but for each new prompt.René 'Necoro' Neumann1-2/+2 2013-10-22cwd-spawn: Use M-Return instead of M-o for consistency.René 'Necoro' Neumann1-2/+2 2013-10-22Add cwd-spawn to urxvt to allow spawning a new terminal from the currentRené 'Necoro' Neumann3-2/+199 2013-10-22Use chpwd_functions and precmd_functions instead of putting everything inRené 'Necoro' Neumann1-19/+23 2013-09-30urxvt: execute the wgetpaste check each timeRené 'Necoro' Neumann1-2/+5 2013-09-30urxvt: wgetpaste fixRené 'Necoro' Neumann1-4/+4 2013-09-30Allow HOME variable in .Xresources.René 'Necoro' Neumann2-3/+3 2013-09-30wgetpaste support for urxvt.René 'Necoro' Neumann2-1/+28 2013-09-30Urxvt autotransform for <filename>:<line>.René 'Necoro' Neumann1-1/+4 2013-09-30Remove tabbed(x) from urxvt. We use i3 -- no need for it.René 'Necoro' Neumann1-9/+0 2013-09-30Do not display icon in urxvt. It's not supported by i3 anyway.René 'Necoro' Neumann1-1/+1 2013-09-29Remove wrong monitors lineRené 'Necoro' Neumann1-1/+0 2013-09-29Delete vimperator paste plugin -- seems not to work anymore with new FFRené 'Necoro' Neumann1-266/+0 2013-09-29Use $HOST instead of Cauchiy in titleRené 'Necoro' Neumann1-1/+1 2013-09-24Remove herbstluftwmRené 'Necoro' Neumann1-1/+0 2013-09-24Conky changesRené 'Necoro' Neumann2-5/+13 2013-09-15Remove trailing slash from \~ulpRené 'Necoro' Neumann1-1/+1 2013-09-15Make cci explicitly use python2René 'Necoro' Neumann1-1/+1 2013-09-10Node/NPM preparationRené 'Necoro' Neumann3-1/+13