diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-02 07:26:33 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-02 07:26:33 +0200 |
commit | cface45b7cfd084f65ead1d5bfa6ecdc639d7017 (patch) | |
tree | 0c2b7f900ee3f116474f9789173b60423b98cf4f /src/mimehooks.h | |
parent | 5b147a3976fcf007a75e9b16cc0cea96011f2e9b (diff) |
Added MimeHooks
This is a very powerful mechanism: translate the contents of any request to something else when the original MIME type matches a configured regexp.
The external hook command may still elect not to process the request.
Diffstat (limited to 'src/mimehooks.h')
-rw-r--r-- | src/mimehooks.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mimehooks.h b/src/mimehooks.h new file mode 100644 index 00000000..c78a3c86 --- /dev/null +++ b/src/mimehooks.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include <the_Foundation/audience.h> | ||
4 | #include <the_Foundation/ptrarray.h> | ||
5 | #include <the_Foundation/regexp.h> | ||
6 | #include <the_Foundation/string.h> | ||
7 | |||
8 | iDeclareType(FilterHook) | ||
9 | iDeclareTypeConstruction(FilterHook) | ||
10 | |||
11 | struct Impl_FilterHook { | ||
12 | iString label; | ||
13 | iString mimePattern; | ||
14 | iRegExp *mimeRegex; | ||
15 | iString command; | ||
16 | }; | ||
17 | |||
18 | void setMimePattern_FilterHook (iFilterHook *, const iString *pattern); | ||
19 | void setCommand_FilterHook (iFilterHook *, const iString *command); | ||
20 | |||
21 | /*----------------------------------------------------------------------------------------------*/ | ||
22 | |||
23 | iDeclareType(MimeHooks) | ||
24 | iDeclareTypeConstruction(MimeHooks) | ||
25 | |||
26 | iBool willTryFilter_MimeHooks (const iMimeHooks *, const iString *mime); | ||
27 | iBlock * tryFilter_MimeHooks (const iMimeHooks *, const iString *mime, | ||
28 | const iBlock *body); | ||
29 | |||
30 | void load_MimeHooks (iMimeHooks *, const char *saveDir); | ||
31 | void save_MimeHooks (const iMimeHooks *); | ||