diff options
author | Caleb Maclennan <caleb@alerque.com> | 2023-11-10 09:12:04 +0300 |
---|---|---|
committer | Caleb Maclennan <caleb@alerque.com> | 2023-11-10 09:12:04 +0300 |
commit | 5c4fc93d5f4137bf4c22ddf1a048c907a4a26727 (patch) | |
tree | a9a68e1f6a9c3bfe2b64fa1c3a4098865b7d3b5d /src/mime.lua | |
parent | ccef3bc4e2aa6ee5b997a80aabb58f4ff0b0e98f (diff) | |
parent | 43a97b7f0053313b43906371dbdc226271e6c8ab (diff) | |
download | luasocket-hjelmeland-patch-1.tar.gz luasocket-hjelmeland-patch-1.tar.bz2 luasocket-hjelmeland-patch-1.zip |
Merge branch 'master' into hjelmeland-patch-1hjelmeland-patch-1
Diffstat (limited to '')
-rw-r--r-- | src/mime.lua | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/mime.lua b/src/mime.lua index 642cd9c..93539de 100644 --- a/src/mime.lua +++ b/src/mime.lua | |||
@@ -10,8 +10,6 @@ | |||
10 | local base = _G | 10 | local base = _G |
11 | local ltn12 = require("ltn12") | 11 | local ltn12 = require("ltn12") |
12 | local mime = require("mime.core") | 12 | local mime = require("mime.core") |
13 | local io = require("io") | ||
14 | local string = require("string") | ||
15 | local _M = mime | 13 | local _M = mime |
16 | 14 | ||
17 | -- encode, decode and wrap algorithm tables | 15 | -- encode, decode and wrap algorithm tables |
@@ -19,7 +17,7 @@ local encodet, decodet, wrapt = {},{},{} | |||
19 | 17 | ||
20 | _M.encodet = encodet | 18 | _M.encodet = encodet |
21 | _M.decodet = decodet | 19 | _M.decodet = decodet |
22 | _M.wrapt = wrapt | 20 | _M.wrapt = wrapt |
23 | 21 | ||
24 | -- creates a function that chooses a filter by name from a given table | 22 | -- creates a function that chooses a filter by name from a given table |
25 | local function choose(table) | 23 | local function choose(table) |
@@ -28,7 +26,7 @@ local function choose(table) | |||
28 | name, opt1, opt2 = "default", name, opt1 | 26 | name, opt1, opt2 = "default", name, opt1 |
29 | end | 27 | end |
30 | local f = table[name or "nil"] | 28 | local f = table[name or "nil"] |
31 | if not f then | 29 | if not f then |
32 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) | 30 | base.error("unknown key (" .. base.tostring(name) .. ")", 3) |
33 | else return f(opt1, opt2) end | 31 | else return f(opt1, opt2) end |
34 | end | 32 | end |
@@ -53,13 +51,6 @@ decodet['quoted-printable'] = function() | |||
53 | return ltn12.filter.cycle(_M.unqp, "") | 51 | return ltn12.filter.cycle(_M.unqp, "") |
54 | end | 52 | end |
55 | 53 | ||
56 | local function format(chunk) | ||
57 | if chunk then | ||
58 | if chunk == "" then return "''" | ||
59 | else return string.len(chunk) end | ||
60 | else return "nil" end | ||
61 | end | ||
62 | |||
63 | -- define the line-wrap filters | 54 | -- define the line-wrap filters |
64 | wrapt['text'] = function(length) | 55 | wrapt['text'] = function(length) |
65 | length = length or 76 | 56 | length = length or 76 |
@@ -87,4 +78,4 @@ function _M.stuff() | |||
87 | return ltn12.filter.cycle(_M.dot, 2) | 78 | return ltn12.filter.cycle(_M.dot, 2) |
88 | end | 79 | end |
89 | 80 | ||
90 | return _M \ No newline at end of file | 81 | return _M |