1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

LibIMAP: Support for LOGIN and LOGOUT

This commit is contained in:
x-yl 2021-06-01 19:10:20 +04:00 committed by Ali Mohammad Pur
parent 2f04d24b66
commit f00c2c0192
4 changed files with 31 additions and 0 deletions

View file

@ -114,6 +114,10 @@ static ReadonlyBytes command_byte_buffer(CommandType command)
return "NOOP"sv.bytes();
case CommandType::Capability:
return "CAPABILITY"sv.bytes();
case CommandType::Logout:
return "LOGOUT"sv.bytes();
case CommandType::Login:
return "LOGIN"sv.bytes();
case CommandType::List:
return "LIST"sv.bytes();
case CommandType::Select:
@ -157,6 +161,12 @@ RefPtr<Promise<Optional<T>>> cast_promise(RefPtr<Promise<Optional<Response>>> pr
return new_promise;
}
RefPtr<Promise<Optional<SolidResponse>>> Client::login(StringView username, StringView password)
{
auto command = Command { CommandType::Login, m_current_command, { username, password } };
return cast_promise<SolidResponse>(send_command(move(command)));
}
RefPtr<Promise<Optional<SolidResponse>>> Client::list(StringView reference_name, StringView mailbox)
{
auto command = Command { CommandType::List, m_current_command,