1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

LibIMAP: Support for the IDLE command

This commit is contained in:
x-yl 2021-06-02 17:17:22 +04:00 committed by Ali Mohammad Pur
parent f00c2c0192
commit 1e9dfdcdcc
3 changed files with 18 additions and 0 deletions

View file

@ -116,6 +116,8 @@ static ReadonlyBytes command_byte_buffer(CommandType command)
return "CAPABILITY"sv.bytes();
case CommandType::Logout:
return "LOGOUT"sv.bytes();
case CommandType ::Idle:
return "IDLE"sv.bytes();
case CommandType::Login:
return "LOGIN"sv.bytes();
case CommandType::List:
@ -232,6 +234,19 @@ void Client::send_next_command()
send_raw(buffer);
m_expecting_response = true;
}
RefPtr<Promise<Optional<ContinueRequest>>> Client::idle()
{
auto promise = send_simple_command(CommandType::Idle);
return cast_promise<ContinueRequest>(promise);
}
RefPtr<Promise<Optional<SolidResponse>>> Client::finish_idle()
{
auto promise = Promise<Optional<Response>>::construct();
m_pending_promises.append(promise);
send_raw("DONE");
m_expecting_response = true;
return cast_promise<SolidResponse>(promise);
}
void Client::close()
{