aboutsummaryrefslogtreecommitdiff
path: root/gmail.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2009-10-05 00:10:47 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2009-10-05 00:10:47 +0200
commit4602ca2fa5e8e2e408713f72ae7e4cd14480bc01 (patch)
treebfbf75b8afd738f5a036737404f3eafe87586c66 /gmail.lua
parentaf4e85f99d0ac63127f19640ef47d768d7bed7cd (diff)
downloadvicious-legacy-4602ca2fa5e8e2e408713f72ae7e4cd14480bc01.tar.xz
Lots of coding style changes
Diffstat (limited to 'gmail.lua')
-rw-r--r--gmail.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/gmail.lua b/gmail.lua
index c31f425..345f6a6 100644
--- a/gmail.lua
+++ b/gmail.lua
@@ -6,6 +6,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
local setmetatable = setmetatable
+local string = { match = string.match }
local helpers = require("vicious.helpers")
-- }}}
@@ -15,7 +16,7 @@ module("vicious.gmail")
-- User data
-local user = "" -- Todo
+local user = "" -- Todo:
local pass = "" -- * find a safer storage
-- {{{ Gmail widget type
@@ -32,10 +33,11 @@ local function worker(format, feed)
-- Could be huge don't read it all at once, info we are after is at the top
for line in f:lines() do
- mail["{count}"] = line:match("<fullcount>([%d]+)</fullcount>") or mail["{count}"]
+ mail["{count}"] = -- Count comes before messages and matches at least 0
+ string.match(line, "<fullcount>([%d]+)</fullcount>") or mail["{count}"]
-- Find subject tags
- local title = line:match("<title>(.*)</title>")
+ local title = string.match(line, "<title>(.*)</title>")
-- If the subject changed then break out of the loop
if title ~= nil and -- Todo: find a better way to deal with 1st title
title ~= "Gmail - Label &#39;unread&#39; for "..user.."@gmail.com" then
@@ -43,8 +45,6 @@ local function worker(format, feed)
title = helpers.escape(title)
-- Don't abuse the wibox, truncate, then store
mail["{subject}"] = helpers.truncate(title, 22)
- -- By this point we have the count, it comes before
- -- messages and always matches, at least 0
break
end
end