thread_tracker.lua

 1-- thread_tracker.lua
 2-- Tracks how many replies and forwards you receive per session.
 3
 4local matcha = require("matcha")
 5
 6local replies = 0
 7local forwards = 0
 8
 9matcha.on("email_received", function(email)
10    local subj = email.subject:lower()
11    if subj:match("^re:") or subj:match("^re%[%d+%]:") then
12        replies = replies + 1
13    elseif subj:match("^fwd:") or subj:match("^fw:") then
14        forwards = forwards + 1
15    end
16    matcha.set_status("inbox", replies .. " replies, " .. forwards .. " fwd")
17end)