IMAP: FetchMessageEntriesCommand now also works without UIDs

* This will be used to solve the TODO in CheckMailboxesCommand::Process()
  when the initial message sizes/flags are retrieved.
* Also fixed imap_tester build.
This commit is contained in:
Axel Dörfler 2013-05-29 16:01:07 +00:00
parent 1052525dc5
commit c1f779e350
4 changed files with 13 additions and 8 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
};

View File

@ -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);