~rockorager/offmap

offmap: imap: set RemoteName before attempting mailbox create v1 APPLIED

Tim Culverhouse: 1
 imap: set RemoteName before attempting mailbox create

 1 files changed, 5 insertions(+), 0 deletions(-)
Will do!

I'm going to make this change but a subsequent patch might fix, related to the
issue you mentioned earlier.

--
Tim
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~rockorager/offmap/patches/37203/mbox | git am -3
Learn more about email & git

[PATCH offmap] imap: set RemoteName before attempting mailbox create Export this patch

The slice of created mailboxes does not include the RemoteName when it
hits the remote.ApplyDiff function. Set the remote name, replacing the
path delimiters, if necessary, before attempting to create it.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
---
 imap/update.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/imap/update.go b/imap/update.go
index 8da0fef18513..57f68edb8d0e 100644
--- a/imap/update.go
+++ b/imap/update.go
@@ -2,6 +2,7 @@ package imap

import (
	"fmt"
	"strings"
	"time"

	"git.sr.ht/~rockorager/offmap"
@@ -17,6 +18,10 @@ func (s *Store) ApplyDiff(state *offmap.State, c *offmap.Diff) error {
	for _, mbox := range c.Mailboxes.Created {
		conn := s.getConn()
		defer conn.done()
		mbox.RemoteName = mbox.LocalName
		if s.Delimiter() != "/" {
			mbox.RemoteName = strings.ReplaceAll(mbox.RemoteName, "/", s.Delimiter())
		}
		err := conn.Create(mbox.RemoteName)
		if err != nil {
			// TODO how to handle this error?
-- 
2.38.1
may I suggest merging these lines into one?

	mbox.RemoteName = strings.ReplaceAll(mbox.LocalName, "/", s.Delimiter()