-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Improve IMAP response handling #270
Comments
@szymekjanaczek suggested to use something similar to Laravel Resources:
I like the idea. Using a known schema or creating one which behaves similar to a known one has definitely some benefits. But I have to admit, that I haven't knowingly worked with Laravel Resources before. Regarding potential dependenciesThis library already uses third party dependencies: Lines 21 to 31 in cc3e72f
But at the same time I would like to keep them at a minimum. One additional thought. I'm a bit worried about the overhead we might create if we do integrate an response interface in the first place. How much longer will it take to fetch, lets say 1000 messages? |
Okey, some thoughts: Divide and conquerI think we can (and maybe should) divide this project into two parts:
Why?
About Laravel Resources and additional packagesThere is no need to install any additional lib. We can create our own DTO as well. I mentioned Laravel's resources only as an example of data structure. I'm not sure what do you mean at this:
|
Sounds good to me 👍 I've meant that every class / object you create during the runtime will need some additional system resources. At some point this adds up and could slow down the operation. |
Hmm, you're right - optimization is really important. About fetching messages - I think we can leave it at the current version - and instead focus on the following operations (and their responses):
Because the response of fetching messages operation is already done - and works fine (but I'm a bit worried about this: performance of version 4.0.0 #443) |
So for now, I suggest:
[a] - instead of dividing into "error" or "bad request", we can temporarily treat both of them as errors and throw them as exceptions with eg. imap_last_error(). And more precise error handling build with the new |
Hi @Webklex Additionally - do we have any unit/feature tests? |
Hi @szymekjanaczek , There are currently no unit tests available. I gave it a try a few times, but had trouble to work with faked resources. Also thanks for your pull request! Ignore my two questions from there - I now understand why you've required the php-imap module. I'm just not sure how to proceed - and if it's worth to try to keep Best regards, |
Is there a reason to keep the legacy protocol around if theres going to be as major of a rewrite as the PR? From what I can see, legacy protocol was to work around not having If a majority of the operations are going to change their return values, then this would jump the project to v5 as its a pretty breaking change. I think it's worth dropping the legacy protocol and the optional uncoupling from If pr #277 does go through, I intend to follow up with some tests if they're not included by either of you two fine individuals. |
@ainesophaur , Yes we are talking about a v5. I believe the proposed changes are worth to introduce some breaking changes. After all, those changes are there to help us all in the long run :) |
By kicking out |
Hi @szymekjanaczek @ainesophaur , Otherwise the main branch is locked until we've finished v5. Best regards, |
Hi! It looks like a good idea to me - gonna start coding off-the-clock ;). Greetings! |
@szymekjanaczek how similar is the work in #277 to what you're working on? @Webklex do you have any preferred way of discussing/planning/communicating regarding v5 work? |
@ainesophaur it's a kinda draft - as I mentioned. Instead of returning less-informative booleans as a response, I switched it to give back the raw response from the IMAP server after the operation. It's quite connected with this issue - because is focussed on more detailed output. But in v5 we would like to return it like a special class (eg. About the communication way - firstly we have to gain interested people. @Webklex what do you think about the small announcement in the README section? Or in discord (oh, the invitation link expired ;-;) If you fix it, we can use discord for this purpose. @ainesophaur, can I assume, you would like to help? |
Absolutely. I'm working a project that heavily depends on this library so
I'd love to contribute back.
…On Fri, Oct 7, 2022, 2:50 AM Szymon Janaczek ***@***.***> wrote:
@ainesophaur <https://github.com/ainesophaur> it's a kinda draft - as I
mentioned. Instead of returning less-informative booleans as a response, I
switched it to give back the raw response from the IMAP server after the
operation. It's quite connected with this issue - because is focussed on
more detailed output. But in v5 we would like to return it like a special
class (eg. ImapResponse::class) with an organized structure, similar in
each operation (to work with eg. PHPStan).
About the communication way - firstly we have to gain interested people.
@Webklex <https://github.com/Webklex> what do you think about the small
announcement in the README section?
@ainesophaur <https://github.com/ainesophaur>, can I assume, you would
like to help?
—
Reply to this email directly, view it on GitHub
<#270 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDYC5SUWCJVUYBFU6OP44TWB7BZXANCNFSM57S54HGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Okay, @ainesophaur so we have a similar situation. Nice - nothing motivates more than need. |
Hi @szymekjanaczek , For example, should this library stay compatible with php >= v7/v7.2 or is >= v8 enough? Given all the "new" and great features php 8 provides, it's perhaps a big blocker if this library continues supporting php < v8. |
Usually every command send to an imap server has one or several responses. Currently they don't always get treated and checked the way they should be.
This was discovered during a discussion on issue #263
For example the command
APPEND
:RFC references:
Possible responses:
..or:
There are also intermediate responses like:
..which indicates the server is ready to accept additional data.
Bad commands or server errors are currently only partially handled and should be handled for every command send. Every command can fail in two ways. Either with a
NO
orBAD
alongside some additional and provider specififc error message.To improve the response handling, every command send to the server, should return an
ImapResponse::class
instance which holds information such as the send command and received responses / errors. This response class might also include "magic" accessors to retrieve named data from the response (like theAttribute::class
class).The text was updated successfully, but these errors were encountered: