浏览代码

Add PoC IRC notification functions based on notifirc

Alois Mahdal 9 年前
父节点
当前提交
4ab4944bb2
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14
    0
      dotfiles/imapfilter/common/functions.lua

+ 14
- 0
dotfiles/imapfilter/common/functions.lua 查看文件

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