aboutsummaryrefslogtreecommitdiff
path: root/etc/qp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'etc/qp.lua')
-rw-r--r--etc/qp.lua24
1 files changed, 11 insertions, 13 deletions
diff --git a/etc/qp.lua b/etc/qp.lua
index 1ca0ae2..08545db 100644
--- a/etc/qp.lua
+++ b/etc/qp.lua
@@ -2,17 +2,15 @@ local convert
2arg = arg or {} 2arg = arg or {}
3local mode = arg and arg[1] or "-et" 3local mode = arg and arg[1] or "-et"
4if mode == "-et" then 4if mode == "-et" then
5 local normalize = socket.mime.normalize() 5 local normalize = mime.normalize()
6 local qp = socket.mime.encode("quoted-printable") 6 local qp = mime.encode("quoted-printable")
7 local wrap = socket.mime.wrap("quoted-printable") 7 local wrap = mime.wrap("quoted-printable")
8 convert = socket.mime.chain(normalize, qp, wrap) 8 convert = ltn12.filter.chain(normalize, qp, wrap)
9elseif mode == "-eb" then 9elseif mode == "-eb" then
10 local qp = socket.mime.encode("quoted-printable", "binary") 10 local qp = mime.encode("quoted-printable", "binary")
11 local wrap = socket.mime.wrap("quoted-printable") 11 local wrap = mime.wrap("quoted-printable")
12 convert = socket.mime.chain(qp, wrap) 12 convert = ltn12.filter.chain(qp, wrap)
13else convert = socket.mime.decode("quoted-printable") end 13else convert = mime.decode("quoted-printable") end
14while 1 do 14local source = ltn12.source.chain(ltn12.source.file(io.stdin), convert)
15 local chunk = io.read(4096) 15local sink = ltn12.sink.file(io.stdout)
16 io.write(convert(chunk)) 16ltn12.pump(source, sink)
17 if not chunk then break end
18end