pick implement rfc2047
authorPhilipp Takacs <philipp@bureaucracy.de>
Wed, 21 Nov 2018 22:25:54 +0000 (23:25 +0100)
committerPhilipp Takacs <philipp@bureaucracy.de>
Thu, 22 Nov 2018 23:14:54 +0000 (00:14 +0100)
uip/pick.c

index 7f0d3a9..aba0c02 100644 (file)
@@ -1088,7 +1088,7 @@ GREPaction(struct field *f, int msgnum, void *data)
 {
        struct grep_data *g = data;
        int ret;
-       char *buf;
+       char buf[BUFSIZ];
 
        if (!g->header && *f->name) {
                return FALSE;
@@ -1099,15 +1099,18 @@ GREPaction(struct field *f, int msgnum, void *data)
                return FALSE;
        }
 
-       ret = regexec(g->preg, f->value, 0, NULL, 0) == REG_NOMATCH;
+       if(decode_rfc2047(f->value, buf, sizeof(buf))) {
+               ret = regexec(g->preg, buf, 0, NULL, 0);
+       } else {
+               ret = regexec(g->preg, f->value, 0, NULL, 0);
+       }
        switch (ret) {
        case 0:
                return TRUE;
        case REG_NOMATCH:
                return FALSE;
        default:
-               buf = mh_xcalloc(BUFSIZ, sizeof(char));
-               regerror(ret, g->preg, buf, BUFSIZ*sizeof(char));
+               regerror(ret, g->preg, buf, sizeof(buf));
                fprintf(stderr, "%s\n", buf);
                return FALSE;
        }