X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=attach.c;h=0b97d5ab3566d4f97e5524d80c916f9cd77a3f50;hp=a644784ad02b27ffe7a987547b0d801c30fe8d99;hb=e83dbdbc6200a71981d06773869cd0492f81f16c;hpb=6a0fbdc73204a837ec7d378eaf0e1248a982ba9d diff --git a/attach.c b/attach.c index a644784..0b97d5a 100644 --- a/attach.c +++ b/attach.c @@ -1013,3 +1013,30 @@ int mutt_print_attachment (FILE * fp, BODY * a) return 0; } } + +int mutt_attach_check (HEADER* hdr) { + int found = 0; + char buf[LONG_STRING]; + char *p = NULL; + FILE* fp = NULL; + regmatch_t pmatch[1]; + + if (!hdr || !hdr->content || !((regex_t*) AttachRemindRegexp.rx) || + (fp = safe_fopen (hdr->content->filename, "r")) == NULL) + return (0); + + while (!found && fgets (buf, sizeof (buf), fp)) { + p = buf; + while (p && *p) { + if (regexec ((regex_t*) AttachRemindRegexp.rx, p, 1, + pmatch, 0) == 0) { + found = 1; + break; + } + p++; + } + } + fclose (fp); + + return (found); +}