Browse Source

Add PoC IRC notification functions based on notifirc

Alois Mahdal 9 years ago
parent
commit
4ab4944bb2
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      dotfiles/imapfilter/common/functions.lua

+ 14
- 0
dotfiles/imapfilter/common/functions.lua View File

1
+os = require "os"
1
 socket = require "socket"
2
 socket = require "socket"
2
 
3
 
3
 function shortname()
4
 function shortname()
10
     return mbox.FILTER_QUEUE:is_newer(84)
11
     return mbox.FILTER_QUEUE:is_newer(84)
11
 end
12
 end
12
 
13
 
14
+function _notifirc1(structure)
15
+    --notify about message using (pre-configured) notifirc
16
+    os.execute('notifirc "A funny message arrived!"; notifirc "too bad we are SO WEAK"')
17
+end
18
+
19
+function notifirc_all(seq)
20
+    for _, mesg in ipairs(seq) do
21
+        mbox, uid = table.unpack(mesg)
22
+        structure = mbox[uid]:fetch_structure()
23
+        _notifirc1(structure)
24
+    end
25
+end
26
+
13
 function _partinf_compare(a, b)
27
 function _partinf_compare(a, b)
14
     if not type(a) == type(b) then
28
     if not type(a) == type(b) then
15
         return false
29
         return false