On *:Start: {
hmake topiclock 10 | hmake topiclock_friends 10
if ($exists(topiclock.hsh)) hload -i topiclock topiclock.hsh
if ($exists(topiclock_friends.hsh)) hload -i topiclock_friends topiclock_friends.hsh
}
alias ut { if ($hfind(topiclock,$active)) hadd topiclock $active $iif($active ischan,$chan($chan).topic) }
alias tl { if (!$dialog(topiclock)) dialog -mo topiclock topiclock }
dialog topiclock_friends {
title "Topic Lock - Friends List"
size -1 -1 109 143
option dbu
combo 1, 4 4 102 107, size
button "Add", 2, 24 113 27 9
button "Rem", 3, 56 113 27 9
button "Close", 4, 37 127 37 12, ok
}
On *:Dialog:topiclock_friends:init:*: {
var %x = 1
while (%x <= $hget($dname,0).item) {
did -a $dname 1 $hget($dname,%x).item
inc %x
}
}
On *:Dialog:topiclock_friends:sclick:*: {
if ($did($dname,1)) {
if (!$hget($dname)) hmake $dname 10
if ($did == 2) {
if (!$hfind($dname,$did($dname,1))) {
hadd $dname $did(1) $did(1)
did -a $dname 1 $did(1)
}
}
elseif ($did == 3) {
if ($hfind($dname,$did($dname,1).seltext)) {
hdel $dname $did($dname,1).seltext
did -d $dname 1 $did($dname,1).sel
}
}
}
hsave -i $dname $+($dname,.hsh)
}
dialog topiclock {
title "Topic Lock"
size -1 -1 109 143
option dbu
combo 1, 4 4 102 107, size
button "Add", 2, 24 113 27 9
button "Rem", 3, 56 113 27 9
button "Friends",4, 80 129 27 9
button "Close", 5, 37 127 37 12, ok
}
On *:Dialog:topiclock:init:*: {
var %x = 1
while (%x <= $hget($dname,0).item) {
did -a $dname 1 $hget($dname,%x).item
inc %x
}
}
On *:Dialog:topiclock:sclick:*: {
if ($did($dname,1)) {
if (!$hget(topiclock)) hmake topiclock 10
if ($did == 2) {
if (!$hfind($dname,$did($dname,1))) {
hadd $dname $did(1)
did -a $dname 1 $did(1)
}
}
elseif ($did == 3) {
if ($hfind($dname,$did($dname,1).seltext)) {
hdel $dname $did($dname,1).seltext
did -d $dname 1 $did($dname,1).sel
}
}
else {
dialog -dm topiclock_friends topiclock_friends
}
}
if ($did == 4) dialog -mo topiclock_friends topiclock_friends
hsave -i topiclock topiclock.hsh
}
Raw 332:*: {
if ($hfind(topiclock,$2)) hadd topiclock $2 $3-
hsave -i topiclock topiclock.hsh
}
On @*:Topic:#: {
if (($nick != $me) && (!$hfind(topiclock_friends,$nick))) {
topic $chan $hget(topiclock,$chan)
hsave -i topiclock topiclock.hsh
}
}