diff options
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/importanceHelper.cpp | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/misc/importanceHelper.cpp b/src/misc/importanceHelper.cpp index 8066cc5f..b13f7466 100644 --- a/src/misc/importanceHelper.cpp +++ b/src/misc/importanceHelper.cpp @@ -39,25 +39,13 @@ void importanceHelper::resetImportance(shared_ptr <message> msg) void importanceHelper::resetImportanceHeader(shared_ptr <header> hdr) { - try - { - shared_ptr <headerField> fld = hdr->findField("X-Priority"); + shared_ptr <headerField> fld; + + if ((fld = hdr->findField("X-Priority"))) hdr->removeField(fld); - } - catch (exceptions::no_such_field) - { - // Ignore - } - try - { - shared_ptr <headerField> fld = hdr->findField("Importance"); + if ((fld = hdr->findField("Importance"))) hdr->removeField(fld); - } - catch (exceptions::no_such_field) - { - // Ignore - } } @@ -70,9 +58,10 @@ importanceHelper::Importance importanceHelper::getImportance(shared_ptr <const m importanceHelper::Importance importanceHelper::getImportanceHeader(shared_ptr <const header> hdr) { // Try "X-Priority" field - try + shared_ptr <const headerField> fld = hdr->findField("X-Priority"); + + if (fld) { - const shared_ptr <const headerField> fld = hdr->findField("X-Priority"); const string value = fld->getValue <text>()->getWholeBuffer(); int n = IMPORTANCE_NORMAL; @@ -93,12 +82,13 @@ importanceHelper::Importance importanceHelper::getImportanceHeader(shared_ptr <c return (i); } - catch (exceptions::no_such_field) + else { // Try "Importance" field - try + fld = hdr->findField("Importance"); + + if (fld) { - const shared_ptr <const headerField> fld = hdr->findField("Importance"); const string value = utility::stringUtils::toLower(utility::stringUtils::trim (fld->getValue <text>()->getWholeBuffer())); @@ -109,7 +99,7 @@ importanceHelper::Importance importanceHelper::getImportanceHeader(shared_ptr <c else return (IMPORTANCE_NORMAL); } - catch (exceptions::no_such_field) + else { // Default return (IMPORTANCE_NORMAL); |