Allow getting/setting importance directly from/on message header.

This commit is contained in:
Vincent Richard 2005-07-24 15:54:05 +00:00
parent 207efb83b1
commit 06ed35edf7
2 changed files with 36 additions and 3 deletions

View File

@ -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>();

View File

@ -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);
};