From 4602ca2fa5e8e2e408713f72ae7e4cd14480bc01 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Mon, 5 Oct 2009 00:10:47 +0200 Subject: Lots of coding style changes --- gmail.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gmail.lua') 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("([%d]+)") or mail["{count}"] + mail["{count}"] = -- Count comes before messages and matches at least 0 + string.match(line, "([%d]+)") or mail["{count}"] -- Find subject tags - local title = line:match("(.*)") + local title = string.match(line, "(.*)") -- 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 'unread' 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 -- cgit v1.2.3