+ /* process existing suppress tag */
+ for (filter_identifier = 0; !err; filter_identifier++)
+ {
+ char key_value[30];
+ char key_name[30];
+ char old_name[30];
+ char key_type[30];
+ const char *name, *new_name;
+ char value; /*
+ * Filter state. Valid states are: 'Y' (active),
+ * 'N' (inactive) and 'X' (no change).
+ * XXX: bad name.
+ */
+ char type; /*
+ * Abbreviated filter type. Valid types are: 'U' (suppress tag).
+ */
+ int multi_action_index = 0;
+
+ /* Generate the keys */
+ snprintf(key_value, sizeof(key_value), "string_filter_r%x", filter_identifier);
+ snprintf(key_name, sizeof(key_name), "string_filter_n%x", filter_identifier);
+ snprintf(old_name, sizeof(old_name), "string_filter_o%x", filter_identifier);
+ snprintf(key_type, sizeof(key_type), "string_filter_t%x", filter_identifier);
+
+ err = get_string_param(parameters, old_name, &name);
+ if (err) break;
+
+ if (name == NULL)
+ {
+ /* The filter identifier isn't present: we're done! */
+ break;
+ }
+
+ err = get_string_param(parameters, key_name, &new_name);
+ if (err) break;
+ if (new_name == NULL) new_name = name;
+
+ type = get_char_param(parameters, key_type);
+ switch (type)
+ {
+ case 'U':
+ multi_action_index = ACTION_MULTI_SUPPRESS_TAG;
+ break;
+ default:
+ log_error(LOG_LEVEL_ERROR,
+ "Unknown filter type: %c for filter %s. Filter ignored.", type, name);
+ continue;
+ }
+ assert(multi_action_index);
+
+ value = get_char_param(parameters, key_value);
+ if (value == 'X' || value == 'Y' || value == 'N')
+ {
+ list_remove_item(cur_line->data.action->multi_add[multi_action_index], name);
+ list_remove_item(cur_line->data.action->multi_remove[multi_action_index], name);
+ }
+
+ if (value == 'Y')
+ {
+ err = enlist(cur_line->data.action->multi_add[multi_action_index], new_name);
+ }
+ else if (value == 'N')
+ {
+ err = enlist(cur_line->data.action->multi_remove[multi_action_index], new_name);
+ }
+ }
+
+ /* process new string filters */
+ for (filter_identifier = 0; !err; filter_identifier++)
+ {
+ char key_value[30];
+ char key_name[30];
+ char key_type[30];
+ const char *name;
+ char value; /*
+ * Filter state. Valid states are: 'Y' (active),
+ * 'N' (inactive) and 'X' (no change).
+ * XXX: bad name.
+ */
+ char type; /*
+ * Abbreviated filter type. Valid types are: 'U' (suppress tag).
+ */
+ int multi_action_index = 0;
+
+ /* Generate the keys */
+ snprintf(key_value, sizeof(key_value), "new_string_filter_r%x", filter_identifier);
+ snprintf(key_name, sizeof(key_name), "new_string_filter_n%x", filter_identifier);
+ snprintf(key_type, sizeof(key_type), "new_string_filter_t%x", filter_identifier);
+
+ err = get_string_param(parameters, key_name, &name);
+ if (err) break;
+
+ if (name == NULL)
+ {
+ /* The filter identifier isn't present: we've done! */
+ break;
+ }
+
+ type = get_char_param(parameters, key_type);
+ switch (type)
+ {
+ case 'U':
+ multi_action_index = ACTION_MULTI_SUPPRESS_TAG;
+ break;
+ default:
+ log_error(LOG_LEVEL_ERROR,
+ "Unknown filter type: %c for filter %s. Filter ignored.", type, name);
+ continue;
+ }
+ assert(multi_action_index);
+
+ value = get_char_param(parameters, key_value);
+ if (value == 'Y')
+ {
+ list_remove_item(cur_line->data.action->multi_add[multi_action_index], name);
+ if (!err) err = enlist(cur_line->data.action->multi_add[multi_action_index], name);
+ list_remove_item(cur_line->data.action->multi_remove[multi_action_index], name);
+ }
+ else if (value == 'N')
+ {
+ list_remove_item(cur_line->data.action->multi_add[multi_action_index], name);
+ list_remove_item(cur_line->data.action->multi_remove[multi_action_index], name);
+ if (!err) err = enlist(cur_line->data.action->multi_remove[multi_action_index], name);
+ }
+ /* nothing to do if the value is 'X' */
+ }
+