diff options
-rw-r--r-- | src/misc/importanceHelper.cpp | 18 | ||||
-rw-r--r-- | vmime/misc/importanceHelper.hpp | 21 |
2 files changed, 36 insertions, 3 deletions
diff --git a/src/misc/importanceHelper.cpp b/src/misc/importanceHelper.cpp index 0fc9e16a..96f80183 100644 --- a/src/misc/importanceHelper.cpp +++ b/src/misc/importanceHelper.cpp @@ -27,8 +27,12 @@ namespace misc { void importanceHelper::resetImportance(ref <message> msg) { - ref <header> hdr = msg->getHeader(); + resetImportance(msg->getHeader()); +} + +void importanceHelper::resetImportance(ref <header> hdr) +{ try { ref <headerField> fld = hdr->findField("X-Priority"); @@ -53,8 +57,12 @@ void importanceHelper::resetImportance(ref <message> msg) const importanceHelper::Importance importanceHelper::getImportance(const ref <const message> msg) { - const ref <const header> hdr = msg->getHeader(); + return getImportance(msg->getHeader()); +} + +const importanceHelper::Importance importanceHelper::getImportance(const ref <const header> hdr) +{ try { const ref <const defaultField> fld = hdr->findField("X-Priority").dynamicCast <const defaultField>(); @@ -98,8 +106,12 @@ const importanceHelper::Importance importanceHelper::getImportance(const ref <co void importanceHelper::setImportance(ref <message> msg, const Importance i) { - ref <header> hdr = msg->getHeader(); + setImportance(msg->getHeader(), i); +} + +void importanceHelper::setImportance(ref <header> hdr, const Importance i) +{ // "X-Priority:" Field ref <defaultField> fld = hdr->getField("X-Priority").dynamicCast <defaultField>(); diff --git a/vmime/misc/importanceHelper.hpp b/vmime/misc/importanceHelper.hpp index b9118659..1f2b4553 100644 --- a/vmime/misc/importanceHelper.hpp +++ b/vmime/misc/importanceHelper.hpp @@ -56,6 +56,12 @@ public: */ static void resetImportance(ref <message> msg); + /** Reset the importance of the message to the default importance. + * + * @param hdr message header on which to reset importance + */ + static void resetImportance(ref <header> hdr); + /** Return the importance of the specified message. * * @param msg message from which to retrieve importance @@ -64,12 +70,27 @@ public: */ static const Importance getImportance(const ref <const message> msg); + /** Return the importance of the specified message. + * + * @param hdr message header from which to retrieve importance + * @return importance of the message, or default importance is no + * information about importance is given in the message + */ + static const Importance getImportance(const ref <const header> hdr); + /** Set the importance of the specified message. * * @param msg message on which to set importance * @param i new message importance */ static void setImportance(ref <message> msg, const Importance i); + + /** Set the importance of the specified message. + * + * @param hdr message header on which to set importance + * @param i new message importance + */ + static void setImportance(ref <header> hdr, const Importance i); }; |