This repository was archived by the owner on Jul 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopicsupportstatus.tcl
61 lines (54 loc) · 2.12 KB
/
topicsupportstatus.tcl
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
# This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License
# http://creativecommons.org/licenses/by-sa/3.0/
# savvas @ Undernet, Freenode
set tsstatuschannel "#hellnetworks"
set tsstatuschannel2 "##hn"
bind pub o "!away" cmd_supportaway
bind pub o "!offline" cmd_supportoffline
bind pub o "!online" cmd_supportonline
bind join m * topicsupportstatuson
bind sign m * topicsupportstatusoff
bind part m * topicsupportstatusoff
proc cmd_supportoffline {nick host handle channel txt} {
global tsstatuschannel tsstatuschannel2
if {$tsstatuschannel != $channel && $tsstatuschannel2 != $channel} {return}
set ctopic [topic $tsstatuschannel]
if {[regsub {SUPPORT: (?:AWAY|ONLINE)} $ctopic "SUPPORT: OFFLINE" ctopic2]} {
putserv "TOPIC $tsstatuschannel :$ctopic2"
}
}
proc cmd_supportonline {nick host handle channel txt} {
global tsstatuschannel tsstatuschannel2
if {$tsstatuschannel != $channel && $tsstatuschannel2 != $channel} {return}
set ctopic [topic $tsstatuschannel]
if {[regsub {SUPPORT: (?:OFFLINE|AWAY)} $ctopic "SUPPORT: ONLINE" ctopic2]} {
putserv "TOPIC $tsstatuschannel :$ctopic2"
}
}
proc cmd_supportaway {nick host handle channel txt} {
global tsstatuschannel tsstatuschannel2
if {$tsstatuschannel != $channel && $tsstatuschannel2 != $channel} {return}
set ctopic [topic $tsstatuschannel]
if {[regsub {SUPPORT: (?:OFFLINE|ONLINE)} $ctopic "SUPPORT: AWAY" ctopic2]} {
putserv "TOPIC $tsstatuschannel :$ctopic2"
}
}
proc topicsupportstatuson {nick uhost handle channel} {
global tsstatuschannel
if {$tsstatuschannel != $channel} {return}
if {$handle == ""} {return}
set ctopic [topic $tsstatuschannel]
if {[regsub {SUPPORT: (?:OFFLINE|AWAY)} $ctopic "SUPPORT: AWAY" ctopic2]} {
putserv "TOPIC $tsstatuschannel :$ctopic2"
}
}
proc topicsupportstatusoff {nick uhost handle channel {reason ""}} {
global tsstatuschannel
if {$tsstatuschannel != $channel} {return}
if {$handle == ""} {return}
set ctopic [topic $tsstatuschannel]
if {[regsub {SUPPORT: (?:ONLINE|AWAY)} $ctopic "SUPPORT: OFFLINE" ctopic2]} {
putserv "TOPIC $tsstatuschannel :$ctopic2"
}
}
putlog "Topic Support Status checking by savvas"