summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-23 14:15:19 -0500
committerJune McEnroe <june@causal.agency>2019-12-23 14:15:36 -0500
commit16fef058063a5a83882c420a5c6e7a4c7ee348dd (patch)
tree8af724b2008f783992ef75a996c0b90975aee817
parentProperly support using drill rather than dig (diff)
downloadimbox-16fef058063a5a83882c420a5c6e7a4c7ee348dd.tar.gz
imbox-16fef058063a5a83882c420a5c6e7a4c7ee348dd.zip
Restrict search to plain-text messages
-rw-r--r--imbox.14
-rw-r--r--imbox.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/imbox.1 b/imbox.1
index b414232..1d3d648 100644
--- a/imbox.1
+++ b/imbox.1
@@ -1,4 +1,4 @@
-.Dd December 22, 2019
+.Dd December 23, 2019
 .Dt IMBOX 1
 .Os
 .
@@ -135,7 +135,7 @@ imbox -T list@example.org june@causal.agency | git am
 .Sh CAVEATS
 The
 .Nm
-utility only expects to deal with plain-text messages.
+utility only exports plain-text messages.
 .
 .Sh BUGS
 Send mail to
diff --git a/imbox.c b/imbox.c
index fff867f..e620a61 100644
--- a/imbox.c
+++ b/imbox.c
@@ -334,7 +334,13 @@ int main(int argc, char *argv[]) {
 				fprintf(imap, "%s EXAMINE \"%s\"\r\n", Atoms[Examine], mailbox);
 			}
 			break; case Examine: {
-				fprintf(imap, "%s SEARCH CHARSET UTF-8", Atoms[Search]);
+				fprintf(
+					imap,
+					"%s SEARCH CHARSET UTF-8 OR "
+					"NOT HEADER Content-Type \"\" "
+					"HEADER Content-Type \"text/plain\"",
+					Atoms[Search]
+				);
 				if (subject) fprintf(imap, " SUBJECT \"%s\"", subject);
 				if (from) fprintf(imap, " FROM \"%s\"", from);
 				if (to) fprintf(imap, " TO \"%s\"", to);