aboutsummaryrefslogtreecommitdiffstats
path: root/vmime
diff options
context:
space:
mode:
Diffstat (limited to 'vmime')
-rw-r--r--vmime/net/events.hpp56
-rw-r--r--vmime/net/folder.hpp7
-rw-r--r--vmime/net/folderStatus.hpp6
-rw-r--r--vmime/net/imap/IMAPFolder.hpp9
-rw-r--r--vmime/net/imap/IMAPFolderStatus.hpp9
-rw-r--r--vmime/net/imap/IMAPMessage.hpp20
-rw-r--r--vmime/net/maildir/maildirFolderStatus.hpp6
-rw-r--r--vmime/net/message.hpp4
-rw-r--r--vmime/net/pop3/POP3FolderStatus.hpp6
9 files changed, 103 insertions, 20 deletions
diff --git a/vmime/net/events.hpp b/vmime/net/events.hpp
index d42f3c1c..1e5fd7f3 100644
--- a/vmime/net/events.hpp
+++ b/vmime/net/events.hpp
@@ -44,13 +44,30 @@ class folder;
namespace events {
+/** Event occurring on folders or messages.
+ */
+
+class VMIME_EXPORT event : public object
+{
+public:
+
+ event();
+ virtual ~event();
+
+ virtual const char* getClass() const = 0;
+};
+
+
/** Event about the message count in a folder.
*/
-class VMIME_EXPORT messageCountEvent
+class VMIME_EXPORT messageCountEvent : public event
{
public:
+ static const char* EVENT_CLASS;
+
+
enum Types
{
TYPE_ADDED, /**< New messages have been added. */
@@ -82,7 +99,10 @@ public:
*
* @param listener listener to notify
*/
- void dispatch(class messageCountListener* listener) const;
+ void dispatch(class messageCountListener* listener);
+
+
+ const char* getClass() const;
private:
@@ -103,18 +123,21 @@ protected:
public:
- virtual void messagesAdded(const messageCountEvent& event) = 0;
- virtual void messagesRemoved(const messageCountEvent& event) = 0;
+ virtual void messagesAdded(ref <messageCountEvent> event) = 0;
+ virtual void messagesRemoved(ref <messageCountEvent> event) = 0;
};
/** Event occuring on a message.
*/
-class VMIME_EXPORT messageChangedEvent
+class VMIME_EXPORT messageChangedEvent : public event
{
public:
+ static const char* EVENT_CLASS;
+
+
enum Types
{
TYPE_FLAGS // flags changed
@@ -145,7 +168,10 @@ public:
*
* @param listener listener to notify
*/
- void dispatch(class messageChangedListener* listener) const;
+ void dispatch(class messageChangedListener* listener);
+
+
+ const char* getClass() const;
private:
@@ -166,17 +192,20 @@ protected:
public:
- virtual void messageChanged(const messageChangedEvent& event) = 0;
+ virtual void messageChanged(ref <messageChangedEvent> event) = 0;
};
/** Event occuring on a folder.
*/
-class VMIME_EXPORT folderEvent
+class VMIME_EXPORT folderEvent : public event
{
public:
+ static const char* EVENT_CLASS;
+
+
enum Types
{
TYPE_CREATED, /**< A folder was created. */
@@ -203,7 +232,10 @@ public:
*
* @param listener listener to notify
*/
- void dispatch(class folderListener* listener) const;
+ void dispatch(class folderListener* listener);
+
+
+ const char* getClass() const;
private:
@@ -225,9 +257,9 @@ protected:
public:
- virtual void folderCreated(const folderEvent& event) = 0;
- virtual void folderRenamed(const folderEvent& event) = 0;
- virtual void folderDeleted(const folderEvent& event) = 0;
+ virtual void folderCreated(ref <folderEvent> event) = 0;
+ virtual void folderRenamed(ref <folderEvent> event) = 0;
+ virtual void folderDeleted(ref <folderEvent> event) = 0;
};
diff --git a/vmime/net/folder.hpp b/vmime/net/folder.hpp
index 6c0a3a3a..4cb6bb1a 100644
--- a/vmime/net/folder.hpp
+++ b/vmime/net/folder.hpp
@@ -437,9 +437,10 @@ public:
protected:
- void notifyMessageChanged(const events::messageChangedEvent& event);
- void notifyMessageCount(const events::messageCountEvent& event);
- void notifyFolder(const events::folderEvent& event);
+ void notifyMessageChanged(ref <events::messageChangedEvent> event);
+ void notifyMessageCount(ref <events::messageCountEvent> event);
+ void notifyFolder(ref <events::folderEvent> event);
+ void notifyEvent(ref <events::event> event);
private:
diff --git a/vmime/net/folderStatus.hpp b/vmime/net/folderStatus.hpp
index 90beea66..f4cc62fc 100644
--- a/vmime/net/folderStatus.hpp
+++ b/vmime/net/folderStatus.hpp
@@ -56,6 +56,12 @@ public:
* @return number of unseen messages
*/
virtual unsigned int getUnseenCount() const = 0;
+
+ /** Clones this object.
+ *
+ * @return a copy of this object
+ */
+ virtual ref <folderStatus> clone() const = 0;
};
diff --git a/vmime/net/imap/IMAPFolder.hpp b/vmime/net/imap/IMAPFolder.hpp
index 88a52523..d7ad19ee 100644
--- a/vmime/net/imap/IMAPFolder.hpp
+++ b/vmime/net/imap/IMAPFolder.hpp
@@ -138,6 +138,15 @@ public:
int getFetchCapabilities() const;
+ /** Returns the highest modification sequence of this folder, ie the
+ * modification sequence of the last message that changed in this
+ * folder.
+ *
+ * @return modification sequence, or zero if not supported by
+ * the underlying protocol
+ */
+ vmime_uint64 getHighestModSequence() const;
+
private:
void registerMessage(IMAPMessage* msg);
diff --git a/vmime/net/imap/IMAPFolderStatus.hpp b/vmime/net/imap/IMAPFolderStatus.hpp
index 77373f1a..bcd6415e 100644
--- a/vmime/net/imap/IMAPFolderStatus.hpp
+++ b/vmime/net/imap/IMAPFolderStatus.hpp
@@ -49,11 +49,14 @@ class VMIME_EXPORT IMAPFolderStatus : public folderStatus
public:
IMAPFolderStatus();
+ IMAPFolderStatus(const IMAPFolderStatus& other);
// Inherited from folderStatus
unsigned int getMessageCount() const;
unsigned int getUnseenCount() const;
+ ref <folderStatus> clone() const;
+
/** Returns the the number of messages with the Recent flag set.
*
* @return number of messages flagged Recent
@@ -89,14 +92,16 @@ public:
/** Reads the folder status from the specified IMAP response.
*
* @param resp parsed IMAP response
+ * @return true if the status changed, or false otherwise
*/
- void 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
*/
- void updateFromResponse(const IMAPParser::resp_text_code* resp);
+ bool updateFromResponse(const IMAPParser::resp_text_code* resp);
private:
diff --git a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp
index fdda139a..59f9fc83 100644
--- a/vmime/net/imap/IMAPMessage.hpp
+++ b/vmime/net/imap/IMAPMessage.hpp
@@ -101,7 +101,25 @@ public:
private:
- void processFetchResponse(const int options, const IMAPParser::message_data* msgData);
+ /** Renumbers the message.
+ *
+ * @param number new sequence number
+ */
+ void renumber(const int number);
+
+ /** Marks the message as expunged.
+ */
+ void setExpunged();
+
+ /** Processes the parsed response to fill in the attributes
+ * and metadata of this message.
+ *
+ * @param options one or more fetch options (see folder::FetchOptions)
+ * @param msgData pointer to message_data component of the parsed response
+ * @return a combination of flags that specify what changed exactly on
+ * this message (see events::messageChangedEvent::Types)
+ */
+ int processFetchResponse(const int options, const IMAPParser::message_data* msgData);
/** Recursively fetch part header for all parts in the structure.
*
diff --git a/vmime/net/maildir/maildirFolderStatus.hpp b/vmime/net/maildir/maildirFolderStatus.hpp
index 80018b14..28e01f11 100644
--- a/vmime/net/maildir/maildirFolderStatus.hpp
+++ b/vmime/net/maildir/maildirFolderStatus.hpp
@@ -46,10 +46,16 @@ class VMIME_EXPORT maildirFolderStatus : public folderStatus
{
public:
+ maildirFolderStatus();
+ maildirFolderStatus(const maildirFolderStatus& other);
+
// Inherited from folderStatus
unsigned int getMessageCount() const;
unsigned int getUnseenCount() const;
+ ref <folderStatus> clone() const;
+
+
void setMessageCount(const unsigned int count);
void setUnseenCount(const unsigned int unseen);
diff --git a/vmime/net/message.hpp b/vmime/net/message.hpp
index a0f79aae..76bfb16b 100644
--- a/vmime/net/message.hpp
+++ b/vmime/net/message.hpp
@@ -217,8 +217,8 @@ public:
*/
virtual int getSize() const = 0;
- /** Check whether this message has been expunged
- * (ie: definitively deleted).
+ /** Check whether this message has been expunged (ie: definitively
+ * deleted) and does not exist in the folder anymore.
*
* @return true if the message is expunged, false otherwise
*/
diff --git a/vmime/net/pop3/POP3FolderStatus.hpp b/vmime/net/pop3/POP3FolderStatus.hpp
index 3e5d15a1..d074ff47 100644
--- a/vmime/net/pop3/POP3FolderStatus.hpp
+++ b/vmime/net/pop3/POP3FolderStatus.hpp
@@ -46,10 +46,16 @@ class VMIME_EXPORT POP3FolderStatus : public folderStatus
{
public:
+ POP3FolderStatus();
+ POP3FolderStatus(const POP3FolderStatus& other);
+
// Inherited from folderStatus
unsigned int getMessageCount() const;
unsigned int getUnseenCount() const;
+ ref <folderStatus> clone() const;
+
+
void setMessageCount(const unsigned int count);
void setUnseenCount(const unsigned int unseen);