]> mj.ucw.cz Git - checkmail.git/blobdiff - cm.c
First attempt at rfc2047 parsing.
[checkmail.git] / cm.c
diff --git a/cm.c b/cm.c
index cce8c273e4fa6e735761e33a9296cd2f7d09c6bd..76db2488bd547a3e653fc9a24da4b6af60ef8b60 100644 (file)
--- a/cm.c
+++ b/cm.c
@@ -20,6 +20,7 @@
 
 #include "util.h"
 #include "clists.h"
+#include "rfc2047.h"
 
 static int check_interval = 30;
 static int force_refresh;
@@ -204,7 +205,7 @@ mbox_visible_p(struct mbox *b)
 }
 
 static void
-add_snippet(char **ppos, char *term, unsigned char *add)
+do_add_snippet(char **ppos, char *term, unsigned char *add)
 {
   char *pos = *ppos;
   int space = 1;
@@ -232,6 +233,20 @@ add_snippet(char **ppos, char *term, unsigned char *add)
   *pos = 0;
 }
 
+static void
+add_snippet(char **ppos, char *term, unsigned char *add)
+{
+#if 1
+  char *buf = xmalloc(strlen(add) + 1);
+  strcpy(buf, add);
+  rfc2047_decode(&buf);
+  do_add_snippet(ppos, term, buf);
+  free(buf);
+#else
+  do_add_snippet(ppos, term, add);
+#endif
+}
+
 static void
 prepare_snippet(struct mbox *b, char *sender, char *subject)
 {
@@ -919,6 +934,7 @@ main(int argc, char **argv)
   while (optind < argc)
     add_pattern(argv[optind++]);
 
+  rfc2047_init();
   term_init();
   scan_and_redraw();
   next_active(0, 1);