Re: [Imap-protocol] COPYUID message order
Brandon Long <[email protected]> Sat, 23 May 2015 12:30:24 -0700
| Newsgroups | gmane.mail.imap.general |
|---|---|
| Message-ID | <CABa8R6s6FQaj6tJRfkiZp+U1ybUeKsOYNb96BrFyiP4=WGavUA@mail.gmail.com> |
--===============3157148293318332563== Content-Type: multipart/alternative; boundary=e89a8f83a13fee02700516c4ce28 --e89a8f83a13fee02700516c4ce28 Content-Type: text/plain; charset=UTF-8 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]> wrote: > Hi Bill, > > On 23 May 2015, at 02:00, Bill Shannon <[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]> > 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] >> http://mailman13.u.washington.edu/mailman/listinfo/imap-protocol >> > > > _______________________________________________ > Imap-protocol mailing list > [email protected] > http://mailman13.u.washington.edu/mailman/listinfo/imap-protocol > > --e89a8f83a13fee02700516c4ce28 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <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 expunge= d by a different client.</p> <p dir=3D"ltr">Not sure what the need to match the requested UIDs vs the so= urce 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&q= uot; <<a href=3D"mailto:[email protected]">alexey.melnikov@isode= .com</a>> wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quot= e" 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 <<a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a>> wrote:<br><br></div><blockquote = type=3D"cite"><div> =20 =20 =20 =20 <div>I <b>so</b> wish there were compatibility tests for servers, rather than "it didn't brea= k 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, and sort the returned source and destination UIDs, the result will be one-to-one, right?=C2=A0 The first 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 th= e same cardinality?<br></div></div></blockquote><div><br></div>Yes. I d= on't think it really matters in which order messages are copied, as lon= g 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 th= e 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 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.</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 client= s typically assumed that was the case and could get confused.</di= v> <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"><<a href=3D"mailto:bill.shannon@ymai= l.com" target=3D"_blank">[email protected]</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord= er-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 mes= sage(s) were copied; the<br> =C2=A0 =C2=A0 =C2=A0 destination UID set corresponds to the sou= rce 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 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 O= r 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 href=3D"mailto:[email protected]" target=3D"_bl= ank">[email protected]</a><br> <a href=3D"http://mailman13.u.washington.edu/mailman/listinfo/i= map-protocol" target=3D"_blank">http://mailman13.u.washington.edu/mailman/l= istinfo/imap-protocol</a><br> </blockquote> </div> <br> </div> </blockquote> <br> =20 </div></blockquote><blockquote type=3D"cite"><div><span>___________________= ____________________________</span><br><span>Imap-protocol mailing list</sp= an><br><span><a href=3D"mailto:[email protected]" target=3D"_b= lank">[email protected]</a></span><br><span><a href=3D"http://= mailman13.u.washington.edu/mailman/listinfo/imap-protocol" target=3D"_blank= ">http://mailman13.u.washington.edu/mailman/listinfo/imap-protocol</a></spa= n></div></blockquote></div></div></blockquote></div> --e89a8f83a13fee02700516c4ce28-- --===============3157148293318332563== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Imap-protocol mailing list [email protected] http://mailman13.u.washington.edu/mailman/listinfo/imap-protocol --===============3157148293318332563==--