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:
@@ -343,7 +343,7 @@ public:
|
|||||||
printf("IMAP: get entries from %lu to %lu\n", from, to);
|
printf("IMAP: get entries from %lu to %lu\n", from, to);
|
||||||
// TODO: we don't really need the flags at this point at all
|
// TODO: we don't really need the flags at this point at all
|
||||||
IMAP::MessageEntryList entries;
|
IMAP::MessageEntryList entries;
|
||||||
IMAP::FetchMessageEntriesCommand fetch(entries, from, to);
|
IMAP::FetchMessageEntriesCommand fetch(entries, from, to, true);
|
||||||
status = protocol.ProcessCommand(fetch);
|
status = protocol.ProcessCommand(fetch);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
@@ -279,11 +279,12 @@ CapabilityHandler::HandleUntagged(Response& response)
|
|||||||
|
|
||||||
|
|
||||||
FetchMessageEntriesCommand::FetchMessageEntriesCommand(
|
FetchMessageEntriesCommand::FetchMessageEntriesCommand(
|
||||||
MessageEntryList& entries, uint32 from, uint32 to)
|
MessageEntryList& entries, uint32 from, uint32 to, bool uids)
|
||||||
:
|
:
|
||||||
fEntries(entries),
|
fEntries(entries),
|
||||||
fFrom(from),
|
fFrom(from),
|
||||||
fTo(to)
|
fTo(to),
|
||||||
|
fUIDs(uids)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,8 +292,11 @@ FetchMessageEntriesCommand::FetchMessageEntriesCommand(
|
|||||||
BString
|
BString
|
||||||
FetchMessageEntriesCommand::CommandString()
|
FetchMessageEntriesCommand::CommandString()
|
||||||
{
|
{
|
||||||
BString command = "UID FETCH ";
|
BString command = fUIDs ? "UID FETCH " : "FETCH ";
|
||||||
command << fFrom << ":" << fTo << " (FLAGS RFC822.SIZE)";
|
command << fFrom << ":" << fTo << " (FLAGS RFC822.SIZE";
|
||||||
|
if (!fUIDs)
|
||||||
|
command << " UID";
|
||||||
|
command << ")";
|
||||||
|
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class FetchMessageEntriesCommand : public Command, public Handler {
|
|||||||
public:
|
public:
|
||||||
FetchMessageEntriesCommand(
|
FetchMessageEntriesCommand(
|
||||||
MessageEntryList& entries, uint32 from,
|
MessageEntryList& entries, uint32 from,
|
||||||
uint32 to);
|
uint32 to, bool uids);
|
||||||
|
|
||||||
BString CommandString();
|
BString CommandString();
|
||||||
virtual bool HandleUntagged(Response& response);
|
virtual bool HandleUntagged(Response& response);
|
||||||
@@ -135,6 +135,7 @@ private:
|
|||||||
MessageEntryList& fEntries;
|
MessageEntryList& fEntries;
|
||||||
uint32 fFrom;
|
uint32 fFrom;
|
||||||
uint32 fTo;
|
uint32 fTo;
|
||||||
|
bool fUIDs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ do_fetch(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool FetchData(uint32 fetchFlags, BDataIO& stream,
|
virtual bool FetchData(uint32 fetchFlags, BDataIO& stream,
|
||||||
size_t length)
|
size_t& length)
|
||||||
{
|
{
|
||||||
fBuffer.SetSize(0);
|
fBuffer.SetSize(0);
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ do_flags(int argc, char** argv)
|
|||||||
to = atoul(argv[1]);
|
to = atoul(argv[1]);
|
||||||
|
|
||||||
IMAP::MessageEntryList entries;
|
IMAP::MessageEntryList entries;
|
||||||
IMAP::FetchMessageEntriesCommand command(entries, from, to);
|
IMAP::FetchMessageEntriesCommand command(entries, from, to, true);
|
||||||
status_t status = sProtocol.ProcessCommand(command);
|
status_t status = sProtocol.ProcessCommand(command);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
error("flags", status);
|
error("flags", status);
|
||||||
|
|||||||
Reference in New Issue
Block a user