Parsing a whole rule file is done using a converter stream. This means that a rule file can come
from anywhere, even across the network. We have defined a special content type for rule files
called WWW_RULES
in HTFormat.
In some situations, a set of rules comes from a subset of a file or some other origin, for example INI files for X resources. In that case, you can also parse a single line from a rules file using the following function:
extern BOOL HTRule_parseLine (HTList * list, const char * config);You can add a rule to a list of rules as any other preference. The
pattern
is a string
containing a single "*". replace
points to the equivalent string with * for the place
where the text matched by * goes.
typedef enum _HTRuleOp { HT_Invalid, HT_Map, HT_Pass, HT_Fail, HT_DefProt, HT_Protect, HT_Exec, HT_Redirect, HT_UseProxy } HTRuleOp; extern BOOL HTRule_add (HTList * list, HTRuleOp op, const char * pattern, const char * replace);And as normal you can delete a set of rules by using this function:
extern BOOL HTRule_deleteAll (HTList *list);
extern HTList * HTRule_global (void); extern BOOL HTRule_setGlobal (HTList * list);
extern char * HTRule_translate (HTList * list, const char * token, BOOL ignore_case);