aboutsummaryrefslogtreecommitdiff
path: root/widgets/mbox.lua
diff options
context:
space:
mode:
authorArvydas Sidorenko <asido4@gmail.com>2012-06-15 18:07:05 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2012-06-18 01:26:31 +0200
commit41cc2c0e27e6a0860d21754ed9d13f6cd61254ac (patch)
tree20ed8fe7b878caec0c9e033168fe79561f31db57 /widgets/mbox.lua
parentb6b52900930ddb2a5b958a6d314766b455358164 (diff)
downloadvicious-legacy-41cc2c0e27e6a0860d21754ed9d13f6cd61254ac.tar.xz
Ported vicious.widgets module to lua 5.2
Signed-off-by: Arvydas Sidorenko <asido4@gmail.com> Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Diffstat (limited to 'widgets/mbox.lua')
-rw-r--r--widgets/mbox.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/widgets/mbox.lua b/widgets/mbox.lua
index be64e03..7b92e36 100644
--- a/widgets/mbox.lua
+++ b/widgets/mbox.lua
@@ -13,7 +13,8 @@ local helpers = require("vicious.helpers")
-- Mbox: provides the subject of last e-mail in a mbox file
-module("vicious.widgets.mbox")
+-- vicious.widgets.mbox
+local mbox = {}
-- Initialize variables
@@ -24,9 +25,9 @@ local function worker(format, warg)
if not warg then return end
-- mbox could be huge, get a 30kb chunk from EOF
- if type(warg) ~= "table" then mbox = warg end
+ if type(warg) ~= "table" then _mbox = warg end
-- * attachment could be much bigger than 30kb
- local f = io.open(mbox or warg[1])
+ local f = io.open(_mbox or warg[1])
f:seek("end", -30720)
local txt = f:read("*all")
f:close()
@@ -49,4 +50,4 @@ local function worker(format, warg)
end
-- }}}
-setmetatable(_M, { __call = function(_, ...) return worker(...) end })
+return setmetatable(mbox, { __call = function(_, ...) return worker(...) end })