diff options
Diffstat (limited to 'etc/qp.lua')
-rw-r--r-- | etc/qp.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/etc/qp.lua b/etc/qp.lua new file mode 100644 index 0000000..23c834a --- /dev/null +++ b/etc/qp.lua | |||
@@ -0,0 +1,18 @@ | |||
1 | local convert | ||
2 | arg = arg or {} | ||
3 | local mode = arg and arg[1] or "-et" | ||
4 | if mode == "-et" then | ||
5 | local canonic = socket.mime.canonic() | ||
6 | local qp = socket.mime.encode("quoted-printable") | ||
7 | local wrap = socket.mime.wrap("quoted-printable") | ||
8 | convert = socket.mime.chain(canonic, qp, wrap) | ||
9 | elseif mode == "-eb" then | ||
10 | local qp = socket.mime.encode("quoted-printable", "binary") | ||
11 | local wrap = socket.mime.wrap("quoted-printable") | ||
12 | convert = socket.mime.chain(qp, wrap) | ||
13 | else convert = socket.mime.decode("quoted-printable") end | ||
14 | while 1 do | ||
15 | local chunk = io.read(4096) | ||
16 | io.write(convert(chunk)) | ||
17 | if not chunk then break end | ||
18 | end | ||