Re: [Imap-protocol] COPYUID message order

Bill Shannon <[email protected]> Fri, 22 May 2015 18:00:49 -0700
Newsgroups gmane.mail.imap.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============8094157944168659704==
Content-Type: multipart/alternative;
 boundary="------------050901040407050001000106"

This is a multi-part message in MIME format.
--------------050901040407050001000106
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

I *so* wish there were compatibility tests for servers, rather than "it didn't
break any clients so it must be good enough".  :-)

Ok, how about this.  If I sort the original message numbers, and sort the
returned source and destination UIDs, the result will be one-to-one, right?  The
first message number will correspond to the first source UID, which will
correspond to the first destination UID, right?  And all three sets will have
exactly the same cardinality?

Brandon Long wrote on 05/22/2015 05:17 PM:
> At least for Gmail, we always re-order the given set into sequence order
> (which is the same as uid order) before doing any operation.  So, the source
> UIDs in COPYUID are in the order in which they were copied.
>
> Since a COPY in Gmail is the equivalent of adding a label to a message, the
> message may already have that label, so it may already be in the recipient
> mailbox.  We always return the destination UIDs in the order which matches the
> source UID order, so in your example, source UID 1 is destination UID 2, and
> source UID 2 is destination UID 1.
>
> When APPEND'ing a duplicate message, we update the UID assigned to the
> original to be the newest UID in the mailbox (and that's returned with
> APPENDUID), since we found clients typically assumed that was the case and
> could get confused.
>
> We could have done this with COPY, I guess, but we didn't see any client
> issues in testing, so we left it this way since the performance is better.
>
> Brandon
>
> On Fri, May 22, 2015 at 4:46 PM, Bill Shannon <[email protected]
> <mailto:[email protected]>> wrote:
>
>     I'm unclear on the requirements around the COPY command and the COPYUID
>     response code.
>
>     Is there any guarantee that the order of messages in the COPY command is
>     the order they'll appear in the destination mailbox?  Or are they
>     allowed to appear in any arbitrary order in the destination mailbox?
>     (After any existing messages, of course.)
>
>     RFC 4315 says of the COPYUID response:
>
>           The source UID set is in the order the message(s) were copied; the
>           destination UID set corresponds to the source UID set and is in
>           the same order.
>
>     Exactly what order is that?  Is it the order in which the messages were
>     mentioned in the COPY command?  Is it the order they actually appear in
>     the destination mailbox (assuming it can be different)?  Or is it in
>     some other undefined order?
>
>     With Gmail I'm getting
>
>     A1 COPY 1:2 dest
>     A1 OK [COPYUID 123456 1:2 2,1]
>
>     and
>
>     A1 COPY 2,1 dest
>     A1 OK [COPYUID 123456 1:2 2,1]
>
>     The order of the source UIDs is unrelated to the order the messages
>     are mentioned in the COPY command and unrelated to the order they
>     appear in the destination mailbox.
>
>     If I don't know the UIDs of the source messages, is there any way to
>     determine which message was copied to which UID in the destination
>     mailbox?
>     _______________________________________________
>     Imap-protocol mailing list
>     [email protected] <mailto:[email protected]>
>     http://mailman13.u.washington.edu/mailman/listinfo/imap-protocol
>
>


--------------050901040407050001000106
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mxout22.s.uw.edu id t4N110cT017446

<html>
  <head>
    <meta content=3D"text/html; charset=3DUTF-8" http-equiv=3D"Content-Ty=
pe">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">I <b>so</b> wish there were
      compatibility tests for servers, rather than "it didn't break any
      clients so it must be good enough".=C2=A0 :-)<br>
      <br>
      Ok, how about this.=C2=A0 If I sort the original message numbers, a=
nd
      sort the returned source and destination UIDs, the result will be
      one-to-one, right?=C2=A0 The first message number will correspond t=
o
      the first source UID, which will correspond to the first
      destination UID, right?=C2=A0 And all three sets will have exactly =
the
      same cardinality?<br>
      <br>
      Brandon Long wrote on 05/22/2015 05:17 PM:<br>
    </div>
    <blockquote
