summaryrefslogtreecommitdiff
path: root/src/mimehooks.h
blob: 6da14fdfdf28a5e3026b4feb48ac2c77f756ff41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <the_Foundation/audience.h>
#include <the_Foundation/ptrarray.h>
#include <the_Foundation/regexp.h>
#include <the_Foundation/string.h>

iDeclareType(FilterHook)
iDeclareTypeConstruction(FilterHook)

struct Impl_FilterHook {
    iString  label;
    iString  mimePattern;
    iRegExp *mimeRegex;
    iString  command;
};

void    setMimePattern_FilterHook   (iFilterHook *, const iString *pattern);
void    setCommand_FilterHook       (iFilterHook *, const iString *command);

/*----------------------------------------------------------------------------------------------*/

iDeclareType(MimeHooks)
iDeclareTypeConstruction(MimeHooks)

iBool       willTryFilter_MimeHooks (const iMimeHooks *, const iString *mime);
iBlock *    tryFilter_MimeHooks     (const iMimeHooks *, const iString *mime,
                                     const iBlock *body, const iString *requestUrl);

void        load_MimeHooks          (iMimeHooks *, const char *saveDir);
void        save_MimeHooks          (const iMimeHooks *);

const iString *debugInfo_MimeHooks  (const iMimeHooks *);