-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgmail2gcal-sample.lua
50 lines (44 loc) · 1.63 KB
/
gmail2gcal-sample.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
------------------------------------------------------------------------
-- Gmail2Gcal configuration example for IMAPFilter
--
-- 1) Insert the coontents of this file at the end of your
-- 'config.lua' file.
--
-- 2) Change the line, near the end of the code, so that the call to
-- 'dofile' contains the correct path to your copy of the gmail2gcal
-- shell script.
------------------------------------------------------------------------
-- It is probably best to put this line near the top of your
-- 'config.lua' file.
dofile 'gmail-account.lua'
function do_subject(msgs, cmd)
count = 0
result = Set()
for _, mesg in ipairs(msgs) do
count = count + 1
-- mbox, uid = table.unpack(mesg)
mbox = mesg[1]
uid = mesg[2]
print("uid=" .. uid .. ".")
subject = mbox[uid]:fetch_field("Subject")
if cmd == nil then
print(" NO COMMAND")
else
pipe_to(cmd, subject)
end
end
return count
end
gmail2gcal=gmail._Gmail2Gcal:select_all()
------------------------------------------------------------------------
-- Modify this line to have the correct path.
do_subject(gmail2gcal, "REPLACE-WITH-APPROPRIATE-PATH/gmail2gcal `cat`")
------------------------------------------------------------------------
gmail._Gmail2Gcal:delete_messages(gmail2gcal)
------------------------------------------------------------------------
-- Gmail2Gcal for IMAPFilter by Neil Smithline is licensed under a
-- Creative Commons Attribution-ShareAlike 3.0 Unported License.
--
-- See https://github.com/Neil-Smithline/imapfilter-gmail2gcal for
-- more details.
------------------------------------------------------------------------