1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

LibIMAP: Support for the FETCH command (*mostly)

This commit doesn't include support for FETCH BODY, because it's a bit
big already. Rest assured, FETCH is the most complicated IMAP command,
and we'll go back to simple boring ones shortly.
This commit is contained in:
x-yl 2021-06-02 17:32:03 +04:00 committed by Ali Mohammad Pur
parent 1e9dfdcdcc
commit c152a9a594
6 changed files with 509 additions and 0 deletions

View file

@ -124,6 +124,10 @@ static ReadonlyBytes command_byte_buffer(CommandType command)
return "LIST"sv.bytes();
case CommandType::Select:
return "SELECT"sv.bytes();
case CommandType::Fetch:
return "FETCH"sv.bytes();
case CommandType::UIDFetch:
return "UID FETCH"sv.bytes();
}
VERIFY_NOT_REACHED();
}
@ -177,6 +181,12 @@ RefPtr<Promise<Optional<SolidResponse>>> Client::list(StringView reference_name,
return cast_promise<SolidResponse>(send_command(move(command)));
}
RefPtr<Promise<Optional<SolidResponse>>> Client::fetch(FetchCommand request, bool uid)
{
auto command = Command { uid ? CommandType::UIDFetch : CommandType::Fetch, m_current_command, { request.serialize() } };
return cast_promise<SolidResponse>(send_command(move(command)));
}
RefPtr<Promise<Optional<Response>>> Client::send_simple_command(CommandType type)
{
auto command = Command { type, m_current_command, {} };