Fixed status update. Prevent opening the same folder two times in a session.
This commit is contained in:
parent
eae4b21d2a
commit
00585bc823
@ -466,6 +466,18 @@ exception* folder_not_found::clone() const { return new folder_not_found(*this);
|
|||||||
const char* folder_not_found::name() const throw() { return "folder_not_found"; }
|
const char* folder_not_found::name() const throw() { return "folder_not_found"; }
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// folder_already_open
|
||||||
|
//
|
||||||
|
|
||||||
|
folder_already_open::~folder_already_open() throw() {}
|
||||||
|
folder_already_open::folder_already_open(const exception& other)
|
||||||
|
: net_exception("Folder is already open in the same session.", other) {}
|
||||||
|
|
||||||
|
exception* folder_already_open::clone() const { return new folder_already_open(*this); }
|
||||||
|
const char* folder_already_open::name() const throw() { return "folder_already_open"; }
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// message_not_found
|
// message_not_found
|
||||||
//
|
//
|
||||||
|
@ -55,7 +55,7 @@ namespace imap {
|
|||||||
IMAPFolder::IMAPFolder(const folder::path& path, ref <IMAPStore> store, const int type, const int flags)
|
IMAPFolder::IMAPFolder(const folder::path& path, ref <IMAPStore> store, const int type, const int flags)
|
||||||
: m_store(store), m_connection(store->connection()), m_path(path),
|
: m_store(store), m_connection(store->connection()), m_path(path),
|
||||||
m_name(path.isEmpty() ? folder::path::component("") : path.getLastComponent()), m_mode(-1),
|
m_name(path.isEmpty() ? folder::path::component("") : path.getLastComponent()), m_mode(-1),
|
||||||
m_open(false), m_type(type), m_flags(flags), m_messageCount(0), m_uidValidity(0)
|
m_open(false), m_type(type), m_flags(flags)
|
||||||
{
|
{
|
||||||
store->registerFolder(this);
|
store->registerFolder(this);
|
||||||
|
|
||||||
@ -150,6 +150,14 @@ void IMAPFolder::open(const int mode, bool failIfModeIsNotAvailable)
|
|||||||
if (!store)
|
if (!store)
|
||||||
throw exceptions::illegal_state("Store disconnected");
|
throw exceptions::illegal_state("Store disconnected");
|
||||||
|
|
||||||
|
// Ensure this folder is not already open in the same session
|
||||||
|
for (std::list <IMAPFolder*>::iterator it = store->m_folders.begin() ;
|
||||||
|
it != store->m_folders.end() ; ++it)
|
||||||
|
{
|
||||||
|
if ((*it) != this && (*it)->getFullPath() == m_path)
|
||||||
|
throw exceptions::folder_already_open();
|
||||||
|
}
|
||||||
|
|
||||||
// Open a connection for this folder
|
// Open a connection for this folder
|
||||||
ref <IMAPConnection> connection =
|
ref <IMAPConnection> connection =
|
||||||
vmime::create <IMAPConnection>(store, store->getAuthenticator());
|
vmime::create <IMAPConnection>(store, store->getAuthenticator());
|
||||||
@ -218,11 +226,6 @@ void IMAPFolder::open(const int mode, bool failIfModeIsNotAvailable)
|
|||||||
{
|
{
|
||||||
switch (code->type())
|
switch (code->type())
|
||||||
{
|
{
|
||||||
case IMAPParser::resp_text_code::UIDVALIDITY:
|
|
||||||
|
|
||||||
m_uidValidity = static_cast <unsigned int>(code->nz_number()->value());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAPParser::resp_text_code::NOMODSEQ:
|
case IMAPParser::resp_text_code::NOMODSEQ:
|
||||||
|
|
||||||
connection->disableMODSEQ();
|
connection->disableMODSEQ();
|
||||||
@ -251,16 +254,6 @@ void IMAPFolder::open(const int mode, bool failIfModeIsNotAvailable)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IMAPParser::mailbox_data::EXISTS:
|
|
||||||
{
|
|
||||||
m_messageCount = responseData->mailbox_data()->number()->value();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IMAPParser::mailbox_data::RECENT:
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,7 +321,7 @@ void IMAPFolder::close(const bool expunge)
|
|||||||
m_open = false;
|
m_open = false;
|
||||||
m_mode = -1;
|
m_mode = -1;
|
||||||
|
|
||||||
m_uidValidity = 0;
|
m_status = vmime::create <IMAPFolderStatus>();
|
||||||
|
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
@ -527,7 +520,7 @@ ref <message> IMAPFolder::getMessage(const int num)
|
|||||||
if (!isOpen())
|
if (!isOpen())
|
||||||
throw exceptions::illegal_state("Folder not open");
|
throw exceptions::illegal_state("Folder not open");
|
||||||
|
|
||||||
if (num < 1 || num > m_messageCount)
|
if (num < 1 || num > getMessageCount())
|
||||||
throw exceptions::message_not_found();
|
throw exceptions::message_not_found();
|
||||||
|
|
||||||
return vmime::create <IMAPMessage>(thisRef().dynamicCast <IMAPFolder>(), num);
|
return vmime::create <IMAPMessage>(thisRef().dynamicCast <IMAPFolder>(), num);
|
||||||
@ -654,7 +647,7 @@ std::vector <ref <message> > IMAPFolder::getMessagesByUID(const std::vector <mes
|
|||||||
{
|
{
|
||||||
if ((*it)->type() == IMAPParser::msg_att_item::UID)
|
if ((*it)->type() == IMAPParser::msg_att_item::UID)
|
||||||
{
|
{
|
||||||
msgFullUID = IMAPUtils::makeGlobalUID(m_uidValidity, (*it)->unique_id()->value());
|
msgFullUID = IMAPUtils::makeGlobalUID(m_status->getUIDValidity(), (*it)->unique_id()->value());
|
||||||
msgUID = (*it)->unique_id()->value();
|
msgUID = (*it)->unique_id()->value();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -677,7 +670,7 @@ int IMAPFolder::getMessageCount()
|
|||||||
if (!isOpen())
|
if (!isOpen())
|
||||||
throw exceptions::illegal_state("Folder not open");
|
throw exceptions::illegal_state("Folder not open");
|
||||||
|
|
||||||
return (m_messageCount);
|
return m_status->getMessageCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1009,7 +1002,7 @@ void IMAPFolder::deleteMessages(const int from, const int to)
|
|||||||
|
|
||||||
command << "STORE " << from << ":";
|
command << "STORE " << from << ":";
|
||||||
|
|
||||||
if (to == -1) command << m_messageCount;
|
if (to == -1) command << getMessageCount();
|
||||||
else command << to;
|
else command << to;
|
||||||
|
|
||||||
command << " +FLAGS.SILENT (\\Deleted)";
|
command << " +FLAGS.SILENT (\\Deleted)";
|
||||||
@ -1028,7 +1021,7 @@ void IMAPFolder::deleteMessages(const int from, const int to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update local flags
|
// Update local flags
|
||||||
const int to2 = (to == -1) ? m_messageCount : to;
|
const int to2 = (to == -1) ? getMessageCount() : to;
|
||||||
const int count = to - from + 1;
|
const int count = to - from + 1;
|
||||||
|
|
||||||
for (std::vector <IMAPMessage*>::iterator it =
|
for (std::vector <IMAPMessage*>::iterator it =
|
||||||
@ -1085,7 +1078,7 @@ void IMAPFolder::deleteMessages(const std::vector <int>& nums)
|
|||||||
command.imbue(std::locale::classic());
|
command.imbue(std::locale::classic());
|
||||||
|
|
||||||
command << "STORE ";
|
command << "STORE ";
|
||||||
command << IMAPUtils::listToSet(list, m_messageCount, true);
|
command << IMAPUtils::listToSet(list, getMessageCount(), true);
|
||||||
command << " +FLAGS.SILENT (\\Deleted)";
|
command << " +FLAGS.SILENT (\\Deleted)";
|
||||||
|
|
||||||
// Send the request
|
// Send the request
|
||||||
@ -1148,7 +1141,7 @@ void IMAPFolder::setMessageFlags(const int from, const int to, const int flags,
|
|||||||
setMessageFlags(oss.str(), flags, mode);
|
setMessageFlags(oss.str(), flags, mode);
|
||||||
|
|
||||||
// Update local flags
|
// Update local flags
|
||||||
const int to2 = (to == -1) ? m_messageCount : to;
|
const int to2 = (to == -1) ? getMessageCount() : to;
|
||||||
const int count = to - from + 1;
|
const int count = to - from + 1;
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
@ -1234,7 +1227,7 @@ void IMAPFolder::setMessageFlags(const std::vector <int>& nums, const int flags,
|
|||||||
std::sort(list.begin(), list.end());
|
std::sort(list.begin(), list.end());
|
||||||
|
|
||||||
// Delegates call
|
// Delegates call
|
||||||
setMessageFlags(IMAPUtils::listToSet(list, m_messageCount, true), flags, mode);
|
setMessageFlags(IMAPUtils::listToSet(list, getMessageCount(), true), flags, mode);
|
||||||
|
|
||||||
// Update local flags
|
// Update local flags
|
||||||
switch (mode)
|
switch (mode)
|
||||||
@ -1449,32 +1442,6 @@ void IMAPFolder::addMessage(utility::inputStream& is, const int size, const int
|
|||||||
m_connection->getParser()->lastLine(), "bad response");
|
m_connection->getParser()->lastLine(), "bad response");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify message added
|
|
||||||
std::vector <int> nums;
|
|
||||||
nums.push_back(m_messageCount + 1);
|
|
||||||
|
|
||||||
events::messageCountEvent event
|
|
||||||
(thisRef().dynamicCast <folder>(),
|
|
||||||
events::messageCountEvent::TYPE_ADDED, nums);
|
|
||||||
|
|
||||||
m_messageCount++;
|
|
||||||
notifyMessageCount(event);
|
|
||||||
|
|
||||||
// Notify folders with the same path
|
|
||||||
for (std::list <IMAPFolder*>::iterator it = store->m_folders.begin() ;
|
|
||||||
it != store->m_folders.end() ; ++it)
|
|
||||||
{
|
|
||||||
if ((*it) != this && (*it)->getFullPath() == m_path)
|
|
||||||
{
|
|
||||||
events::messageCountEvent event
|
|
||||||
((*it)->thisRef().dynamicCast <folder>(),
|
|
||||||
events::messageCountEvent::TYPE_ADDED, nums);
|
|
||||||
|
|
||||||
(*it)->m_messageCount++;
|
|
||||||
(*it)->notifyMessageCount(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processStatusUpdate(resp);
|
processStatusUpdate(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1542,31 +1509,6 @@ void IMAPFolder::expunge()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_messageCount -= nums.size();
|
|
||||||
|
|
||||||
// Notify message expunged
|
|
||||||
events::messageCountEvent event
|
|
||||||
(thisRef().dynamicCast <folder>(),
|
|
||||||
events::messageCountEvent::TYPE_REMOVED, nums);
|
|
||||||
|
|
||||||
notifyMessageCount(event);
|
|
||||||
|
|
||||||
// Notify folders with the same path
|
|
||||||
for (std::list <IMAPFolder*>::iterator it = store->m_folders.begin() ;
|
|
||||||
it != store->m_folders.end() ; ++it)
|
|
||||||
{
|
|
||||||
if ((*it) != this && (*it)->getFullPath() == m_path)
|
|
||||||
{
|
|
||||||
(*it)->m_messageCount = m_messageCount;
|
|
||||||
|
|
||||||
events::messageCountEvent event
|
|
||||||
((*it)->thisRef().dynamicCast <folder>(),
|
|
||||||
events::messageCountEvent::TYPE_REMOVED, nums);
|
|
||||||
|
|
||||||
(*it)->notifyMessageCount(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processStatusUpdate(resp);
|
processStatusUpdate(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1619,22 +1561,11 @@ void IMAPFolder::rename(const folder::path& newPath)
|
|||||||
|
|
||||||
notifyFolder(event);
|
notifyFolder(event);
|
||||||
|
|
||||||
// Notify folders with the same path and sub-folders
|
// Notify sub-folders
|
||||||
for (std::list <IMAPFolder*>::iterator it = store->m_folders.begin() ;
|
for (std::list <IMAPFolder*>::iterator it = store->m_folders.begin() ;
|
||||||
it != store->m_folders.end() ; ++it)
|
it != store->m_folders.end() ; ++it)
|
||||||
{
|
{
|
||||||
if ((*it) != this && (*it)->getFullPath() == oldPath)
|
if ((*it) != this && oldPath.isParentOf((*it)->getFullPath()))
|
||||||
{
|
|
||||||
(*it)->m_path = newPath;
|
|
||||||
(*it)->m_name = newPath.getLastComponent();
|
|
||||||
|
|
||||||
events::folderEvent event
|
|
||||||
((*it)->thisRef().dynamicCast <folder>(),
|
|
||||||
events::folderEvent::TYPE_RENAMED, oldPath, newPath);
|
|
||||||
|
|
||||||
(*it)->notifyFolder(event);
|
|
||||||
}
|
|
||||||
else if ((*it) != this && oldPath.isParentOf((*it)->getFullPath()))
|
|
||||||
{
|
{
|
||||||
folder::path oldPath((*it)->m_path);
|
folder::path oldPath((*it)->m_path);
|
||||||
|
|
||||||
@ -1669,24 +1600,6 @@ void IMAPFolder::copyMessage(const folder::path& dest, const int num)
|
|||||||
|
|
||||||
// Delegate message copy
|
// Delegate message copy
|
||||||
copyMessages(set.str(), dest);
|
copyMessages(set.str(), dest);
|
||||||
|
|
||||||
// Notify message count changed
|
|
||||||
std::vector <int> nums;
|
|
||||||
nums.push_back(num);
|
|
||||||
|
|
||||||
for (std::list <IMAPFolder*>::iterator it = store->m_folders.begin() ;
|
|
||||||
it != store->m_folders.end() ; ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->getFullPath() == dest)
|
|
||||||
{
|
|
||||||
events::messageCountEvent event
|
|
||||||
((*it)->thisRef().dynamicCast <folder>(),
|
|
||||||
events::messageCountEvent::TYPE_ADDED, nums);
|
|
||||||
|
|
||||||
(*it)->m_messageCount++;
|
|
||||||
(*it)->notifyMessageCount(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1712,30 +1625,6 @@ void IMAPFolder::copyMessages(const folder::path& dest, const int from, const in
|
|||||||
|
|
||||||
// Delegate message copy
|
// Delegate message copy
|
||||||
copyMessages(set.str(), dest);
|
copyMessages(set.str(), dest);
|
||||||
|
|
||||||
// Notify message count changed
|
|
||||||
const int to2 = (to == -1) ? m_messageCount : to;
|
|
||||||
const int count = to - from + 1;
|
|
||||||
|
|
||||||
std::vector <int> nums;
|
|
||||||
nums.resize(count);
|
|
||||||
|
|
||||||
for (int i = from, j = 0 ; i <= to2 ; ++i, ++j)
|
|
||||||
nums[j] = i;
|
|
||||||
|
|
||||||
for (std::list <IMAPFolder*>::iterator it = store->m_folders.begin() ;
|
|
||||||
it != store->m_folders.end() ; ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->getFullPath() == dest)
|
|
||||||
{
|
|
||||||
events::messageCountEvent event
|
|
||||||
((*it)->thisRef().dynamicCast <folder>(),
|
|
||||||
events::messageCountEvent::TYPE_ADDED, nums);
|
|
||||||
|
|
||||||
(*it)->m_messageCount += count;
|
|
||||||
(*it)->notifyMessageCount(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1749,24 +1638,7 @@ void IMAPFolder::copyMessages(const folder::path& dest, const std::vector <int>&
|
|||||||
throw exceptions::illegal_state("Folder not open");
|
throw exceptions::illegal_state("Folder not open");
|
||||||
|
|
||||||
// Delegate message copy
|
// Delegate message copy
|
||||||
copyMessages(IMAPUtils::listToSet(nums, m_messageCount), dest);
|
copyMessages(IMAPUtils::listToSet(nums, getMessageCount()), dest);
|
||||||
|
|
||||||
// Notify message count changed
|
|
||||||
const int count = nums.size();
|
|
||||||
|
|
||||||
for (std::list <IMAPFolder*>::iterator it = store->m_folders.begin() ;
|
|
||||||
it != store->m_folders.end() ; ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->getFullPath() == dest)
|
|
||||||
{
|
|
||||||
events::messageCountEvent event
|
|
||||||
((*it)->thisRef().dynamicCast <folder>(),
|
|
||||||
events::messageCountEvent::TYPE_ADDED, nums);
|
|
||||||
|
|
||||||
(*it)->m_messageCount += count;
|
|
||||||
(*it)->notifyMessageCount(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1861,8 +1733,7 @@ ref <folderStatus> IMAPFolder::getStatus()
|
|||||||
ref <IMAPFolderStatus> status = vmime::create <IMAPFolderStatus>();
|
ref <IMAPFolderStatus> status = vmime::create <IMAPFolderStatus>();
|
||||||
status->updateFromResponse(responseData->mailbox_data());
|
status->updateFromResponse(responseData->mailbox_data());
|
||||||
|
|
||||||
m_messageCount = status->getMessageCount();
|
m_status->updateFromResponse(responseData->mailbox_data());
|
||||||
m_uidValidity = status->getUIDValidity();
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -1978,10 +1849,13 @@ void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp)
|
|||||||
|
|
||||||
m_status->updateFromResponse(code);
|
m_status->updateFromResponse(code);
|
||||||
}
|
}
|
||||||
|
else if ((*it)->response_data() && (*it)->response_data()->mailbox_data())
|
||||||
|
{
|
||||||
|
m_status->updateFromResponse((*it)->response_data()->mailbox_data());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_messageCount = m_status->getMessageCount();
|
// TODO: notification
|
||||||
m_uidValidity = m_status->getUIDValidity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // imap
|
} // imap
|
||||||
|
@ -35,6 +35,17 @@ namespace net {
|
|||||||
namespace imap {
|
namespace imap {
|
||||||
|
|
||||||
|
|
||||||
|
IMAPFolderStatus::IMAPFolderStatus()
|
||||||
|
: m_count(0),
|
||||||
|
m_unseen(0),
|
||||||
|
m_recent(0),
|
||||||
|
m_uidValidity(0),
|
||||||
|
m_uidNext(0),
|
||||||
|
m_highestModSeq(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int IMAPFolderStatus::getMessageCount() const
|
unsigned int IMAPFolderStatus::getMessageCount() const
|
||||||
{
|
{
|
||||||
return m_count;
|
return m_count;
|
||||||
@ -73,44 +84,55 @@ vmime_uint64 IMAPFolderStatus::getHighestModSeq() const
|
|||||||
|
|
||||||
void IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
void IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
|
||||||
{
|
{
|
||||||
const IMAPParser::status_att_list* statusAttList = resp->status_att_list();
|
if (resp->type() == IMAPParser::mailbox_data::STATUS)
|
||||||
|
|
||||||
for (std::vector <IMAPParser::status_att_val*>::const_iterator
|
|
||||||
jt = statusAttList->values().begin() ; jt != statusAttList->values().end() ; ++jt)
|
|
||||||
{
|
{
|
||||||
switch ((*jt)->type())
|
const IMAPParser::status_att_list* statusAttList = resp->status_att_list();
|
||||||
|
|
||||||
|
for (std::vector <IMAPParser::status_att_val*>::const_iterator
|
||||||
|
jt = statusAttList->values().begin() ; jt != statusAttList->values().end() ; ++jt)
|
||||||
{
|
{
|
||||||
case IMAPParser::status_att_val::MESSAGES:
|
switch ((*jt)->type())
|
||||||
|
{
|
||||||
|
case IMAPParser::status_att_val::MESSAGES:
|
||||||
|
|
||||||
m_count = (*jt)->value_as_number()->value();
|
m_count = (*jt)->value_as_number()->value();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IMAPParser::status_att_val::UNSEEN:
|
case IMAPParser::status_att_val::UNSEEN:
|
||||||
|
|
||||||
m_unseen = (*jt)->value_as_number()->value();
|
m_unseen = (*jt)->value_as_number()->value();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IMAPParser::status_att_val::RECENT:
|
case IMAPParser::status_att_val::RECENT:
|
||||||
|
|
||||||
m_recent = (*jt)->value_as_number()->value();
|
m_recent = (*jt)->value_as_number()->value();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IMAPParser::status_att_val::UIDNEXT:
|
case IMAPParser::status_att_val::UIDNEXT:
|
||||||
|
|
||||||
m_uidNext = (*jt)->value_as_number()->value();
|
m_uidNext = (*jt)->value_as_number()->value();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IMAPParser::status_att_val::UIDVALIDITY:
|
case IMAPParser::status_att_val::UIDVALIDITY:
|
||||||
|
|
||||||
m_uidValidity = (*jt)->value_as_number()->value();
|
m_uidValidity = (*jt)->value_as_number()->value();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IMAPParser::status_att_val::HIGHESTMODSEQ:
|
case IMAPParser::status_att_val::HIGHESTMODSEQ:
|
||||||
|
|
||||||
m_highestModSeq = (*jt)->value_as_mod_sequence_value()->value();
|
m_highestModSeq = (*jt)->value_as_mod_sequence_value()->value();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (resp->type() == IMAPParser::mailbox_data::EXISTS)
|
||||||
|
{
|
||||||
|
m_count = resp->number()->value();
|
||||||
|
}
|
||||||
|
else if (resp->type() == IMAPParser::mailbox_data::RECENT)
|
||||||
|
{
|
||||||
|
m_recent = resp->number()->value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "vmime/net/imap/IMAPParser.hpp"
|
#include "vmime/net/imap/IMAPParser.hpp"
|
||||||
#include "vmime/net/imap/IMAPMessage.hpp"
|
#include "vmime/net/imap/IMAPMessage.hpp"
|
||||||
#include "vmime/net/imap/IMAPFolder.hpp"
|
#include "vmime/net/imap/IMAPFolder.hpp"
|
||||||
|
#include "vmime/net/imap/IMAPFolderStatus.hpp"
|
||||||
#include "vmime/net/imap/IMAPStore.hpp"
|
#include "vmime/net/imap/IMAPStore.hpp"
|
||||||
#include "vmime/net/imap/IMAPConnection.hpp"
|
#include "vmime/net/imap/IMAPConnection.hpp"
|
||||||
#include "vmime/net/imap/IMAPUtils.hpp"
|
#include "vmime/net/imap/IMAPUtils.hpp"
|
||||||
@ -386,7 +387,7 @@ void IMAPMessage::processFetchResponse
|
|||||||
}
|
}
|
||||||
case IMAPParser::msg_att_item::UID:
|
case IMAPParser::msg_att_item::UID:
|
||||||
{
|
{
|
||||||
m_uid = IMAPUtils::makeGlobalUID(folder->m_uidValidity, (*it)->unique_id()->value());
|
m_uid = IMAPUtils::makeGlobalUID(folder->m_status->getUIDValidity(), (*it)->unique_id()->value());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IMAPParser::msg_att_item::MODSEQ:
|
case IMAPParser::msg_att_item::MODSEQ:
|
||||||
|
@ -538,6 +538,21 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** Folder is already open in the same session.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class VMIME_EXPORT folder_already_open : public net_exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
folder_already_open(const exception& other = NO_EXCEPTION);
|
||||||
|
~folder_already_open() throw();
|
||||||
|
|
||||||
|
exception* clone() const;
|
||||||
|
const char* name() const throw();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Message not found (does not exist).
|
/** Message not found (does not exist).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -140,6 +140,8 @@ public:
|
|||||||
* If set to true and if the requested mode is not available, the opening
|
* If set to true and if the requested mode is not available, the opening
|
||||||
* will fail.
|
* will fail.
|
||||||
* @throw net_exception if an error occurs
|
* @throw net_exception if an error occurs
|
||||||
|
* @throw exceptions::folder_already_open if the folder is already open
|
||||||
|
* in the same session
|
||||||
*/
|
*/
|
||||||
virtual void open(const int mode, bool failIfModeIsNotAvailable = false) = 0;
|
virtual void open(const int mode, bool failIfModeIsNotAvailable = false) = 0;
|
||||||
|
|
||||||
|
@ -178,8 +178,6 @@ private:
|
|||||||
int m_type;
|
int m_type;
|
||||||
int m_flags;
|
int m_flags;
|
||||||
|
|
||||||
int m_messageCount;
|
|
||||||
vmime_uint32 m_uidValidity;
|
|
||||||
ref <IMAPFolderStatus> m_status;
|
ref <IMAPFolderStatus> m_status;
|
||||||
|
|
||||||
std::vector <IMAPMessage*> m_messages;
|
std::vector <IMAPMessage*> m_messages;
|
||||||
|
@ -48,6 +48,8 @@ class VMIME_EXPORT IMAPFolderStatus : public folderStatus
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
IMAPFolderStatus();
|
||||||
|
|
||||||
// Inherited from folderStatus
|
// Inherited from folderStatus
|
||||||
unsigned int getMessageCount() const;
|
unsigned int getMessageCount() const;
|
||||||
unsigned int getUnseenCount() const;
|
unsigned int getUnseenCount() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user