diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp index 97add7b291..34f58cc300 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPConnectionWorker.cpp @@ -343,7 +343,7 @@ public: printf("IMAP: get entries from %lu to %lu\n", from, to); // TODO: we don't really need the flags at this point at all IMAP::MessageEntryList entries; - IMAP::FetchMessageEntriesCommand fetch(entries, from, to); + IMAP::FetchMessageEntriesCommand fetch(entries, from, to, true); status = protocol.ProcessCommand(fetch); if (status != B_OK) return status; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.cpp index df42f681b0..149e921edc 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.cpp @@ -279,11 +279,12 @@ CapabilityHandler::HandleUntagged(Response& response) FetchMessageEntriesCommand::FetchMessageEntriesCommand( - MessageEntryList& entries, uint32 from, uint32 to) + MessageEntryList& entries, uint32 from, uint32 to, bool uids) : fEntries(entries), fFrom(from), - fTo(to) + fTo(to), + fUIDs(uids) { } @@ -291,8 +292,11 @@ FetchMessageEntriesCommand::FetchMessageEntriesCommand( BString FetchMessageEntriesCommand::CommandString() { - BString command = "UID FETCH "; - command << fFrom << ":" << fTo << " (FLAGS RFC822.SIZE)"; + BString command = fUIDs ? "UID FETCH " : "FETCH "; + command << fFrom << ":" << fTo << " (FLAGS RFC822.SIZE"; + if (!fUIDs) + command << " UID"; + command << ")"; return command; } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.h index 634d2ecf29..8d4c04221f 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.h @@ -126,7 +126,7 @@ class FetchMessageEntriesCommand : public Command, public Handler { public: FetchMessageEntriesCommand( MessageEntryList& entries, uint32 from, - uint32 to); + uint32 to, bool uids); BString CommandString(); virtual bool HandleUntagged(Response& response); @@ -135,6 +135,7 @@ private: MessageEntryList& fEntries; uint32 fFrom; uint32 fTo; + bool fUIDs; }; diff --git a/src/tests/add-ons/mail/imap/imap_tester.cpp b/src/tests/add-ons/mail/imap/imap_tester.cpp index 95ddc8642c..571bc81871 100644 --- a/src/tests/add-ons/mail/imap/imap_tester.cpp +++ b/src/tests/add-ons/mail/imap/imap_tester.cpp @@ -117,7 +117,7 @@ do_fetch(int argc, char** argv) } virtual bool FetchData(uint32 fetchFlags, BDataIO& stream, - size_t length) + size_t& length) { fBuffer.SetSize(0); @@ -176,7 +176,7 @@ do_flags(int argc, char** argv) to = atoul(argv[1]); IMAP::MessageEntryList entries; - IMAP::FetchMessageEntriesCommand command(entries, from, to); + IMAP::FetchMessageEntriesCommand command(entries, from, to, true); status_t status = sProtocol.ProcessCommand(command); if (status != B_OK) { error("flags", status);