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,3 +1,4 @@
1
+os = require "os"
1 2
 socket = require "socket"
2 3
 
3 4
 function shortname()
@@ -10,6 +11,19 @@ function get_queue(mbox)
10 11
     return mbox.FILTER_QUEUE:is_newer(84)
11 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 27
 function _partinf_compare(a, b)
14 28
     if not type(a) == type(b) then
15 29
         return false