~rockorager/offmap

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

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

Details
Message ID
<20221128212815.4920-1-tim@timculverhouse.com>
DKIM signature
pass
Download raw message
Patch: +5 -0
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
Details
Message ID
<COPG1YM83ZS0.8UD7A6PJP5G3@hera>
In-Reply-To
<20221128212815.4920-1-tim@timculverhouse.com> (view parent)
DKIM signature
pass
Download raw message
may I suggest merging these lines into one?

	mbox.RemoteName = strings.ReplaceAll(mbox.LocalName, "/", s.Delimiter())
-- 
Moritz Poldrack
https://moritz.sh
Details
Message ID
<COPOIHAZLYB0.1NWRM3WM1SMT7@spunky>
In-Reply-To
<COPG1YM83ZS0.8UD7A6PJP5G3@hera> (view parent)
DKIM signature
pass
Download raw message
On Wed Nov 30, 2022 at 1:39 AM CST, Moritz Poldrack wrote:
> may I suggest merging these lines into one?
>
> 	mbox.RemoteName = strings.ReplaceAll(mbox.LocalName, "/", s.Delimiter())

Will do!

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

--
Tim
Reply to thread Export thread (mbox)