-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some UIDPLUS issues #69
Conversation
Mostly just adds/updates how different capabilities affect each command.
* 🐛 Bug fixed: `uid-range` should behave the same, regardless of order. i.e. "2:4" and "4:2" are equivalent. * 🐛 Reversed a breaking change: The return values of Net::IMAP#copy, #move, #uid_copy, #uid_move, and #append are incompatible with all previously released versions. That would break any apps that expect the tagged response. TaggedResponse is more broadly useful anyway, since it contains the response code with its data. * Forward compatibility with `MULTIAPPEND`: I converted "append-uid" to parse a "uid-set" instead of a "uniqueid". This also provides a consistent interface: assigned_uids will always be an array of ints. * Replaced arrays with a `UIDPlusData` struct. In my opinion, it's much nicer to use a Struct than a "tuple". This also provides a home for documentation and utility methods. E.g. I also added UIDPlusData#uid_mapping, which returns a hash of {src_uid => dst_uid}. * Number parsing was converted from `to_i` to `Integer`. We matched the `uid-set` with a single `T_ATOM` token, so we haven't validated that it follows the rest of the grammar. This will still parse some invalid strings (e.g. `",:1,,:::,,"`), but in practice it's much more likely that a bogus atom would have at least one non-numeric character besides ":" and ",". (Although I've seen some crazy server bugs...)
Hi @nevans, good catch with that
I really like the idea of the It would still be a breaking change for anyone that already parsed the information out of the response code data, as it is no longer a string but now a |
Yeah, I've thought about that a bit, too. I went through a lot of ideas, and my first thoughts were more-or-less what you suggested. And I'm sure I could think of some even more compatible approaches too. But my current thinking is much simpler: Document that all response code data
|
Yes seems fine to me to just document that Your other idea also sounds interesting, but don't think any of the current code would require something like that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks fine. Than you!
uid-range
should behave the same, regardless of order. i.e. "2:4" and "4:2" are equivalent.MULTIAPPEND
: I converted "append-uid" to parse a "uid-set" instead of a "uniqueid". This also provides a consistent interface: assigned_uids will always be an array of ints.UIDPlusData
struct. In my opinion, it's much nicer to use a Struct than a "tuple". This also provides a home for documentation and utility methods. E.g. I also added UIDPlusData#uid_mapping, which returns a hash of {src_uid => dst_uid}.to_i
toInteger
. We matched theuid-set
with a singleT_ATOM
token, so we haven't validated that it follows the rest of the grammar. This will still parse some invalid strings (e.g.",:1,,:::,,"
), but in practice it's much more likely that a bogus atom would have at least one non-numeric character besides ":" and ",". (Although I've seen some crazy server bugs...)