aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2012-04-05 11:46:39 +0200
committerVincent Richard <[email protected]>2012-04-05 11:46:39 +0200
commit92c445dd63d463aaf0ee674dcae1a192e8a50381 (patch)
tree0e9826aa1dc354a05f6fd9aabe70f698166c8216 /src
parentUpdated coding conventions. (diff)
downloadvmime-92c445dd63d463aaf0ee674dcae1a192e8a50381.tar.gz
vmime-92c445dd63d463aaf0ee674dcae1a192e8a50381.zip
Added function to retrieve sequence numbers of messages whose UID is greater or equal than a specified UID (thanks to Zahi Mashael).
Diffstat (limited to 'src')
-rw-r--r--src/net/imap/IMAPFolder.cpp56
-rw-r--r--src/net/maildir/maildirFolder.cpp6
-rw-r--r--src/net/pop3/POP3Folder.cpp6
3 files changed, 68 insertions, 0 deletions
diff --git a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp
index 0122d217..50a2f2ba 100644
--- a/src/net/imap/IMAPFolder.cpp
+++ b/src/net/imap/IMAPFolder.cpp
@@ -1772,6 +1772,62 @@ void IMAPFolder::status(int& count, int& unseen)
}
+std::vector <int> IMAPFolder::getMessageNumbersStartingOnUID(const message::uid& uid)
+{
+ std::vector<int> v;
+
+ std::ostringstream command;
+ command.imbue(std::locale::classic());
+
+ command << "SEARCH UID " << uid;
+
+ // Send the request
+ m_connection->send(true, command.str(), true);
+
+ // Get the response
+ utility::auto_ptr <IMAPParser::response> resp(m_connection->readResponse());
+
+ if (resp->isBad() ||
+ resp->response_done()->response_tagged()->resp_cond_state()->status() != IMAPParser::resp_cond_state::OK)
+ {
+ throw exceptions::command_error("SEARCH",
+ m_connection->getParser()->lastLine(), "bad response");
+ }
+
+ const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList = resp->continue_req_or_response_data();
+
+ for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
+ it = respDataList.begin() ; it != respDataList.end() ; ++it)
+ {
+ if ((*it)->response_data() == NULL)
+ {
+ throw exceptions::command_error("SEARCH",
+ m_connection->getParser()->lastLine(), "invalid response");
+ }
+
+ const IMAPParser::mailbox_data* mailboxData =
+ (*it)->response_data()->mailbox_data();
+
+ // We are only interested in responses of type "SEARCH"
+ if (mailboxData == NULL ||
+ mailboxData->type() != IMAPParser::mailbox_data::SEARCH)
+ {
+ continue;
+ }
+
+ for (std::vector <IMAPParser::nz_number*>::const_iterator
+ it = mailboxData->search_nz_number_list().begin() ;
+ it != mailboxData->search_nz_number_list().end();
+ ++it)
+ {
+ v.push_back((*it)->value());
+ }
+ }
+
+ return v;
+}
+
+
} // imap
} // net
} // vmime
diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp
index dd680c9c..d11ae3b8 100644
--- a/src/net/maildir/maildirFolder.cpp
+++ b/src/net/maildir/maildirFolder.cpp
@@ -1363,6 +1363,12 @@ const utility::file::path maildirFolder::getMessageFSPath(const int number) cons
}
+std::vector <int> maildirFolder::getMessageNumbersStartingOnUID(const message::uid& /* uid */)
+{
+ throw exceptions::operation_not_supported();
+}
+
+
} // maildir
} // net
} // vmime
diff --git a/src/net/pop3/POP3Folder.cpp b/src/net/pop3/POP3Folder.cpp
index d5fc6874..e0856090 100644
--- a/src/net/pop3/POP3Folder.cpp
+++ b/src/net/pop3/POP3Folder.cpp
@@ -843,6 +843,12 @@ void POP3Folder::expunge()
}
+std::vector <int> POP3Folder::getMessageNumbersStartingOnUID(const message::uid& /* uid */)
+{
+ throw exceptions::operation_not_supported();
+}
+
+
} // pop3
} // net
} // vmime