From 81b7b009e9562323efb277d8fd4cc48675b35dc7 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sat, 23 Jul 2005 13:14:21 +0000 Subject: Fixed getMessages(). --- src/messaging/imap/IMAPFolder.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/messaging/imap/IMAPFolder.cpp') diff --git a/src/messaging/imap/IMAPFolder.cpp b/src/messaging/imap/IMAPFolder.cpp index c567c590..a63e8aa6 100644 --- a/src/messaging/imap/IMAPFolder.cpp +++ b/src/messaging/imap/IMAPFolder.cpp @@ -464,12 +464,17 @@ ref IMAPFolder::getMessage(const int num) std::vector > IMAPFolder::getMessages(const int from, const int to) { + const int messageCount = getMessageCount(); + const int to2 = (to == -1 ? messageCount : to); + if (!isOpen()) throw exceptions::illegal_state("Folder not open"); + else if (to2 < from || from < 1 || to2 < 1 || from > messageCount || to2 > messageCount) + throw exceptions::message_not_found(); std::vector > v; - for (int i = from ; i <= to ; ++i) + for (int i = from ; i <= to2 ; ++i) v.push_back(vmime::create (this, i)); return (v); -- cgit v1.2.3