mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibIMAP: Support for the IDLE command
This commit is contained in:
parent
f00c2c0192
commit
1e9dfdcdcc
3 changed files with 18 additions and 0 deletions
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
RefPtr<Promise<Optional<SolidResponse>>> login(StringView username, StringView password);
|
||||
RefPtr<Promise<Optional<SolidResponse>>> list(StringView reference_name, StringView mailbox_name);
|
||||
RefPtr<Promise<Optional<SolidResponse>>> select(StringView string);
|
||||
RefPtr<Promise<Optional<ContinueRequest>>> idle();
|
||||
RefPtr<Promise<Optional<SolidResponse>>> finish_idle();
|
||||
|
||||
void close();
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
namespace IMAP {
|
||||
enum class CommandType {
|
||||
Capability,
|
||||
Idle,
|
||||
List,
|
||||
Login,
|
||||
Logout,
|
||||
|
|
Loading…
Add table
Reference in a new issue