cite=3D"mid:[email protected]=
l.com"
      type=3D"cite">
      <div dir=3D"ltr">At least for Gmail, we always re-order the given
        set into sequence order (which is the same as uid order) before
        doing any operation.=C2=A0 So, the source UIDs in COPYUID are in =
the
        order in which they were copied.
        <div><br>
          <div>Since a COPY in Gmail is the equivalent of adding a label
            to a message, the message may already have that label, so it
            may already be in the recipient mailbox.=C2=A0 We always retu=
rn
            the destination UIDs in the order which matches the source
            UID order, so in your example, source UID 1 is destination
            UID 2, and source UID 2 is destination UID 1.</div>
          <div><br>
          </div>
          <div>When APPEND'ing a duplicate message, we update the UID
            assigned to the original to be the newest UID in the mailbox
            (and that's returned with APPENDUID), since we found clients
            typically assumed that was the case and could get confused.</=
div>
          <div><br>
          </div>
          <div>We could have done this with COPY, I guess, but we didn't
            see any client issues in testing, so we left it this way
            since the performance is better.</div>
          <div><br>
          </div>
          <div>Brandon</div>
        </div>
      </div>
      <div class=3D"gmail_extra"><br>
        <div class=3D"gmail_quote">On Fri, May 22, 2015 at 4:46 PM, Bill
          Shannon <span dir=3D"ltr">&lt;<a moz-do-not-send=3D"true"
              href=3D"mailto:[email protected]" target=3D"_blank">bi=
[email protected]</a>&gt;</span>
          wrote:<br>
          <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm
            unclear on the requirements around the COPY command and the
            COPYUID<br>
            response code.<br>
            <br>
            Is there any guarantee that the order of messages in the
            COPY command is<br>
            the order they'll appear in the destination mailbox?=C2=A0 Or=
 are
            they<br>
            allowed to appear in any arbitrary order in the destination
            mailbox?<br>
            (After any existing messages, of course.)<br>
            <br>
            RFC 4315 says of the COPYUID response:<br>
            <br>
            =C2=A0 =C2=A0 =C2=A0 The source UID set is in the order the m=
essage(s) were
            copied; the<br>
            =C2=A0 =C2=A0 =C2=A0 destination UID set corresponds to the s=
ource UID set
            and is in<br>
            =C2=A0 =C2=A0 =C2=A0 the same order.<br>
            <br>
            Exactly what order is that?=C2=A0 Is it the order in which th=
e
            messages were<br>
            mentioned in the COPY command?=C2=A0 Is it the order they
            actually appear in<br>
            the destination mailbox (assuming it can be different)?=C2=A0=
 Or
            is it in<br>
            some other undefined order?<br>
            <br>
            With Gmail I'm getting<br>
            <br>
            A1 COPY 1:2 dest<br>
            A1 OK [COPYUID 123456 1:2 2,1]<br>
            <br>
            and<br>
            <br>
            A1 COPY 2,1 dest<br>
            A1 OK [COPYUID 123456 1:2 2,1]<br>
            <br>
            The order of the source UIDs is unrelated to the order the
            messages<br>
            are mentioned in the COPY command and unrelated to the order
            they<br>
            appear in the destination mailbox.<br>
            <br>
            If I don't know the UIDs of the source messages, is there
            any way to<br>
            determine which message was copied to which UID in the
            destination<br>
            mailbox?<br>
            _______________________________________________<br>
            Imap-protocol mailing list<br>
            <a moz-do-not-send=3D"true"
              href=3D"mailto:[email protected]">Imap-protoco=
[email protected]</a><br>
            <a moz-do-not-send=3D"true"
              href=3D"http://mailman13.u.washington.edu/mailman/listinfo/=
imap-protocol"
              target=3D"_blank">http://mailman13.u.washington.edu/mailman=
/listinfo/imap-protocol</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>

--------------050901040407050001000106--

--===============8094157944168659704==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

_______________________________________________
Imap-protocol mailing list
[email protected]
http://mailman13.u.washington.edu/mailman/listinfo/imap-protocol
--===============8094157944168659704==--