diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-02-04 14:29:11 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-02-04 14:29:11 +0000 |
commit | 0b2542d1a61fc5425ff65ab3dbf7ba7de174763f (patch) | |
tree | 8a6188e11db0c9ef6891c31e8a1bebca050b23b2 /etc | |
parent | f67864f86c7d703325e86b14d0ba33992c52891b (diff) | |
download | luasocket-0b2542d1a61fc5425ff65ab3dbf7ba7de174763f.tar.gz luasocket-0b2542d1a61fc5425ff65ab3dbf7ba7de174763f.tar.bz2 luasocket-0b2542d1a61fc5425ff65ab3dbf7ba7de174763f.zip |
Worked on the manual.
Implemented stuffing (needs test)
Added cddb and qp examples.
Diffstat (limited to 'etc')
-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 | ||