Re: [Imap-protocol] COPYUID message order

Bill Shannon <[email protected]> Mon, 25 May 2015 23:31:45 -0700
Newsgroups gmane.mail.imap.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============4856253217328234253==
Content-Type: multipart/alternative;
 boundary="------------020206050206060601080209"

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

I'd like to be able to report the status of each message that was requested to
be copied.  If one of the messages was not copied for some reason, and so is
left out of the returned list of source UIDs, how do I figure out which one that
was?  Without a complete map from sequence number to UID, it seems that the
COPYUID response code for the simple COPY command may not be sufficient.


Brandon Long wrote on 05/23/2015 12:30 PM:
>
> I don't think you can guarantee that all of the messages you asked to be
> copied were, for example one of them may have been expunged by a different client.
>
> Not sure what the need to match the requested UIDs vs the source UIDs
> returned, but they may not match.
>
> Brandon
>
> On May 23, 2015 3:52 AM, "Alexey Melnikov" <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Hi Bill,
>
>     On 23 May 2015, at 02:00, Bill Shannon <[email protected]
>     <mailto:[email protected]>> wrote:
>
>>     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?
>
>     Yes. I don't think it really matters in which order messages are copied,
>     as long as the matching UIDs are returned correctly.
>
>>
>>     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
>>>
>>>
>>
>>     _______________________________________________
>>     Imap-protocol mailing list
>>     [email protected] <mailto:[email protected]>
>>     http://mailman13.u.washington.edu/mailman/listinfo/imap-protocol
>


--------------020206050206060601080209
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mxout24.cac.washington.edu id t4Q6Vetb007643

<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'd like to be able to report the
      status of each message that was requested to be copied.=C2=A0 If on=
e of
      the messages was not copied for some reason, and so is left out of
      the returned list of source UIDs, how do I figure out which one
      that was?=C2=A0 Without a complete map from sequence number to UID,=
 it
      seems that the COPYUID response code for the simple COPY command
      may not be sufficient.<br>
      <br>
      <br>
      Brandon Long wrote on 05/23/2015 12:30 PM:<br>
    </div>
    <blockquote
cite=3D"mid:[email protected]=
ail.com"
      type=3D"cite">
      <p dir=3D"ltr">I don't think you can guarantee that all of the
        messages you asked to be copied were, for example one of them
        may have been expunged by a different client.</p>
      <p dir=3D"ltr">Not sure what the need to match the requested UIDs v=
s
        the source UIDs returned, but they may not match.</p>
      <p dir=3D"ltr">Brandon</p>
      <div class=3D"gmail_quote">On May 23, 2015 3:52 AM, "Alexey
        Melnikov" &lt;<a moz-do-not-send=3D"true"
          href=3D"mailto:[email protected]">alexey.melnikov@isode=
.com</a>&gt;
        wrote:<br type=3D"attribution">
        <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir=3D"auto">
            <div>Hi Bill,</div>
            <div><br>
            </div>
            <div>On 23 May 2015, at 02:00, Bill Shannon &lt;<a
                moz-do-not-send=3D"true"
                href=3D"mailto:[email protected]" target=3D"_blank">=
[email protected]</a>&gt;
              wrote:<br>
              <br>
            </div>
            <blockquote type=3D"cite">
              <div>
                <div>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 messag=
e
                  numbers, and sort the returned source and destination
                  UIDs, the result will be one-to-one, right?=C2=A0 The f=
irst
                  message number will correspond to 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>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            Yes. I don't think it really matters in which order messages
            are copied, as long as the matching UIDs are returned
            correctly.
            <div><br>
              <blockquote type=3D"cite">
                <div>
                  <div> <br>
                    Brandon Long wrote on 05/22/2015 05:17 PM:<br>
                  </div>
                  <blockquote 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 retur=
n
                          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">[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 t=
he order the
                          message(s) were copied; the<br>
                          =C2=A0 =C2=A0 =C2=A0 destination UID set corres=
ponds to the
                          source 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 ord=
er
                          in which the 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]=
"
                            target=3D"_blank">[email protected].=
edu</a><br>
                          <a moz-do-not-send=3D"true"
                            href=3D"http://mailman13.u.washington.edu/mai=
lman/listinfo/imap-protocol"
                            target=3D"_blank">http://mailman13.u.washingt=
on.edu/mailman/listinfo/imap-protocol</a><br>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </blockquote>
              <blockquote type=3D"cite">
                <div><span>______________________________________________=
_</span><br>
                  <span>Imap-protocol mailing list</span><br>
                  <span><a moz-do-not-send=3D"true"
                      href=3D"mailto:[email protected]"
                      target=3D"_blank">[email protected]</a=
></span><br>
                  <span><a moz-do-not-send=3D"true"
                      href=3D"http://mailman13.u.washington.edu/mailman/l=
istinfo/imap-protocol"
                      target=3D"_blank">http://mailman13.u.washington.edu=
/mailman/listinfo/imap-protocol</a></span></div>
              </blockquote>
            </div>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>

--------------020206050206060601080209--

--===============4856253217328234253==
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
--===============4856253217328234253==--