Skip to content

Commit

Permalink
#268 Code style fixes + moved specific bits to IMAP namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-richard committed Nov 25, 2021
1 parent c6e3b75 commit 80ad529
Show file tree
Hide file tree
Showing 16 changed files with 787 additions and 684 deletions.
8 changes: 0 additions & 8 deletions src/vmime/dateTime.cpp
Expand Up @@ -775,14 +775,6 @@ void datetime::getDate(int& year, int& month, int& day) const {
}


string datetime::getDate() const {

std::ostringstream date;
date << m_day << "-" << monthNames[m_month - 1] << "-" << m_year;
return date.str();
}


void datetime::setTime(
const int hour,
const int minute,
Expand Down
2 changes: 0 additions & 2 deletions src/vmime/dateTime.hpp
Expand Up @@ -216,8 +216,6 @@ class VMIME_EXPORT datetime : public headerFieldValue {
void getTime(int& hour, int& minute, int& second) const;
void getDate(int& year, int& month, int& day) const;

string getDate() const;

// Set
void setYear(const int year);
void setMonth(const int month);
Expand Down
31 changes: 0 additions & 31 deletions src/vmime/net/folder.hpp
Expand Up @@ -43,7 +43,6 @@
#include "vmime/net/folderStatus.hpp"
#include "vmime/net/fetchAttributes.hpp"
#include "vmime/net/folderAttributes.hpp"
#include "vmime/net/searchAttributes.hpp"

#include "vmime/utility/path.hpp"
#include "vmime/utility/stream.hpp"
Expand Down Expand Up @@ -407,36 +406,6 @@ class VMIME_EXPORT folder : public object, public enable_shared_from_this <folde
*/
virtual std::vector <size_t> getMessageNumbersStartingOnUID(const message::uid& uid) = 0;

/** Return the sequence numbers of messages matching the searchAttributes.
*
* @param sa the searchAttributes containing search tokens to match messages to
* @param charset optional charset name, the string tokens are assumed to be encoded
* in the provided encoding OR need to be in US-ASCII if no charset is provided
* @throw exceptions::net_exception if an error occurs
*
* Quirks: some servers will not accept any encoding other than US-ASCII,
* other servers will accept UTF-8 but will fail utf-8
*/
virtual std::vector <size_t> getMessageNumbersMatchingSearchAttributes(
const searchAttributes& sa,
const vmime::charset* charset = nullptr
) = 0;

/** Return the UIDs of messages matching the searchAttributes.
*
* @param sa the searchAttributes containing search tokens to match messages to
* @param charset optional charset name, the string tokens are assumed to be encoded
* in the provided encoding OR need to be in US-ASCII if no charset is provided
* @throw exceptions::net_exception if an error occurs
*
* Quirks: some servers will not accept any encoding other than US-ASCII,
* other servers will accept UTF-8 but will fail utf-8
*/
virtual std::vector <message::uid> getMessageUIDsMatchingSearchAttributes(
const searchAttributes& sa,
const vmime::charset* charset = nullptr
) = 0;

// Event listeners
void addMessageChangedListener(events::messageChangedListener* l);
void removeMessageChangedListener(events::messageChangedListener* l);
Expand Down
2 changes: 1 addition & 1 deletion src/vmime/net/imap/IMAPCommand.hpp
Expand Up @@ -66,7 +66,7 @@ class VMIME_EXPORT IMAPCommand : public object, public enable_shared_from_this <
static shared_ptr <IMAPCommand> APPEND(const string& mailboxName, const std::vector <string>& flags, vmime::datetime* date, const size_t size);
static shared_ptr <IMAPCommand> COPY(const messageSet& msgs, const string& mailboxName);
static shared_ptr <IMAPCommand> SEARCH(const std::vector <string>& keys, const vmime::charset* charset);
static shared_ptr <IMAPCommand> UIDSEARCH(const std::vector <string>& keys, const vmime::charset* charset);
static shared_ptr <IMAPCommand> UIDSEARCH(const std::vector <string>& keys, const vmime::charset* charset);
static shared_ptr <IMAPCommand> STARTTLS();
static shared_ptr <IMAPCommand> CAPABILITY();
static shared_ptr <IMAPCommand> NOOP();
Expand Down
9 changes: 6 additions & 3 deletions src/vmime/net/imap/IMAPFolder.cpp
Expand Up @@ -1501,8 +1501,9 @@ std::vector <size_t> IMAPFolder::getMessageNumbersStartingOnUID(const message::u
return seqNumbers;
}


std::vector <size_t> IMAPFolder::getMessageNumbersMatchingSearchAttributes(
const searchAttributes& sa,
const IMAPSearchAttributes& sa,
const vmime::charset* charset
) {

Expand Down Expand Up @@ -1548,8 +1549,9 @@ std::vector <size_t> IMAPFolder::getMessageNumbersMatchingSearchAttributes(
return seqNumbers;
}


std::vector <message::uid> IMAPFolder::getMessageUIDsMatchingSearchAttributes(
const searchAttributes& sa,
const IMAPSearchAttributes& sa,
const vmime::charset* charset
) {

Expand Down Expand Up @@ -1593,7 +1595,8 @@ std::vector <message::uid> IMAPFolder::getMessageUIDsMatchingSearchAttributes(
processStatusUpdate(resp.get());

return uidNumbers;
}
}


void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp) {

Expand Down
31 changes: 26 additions & 5 deletions src/vmime/net/imap/IMAPFolder.hpp
Expand Up @@ -39,6 +39,7 @@
#include "vmime/net/folder.hpp"

#include "vmime/net/imap/IMAPParser.hpp"
#include "vmime/net/imap/IMAPSearchAttributes.hpp"


namespace vmime {
Expand Down Expand Up @@ -94,16 +95,36 @@ class VMIME_EXPORT IMAPFolder : public folder {
std::vector <shared_ptr <message> > getMessages(const messageSet& msgs);

std::vector <size_t> getMessageNumbersStartingOnUID(const message::uid& uid);


/** Return the sequence numbers of messages matching the searchAttributes.
*
* @param sa the searchAttributes containing search tokens to match messages to
* @param charset optional charset name, the string tokens are assumed to be encoded
* in the provided encoding OR need to be in US-ASCII if no charset is provided
* @throw exceptions::net_exception if an error occurs
*
* Quirks: some servers will not accept any encoding other than US-ASCII,
* other servers will accept UTF-8 but will fail utf-8
*/
std::vector <size_t> getMessageNumbersMatchingSearchAttributes(
const searchAttributes& sa,
const IMAPSearchAttributes& sa,
const vmime::charset* charset = nullptr
) override;
);

/** Return the UIDs of messages matching the searchAttributes.
*
* @param sa the searchAttributes containing search tokens to match messages to
* @param charset optional charset name, the string tokens are assumed to be encoded
* in the provided encoding OR need to be in US-ASCII if no charset is provided
* @throw exceptions::net_exception if an error occurs
*
* Quirks: some servers will not accept any encoding other than US-ASCII,
* other servers will accept UTF-8 but will fail utf-8
*/
std::vector <message::uid> getMessageUIDsMatchingSearchAttributes(
const searchAttributes& sa,
const IMAPSearchAttributes& sa,
const vmime::charset* charset = nullptr
) override;
);

size_t getMessageCount();

Expand Down

0 comments on commit 80ad529

Please sign in to comment.