From de4b1dede1d53ff01585d2bd9087ebafdbb8e582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 20 Jan 2016 21:11:58 +0100 Subject: [PATCH] BMailProtocol: Removed delete/append methods. * The mail system is file based which makes these methods pretty much superfluous. --- headers/os/add-ons/mail_daemon/MailProtocol.h | 9 ---- .../inbound_protocols/imap/IMAPProtocol.cpp | 16 ------ .../inbound_protocols/imap/IMAPProtocol.h | 2 - .../inbound_protocols/pop3/POP3.cpp | 31 ------------ .../mail_daemon/inbound_protocols/pop3/POP3.h | 1 - src/kits/mail/MailProtocol.cpp | 50 ------------------- 6 files changed, 109 deletions(-) diff --git a/headers/os/add-ons/mail_daemon/MailProtocol.h b/headers/os/add-ons/mail_daemon/MailProtocol.h index 6ae1dffb7b..48400576e5 100644 --- a/headers/os/add-ons/mail_daemon/MailProtocol.h +++ b/headers/os/add-ons/mail_daemon/MailProtocol.h @@ -70,11 +70,6 @@ public: virtual void MessageReceived(BMessage* message); - // Mail storage operations - virtual status_t MoveMessage(const entry_ref& ref, - BDirectory& dir); - virtual status_t DeleteMessage(const entry_ref& ref); - // Convenience methods that call the BMailNotifier void ShowError(const char* error); void ShowMessage(const char* message); @@ -140,8 +135,6 @@ public: BMessenger* replyTo); virtual status_t MarkMessageAsRead(const entry_ref& ref, read_flags flags = B_READ); - virtual status_t DeleteMessage(const entry_ref& ref); - virtual status_t AppendMessage(const entry_ref& ref); static void ReplyBodyFetched(const BMessenger& replyTo, const entry_ref& ref, status_t status); @@ -150,8 +143,6 @@ protected: virtual status_t HandleFetchBody(const entry_ref& ref, const BMessenger& replyTo) = 0; - virtual status_t HandleDeleteMessage(const entry_ref& ref) = 0; - void NotiyMailboxSynchronized(status_t status); }; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.cpp index 8ad0f54f2b..2af060538f 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.cpp @@ -200,14 +200,6 @@ IMAPProtocol::MarkMessageAsRead(const entry_ref& ref, read_flags flags) } -status_t -IMAPProtocol::AppendMessage(const entry_ref& ref) -{ - printf("IMAP: append message %s\n", ref.name); - return B_ERROR; -} - - void IMAPProtocol::MessageReceived(BMessage* message) { @@ -247,14 +239,6 @@ IMAPProtocol::HandleFetchBody(const entry_ref& ref, const BMessenger& replyTo) } -status_t -IMAPProtocol::HandleDeleteMessage(const entry_ref& ref) -{ - printf("IMAP: delete message %s\n", ref.name); - return B_ERROR; -} - - void IMAPProtocol::ReadyToRun() { diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h index 57ab5816d6..0f89ae4b8a 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h @@ -47,14 +47,12 @@ public: virtual status_t SyncMessages(); virtual status_t MarkMessageAsRead(const entry_ref& ref, read_flags flags = B_READ); - virtual status_t AppendMessage(const entry_ref& ref); virtual void MessageReceived(BMessage* message); protected: virtual status_t HandleFetchBody(const entry_ref& ref, const BMessenger& replyTo); - virtual status_t HandleDeleteMessage(const entry_ref& ref); void ReadyToRun(); diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp index 4ecdfc525a..313aa74682 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.cpp @@ -316,37 +316,6 @@ POP3Protocol::HandleFetchBody(const entry_ref& ref, const BMessenger& replyTo) } -status_t -POP3Protocol::HandleDeleteMessage(const entry_ref& ref) -{ - status_t error = Connect(); - if (error < B_OK) - return error; - - error = _RetrieveUniqueIDs(); - if (error < B_OK) { - Disconnect(); - return error; - } - - char uidString[256]; - BNode node(&ref); - if (node.ReadAttr("MAIL:unique_id", B_STRING_TYPE, 0, uidString, 256) < 0) { - Disconnect(); - return B_ERROR; - } - - #if DEBUG - printf("DeleteMessage: ID is %d\n", (int)fUniqueIDs.IndexOf(uidString)); - // What should we use for int32 instead of %d? - #endif - Delete(fUniqueIDs.IndexOf(uidString)); - - Disconnect(); - return B_OK; -} - - status_t POP3Protocol::Open(const char* server, int port, int) { diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.h b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.h index c4cf020300..4049cd9039 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.h +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/POP3.h @@ -43,7 +43,6 @@ public: protected: virtual status_t HandleFetchBody(const entry_ref& ref, const BMessenger& replyTo); - virtual status_t HandleDeleteMessage(const entry_ref& ref); // pop3 methods status_t Open(const char* server, int port, diff --git a/src/kits/mail/MailProtocol.cpp b/src/kits/mail/MailProtocol.cpp index eb3bcc1698..c4291b093b 100644 --- a/src/kits/mail/MailProtocol.cpp +++ b/src/kits/mail/MailProtocol.cpp @@ -39,10 +39,6 @@ using namespace BPrivate; -const uint32 kMsgDeleteMessage = '&DeM'; -const uint32 kMsgAppendMessage = '&ApM'; - - BMailProtocol::BMailProtocol(const char* name, const BMailAccountSettings& settings) : @@ -136,22 +132,6 @@ BMailProtocol::MessageReceived(BMessage* message) } -status_t -BMailProtocol::MoveMessage(const entry_ref& ref, BDirectory& dir) -{ - BEntry entry(&ref); - return entry.MoveTo(&dir); -} - - -status_t -BMailProtocol::DeleteMessage(const entry_ref& ref) -{ - BEntry entry(&ref); - return entry.Remove(); -} - - void BMailProtocol::ShowError(const char* error) { @@ -435,22 +415,6 @@ BInboundMailProtocol::MessageReceived(BMessage* message) break; } - case kMsgDeleteMessage: - { - entry_ref ref; - message->FindRef("ref", &ref); - DeleteMessage(ref); - break; - } - - case kMsgAppendMessage: - { - entry_ref ref; - message->FindRef("ref", &ref); - AppendMessage(ref); - break; - } - default: BMailProtocol::MessageReceived(message); break; @@ -478,20 +442,6 @@ BInboundMailProtocol::MarkMessageAsRead(const entry_ref& ref, read_flags flag) } -status_t -BInboundMailProtocol::DeleteMessage(const entry_ref& ref) -{ - return B_ERROR; -} - - -status_t -BInboundMailProtocol::AppendMessage(const entry_ref& ref) -{ - return B_OK; -} - - /*static*/ void BInboundMailProtocol::ReplyBodyFetched(const BMessenger& replyTo, const entry_ref& ref, status_t status)