summaryrefslogtreecommitdiff
path: root/src/mimehooks.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-02 07:26:33 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-02 07:26:33 +0200
commitcface45b7cfd084f65ead1d5bfa6ecdc639d7017 (patch)
tree0c2b7f900ee3f116474f9789173b60423b98cf4f /src/mimehooks.h
parent5b147a3976fcf007a75e9b16cc0cea96011f2e9b (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.h31
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
8iDeclareType(FilterHook)
9iDeclareTypeConstruction(FilterHook)
10
11struct Impl_FilterHook {
12 iString label;
13 iString mimePattern;
14 iRegExp *mimeRegex;
15 iString command;
16};
17
18void setMimePattern_FilterHook (iFilterHook *, const iString *pattern);
19void setCommand_FilterHook (iFilterHook *, const iString *command);
20
21/*----------------------------------------------------------------------------------------------*/
22
23iDeclareType(MimeHooks)
24iDeclareTypeConstruction(MimeHooks)
25
26iBool willTryFilter_MimeHooks (const iMimeHooks *, const iString *mime);
27iBlock * tryFilter_MimeHooks (const iMimeHooks *, const iString *mime,
28 const iBlock *body);
29
30void load_MimeHooks (iMimeHooks *, const char *saveDir);
31void save_MimeHooks (const iMimeHooks *);