+ // Determine what type of host rule this is.
+ const std::string action = tag->getString("action");
+ if (stdalgo::string::equalsci(action, "addaccount"))
+ {
+ // The hostname is in the format [prefix]<account>[suffix].
+ rules.push_back(HostRule(HostRule::HCA_ADDACCOUNT, mask, ports, tag->getString("prefix"), tag->getString("suffix")));
+ }
+ else if (stdalgo::string::equalsci(action, "addnick"))
+ {
+ // The hostname is in the format [prefix]<nick>[suffix].
+ rules.push_back(HostRule(HostRule::HCA_ADDNICK, mask, ports, tag->getString("prefix"), tag->getString("suffix")));
+ }
+ else if (stdalgo::string::equalsci(action, "set"))
+ {
+ // Ensure that we have the <hostchange:value> parameter.
+ const std::string value = tag->getString("value");
+ if (value.empty())
+ throw ModuleException("<hostchange:value> is a mandatory field when using the 'set' action, at " + tag->getTagLocation());
+
+ // The hostname is in the format <value>.
+ rules.push_back(HostRule(mask, value, ports));
+ continue;
+ }
+ else
+ {
+ throw ModuleException(action + " is an invalid <hostchange:action> type, at " + tag->getTagLocation());
+ }