21 static const char* conditionValues[] =
23 "deliver",
"expire-at",
"match-resource"
26 static const char* actionValues[] =
28 "alert",
"error",
"drop",
"notify"
31 static const char* deliverValues[] =
33 "direct",
"forward",
"gateway",
"none",
"stored"
36 static const char* matchResourceValues[] =
38 "any",
"exact",
"other"
41 static const char* statusValues[] =
48 : m_condition( ConditionDeliver ), m_deliver( deliver ), m_action( action )
53 : m_condition(
ConditionExpireAt ), m_expireat( new std::string( date ) ), m_action( action )
63 const std::string& value )
65 m_condition = (
ConditionType)util::lookup( condition, conditionValues );
66 m_action = (
ActionType)util::lookup( action, actionValues );
70 m_deliver = (
DeliverType)util::lookup( value, deliverValues );
73 m_expireat =
new std::string( value );
98 Tag* rule =
new Tag(
"rule" );
99 rule->
addAttribute(
"condition", util::lookup( m_condition, conditionValues ) );
100 rule->
addAttribute(
"action", util::lookup( m_action, actionValues ) );
102 switch( m_condition )
105 rule->
addAttribute(
"value", util::lookup( m_deliver, deliverValues ) );
111 rule->
addAttribute(
"value", util::lookup( m_matchresource, matchResourceValues ) );
134 ConstTagList::const_iterator it = rules.begin();
135 for( ; it != rules.end(); ++it )
137 m_rules.push_back(
new Rule( (*it)->findAttribute(
"condition" ),
138 (*it)->findAttribute(
"action" ),
139 (*it)->findAttribute(
"value" ) ) );
158 m_rules.push_back( rule );
163 static const std::string filter =
"/message/amp[@xmlns='" +
XMLNS_AMP +
"']";
169 if( !m_valid || !m_rules.size() )
172 Tag* amp =
new Tag(
"amp" );
179 amp->
addAttribute(
"status", util::lookup( m_status, statusValues ) );
182 RuleList::const_iterator it = m_rules.begin();
183 for( ; it != m_rules.end(); ++it )