Simplified IMAP parser objects.
This commit is contained in:
parent
523aacb499
commit
182e8f5dd8
@ -176,20 +176,20 @@ void IMAPConnection::connect() {
|
||||
scoped_ptr <IMAPParser::greeting> greet(m_parser->readGreeting());
|
||||
bool needAuth = false;
|
||||
|
||||
if (greet->resp_cond_bye()) {
|
||||
if (greet->resp_cond_bye) {
|
||||
|
||||
internalDisconnect();
|
||||
throw exceptions::connection_greeting_error(greet->getErrorLog());
|
||||
|
||||
} else if (greet->resp_cond_auth()->condition() != IMAPParser::resp_cond_auth::PREAUTH) {
|
||||
} else if (greet->resp_cond_auth->condition != IMAPParser::resp_cond_auth::PREAUTH) {
|
||||
|
||||
needAuth = true;
|
||||
}
|
||||
|
||||
if (greet->resp_cond_auth()->resp_text()->resp_text_code() &&
|
||||
greet->resp_cond_auth()->resp_text()->resp_text_code()->capability_data()) {
|
||||
if (greet->resp_cond_auth->resp_text->resp_text_code &&
|
||||
greet->resp_cond_auth->resp_text->resp_text_code->capability_data) {
|
||||
|
||||
processCapabilityResponseData(greet->resp_cond_auth()->resp_text()->resp_text_code()->capability_data());
|
||||
processCapabilityResponseData(greet->resp_cond_auth->resp_text->resp_text_code->capability_data.get());
|
||||
}
|
||||
|
||||
#if VMIME_HAVE_TLS_SUPPORT
|
||||
@ -294,8 +294,8 @@ void IMAPConnection::authenticate() {
|
||||
internalDisconnect();
|
||||
throw exceptions::command_error("LOGIN", resp->getErrorLog());
|
||||
|
||||
} else if (resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
} else if (resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
internalDisconnect();
|
||||
throw exceptions::authentication_error(resp->getErrorLog());
|
||||
@ -411,27 +411,24 @@ void IMAPConnection::authenticateSASL() {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_parser->readResponse());
|
||||
|
||||
if (resp->response_done() &&
|
||||
resp->response_done()->response_tagged() &&
|
||||
resp->response_done()->response_tagged()->resp_cond_state()->
|
||||
status() == IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->response_done &&
|
||||
resp->response_done->response_tagged &&
|
||||
resp->response_done->response_tagged->resp_cond_state->
|
||||
status == IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
m_socket = saslSession->getSecuredSocket(m_socket);
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
std::vector <IMAPParser::continue_req_or_response_data*>
|
||||
respDataList = resp->continue_req_or_response_data();
|
||||
|
||||
string response;
|
||||
bool hasResponse = false;
|
||||
|
||||
for (unsigned int i = 0 ; i < respDataList.size() ; ++i) {
|
||||
for (auto &respData : resp->continue_req_or_response_data) {
|
||||
|
||||
if (respDataList[i]->continue_req()) {
|
||||
if (respData->continue_req) {
|
||||
|
||||
response = respDataList[i]->continue_req()->resp_text()->text();
|
||||
response = respData->continue_req->resp_text->text;
|
||||
hasResponse = true;
|
||||
break;
|
||||
}
|
||||
@ -527,8 +524,8 @@ void IMAPConnection::startTLS() {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_parser->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("STARTTLS", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
@ -629,8 +626,8 @@ void IMAPConnection::fetchCapabilities() {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_parser->readResponse());
|
||||
|
||||
if (resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() == IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->response_done->response_tagged->
|
||||
resp_cond_state->status == IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
processCapabilityResponseData(resp.get());
|
||||
}
|
||||
@ -639,23 +636,19 @@ void IMAPConnection::fetchCapabilities() {
|
||||
|
||||
bool IMAPConnection::processCapabilityResponseData(const IMAPParser::response* resp) {
|
||||
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
for (auto &respData : resp->continue_req_or_response_data) {
|
||||
|
||||
for (size_t i = 0 ; i < respDataList.size() ; ++i) {
|
||||
|
||||
if (respDataList[i]->response_data() == NULL) {
|
||||
if (respData->response_data == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const IMAPParser::capability_data* capaData =
|
||||
respDataList[i]->response_data()->capability_data();
|
||||
auto &capaData = respData->response_data->capability_data;
|
||||
|
||||
if (capaData == NULL) {
|
||||
if (!capaData) {
|
||||
continue;
|
||||
}
|
||||
|
||||
processCapabilityResponseData(capaData);
|
||||
processCapabilityResponseData(capaData.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -667,14 +660,12 @@ void IMAPConnection::processCapabilityResponseData(const IMAPParser::capability_
|
||||
|
||||
std::vector <string> res;
|
||||
|
||||
std::vector <IMAPParser::capability*> caps = capaData->capabilities();
|
||||
for (auto &cap : capaData->capabilities) {
|
||||
|
||||
for (unsigned int j = 0 ; j < caps.size() ; ++j) {
|
||||
|
||||
if (caps[j]->auth_type()) {
|
||||
res.push_back("AUTH=" + caps[j]->auth_type()->name());
|
||||
if (cap->auth_type) {
|
||||
res.push_back("AUTH=" + cap->auth_type->name);
|
||||
} else {
|
||||
res.push_back(utility::stringUtils::toUpper(caps[j]->atom()->value()));
|
||||
res.push_back(utility::stringUtils::toUpper(cap->atom->value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -744,34 +735,31 @@ void IMAPConnection::initHierarchySeparator() {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_parser->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
internalDisconnect();
|
||||
throw exceptions::command_error("LIST", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
const auto& respDataList = resp->continue_req_or_response_data;
|
||||
|
||||
bool found = false;
|
||||
|
||||
for (unsigned int i = 0 ; !found && i < respDataList.size() ; ++i) {
|
||||
|
||||
if (respDataList[i]->response_data() == NULL) {
|
||||
if (!respDataList[i]->response_data) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const IMAPParser::mailbox_data* mailboxData =
|
||||
static_cast <const IMAPParser::response_data*>
|
||||
(respDataList[i]->response_data())->mailbox_data();
|
||||
auto &mailboxData = respDataList[i]->response_data->mailbox_data;
|
||||
|
||||
if (mailboxData == NULL || mailboxData->type() != IMAPParser::mailbox_data::LIST) {
|
||||
if (!mailboxData || mailboxData->type != IMAPParser::mailbox_data::LIST) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mailboxData->mailbox_list()->quoted_char() != '\0') {
|
||||
m_hierarchySeparator = mailboxData->mailbox_list()->quoted_char();
|
||||
if (mailboxData->mailbox_list->quoted_char != '\0') {
|
||||
m_hierarchySeparator = mailboxData->mailbox_list->quoted_char;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
@ -193,34 +193,30 @@ void IMAPFolder::open(const int mode, bool failIfModeIsNotAvailable) {
|
||||
// Read the response
|
||||
scoped_ptr <IMAPParser::response> resp(connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("SELECT", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
auto &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) {
|
||||
for (auto it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if ((*it)->response_data() == NULL) {
|
||||
auto *responseData = (*it)->response_data.get();
|
||||
|
||||
if (!responseData) {
|
||||
throw exceptions::command_error("SELECT", resp->getErrorLog(), "invalid response");
|
||||
}
|
||||
|
||||
const IMAPParser::response_data* responseData = (*it)->response_data();
|
||||
|
||||
// OK Untagged responses: UNSEEN, PERMANENTFLAGS, UIDVALIDITY (optional)
|
||||
if (responseData->resp_cond_state()) {
|
||||
if (responseData->resp_cond_state) {
|
||||
|
||||
const IMAPParser::resp_text_code* code =
|
||||
responseData->resp_cond_state()->resp_text()->resp_text_code();
|
||||
auto *code = responseData->resp_cond_state->resp_text->resp_text_code.get();
|
||||
|
||||
if (code != NULL) {
|
||||
if (code) {
|
||||
|
||||
switch (code->type()) {
|
||||
switch (code->type) {
|
||||
|
||||
case IMAPParser::resp_text_code::NOMODSEQ:
|
||||
|
||||
@ -234,9 +230,9 @@ void IMAPFolder::open(const int mode, bool failIfModeIsNotAvailable) {
|
||||
}
|
||||
|
||||
// Untagged responses: FLAGS, EXISTS, RECENT (required)
|
||||
} else if (responseData->mailbox_data()) {
|
||||
} else if (responseData->mailbox_data) {
|
||||
|
||||
switch (responseData->mailbox_data()->type()) {
|
||||
switch (responseData->mailbox_data->type) {
|
||||
|
||||
default: break;
|
||||
|
||||
@ -248,7 +244,7 @@ void IMAPFolder::open(const int mode, bool failIfModeIsNotAvailable) {
|
||||
|
||||
IMAPUtils::mailboxFlagsToFolderAttributes(
|
||||
connection,
|
||||
responseData->mailbox_data()->mailbox_flag_list(),
|
||||
*responseData->mailbox_data->mailbox_flag_list,
|
||||
*m_attribs
|
||||
);
|
||||
|
||||
@ -261,13 +257,12 @@ void IMAPFolder::open(const int mode, bool failIfModeIsNotAvailable) {
|
||||
processStatusUpdate(resp.get());
|
||||
|
||||
// Check for access mode (read-only or read-write)
|
||||
const IMAPParser::resp_text_code* respTextCode = resp->response_done()->
|
||||
response_tagged()->resp_cond_state()->resp_text()->resp_text_code();
|
||||
auto *respTextCode = resp->response_done->response_tagged->resp_cond_state->resp_text->resp_text_code.get();
|
||||
|
||||
if (respTextCode) {
|
||||
|
||||
const int openMode =
|
||||
(respTextCode->type() == IMAPParser::resp_text_code::READ_WRITE)
|
||||
(respTextCode->type == IMAPParser::resp_text_code::READ_WRITE)
|
||||
? MODE_READ_WRITE
|
||||
: MODE_READ_ONLY;
|
||||
|
||||
@ -404,8 +399,8 @@ void IMAPFolder::create(const folderAttributes& attribs) {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("CREATE", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
@ -443,8 +438,8 @@ void IMAPFolder::destroy() {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("DELETE", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
@ -505,38 +500,34 @@ int IMAPFolder::testExistAndGetType() {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("LIST", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
// Check whether the result mailbox list contains this folder
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
auto& respDataList = resp->continue_req_or_response_data;
|
||||
|
||||
folderAttributes attribs;
|
||||
attribs.setType(-1);
|
||||
|
||||
for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
|
||||
it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if ((*it)->response_data() == NULL) {
|
||||
for (auto it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if (!(*it)->response_data) {
|
||||
throw exceptions::command_error("LIST", resp->getErrorLog(), "invalid response");
|
||||
}
|
||||
|
||||
const IMAPParser::mailbox_data* mailboxData =
|
||||
(*it)->response_data()->mailbox_data();
|
||||
auto *mailboxData = (*it)->response_data->mailbox_data.get();
|
||||
|
||||
// We are only interested in responses of type "LIST"
|
||||
if (mailboxData != NULL &&
|
||||
mailboxData->type() == IMAPParser::mailbox_data::LIST) {
|
||||
if (mailboxData &&
|
||||
mailboxData->type == IMAPParser::mailbox_data::LIST) {
|
||||
|
||||
// Get the folder type/flags at the same time
|
||||
IMAPUtils::mailboxFlagsToFolderAttributes(
|
||||
m_connection,
|
||||
mailboxData->mailbox_list()->mailbox_flag_list(),
|
||||
*mailboxData->mailbox_list->mailbox_flag_list,
|
||||
attribs
|
||||
);
|
||||
}
|
||||
@ -602,44 +593,36 @@ std::vector <shared_ptr <message> > IMAPFolder::getMessages(const messageSet& ms
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("UID FETCH ... UID", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
// Process the response
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
auto &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) {
|
||||
for (auto it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if (!(*it)->response_data) {
|
||||
throw exceptions::command_error("UID FETCH ... UID", resp->getErrorLog(), "invalid response");
|
||||
}
|
||||
|
||||
const IMAPParser::message_data* messageData =
|
||||
(*it)->response_data()->message_data();
|
||||
auto *messageData = (*it)->response_data->message_data.get();
|
||||
|
||||
// We are only interested in responses of type "FETCH"
|
||||
if (messageData == NULL || messageData->type() != IMAPParser::message_data::FETCH) {
|
||||
if (!messageData || messageData->type != IMAPParser::message_data::FETCH) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get Process fetch response for this message
|
||||
const size_t msgNum = messageData->number();
|
||||
// Find UID in message attributes
|
||||
const size_t msgNum = messageData->number;
|
||||
message::uid msgUID;
|
||||
|
||||
// Find UID in message attributes
|
||||
const std::vector <IMAPParser::msg_att_item*> atts = messageData->msg_att()->items();
|
||||
for (auto &att : messageData->msg_att->items) {
|
||||
|
||||
for (std::vector <IMAPParser::msg_att_item*>::const_iterator
|
||||
it = atts.begin() ; it != atts.end() ; ++it) {
|
||||
|
||||
if ((*it)->type() == IMAPParser::msg_att_item::UID) {
|
||||
msgUID = (*it)->unique_id()->value();
|
||||
if (att->type == IMAPParser::msg_att_item::UID) {
|
||||
msgUID = att->uniqueid->value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -736,49 +719,45 @@ std::vector <shared_ptr <folder> > IMAPFolder::getFolders(const bool recursive)
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("LIST", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
|
||||
auto &respDataList = resp->continue_req_or_response_data;
|
||||
|
||||
std::vector <shared_ptr <folder> > v;
|
||||
|
||||
for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
|
||||
it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if ((*it)->response_data() == NULL) {
|
||||
for (auto it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if (!(*it)->response_data) {
|
||||
throw exceptions::command_error("LIST", resp->getErrorLog(), "invalid response");
|
||||
}
|
||||
|
||||
const IMAPParser::mailbox_data* mailboxData =
|
||||
(*it)->response_data()->mailbox_data();
|
||||
auto *mailboxData = (*it)->response_data->mailbox_data.get();
|
||||
|
||||
if (mailboxData == NULL || mailboxData->type() != IMAPParser::mailbox_data::LIST) {
|
||||
if (!mailboxData || mailboxData->type != IMAPParser::mailbox_data::LIST) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get folder path
|
||||
const class IMAPParser::mailbox* mailbox =
|
||||
mailboxData->mailbox_list()->mailbox();
|
||||
auto &mailbox = mailboxData->mailbox_list->mailbox;
|
||||
|
||||
folder::path path = IMAPUtils::stringToPath(
|
||||
mailboxData->mailbox_list()->quoted_char(), mailbox->name()
|
||||
mailboxData->mailbox_list->quoted_char, mailbox->name
|
||||
);
|
||||
|
||||
if (recursive || m_path.isDirectParentOf(path)) {
|
||||
|
||||
// Append folder to list
|
||||
const class IMAPParser::mailbox_flag_list* mailbox_flag_list =
|
||||
mailboxData->mailbox_list()->mailbox_flag_list();
|
||||
|
||||
shared_ptr <folderAttributes> attribs = make_shared <folderAttributes>();
|
||||
IMAPUtils::mailboxFlagsToFolderAttributes(m_connection, mailbox_flag_list, *attribs);
|
||||
|
||||
IMAPUtils::mailboxFlagsToFolderAttributes(
|
||||
m_connection,
|
||||
*mailboxData->mailbox_list->mailbox_flag_list,
|
||||
*attribs
|
||||
);
|
||||
|
||||
v.push_back(make_shared <IMAPFolder>(path, store, attribs));
|
||||
}
|
||||
@ -826,14 +805,13 @@ void IMAPFolder::fetchMessages(
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("FETCH", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
auto &respDataList = resp->continue_req_or_response_data;
|
||||
|
||||
const size_t total = msg.size();
|
||||
size_t current = 0;
|
||||
@ -844,30 +822,27 @@ void IMAPFolder::fetchMessages(
|
||||
|
||||
try {
|
||||
|
||||
for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
|
||||
it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if ((*it)->response_data() == NULL) {
|
||||
for (auto it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if (!(*it)->response_data) {
|
||||
throw exceptions::command_error("FETCH", resp->getErrorLog(), "invalid response");
|
||||
}
|
||||
|
||||
const IMAPParser::message_data* messageData =
|
||||
(*it)->response_data()->message_data();
|
||||
auto *messageData = (*it)->response_data->message_data.get();
|
||||
|
||||
// We are only interested in responses of type "FETCH"
|
||||
if (messageData == NULL || messageData->type() != IMAPParser::message_data::FETCH) {
|
||||
if (!messageData || messageData->type != IMAPParser::message_data::FETCH) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process fetch response for this message
|
||||
const size_t num = messageData->number();
|
||||
const size_t num = messageData->number;
|
||||
|
||||
std::map <size_t, shared_ptr <IMAPMessage> >::iterator msg = numberToMsg.find(num);
|
||||
|
||||
if (msg != numberToMsg.end()) {
|
||||
|
||||
(*msg).second->processFetchResponse(options, messageData);
|
||||
(*msg).second->processFetchResponse(options, *messageData);
|
||||
|
||||
if (progress) {
|
||||
progress->progress(++current, total);
|
||||
@ -928,45 +903,39 @@ std::vector <shared_ptr <message> > IMAPFolder::getAndFetchMessages(
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("FETCH", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
auto &respDataList = resp->continue_req_or_response_data;
|
||||
|
||||
std::vector <shared_ptr <message> > messages;
|
||||
|
||||
for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
|
||||
it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if ((*it)->response_data() == NULL) {
|
||||
for (auto it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if (!(*it)->response_data) {
|
||||
throw exceptions::command_error("FETCH", resp->getErrorLog(), "invalid response");
|
||||
}
|
||||
|
||||
const IMAPParser::message_data* messageData =
|
||||
(*it)->response_data()->message_data();
|
||||
auto *messageData = (*it)->response_data->message_data.get();
|
||||
|
||||
// We are only interested in responses of type "FETCH"
|
||||
if (messageData == NULL || messageData->type() != IMAPParser::message_data::FETCH) {
|
||||
if (!messageData || messageData->type != IMAPParser::message_data::FETCH) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get message number
|
||||
const size_t msgNum = messageData->number();
|
||||
const size_t msgNum = messageData->number;
|
||||
|
||||
// Get message UID
|
||||
const std::vector <IMAPParser::msg_att_item*> atts = messageData->msg_att()->items();
|
||||
message::uid msgUID;
|
||||
|
||||
for (std::vector <IMAPParser::msg_att_item*>::const_iterator
|
||||
it = atts.begin() ; it != atts.end() ; ++it) {
|
||||
for (auto &att : messageData->msg_att->items) {
|
||||
|
||||
if ((*it)->type() == IMAPParser::msg_att_item::UID) {
|
||||
msgUID = (*it)->unique_id()->value();
|
||||
if (att->type == IMAPParser::msg_att_item::UID) {
|
||||
msgUID = att->uniqueid->value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -978,7 +947,7 @@ std::vector <shared_ptr <message> > IMAPFolder::getAndFetchMessages(
|
||||
messages.push_back(msg);
|
||||
|
||||
// Process fetch response for this message
|
||||
msg->processFetchResponse(attribsWithUID, messageData);
|
||||
msg->processFetchResponse(attribsWithUID, *messageData);
|
||||
}
|
||||
|
||||
processStatusUpdate(resp.get());
|
||||
@ -1071,8 +1040,8 @@ void IMAPFolder::deleteMessages(const messageSet& msgs) {
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("STORE", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
@ -1097,8 +1066,8 @@ void IMAPFolder::setMessageFlags(
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("STORE", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
@ -1155,13 +1124,11 @@ messageSet IMAPFolder::addMessage(
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
bool ok = false;
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respList
|
||||
= resp->continue_req_or_response_data();
|
||||
auto &respList = resp->continue_req_or_response_data;
|
||||
|
||||
for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
|
||||
it = respList.begin() ; !ok && (it != respList.end()) ; ++it) {
|
||||
for (auto it = respList.begin() ; !ok && (it != respList.end()) ; ++it) {
|
||||
|
||||
if ((*it)->continue_req()) {
|
||||
if ((*it)->continue_req) {
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
@ -1216,19 +1183,19 @@ messageSet IMAPFolder::addMessage(
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> finalResp(m_connection->readResponse());
|
||||
|
||||
if (finalResp->isBad() || finalResp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (finalResp->isBad() || finalResp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("APPEND", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
processStatusUpdate(finalResp.get());
|
||||
|
||||
const IMAPParser::resp_text_code* respTextCode =
|
||||
finalResp->response_done()->response_tagged()->resp_cond_state()->resp_text()->resp_text_code();
|
||||
auto *respTextCode =
|
||||
finalResp->response_done->response_tagged->resp_cond_state->resp_text->resp_text_code.get();
|
||||
|
||||
if (respTextCode && respTextCode->type() == IMAPParser::resp_text_code::APPENDUID) {
|
||||
return IMAPUtils::buildMessageSet(respTextCode->uid_set());
|
||||
if (respTextCode && respTextCode->type == IMAPParser::resp_text_code::APPENDUID) {
|
||||
return IMAPUtils::buildMessageSet(*respTextCode->uid_set);
|
||||
}
|
||||
|
||||
return messageSet::empty();
|
||||
@ -1253,8 +1220,8 @@ void IMAPFolder::expunge() {
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("EXPUNGE", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
@ -1286,8 +1253,8 @@ void IMAPFolder::rename(const folder::path& newPath) {
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("RENAME", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
@ -1352,19 +1319,19 @@ messageSet IMAPFolder::copyMessages(const folder::path& dest, const messageSet&
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("COPY", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
processStatusUpdate(resp.get());
|
||||
|
||||
const IMAPParser::resp_text_code* respTextCode =
|
||||
resp->response_done()->response_tagged()->resp_cond_state()->resp_text()->resp_text_code();
|
||||
auto *respTextCode =
|
||||
resp->response_done->response_tagged->resp_cond_state->resp_text->resp_text_code.get();
|
||||
|
||||
if (respTextCode && respTextCode->type() == IMAPParser::resp_text_code::COPYUID) {
|
||||
return IMAPUtils::buildMessageSet(respTextCode->uid_set2());
|
||||
if (respTextCode && respTextCode->type == IMAPParser::resp_text_code::COPYUID) {
|
||||
return IMAPUtils::buildMessageSet(*respTextCode->uid_set2);
|
||||
}
|
||||
|
||||
return messageSet::empty();
|
||||
@ -1412,29 +1379,27 @@ shared_ptr <folderStatus> IMAPFolder::getStatus() {
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("STATUS", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList =
|
||||
resp->continue_req_or_response_data();
|
||||
auto &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) {
|
||||
for (auto it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if ((*it)->response_data() != NULL) {
|
||||
if ((*it)->response_data) {
|
||||
|
||||
const IMAPParser::response_data* responseData = (*it)->response_data();
|
||||
auto &responseData = (*it)->response_data;
|
||||
|
||||
if (responseData->mailbox_data() &&
|
||||
responseData->mailbox_data()->type() == IMAPParser::mailbox_data::STATUS) {
|
||||
if (responseData->mailbox_data &&
|
||||
responseData->mailbox_data->type == IMAPParser::mailbox_data::STATUS) {
|
||||
|
||||
shared_ptr <IMAPFolderStatus> status = make_shared <IMAPFolderStatus>();
|
||||
status->updateFromResponse(responseData->mailbox_data());
|
||||
status->updateFromResponse(*responseData->mailbox_data);
|
||||
|
||||
m_status->updateFromResponse(responseData->mailbox_data());
|
||||
m_status->updateFromResponse(*responseData->mailbox_data);
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -1457,8 +1422,8 @@ void IMAPFolder::noop() {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("NOOP", resp->getErrorLog());
|
||||
}
|
||||
@ -1483,38 +1448,32 @@ std::vector <size_t> IMAPFolder::getMessageNumbersStartingOnUID(const message::u
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() ||
|
||||
resp->response_done()->response_tagged()->resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
resp->response_done->response_tagged->resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("SEARCH", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
|
||||
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList = resp->continue_req_or_response_data();
|
||||
auto& respDataList = resp->continue_req_or_response_data;
|
||||
|
||||
std::vector <size_t> seqNumbers;
|
||||
|
||||
for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
|
||||
it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
for (auto it = respDataList.begin() ; it != respDataList.end() ; ++it) {
|
||||
|
||||
if ((*it)->response_data() == NULL) {
|
||||
if (!(*it)->response_data) {
|
||||
throw exceptions::command_error("SEARCH", resp->getErrorLog(), "invalid response");
|
||||
}
|
||||
|
||||
const IMAPParser::mailbox_data* mailboxData =
|
||||
(*it)->response_data()->mailbox_data();
|
||||
auto *mailboxData = (*it)->response_data->mailbox_data.get();
|
||||
|
||||
// We are only interested in responses of type "SEARCH"
|
||||
if (mailboxData == NULL ||
|
||||
mailboxData->type() != IMAPParser::mailbox_data::SEARCH) {
|
||||
if (!mailboxData ||
|
||||
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) {
|
||||
|
||||
seqNumbers.push_back((*it)->value());
|
||||
for (auto &nzn : mailboxData->search_nz_number_list) {
|
||||
seqNumbers.push_back(nzn->value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1532,60 +1491,58 @@ void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp) {
|
||||
int expungedMessageCount = 0;
|
||||
|
||||
// Process tagged response
|
||||
if (resp->response_done() && resp->response_done()->response_tagged() &&
|
||||
resp->response_done()->response_tagged()
|
||||
->resp_cond_state()->resp_text()->resp_text_code()) {
|
||||
if (resp->response_done &&
|
||||
resp->response_done->response_tagged &&
|
||||
resp->response_done->response_tagged->resp_cond_state->resp_text->resp_text_code) {
|
||||
|
||||
const IMAPParser::resp_text_code* code =
|
||||
resp->response_done()->response_tagged()
|
||||
->resp_cond_state()->resp_text()->resp_text_code();
|
||||
|
||||
m_status->updateFromResponse(code);
|
||||
m_status->updateFromResponse(
|
||||
*resp->response_done->response_tagged->resp_cond_state->resp_text->resp_text_code
|
||||
);
|
||||
}
|
||||
|
||||
// Process untagged responses
|
||||
for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
|
||||
it = resp->continue_req_or_response_data().begin() ;
|
||||
it != resp->continue_req_or_response_data().end() ; ++it) {
|
||||
for (auto it = resp->continue_req_or_response_data.begin() ;
|
||||
it != resp->continue_req_or_response_data.end() ; ++it) {
|
||||
|
||||
if ((*it)->response_data() && (*it)->response_data()->resp_cond_state() &&
|
||||
(*it)->response_data()->resp_cond_state()->resp_text()->resp_text_code()) {
|
||||
if ((*it)->response_data &&
|
||||
(*it)->response_data->resp_cond_state &&
|
||||
(*it)->response_data->resp_cond_state->resp_text->resp_text_code) {
|
||||
|
||||
const IMAPParser::resp_text_code* code =
|
||||
(*it)->response_data()->resp_cond_state()->resp_text()->resp_text_code();
|
||||
m_status->updateFromResponse(
|
||||
*(*it)->response_data->resp_cond_state->resp_text->resp_text_code
|
||||
);
|
||||
|
||||
m_status->updateFromResponse(code);
|
||||
} else if ((*it)->response_data &&
|
||||
(*it)->response_data->mailbox_data) {
|
||||
|
||||
} else if ((*it)->response_data() && (*it)->response_data()->mailbox_data()) {
|
||||
|
||||
m_status->updateFromResponse((*it)->response_data()->mailbox_data());
|
||||
m_status->updateFromResponse(*(*it)->response_data->mailbox_data);
|
||||
|
||||
// Update folder attributes, if available
|
||||
if ((*it)->response_data()->mailbox_data()->type() == IMAPParser::mailbox_data::LIST) {
|
||||
if ((*it)->response_data->mailbox_data->type == IMAPParser::mailbox_data::LIST) {
|
||||
|
||||
folderAttributes attribs;
|
||||
IMAPUtils::mailboxFlagsToFolderAttributes(
|
||||
m_connection,
|
||||
(*it)->response_data()->mailbox_data()->mailbox_list()->mailbox_flag_list(),
|
||||
*(*it)->response_data->mailbox_data->mailbox_list->mailbox_flag_list,
|
||||
attribs
|
||||
);
|
||||
|
||||
m_attribs = make_shared <folderAttributes>(attribs);
|
||||
}
|
||||
|
||||
} else if ((*it)->response_data() && (*it)->response_data()->message_data()) {
|
||||
} else if ((*it)->response_data && (*it)->response_data->message_data) {
|
||||
|
||||
const IMAPParser::message_data* msgData = (*it)->response_data()->message_data();
|
||||
const size_t msgNumber = msgData->number();
|
||||
auto* msgData = (*it)->response_data->message_data.get();
|
||||
const size_t msgNumber = msgData->number;
|
||||
|
||||
if ((*it)->response_data()->message_data()->type() == IMAPParser::message_data::FETCH) {
|
||||
if (msgData->type == IMAPParser::message_data::FETCH) {
|
||||
|
||||
// Message changed
|
||||
for (std::vector <IMAPMessage*>::iterator mit =
|
||||
m_messages.begin() ; mit != m_messages.end() ; ++mit) {
|
||||
|
||||
if ((*mit)->getNumber() == msgNumber) {
|
||||
(*mit)->processFetchResponse(/* options */ 0, msgData);
|
||||
(*mit)->processFetchResponse(/* options */ 0, *msgData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1597,7 +1554,7 @@ void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp) {
|
||||
)
|
||||
);
|
||||
|
||||
} else if ((*it)->response_data()->message_data()->type() == IMAPParser::message_data::EXPUNGE) {
|
||||
} else if (msgData->type == IMAPParser::message_data::EXPUNGE) {
|
||||
|
||||
// A message has been expunged, renumber messages
|
||||
for (std::vector <IMAPMessage*>::iterator jt =
|
||||
|
@ -100,23 +100,20 @@ shared_ptr <folderStatus> IMAPFolderStatus::clone() const {
|
||||
}
|
||||
|
||||
|
||||
bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp) {
|
||||
bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data& resp) {
|
||||
|
||||
bool changed = false;
|
||||
|
||||
if (resp->type() == IMAPParser::mailbox_data::STATUS) {
|
||||
if (resp.type == IMAPParser::mailbox_data::STATUS) {
|
||||
|
||||
const IMAPParser::status_att_list* statusAttList = resp->status_att_list();
|
||||
for (auto &attval : resp.status_att_list->values) {
|
||||
|
||||
for (std::vector <IMAPParser::status_att_val*>::const_iterator
|
||||
jt = statusAttList->values().begin() ; jt != statusAttList->values().end() ; ++jt) {
|
||||
|
||||
switch ((*jt)->type()) {
|
||||
switch (attval->type) {
|
||||
|
||||
case IMAPParser::status_att_val::MESSAGES: {
|
||||
|
||||
const size_t count =
|
||||
static_cast <size_t>((*jt)->value_as_number()->value());
|
||||
static_cast <size_t>(attval->value_as_number()->value);
|
||||
|
||||
if (m_count != count) {
|
||||
m_count = count;
|
||||
@ -128,7 +125,7 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
||||
case IMAPParser::status_att_val::UNSEEN: {
|
||||
|
||||
const size_t unseen =
|
||||
static_cast <size_t>((*jt)->value_as_number()->value());
|
||||
static_cast <size_t>(attval->value_as_number()->value);
|
||||
|
||||
if (m_unseen != unseen) {
|
||||
m_unseen = unseen;
|
||||
@ -140,7 +137,7 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
||||
case IMAPParser::status_att_val::RECENT: {
|
||||
|
||||
const size_t recent =
|
||||
static_cast <size_t>((*jt)->value_as_number()->value());
|
||||
static_cast <size_t>(attval->value_as_number()->value);
|
||||
|
||||
if (m_recent != recent) {
|
||||
m_recent = recent;
|
||||
@ -152,7 +149,7 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
||||
case IMAPParser::status_att_val::UIDNEXT: {
|
||||
|
||||
const vmime_uint32 uidNext =
|
||||
static_cast <vmime_uint32>((*jt)->value_as_number()->value());
|
||||
static_cast <vmime_uint32>(attval->value_as_number()->value);
|
||||
|
||||
if (m_uidNext != uidNext) {
|
||||
m_uidNext = uidNext;
|
||||
@ -164,7 +161,7 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
||||
case IMAPParser::status_att_val::UIDVALIDITY: {
|
||||
|
||||
const vmime_uint32 uidValidity =
|
||||
static_cast <vmime_uint32>((*jt)->value_as_number()->value());
|
||||
static_cast <vmime_uint32>(attval->value_as_number()->value);
|
||||
|
||||
if (m_uidValidity != uidValidity) {
|
||||
m_uidValidity = uidValidity;
|
||||
@ -176,7 +173,7 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
||||
case IMAPParser::status_att_val::HIGHESTMODSEQ: {
|
||||
|
||||
const vmime_uint64 highestModSeq =
|
||||
static_cast <vmime_uint64>((*jt)->value_as_mod_sequence_value()->value());
|
||||
static_cast <vmime_uint64>(attval->value_as_mod_sequence_value()->value);
|
||||
|
||||
if (m_highestModSeq != highestModSeq) {
|
||||
m_highestModSeq = highestModSeq;
|
||||
@ -189,20 +186,20 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
||||
}
|
||||
}
|
||||
|
||||
} else if (resp->type() == IMAPParser::mailbox_data::EXISTS) {
|
||||
} else if (resp.type == IMAPParser::mailbox_data::EXISTS) {
|
||||
|
||||
const size_t count =
|
||||
static_cast <size_t>(resp->number()->value());
|
||||
static_cast <size_t>(resp.number->value);
|
||||
|
||||
if (m_count != count) {
|
||||
m_count = count;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
} else if (resp->type() == IMAPParser::mailbox_data::RECENT) {
|
||||
} else if (resp.type == IMAPParser::mailbox_data::RECENT) {
|
||||
|
||||
const size_t recent =
|
||||
static_cast <size_t>(resp->number()->value());
|
||||
static_cast <size_t>(resp.number->value);
|
||||
|
||||
if (m_recent != recent) {
|
||||
m_recent = recent;
|
||||
@ -214,16 +211,16 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
||||
}
|
||||
|
||||
|
||||
bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp) {
|
||||
bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code& resp) {
|
||||
|
||||
bool changed = false;
|
||||
|
||||
switch (resp->type()) {
|
||||
switch (resp.type) {
|
||||
|
||||
case IMAPParser::resp_text_code::UIDVALIDITY: {
|
||||
|
||||
const vmime_uint32 uidValidity =
|
||||
static_cast <vmime_uint32>(resp->nz_number()->value());
|
||||
static_cast <vmime_uint32>(resp.nz_number->value);
|
||||
|
||||
if (m_uidValidity != uidValidity) {
|
||||
m_uidValidity = uidValidity;
|
||||
@ -235,7 +232,7 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp
|
||||
case IMAPParser::resp_text_code::UIDNEXT: {
|
||||
|
||||
const vmime_uint32 uidNext =
|
||||
static_cast <vmime_uint32>(resp->nz_number()->value());
|
||||
static_cast <vmime_uint32>(resp.nz_number->value);
|
||||
|
||||
if (m_uidNext != uidNext) {
|
||||
m_uidNext = uidNext;
|
||||
@ -247,7 +244,7 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp
|
||||
case IMAPParser::resp_text_code::UNSEEN: {
|
||||
|
||||
const size_t unseen =
|
||||
static_cast <size_t>(resp->nz_number()->value());
|
||||
static_cast <size_t>(resp.nz_number->value);
|
||||
|
||||
if (m_unseen != unseen)
|
||||
{
|
||||
@ -260,7 +257,7 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp
|
||||
case IMAPParser::resp_text_code::HIGHESTMODSEQ: {
|
||||
|
||||
const vmime_uint64 highestModSeq =
|
||||
static_cast <vmime_uint64>(resp->mod_sequence_value()->value());
|
||||
static_cast <vmime_uint64>(resp.mod_sequence_value->value);
|
||||
|
||||
if (m_highestModSeq != highestModSeq) {
|
||||
m_highestModSeq = highestModSeq;
|
||||
|
@ -93,14 +93,14 @@ public:
|
||||
* @param resp parsed IMAP response
|
||||
* @return true if the status changed, or false otherwise
|
||||
*/
|
||||
bool updateFromResponse(const IMAPParser::mailbox_data* resp);
|
||||
bool updateFromResponse(const IMAPParser::mailbox_data& resp);
|
||||
|
||||
/** Reads the folder status from the specified IMAP response.
|
||||
*
|
||||
* @param resp parsed IMAP response
|
||||
* @return true if the status changed, or false otherwise
|
||||
*/
|
||||
bool updateFromResponse(const IMAPParser::resp_text_code* resp);
|
||||
bool updateFromResponse(const IMAPParser::resp_text_code& resp);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
if (typeid(comp) == typeid(IMAPParser::msg_att_item)) {
|
||||
|
||||
const int type = static_cast
|
||||
<const IMAPParser::msg_att_item&>(comp).type();
|
||||
<const IMAPParser::msg_att_item&>(comp).type;
|
||||
|
||||
if (type == IMAPParser::msg_att_item::BODY_SECTION ||
|
||||
type == IMAPParser::msg_att_item::RFC822_TEXT) {
|
||||
@ -460,8 +460,8 @@ size_t IMAPMessage::extractImpl(
|
||||
// Get the response
|
||||
scoped_ptr <IMAPParser::response> resp(folder->m_connection->readResponse(&literalHandler));
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("FETCH", resp->getErrorLog(), "bad response");
|
||||
}
|
||||
@ -477,23 +477,21 @@ size_t IMAPMessage::extractImpl(
|
||||
|
||||
int IMAPMessage::processFetchResponse(
|
||||
const fetchAttributes& options,
|
||||
const IMAPParser::message_data* msgData
|
||||
const IMAPParser::message_data& msgData
|
||||
) {
|
||||
|
||||
shared_ptr <IMAPFolder> folder = m_folder.lock();
|
||||
|
||||
// Get message attributes
|
||||
const std::vector <IMAPParser::msg_att_item*> atts = msgData->msg_att()->items();
|
||||
int changes = 0;
|
||||
|
||||
for (std::vector <IMAPParser::msg_att_item*>::const_iterator
|
||||
it = atts.begin() ; it != atts.end() ; ++it) {
|
||||
for (auto &att : msgData.msg_att->items) {
|
||||
|
||||
switch ((*it)->type()) {
|
||||
switch (att->type) {
|
||||
|
||||
case IMAPParser::msg_att_item::FLAGS: {
|
||||
|
||||
int flags = IMAPUtils::messageFlagsFromFlags((*it)->flag_list());
|
||||
int flags = IMAPUtils::messageFlagsFromFlags(*att->flag_list);
|
||||
|
||||
if (m_flags != flags) {
|
||||
m_flags = flags;
|
||||
@ -504,33 +502,33 @@ int IMAPMessage::processFetchResponse(
|
||||
}
|
||||
case IMAPParser::msg_att_item::UID: {
|
||||
|
||||
m_uid = (*it)->unique_id()->value();
|
||||
m_uid = att->uniqueid->value;
|
||||
break;
|
||||
}
|
||||
case IMAPParser::msg_att_item::MODSEQ: {
|
||||
|
||||
m_modseq = (*it)->mod_sequence_value()->value();
|
||||
m_modseq = att->mod_sequence_value->value;
|
||||
break;
|
||||
}
|
||||
case IMAPParser::msg_att_item::ENVELOPE: {
|
||||
|
||||
if (!options.has(fetchAttributes::FULL_HEADER)) {
|
||||
|
||||
const IMAPParser::envelope* env = (*it)->envelope();
|
||||
auto* env = att->envelope.get();
|
||||
shared_ptr <vmime::header> hdr = getOrCreateHeader();
|
||||
|
||||
// Date
|
||||
hdr->Date()->setValue(env->env_date()->value());
|
||||
hdr->Date()->setValue(env->env_date->value);
|
||||
|
||||
// Subject
|
||||
text subject;
|
||||
text::decodeAndUnfold(env->env_subject()->value(), &subject);
|
||||
text::decodeAndUnfold(env->env_subject->value, &subject);
|
||||
|
||||
hdr->Subject()->setValue(subject);
|
||||
|
||||
// From
|
||||
mailboxList from;
|
||||
IMAPUtils::convertAddressList(*(env->env_from()), from);
|
||||
IMAPUtils::convertAddressList(*(env->env_from), from);
|
||||
|
||||
if (!from.isEmpty()) {
|
||||
hdr->From()->setValue(*(from.getMailboxAt(0)));
|
||||
@ -538,13 +536,13 @@ int IMAPMessage::processFetchResponse(
|
||||
|
||||
// To
|
||||
mailboxList to;
|
||||
IMAPUtils::convertAddressList(*(env->env_to()), to);
|
||||
IMAPUtils::convertAddressList(*(env->env_to), to);
|
||||
|
||||
hdr->To()->setValue(to.toAddressList());
|
||||
|
||||
// Sender
|
||||
mailboxList sender;
|
||||
IMAPUtils::convertAddressList(*(env->env_sender()), sender);
|
||||
IMAPUtils::convertAddressList(*(env->env_sender), sender);
|
||||
|
||||
if (!sender.isEmpty()) {
|
||||
hdr->Sender()->setValue(*(sender.getMailboxAt(0)));
|
||||
@ -552,7 +550,7 @@ int IMAPMessage::processFetchResponse(
|
||||
|
||||
// Reply-to
|
||||
mailboxList replyTo;
|
||||
IMAPUtils::convertAddressList(*(env->env_reply_to()), replyTo);
|
||||
IMAPUtils::convertAddressList(*(env->env_reply_to), replyTo);
|
||||
|
||||
if (!replyTo.isEmpty()) {
|
||||
hdr->ReplyTo()->setValue(*(replyTo.getMailboxAt(0)));
|
||||
@ -560,7 +558,7 @@ int IMAPMessage::processFetchResponse(
|
||||
|
||||
// Cc
|
||||
mailboxList cc;
|
||||
IMAPUtils::convertAddressList(*(env->env_cc()), cc);
|
||||
IMAPUtils::convertAddressList(*(env->env_cc), cc);
|
||||
|
||||
if (!cc.isEmpty()) {
|
||||
hdr->Cc()->setValue(cc.toAddressList());
|
||||
@ -568,7 +566,7 @@ int IMAPMessage::processFetchResponse(
|
||||
|
||||
// Bcc
|
||||
mailboxList bcc;
|
||||
IMAPUtils::convertAddressList(*(env->env_bcc()), bcc);
|
||||
IMAPUtils::convertAddressList(*(env->env_bcc), bcc);
|
||||
|
||||
if (!bcc.isEmpty()) {
|
||||
hdr->Bcc()->setValue(bcc.toAddressList());
|
||||
@ -579,37 +577,34 @@ int IMAPMessage::processFetchResponse(
|
||||
}
|
||||
case IMAPParser::msg_att_item::BODY_STRUCTURE: {
|
||||
|
||||
m_structure = make_shared <IMAPMessageStructure>((*it)->body());
|
||||
m_structure = make_shared <IMAPMessageStructure>(att->body.get());
|
||||
break;
|
||||
}
|
||||
case IMAPParser::msg_att_item::RFC822_HEADER: {
|
||||
|
||||
getOrCreateHeader()->parse((*it)->nstring()->value());
|
||||
getOrCreateHeader()->parse(att->nstring->value);
|
||||
break;
|
||||
}
|
||||
case IMAPParser::msg_att_item::RFC822_SIZE: {
|
||||
|
||||
m_size = static_cast <size_t>((*it)->number()->value());
|
||||
m_size = static_cast <size_t>(att->number->value);
|
||||
break;
|
||||
}
|
||||
case IMAPParser::msg_att_item::BODY_SECTION: {
|
||||
|
||||
if (!options.has(fetchAttributes::FULL_HEADER)) {
|
||||
|
||||
if ((*it)->section()->section_text1() &&
|
||||
(*it)->section()->section_text1()->type()
|
||||
if (att->section->section_text1 &&
|
||||
att->section->section_text1->type
|
||||
== IMAPParser::section_text::HEADER_FIELDS) {
|
||||
|
||||
header tempHeader;
|
||||
tempHeader.parse((*it)->nstring()->value());
|
||||
tempHeader.parse(att->nstring->value);
|
||||
|
||||
vmime::header& hdr = *getOrCreateHeader();
|
||||
std::vector <shared_ptr <headerField> > fields = tempHeader.getFieldList();
|
||||
|
||||
for (std::vector <shared_ptr <headerField> >::const_iterator jt = fields.begin() ;
|
||||
jt != fields.end() ; ++jt) {
|
||||
|
||||
hdr.appendField(vmime::clone(*jt));
|
||||
for (auto& fld : tempHeader.getFieldList()) {
|
||||
hdr.appendField(vmime::clone(fld));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ private:
|
||||
* @return a combination of flags that specify what changed exactly on
|
||||
* this message (see events::messageChangedEvent::Types)
|
||||
*/
|
||||
int processFetchResponse(const fetchAttributes& options, const IMAPParser::message_data* msgData);
|
||||
int processFetchResponse(const fetchAttributes& options, const IMAPParser::message_data& msgData);
|
||||
|
||||
/** Recursively fetch part header for all parts in the structure.
|
||||
*
|
||||
|
@ -48,7 +48,7 @@ IMAPMessagePart::IMAPMessagePart(
|
||||
|
||||
m_mediaType = vmime::mediaType(
|
||||
"multipart",
|
||||
mpart->media_subtype()->value()
|
||||
mpart->media_subtype->value
|
||||
);
|
||||
}
|
||||
|
||||
@ -63,35 +63,35 @@ IMAPMessagePart::IMAPMessagePart(
|
||||
m_number(number),
|
||||
m_size(0) {
|
||||
|
||||
if (part->body_type_text()) {
|
||||
if (part->body_type_text) {
|
||||
|
||||
m_mediaType = vmime::mediaType(
|
||||
"text",
|
||||
part->body_type_text()->media_text()->media_subtype()->value()
|
||||
part->body_type_text->media_text->media_subtype->value
|
||||
);
|
||||
|
||||
m_size = part->body_type_text()->body_fields()->body_fld_octets()->value();
|
||||
m_size = part->body_type_text->body_fields->body_fld_octets->value;
|
||||
|
||||
} else if (part->body_type_msg()) {
|
||||
} else if (part->body_type_msg) {
|
||||
|
||||
m_mediaType = vmime::mediaType(
|
||||
"message",
|
||||
part->body_type_msg()->media_message()->media_subtype()->value()
|
||||
part->body_type_msg->media_message->media_subtype->value
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
m_mediaType = vmime::mediaType(
|
||||
part->body_type_basic()->media_basic()->media_type()->value(),
|
||||
part->body_type_basic()->media_basic()->media_subtype()->value()
|
||||
part->body_type_basic->media_basic->media_type->value,
|
||||
part->body_type_basic->media_basic->media_subtype->value
|
||||
);
|
||||
|
||||
m_size = part->body_type_basic()->body_fields()->body_fld_octets()->value();
|
||||
m_size = part->body_type_basic->body_fields->body_fld_octets->value;
|
||||
|
||||
if (const auto pparam = part->body_type_basic()->body_fields()->body_fld_param()) {
|
||||
for (const auto& param : pparam->items()) {
|
||||
if (param->string1()->value() == "NAME") {
|
||||
m_name = param->string2()->value();
|
||||
if (const auto* pparam = part->body_type_basic->body_fields->body_fld_param.get()) {
|
||||
for (const auto& param : pparam->items) {
|
||||
if (param->string1->value == "NAME") {
|
||||
m_name = param->string2->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -168,16 +168,16 @@ shared_ptr <IMAPMessagePart> IMAPMessagePart::create(
|
||||
const IMAPParser::body* body
|
||||
) {
|
||||
|
||||
if (body->body_type_mpart()) {
|
||||
if (body->body_type_mpart) {
|
||||
|
||||
shared_ptr <IMAPMessagePart> part = make_shared <IMAPMessagePart>(parent, number, body->body_type_mpart());
|
||||
part->m_structure = make_shared <IMAPMessageStructure>(part, body->body_type_mpart()->list());
|
||||
auto part = make_shared <IMAPMessagePart>(parent, number, body->body_type_mpart.get());
|
||||
part->m_structure = make_shared <IMAPMessageStructure>(part, body->body_type_mpart->list);
|
||||
|
||||
return part;
|
||||
|
||||
} else {
|
||||
|
||||
return make_shared <IMAPMessagePart>(parent, number, body->body_type_1part());
|
||||
return make_shared <IMAPMessagePart>(parent, number, body->body_type_1part.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,15 +48,13 @@ IMAPMessageStructure::IMAPMessageStructure(const IMAPParser::body* body) {
|
||||
|
||||
IMAPMessageStructure::IMAPMessageStructure(
|
||||
const shared_ptr <IMAPMessagePart>& parent,
|
||||
const std::vector <IMAPParser::body*>& list
|
||||
const std::vector <std::unique_ptr <IMAPParser::body>>& list
|
||||
) {
|
||||
|
||||
size_t number = 0;
|
||||
|
||||
for (std::vector <IMAPParser::body*>::const_iterator
|
||||
it = list.begin() ; it != list.end() ; ++it, ++number) {
|
||||
|
||||
m_parts.push_back(IMAPMessagePart::create(parent, number, *it));
|
||||
for (auto it = list.begin() ; it != list.end() ; ++it, ++number) {
|
||||
m_parts.push_back(IMAPMessagePart::create(parent, number, it->get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
|
||||
IMAPMessageStructure();
|
||||
IMAPMessageStructure(const IMAPParser::body* body);
|
||||
IMAPMessageStructure(const shared_ptr <IMAPMessagePart>& parent, const std::vector <IMAPParser::body*>& list);
|
||||
IMAPMessageStructure(const shared_ptr <IMAPMessagePart>& parent, const std::vector <std::unique_ptr <IMAPParser::body>>& list);
|
||||
|
||||
shared_ptr <const messagePart> getPartAt(const size_t x) const;
|
||||
shared_ptr <messagePart> getPartAt(const size_t x);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -208,8 +208,8 @@ void IMAPStore::noop() {
|
||||
|
||||
scoped_ptr <IMAPParser::response> resp(m_connection->readResponse());
|
||||
|
||||
if (resp->isBad() || resp->response_done()->response_tagged()->
|
||||
resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) {
|
||||
if (resp->isBad() || resp->response_done->response_tagged->
|
||||
resp_cond_state->status != IMAPParser::resp_cond_state::OK) {
|
||||
|
||||
throw exceptions::command_error("NOOP", resp->getErrorLog());
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ const folder::path::component IMAPUtils::fromModifiedUTF7(const string& text) {
|
||||
// static
|
||||
void IMAPUtils::mailboxFlagsToFolderAttributes(
|
||||
const shared_ptr <const IMAPConnection>& cnt,
|
||||
const IMAPParser::mailbox_flag_list* list,
|
||||
const IMAPParser::mailbox_flag_list& list,
|
||||
folderAttributes& attribs
|
||||
) {
|
||||
|
||||
@ -404,12 +404,9 @@ void IMAPUtils::mailboxFlagsToFolderAttributes(
|
||||
flags |= folderAttributes::FLAG_HAS_CHILDREN;
|
||||
}
|
||||
|
||||
const std::vector <IMAPParser::mailbox_flag*>& mailboxFlags = list->flags();
|
||||
for (auto it = list.flags.begin() ; it != list.flags.end() ; ++it) {
|
||||
|
||||
for (std::vector <IMAPParser::mailbox_flag*>::const_iterator it = mailboxFlags.begin() ;
|
||||
it != mailboxFlags.end() ; ++it) {
|
||||
|
||||
switch ((*it)->type()) {
|
||||
switch ((*it)->type) {
|
||||
|
||||
case IMAPParser::mailbox_flag::NOSELECT:
|
||||
|
||||
@ -480,15 +477,13 @@ void IMAPUtils::mailboxFlagsToFolderAttributes(
|
||||
}
|
||||
|
||||
|
||||
int IMAPUtils::messageFlagsFromFlags(const IMAPParser::flag_list* list) {
|
||||
int IMAPUtils::messageFlagsFromFlags(const IMAPParser::flag_list& list) {
|
||||
|
||||
const std::vector <IMAPParser::flag*>& flagList = list->flags();
|
||||
int flags = 0;
|
||||
|
||||
for (std::vector <IMAPParser::flag*>::const_iterator
|
||||
it = flagList.begin() ; it != flagList.end() ; ++it) {
|
||||
for (auto &flag : list.flags) {
|
||||
|
||||
switch ((*it)->type()) {
|
||||
switch (flag->type) {
|
||||
|
||||
case IMAPParser::flag::ANSWERED:
|
||||
|
||||
@ -705,16 +700,13 @@ void IMAPUtils::convertAddressList(
|
||||
mailboxList& dest
|
||||
) {
|
||||
|
||||
for (std::vector <IMAPParser::address*>::const_iterator
|
||||
it = src.addresses().begin() ; it != src.addresses().end() ; ++it) {
|
||||
|
||||
const IMAPParser::address& addr = **it;
|
||||
for (auto& addr : src.addresses) {
|
||||
|
||||
text name;
|
||||
text::decodeAndUnfold(addr.addr_name()->value(), &name);
|
||||
text::decodeAndUnfold(addr->addr_name->value, &name);
|
||||
|
||||
string email = addr.addr_mailbox()->value()
|
||||
+ "@" + addr.addr_host()->value();
|
||||
string email = addr->addr_mailbox->value
|
||||
+ "@" + addr->addr_host->value;
|
||||
|
||||
dest.appendMailbox(make_shared <mailbox>(name, email));
|
||||
}
|
||||
@ -817,18 +809,20 @@ const string IMAPUtils::messageSetToSequenceSet(const messageSet& msgs) {
|
||||
|
||||
|
||||
// static
|
||||
messageSet IMAPUtils::buildMessageSet(const IMAPParser::uid_set* uidSet) {
|
||||
messageSet IMAPUtils::buildMessageSet(const IMAPParser::uid_set& uidSetRef) {
|
||||
|
||||
messageSet set = messageSet::empty();
|
||||
|
||||
for ( ; uidSet ; uidSet = uidSet->next_uid_set()) {
|
||||
const IMAPParser::uid_set* uidSet = &uidSetRef;
|
||||
|
||||
if (uidSet->uid_range()) {
|
||||
for ( ; uidSet ; uidSet = uidSet->next_uid_set.get()) {
|
||||
|
||||
if (uidSet->uid_range) {
|
||||
|
||||
set.addRange(
|
||||
UIDMessageRange(
|
||||
message::uid(uidSet->uid_range()->uniqueid1()->value()),
|
||||
message::uid(uidSet->uid_range()->uniqueid2()->value())
|
||||
message::uid(uidSet->uid_range->uniqueid1->value),
|
||||
message::uid(uidSet->uid_range->uniqueid2->value)
|
||||
)
|
||||
);
|
||||
|
||||
@ -836,7 +830,7 @@ messageSet IMAPUtils::buildMessageSet(const IMAPParser::uid_set* uidSet) {
|
||||
|
||||
set.addRange(
|
||||
UIDMessageRange(
|
||||
message::uid(uidSet->uniqueid()->value())
|
||||
message::uid(uidSet->uniqueid->value)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -73,12 +73,13 @@ public:
|
||||
* @param list list of mailbox flags
|
||||
* @param attribs reference to an object holding folder attributes
|
||||
*/
|
||||
static void mailboxFlagsToFolderAttributes
|
||||
(const shared_ptr <const IMAPConnection>& cnt,
|
||||
const IMAPParser::mailbox_flag_list* list,
|
||||
folderAttributes& attribs);
|
||||
static void mailboxFlagsToFolderAttributes(
|
||||
const shared_ptr <const IMAPConnection>& cnt,
|
||||
const IMAPParser::mailbox_flag_list& list,
|
||||
folderAttributes& attribs
|
||||
);
|
||||
|
||||
static int messageFlagsFromFlags(const IMAPParser::flag_list* list);
|
||||
static int messageFlagsFromFlags(const IMAPParser::flag_list& list);
|
||||
|
||||
static const std::vector <string> messageFlagList(const int flags);
|
||||
|
||||
@ -97,8 +98,11 @@ public:
|
||||
* @param options fetch options
|
||||
* @return fetch request
|
||||
*/
|
||||
static shared_ptr <IMAPCommand> buildFetchCommand
|
||||
(const shared_ptr <IMAPConnection>& cnt, const messageSet& msgs, const fetchAttributes& options);
|
||||
static shared_ptr <IMAPCommand> buildFetchCommand(
|
||||
const shared_ptr <IMAPConnection>& cnt,
|
||||
const messageSet& msgs,
|
||||
const fetchAttributes& options
|
||||
);
|
||||
|
||||
/** Convert a parser-style address list to a mailbox list.
|
||||
*
|
||||
@ -119,7 +123,7 @@ public:
|
||||
* @param uidSet UID set, as returned by the parser
|
||||
* @return message set
|
||||
*/
|
||||
static messageSet buildMessageSet(const IMAPParser::uid_set* uidSet);
|
||||
static messageSet buildMessageSet(const IMAPParser::uid_set& uidSet);
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user