]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libhttpd/checkcontent.c
upas/Mail: avoid showing empty To: and CC: lines in compose windows
[plan9front.git] / sys / src / libhttpd / checkcontent.c
1 #include <u.h>
2 #include <libc.h>
3 #include <bin.h>
4 #include <httpd.h>
5
6 int
7 hcheckcontent(HContent *me, HContent *oks, char *list, int size)
8 {
9         HContent *ok;
10
11         if(oks == nil || me == nil)
12                 return 1;
13         for(ok = oks; ok != nil; ok = ok->next){
14                 if((cistrcmp(ok->generic, me->generic) == 0 || strcmp(ok->generic, "*") == 0)
15                 && (me->specific == nil || cistrcmp(ok->specific, me->specific) == 0 || strcmp(ok->specific, "*") == 0)){
16                         if(ok->mxb > 0 && size > ok->mxb)
17                                 return 0;
18                         return 1;
19                 }
20         }
21
22         USED(list);
23         if(0){
24                 fprint(2, "list: %s/%s not found\n", me->generic, me->specific);
25                 for(; oks != nil; oks = oks->next){
26                         if(oks->specific)
27                                 fprint(2, "\t%s/%s\n", oks->generic, oks->specific);
28                         else
29                                 fprint(2, "\t%s\n", oks->generic);
30                 }
31         }
32         return 0;
33 }