-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotify.fs
109 lines (92 loc) · 3.03 KB
/
notify.fs
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
\ net2o template for new files
\ Copyright © 2015 Bernd Paysan
\ This program is free software: you can redistribute it and/or modify
\ it under the terms of the GNU Affero General Public License as published by
\ the Free Software Foundation, either version 3 of the License, or
\ (at your option) any later version.
\ This program is distributed in the hope that it will be useful,
\ but WITHOUT ANY WARRANTY; without even the implied warranty of
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\ GNU Affero General Public License for more details.
\ You should have received a copy of the GNU Affero General Public License
\ along with this program. If not, see <http://www.gnu.org/licenses/>.
\ notifications (on android only now)
64#0 64Value last-notify
64#0 64Value latest-notify
scope{ config
2Variable delta-notify& #60.000.000.000 delta-notify& 2! \ one notification per minute is enough
Variable notify-mode# 3 notify-mode# !
Variable notify-rgb# $FFFF00 notify-rgb# !
Variable notify-on# 500 notify-on# !
Variable notify-off# 4500 notify-off# !
Variable notify-text# 1 notify-text# !
Variable notify?# -2 notify?# ! \ default: no notification when active
}scope
: tick-notify? ( -- flag )
ticks last-notify 64- config:delta-notify& 2@ d>64 64< ;
Variable notify$
Variable notify-nick$
Variable notify-otr?
Variable pending-notifications
: notify- ( -- )
pending-notifications off
latest-notify to last-notify ;
Sema notify-sema
: notify; nip (;]) ]] notify-sema c-section ; [[ ;
: notify> comp-[: ['] notify; colon-sys-xt-offset stick ; immediate
: notify+ ( addr u -- ) notify> notify$ $+! ;
: notify-nick+ ( addr u -- ) notify> s" @" notify-nick$ $+! notify-nick$ $+! ;
: notify-nick! ( addr u -- ) notify> s" @" notify-nick$ $!
notify-nick$ $+! notify$ $free ;
: notify! ( addr u -- ) notify> notify$ $! ;
: notify-title ( -- )
." net2o: " pending-notifications @ dup .
." Message" 1 > IF ." s" THEN
." from" notify-nick$ $. ;
[IFDEF] android
require android/notify.fs
[ELSE]
[IFDEF] linux
require linux/notify.fs
[THEN]
: show-notification ( -- )
1 pending-notifications +!
[IFDEF] linux-notification
linux-notification
[THEN] ;
: msg-builder ;
[IFUNDEF] rendering
Variable rendering
[THEN] -2 rendering !
[IFUNDEF] level#
Variable level#
[THEN]
also also
[THEN]
: msg-notify ( -- ) notify>
ticks to latest-notify
rendering @ config:notify?# @ <= dup IF
notify-
THEN
tick-notify? or 0= IF
[IFDEF] build-notification
build-notification show-notification
[THEN]
latest-notify to last-notify
THEN notify$ $free ;
previous previous
\\\
Local Variables:
forth-local-words:
(
(("net2o:" "+net2o:") definition-starter (font-lock-keyword-face . 1)
"[ \t\n]" t name (font-lock-function-name-face . 3))
("[a-z0-9]+(" immediate (font-lock-comment-face . 1)
")" nil comment (font-lock-comment-face . 1))
)
forth-local-indent-words:
(
(("net2o:" "+net2o:") (0 . 2) (0 . 2) non-immediate)
)
End:
[THEN]