aboutsummaryrefslogtreecommitdiff
path: root/src/mime.lua
diff options
context:
space:
mode:
authorCaleb Maclennan <caleb@alerque.com>2023-11-10 09:12:04 +0300
committerCaleb Maclennan <caleb@alerque.com>2023-11-10 09:12:04 +0300
commit5c4fc93d5f4137bf4c22ddf1a048c907a4a26727 (patch)
treea9a68e1f6a9c3bfe2b64fa1c3a4098865b7d3b5d /src/mime.lua
parentccef3bc4e2aa6ee5b997a80aabb58f4ff0b0e98f (diff)
parent43a97b7f0053313b43906371dbdc226271e6c8ab (diff)
downloadluasocket-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 'src/mime.lua')
-rw-r--r--src/mime.lua15
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 @@
10local base = _G 10local base = _G
11local ltn12 = require("ltn12") 11local ltn12 = require("ltn12")
12local mime = require("mime.core") 12local mime = require("mime.core")
13local io = require("io")
14local string = require("string")
15local _M = mime 13local _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
25local function choose(table) 23local 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, "")
54end 52end
55 53
56local function format(chunk)
57 if chunk then
58 if chunk == "" then return "''"
59 else return string.len(chunk) end
60 else return "nil" end
61end
62
63-- define the line-wrap filters 54-- define the line-wrap filters
64wrapt['text'] = function(length) 55wrapt['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)
88end 79end
89 80
90return _M \ No newline at end of file 81return _M