Skip to content

api: add login_with_capabilities()#135

Merged
link2xt merged 1 commit into
mainfrom
link2xt/login-unsolicited-responses
Jul 17, 2026
Merged

api: add login_with_capabilities()#135
link2xt merged 1 commit into
mainfrom
link2xt/login-unsolicited-responses

Conversation

@link2xt

@link2xt link2xt commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Closes #134

@link2xt
link2xt force-pushed the link2xt/login-unsolicited-responses branch from 7ce4649 to 6780a91 Compare July 16, 2026 21:41
@link2xt link2xt changed the title feat: do not drop unsolicited responses during LOGIN api: add login_with_capabilities() Jul 16, 2026
@link2xt
link2xt force-pushed the link2xt/login-unsolicited-responses branch 2 times, most recently from 36f01ca to e956d09 Compare July 17, 2026 08:39
@link2xt
link2xt marked this pull request as ready for review July 17, 2026 08:46
@link2xt

link2xt commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Similar change is possible for AUTHENTICATE command, but i'm not doing it in this PR.

Hocuri
Hocuri previously approved these changes Jul 17, 2026

@Hocuri Hocuri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks plausible, though I don't really know this code

Comment thread src/client.rs
Comment thread src/client.rs Outdated
Comment thread src/client.rs
Comment on lines +206 to +207
loop {
let Some(res) = ok_or_unauth_client_err!(self.stream.try_next().await, self) else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop will throw away any response that does is not a Done response with the matching id. Is this the expected behavior, or will some other code need these responses?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Practically when you login there are no other commands pipelined, so nothing should arrive other than LOGIN response. Existing code in run_command_and_check_ok checks responses that have the wrong tag, but also consumes them. Likely the most correct option is to return an error on unexpected response and close the connection afterwards, but practically no server will send unexpected responses and if it does it's the server fault.

@link2xt
link2xt force-pushed the link2xt/login-unsolicited-responses branch from e956d09 to c75f121 Compare July 17, 2026 14:49
@Hocuri
Hocuri dismissed their stale review July 17, 2026 15:14

I'm wondering if this PR is needed?

@Hocuri

Hocuri commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

But actually, I'm wondering if this PR is needed? I mean, we want to get rid of the is_chatmail capability?

@Hocuri

Hocuri commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Ah, I guess it's about the other capabilities like can_idle

@link2xt
link2xt force-pushed the link2xt/login-unsolicited-responses branch from c75f121 to 33b73c8 Compare July 17, 2026 15:32
@link2xt

link2xt commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

There are at least IDLE and METADATA capabilities that are not going away.

@link2xt
link2xt merged commit 1a9f4c0 into main Jul 17, 2026
22 checks passed
@link2xt
link2xt deleted the link2xt/login-unsolicited-responses branch July 17, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return optional capabilities from successful LOGIN command

2 participants