1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:07:36 +00:00

LibIMAP: Support for remaining IMAP commands

These include APPEND, AUTHENTICATE, CHECK, CLOSE, EXAMINE, EXPUNGE,
LSUB, SUBSCRIBE, UNSUBSCRIBE
This commit is contained in:
x-yl 2021-06-02 18:53:08 +04:00 committed by Ali Mohammad Pur
parent 16995dc3d9
commit 9174fabf05
4 changed files with 93 additions and 0 deletions

View file

@ -18,13 +18,19 @@
namespace IMAP {
enum class CommandType {
Append,
Authenticate,
Capability,
Copy,
Check,
Close,
Create,
Delete,
Examine,
Expunge,
Fetch,
Idle,
List,
ListSub,
Login,
Logout,
Noop,
@ -33,10 +39,12 @@ enum class CommandType {
Select,
Status,
Store,
Subscribe,
UIDCopy,
UIDFetch,
UIDSearch,
UIDStore,
Unsubscribe,
};
enum class MailboxFlag : unsigned {
@ -68,6 +76,8 @@ enum class ResponseType : unsigned {
PermanentFlags = 1u << 8,
Fetch = 1u << 9,
Search = 1u << 10,
ListSub = 1u << 11,
Expunged = 1u << 12,
Bye = 1u << 13,
Status = 1u << 14
};
@ -532,6 +542,18 @@ public:
return m_list_items;
}
void add_lsub_item(ListItem&& item)
{
add_response_type(ResponseType::List);
m_lsub_items.append(move(item));
}
Vector<ListItem>& lsub_items()
{
VERIFY(contains_response_type(ResponseType::ListSub));
return m_lsub_items;
}
void set_exists(unsigned exists)
{
add_response_type(ResponseType::Exists);
@ -640,6 +662,18 @@ public:
return m_search_results;
}
void add_expunged(unsigned message)
{
add_response_type(ResponseType::Expunged);
m_expunged.append(message);
}
Vector<unsigned>& expunged()
{
VERIFY(contains_response_type(ResponseType::Expunged));
return m_expunged;
}
void set_bye(Optional<String> message)
{
add_response_type(ResponseType::Bye);
@ -668,6 +702,8 @@ private:
Vector<String> m_capabilities;
Vector<ListItem> m_list_items;
Vector<ListItem> m_lsub_items;
Vector<unsigned> m_expunged;
unsigned m_recent {};
unsigned m_exists {};