2004-02-04 15:29:11 +01:00
|
|
|
local convert
|
|
|
|
arg = arg or {}
|
|
|
|
local mode = arg and arg[1] or "-et"
|
|
|
|
if mode == "-et" then
|
2004-02-11 04:31:53 +01:00
|
|
|
local normalize = socket.mime.normalize()
|
2004-02-04 15:29:11 +01:00
|
|
|
local qp = socket.mime.encode("quoted-printable")
|
|
|
|
local wrap = socket.mime.wrap("quoted-printable")
|
2004-02-11 04:31:53 +01:00
|
|
|
convert = socket.mime.chain(normalize, qp, wrap)
|
2004-02-04 15:29:11 +01:00
|
|
|
elseif mode == "-eb" then
|
|
|
|
local qp = socket.mime.encode("quoted-printable", "binary")
|
|
|
|
local wrap = socket.mime.wrap("quoted-printable")
|
|
|
|
convert = socket.mime.chain(qp, wrap)
|
|
|
|
else convert = socket.mime.decode("quoted-printable") end
|
|
|
|
while 1 do
|
|
|
|
local chunk = io.read(4096)
|
|
|
|
io.write(convert(chunk))
|
|
|
|
if not chunk then break end
|
|
|
|
end
|