commit d3273dc58a9a5896c5ec048d132ecfc6c37e2bf8
parent 7693825f4f605b4f1c7701af5348d2e7ed704aa3
Author: Jaffa Cake <j4jackj@template.hostname>
Date: Sun, 10 Aug 2014 14:02:58 -0400
added workable TS6 support.
Diffstat:
9 files changed, 252 insertions(+), 182 deletions(-)
diff --git a/chanserv.help b/chanserv.help
@@ -38,7 +38,8 @@ channel protection bot.
topiclock Locks the channel topic to be whatever you
set with topic.
-topic
+topic channel new topic
+ Set or change the stored "locked" topic for the named channel.
lsu channel
View the userlist for a channel.
diff --git a/core/0002-p10.tcl b/core/0002-p10.tcl
@@ -11,7 +11,7 @@ proc ::p10::sendUid {sck nick ident host dhost uid {realname "* Unknown *"} {mod
set sendnn [string repeat "A" [expr {3-[string length $sendid]}]]
append sendnn $sendid
set sl [format "%s N %s 1 %s %s %s %s AAAAAA %s%s :%s" $sid $nick [clock format [clock seconds] -format %s] $ident $host $modes $sid $sendnn $realname]
- tnda set "intclient/$::netname($sck)/${sid}${sendnn}" $uid
+ tnda set "intclient/$::netname($sck)/$::netname($sck)/$::netname($sck)/${sid}${sendnn}" $uid
puts $sck $sl
}
@@ -56,7 +56,7 @@ proc ::p10::notice {sck uid targ msg} {
proc ::p10::setacct {sck targ msg} {
global sid
puts $sck [format "%s AC %s R %s" $sid $targ $msg]
- tnda set "login/$::netname($sck)/$targ" $msg
+ tnda set "login/$::netname($sck)/$::netname($sck)/$::netname($sck)/$targ" $msg
}
proc ::p10::bind {sock type client comd script} {
@@ -65,13 +65,13 @@ proc ::p10::bind {sock type client comd script} {
set bindnum [rand 1 10000000]
if {[tnda get "binds/$sock/$type/$client/$comd/$bindnum"]!=""} {} {set moretodo 0}
}
- tnda set "binds/$sock/$type/$client/$comd/$bindnum" $script
+ tnda set "binds/$sock/$type/$client/$comd/$::netname($sck)/$::netname($sck)/$bindnum" $script
puts stdout "binds/$sock/$type/$client/$comd/$bindnum [tnda get "binds/$sock/$type/$client/$comd"]"
return $bindnum
}
proc ::p10::unbind {sock type client comd id} {
- tnda set "binds/$sock/$type/$client/$comd/$id" ""
+ tnda set "binds/$sock/$type/$client/$comd/$::netname($sck)/$::netname($sck)/$id" ""
}
proc ::p10::putmode {sck uid targ mode parm ts} {
@@ -143,7 +143,7 @@ proc ::p10::irc-main {sck} {
switch -- $c {
"+" {set state 1}
"-" {set state 0}
- "o" {tnda set "oper/$::netname($sck)/[lindex $comd 0]" $state}
+ "o" {tnda set "oper/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 0]" $state}
}
}
} } {
@@ -163,7 +163,7 @@ proc ::p10::irc-main {sck} {
callbind $sck create "-" "-" [lindex $comd 2] [lindex $comd 0] $::netname($sck)
callbind $sck join "-" "-" [lindex $comd 2] [lindex $comd 0] $::netname($sck)
set chan [string map {/ [} [::base64::encode [string tolower [lindex $comd 2]]]]
- tnda set "channels/$::netname($sck)/$chan/$::netname($sck)/ts" [lindex $comd 3]
+ tnda set "channels/$::netname($sck)/$chan/$::netname($sck)/$::netname($sck)/$::netname($sck)/ts" [lindex $comd 3]
}
"T" {
@@ -194,12 +194,12 @@ proc ::p10::irc-main {sck} {
} {
set four 4
}
- tnda set "channels/$::netname($sck)/$chan/$::netname($sck)/ts" [lindex $comd 3]
+ tnda set "channels/$::netname($sck)/$chan/$::netname($sck)/$::netname($sck)/$::netname($sck)/ts" [lindex $comd 3]
foreach {nick} [split [lindex $comd $four] ","] {
set n [split $nick ":"]
set un [lindex $n 0]
set uo [lindex $n 1]
- if {""!=$uo} {tnda set "channels/$::netname($sck)/$chan/modes/$::netname($sck)/$un" $uo}
+ if {""!=$uo} {tnda set "channels/$::netname($sck)/$chan/modes/$::netname($sck)/$::netname($sck)/$::netname($sck)/$un" $uo}
callbind $sck join "-" "-" [lindex $comd 2] $un
}
@@ -243,40 +243,40 @@ proc ::p10::irc-main {sck} {
}
if {""!=$loggedin} {
- tnda set "login/$::netname($sck)/[lindex $comd $num]" $loggedin
+ tnda set "login/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd $num]" $loggedin
}
if {""!=$fakehost} {
- tnda set "vhost/$::netname($sck)/[lindex $comd $num]" $fakehost
+ tnda set "vhost/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd $num]" $fakehost
}
- tnda set "nick/$::netname($sck)/[lindex $comd $num]" [lindex $comd 2]
- tnda set "oper/$::netname($sck)/[lindex $comd $num]" $oper
- tnda set "ident/$::netname($sck)/[lindex $comd $num]" [lindex $comd 5]
- tnda set "rhost/$::netname($sck)/[lindex $comd $num]" [lindex $comd 6]
+ tnda set "nick/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd $num]" [lindex $comd 2]
+ tnda set "oper/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd $num]" $oper
+ tnda set "ident/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd $num]" [lindex $comd 5]
+ tnda set "rhost/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd $num]" [lindex $comd 6]
callbind $sck conn "-" "-" [lindex $comd $num]
} {
callbind $sck nch "-" "-" [lindex $comd 0] [tnda get "nick/$::netname($sck)/[lindex $comd 0]"] [lindex $comd 2]
- tnda set "nick/$::netname($sck)/[lindex $comd 0]" [lindex $comd 2]
+ tnda set "nick/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 0]" [lindex $comd 2]
}
}
"Q" {
- tnda set "login/$::netname($sck)/[lindex $comd 0]" ""
- tnda set "nick/$::netname($sck)/[lindex $comd 0]" ""
- tnda set "oper/$::netname($sck)/[lindex $comd 0]" 0
- tnda set "ident/$::netname($sck)/[lindex $comd 0]" ""
- tnda set "rhost/$::netname($sck)/[lindex $comd 0]" ""
- tnda set "vhost/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "login/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "nick/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "oper/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 0]" 0
+ tnda set "ident/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "rhost/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "vhost/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 0]" ""
}
"D" {
- tnda set "login/$::netname($sck)/[lindex $comd 2]" ""
- tnda set "nick/$::netname($sck)/[lindex $comd 2]" ""
- tnda set "oper/$::netname($sck)/[lindex $comd 2]" 0
- tnda set "ident/$::netname($sck)/[lindex $comd 2]" ""
- tnda set "rhost/$::netname($sck)/[lindex $comd 2]" ""
- tnda set "vhost/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "login/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "nick/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "oper/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 2]" 0
+ tnda set "ident/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "rhost/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "vhost/$::netname($sck)/$::netname($sck)/$::netname($sck)/[lindex $comd 2]" ""
}
"G" {
@@ -287,6 +287,9 @@ proc ::p10::irc-main {sck} {
proc ::p10::login {sck} {
global servername sid password
+ tnda set "pfx/owner" o
+ tnda set "pfx/protect" o
+ tnda set "pfx/halfop" h
set sid [string repeat "A" [expr {2-[b64e $::numeric]}]]
append sid [b64e $::numeric]
puts $sck "PASS :$password"
diff --git a/core/0003-ts6.tcl b/core/0003-ts6.tcl
@@ -1,61 +1,70 @@
# Because TS6 ircds are highly configurable, we start in Charybdis mode without
# an idea what modes are permissible. This is to aid ChanServ.
-if {![info exists ::ts6(halfops)]} {set halfops 0} {set halfops $::ts6(halfops)}
-if {![info exists ::ts6(euid)]} {set ::ts6(euid) 1}
-
namespace eval ts6 {
-set sid [string repeat "0" [expr {3-[string length [b64e $::numeric]]}]]
-append sid [b64e $::numeric]
proc ::ts6::sendUid {sck nick ident host dhost uid {realname "* Unknown *"} {modes "+oiS"} {server ""}} {
if {""==$server} {set server $::numeric}
- set sid [string repeat "0" [expr {3-[string length [b64e $server]]}]]
- append sid [b64e $server]
- set sendid [b64e $uid]
- set sendnn [string repeat "A" [expr {3-[string length $sendid]}]]
+ set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $server]]}]]
+ append sid [::ts6::b64e $server]
+ set sendid [::ts6::b64e $uid]
+ set sendnn [string repeat "A" [expr {6-[string length $sendid]}]]
append sendnn $sendid
if {!$::ts6(euid)} {
- set sl [format ":%s UID %s 1 %s %s %s 0 %s%s :%s" $sid $nick [clock format [clock seconds] -format %s] $modes $ident $host $sid $sendnn $realname]
+ set sl [format ":%s UID %s 1 %s %s %s %s 0 %s%s :%s" $sid $nick [clock format [clock seconds] -format %s] $modes $ident $host $sid $sendnn $realname]
} {
- set sl [format ":%s EUID %s 1 %s %s %s 0 %s%s * * :%s" $sid $nick [clock format [clock seconds] -format %s] $modes $ident $host $sid $sendnn $realname]
+ set sl [format ":%s EUID %s 1 %s %s %s %s 0 %s%s * * :%s" $sid $nick [clock format [clock seconds] -format %s] $modes $ident $host $sid $sendnn $realname]
}
- tnda set "intclient/$::netname($sck)/$::netname($::sock)/${sid}${sendnn}" $uid
+ tnda set "intclient/$::netname($sck)/${sid}${sendnn}" $uid
puts $sck $sl
+ puts stdout $sl
+}
+
+proc ::ts6::topic {sck uid targ topic} {
+ set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]]
+ append sid [::ts6::b64e $::numeric]
+ set sendid [::ts6::b64e $uid]
+ set sendnn [string repeat "A" [expr {6-[string length $sendid]}]]
+ append sendnn $sendid
+ puts $sck [format ":%s%s TOPIC %s :%s" $sid $sendnn $targ $topic]
}
proc ::ts6::sendSid {sck sname sid {realname "In use by Services"}} {
- set sl [format ":%s SID %s 1 %s :%s" [b64e $::sid] $sname [b64e $sid] $realname]
+set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]]
+append sid [::ts6::b64e $::numeric]
+ set sl [format ":%s SID %s 1 %s :%s" [::ts6::b64e $sid] $sname [::ts6::b64e $sid] $realname]
puts $sck $sl
}
proc ::ts6::privmsg {sck uid targ msg} {
- global sid
- set sendid [b64e $uid]
- set sendnn [string repeat "A" [expr {3-[string length $sendid]}]]
+set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]]
+append sid [::ts6::b64e $::numeric]
+ set sendid [::ts6::b64e $uid]
+ set sendnn [string repeat "A" [expr {6-[string length $sendid]}]]
append sendnn $sendid
puts $sck [format ":%s%s PRIVMSG %s :%s" $sid $sendnn $targ $msg]
}
proc ::ts6::kick {sck uid targ tn msg} {
- global sid
- set sendid [b64e $uid]
- set sendnn [string repeat "A" [expr {3-[string length $sendid]}]]
+set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]]
+append sid [::ts6::b64e $::numeric]
+ set sendid [::ts6::b64e $uid]
+ set sendnn [string repeat "A" [expr {6-[string length $sendid]}]]
append sendnn $sendid
puts $sck [format ":%s%s KICK %s %s :%s" $sid $sendnn $targ $tn $msg]
}
proc ::ts6::notice {sck uid targ msg} {
- global sid
- set sendid [b64e $uid]
- set sendnn [string repeat "A" [expr {3-[string length $sendid]}]]
+ set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]];append sid [::ts6::b64e $::numeric]
+ set sendid [::ts6::b64e $uid]
+ set sendnn [string repeat "A" [expr {6-[string length $sendid]}]]
append sendnn $sendid
puts $sck [format ":%s%s NOTICE %s :%s" $sid $sendnn $targ $msg]
}
proc ::ts6::setacct {sck targ msg} {
- global sid
+ set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]];append sid [::ts6::b64e $::numeric]
puts $sck [format ":%s ENCAP * SU %s %s" $sid $targ $msg]
- tnda set "login/$::netname($sck)/$::netname($::sock)/$targ" $msg
+ tnda set "login/$::netname($sck)/$targ" $msg
}
proc ::ts6::bind {type client comd script} {
@@ -64,30 +73,30 @@ proc ::ts6::bind {type client comd script} {
set bindnum [rand 1 10000000]
if {[tnda get "binds/$type/$client/$comd/$bindnum"]!=""} {} {set moretodo 0}
}
- tnda set "binds/$type/$client/$comd/$::netname($::sock)/$bindnum" $script
+ tnda set "binds/$type/$client/$comd/$::netname($sck)/$bindnum" $script
return $bindnum
}
proc ::ts6::unbind {type client comd id} {
- tnda set "binds/$type/$client/$comd/$::netname($::sock)/$id" ""
+ tnda set "binds/$type/$client/$comd/$::netname($sck)/$id" ""
}
proc ::ts6::putmode {sck uid targ mode parm ts} {
- global sid
- set sendid [b64e $uid]
- set sendnn [string repeat "A" [expr {3-[string length $sendid]}]]
+ set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]];append sid [::ts6::b64e $::numeric]
+ set sendid [::ts6::b64e $uid]
+ set sendnn [string repeat "A" [expr {6-[string length $sendid]}]]
append sendnn $sendid
- puts $sck [format "%s%s M %s %s %s" $sid $sendnn $targ $mode $parm $ts]
+ puts $sck [format ":%s%s TMODE %s %s %s %s" $sid $sendnn $ts $targ $mode $parm]
+ puts stdout [format ":%s%s TMODE %s %s %s %s" $sid $sendnn $ts $targ $mode $parm]
}
proc ::ts6::putjoin {sck uid targ ts} {
- global sid
- set sendid [b64e $uid]
- set sendnn [string repeat "A" [expr {3-[string length $sendid]}]]
+ set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]];append sid [::ts6::b64e $::numeric]
+ set sendid [::ts6::b64e $uid]
+ set sendnn [string repeat "A" [expr {6-[string length $sendid]}]]
append sendnn $sendid
- puts $sck [format "%s B %s %s %s%s:o" $sid $targ $ts $sid $sendnn]
- puts stdout [format "%s B %s %s %s%s:o" $sid $targ $ts $sid $sendnn]
-
+ puts $sck [format ":%s SJOIN %s %s + :@%s%s" $sid $ts $targ $sid $sendnn]
+ puts stdout [format ":%s SJOIN %s %s + :@%s%s" $sid $ts $targ $sid $sendnn]
}
proc ::ts6::callbind {sock type client comd args} {
@@ -106,22 +115,28 @@ proc ::ts6::irc-main {sck} {
gets $sck line
set line [string trim $line "\r\n"]
set one [string match ":*" $line]
+ set line [string trimleft $line ":"]
set gotsplitwhere [string first " :" $line]
- if {$gotsplitwhere==-1} {set comd [split $line " "]} {set comd [split [string range $line 1 [expr {$gotsplitwhere - 1}]] " "]}
+ if {$gotsplitwhere==-1} {set comd [split $line " "]} {set comd [split [string range $line 0 [expr {$gotsplitwhere - 1}]] " "]}
set payload [split [string range $line [expr {$gotsplitwhere + 2}] end] " "]
puts stdout [join $comd " "]
+ if {[lindex $comd 0] == "PING"} {puts $sck "PONG $::servername :$payload"}
+ if {[lindex $comd 0] == "SERVER"} {puts $sck "VERSION"}
switch -nocase -- [lindex $comd $one] {
+ "479" {puts stdout $payload}
+
"005" {
- foreach {tok} [lrange $comd [expr {$comd+1}] end] {
+ foreach {tok} [lrange $comd 3 end] {
foreach {key val} [split $tok "="] {
if {$key == "PREFIX"} {
# We're in luck! Server advertises its PREFIX in VERSION reply to servers.
set v [string range $val 1 end]
set mod [split $v ")"]
- set modechar [split [lindex $mod 0] {}]
- set modepref [split [lindex $mod 1] {}]
+ set modechar [split [lindex $mod 1] {}]
+ puts stdout "$key $val"
+ set modepref [split [lindex $mod 0] {}]
foreach {c} $modechar {x} $modepref {
- tnda set "ts6/$::netname($sck)/prefix/$::netname($::sock)/$modepref" $modechar
+ tnda set "ts6/$::netname($sck)/prefix/$modepref" $modechar
}
}
}
@@ -135,10 +150,10 @@ proc ::ts6::irc-main {sck} {
# We're in luck! Server advertises its PREFIX in VERSION reply to servers.
set v [string range $val 1 end]
set mod [split $v ")"]
- set modechar [split [lindex $mod 0] {}]
- set modepref [split [lindex $mod 1] {}]
+ set modechar [split [lindex $mod 1] {}]
+ set modepref [split [lindex $mod 0] {}]
foreach {c} $modechar {x} $modepref {
- tnda set "ts6/$::netname($sck)/prefix/$::netname($::sock)/$modepref" $modechar
+ tnda set "ts6/$::netname($sck)/prefix/$modepref" $modechar
}
}
}
@@ -176,26 +191,27 @@ proc ::ts6::irc-main {sck} {
switch -- $c {
"+" {set state 1}
"-" {set state 0}
- "o" {tnda set "oper/$::netname($sck)/$::netname($::sock)/[lindex $comd 0]" $state}
+ "o" {tnda set "oper/$::netname($sck)/[lindex $comd 0]" $state}
}
}
}
}
"JOIN" {
- set chan [string map {/ [} [::base64::encode [string tolower [lindex $comd 2]]]]
- if {""==[tnda get "channels/$::netname($sck)/$chan/ts"]} {callbind $sck create "-" "-" [lindex $comd 2] [lindex $comd 0]}
- callbind $sck join "-" "-" [lindex $comd 2] [lindex $comd 0]
- tnda set "channels/$::netname($sck)/$chan/$::netname($::sock)/ts" [lindex $comd 3]
+ set chan [string map {/ [} [::base64::encode [string tolower [lindex $comd 3]]]]
+ if {""==[tnda get "channels/$::netname($sck)/$chan/ts"]} {callbind $sck create "-" "-" [lindex $comd 3] [lindex $comd 0]}
+ callbind $sck join "-" "-" [lindex $comd 3] [lindex $comd 0]
+ tnda set "channels/$::netname($sck)/$chan/$::netname($sck)/ts" [lindex $comd 2]
}
"TMODE" {
set ctr 3
+ set state 1
foreach {c} [split [lindex $comd 3] {}] {
switch -regexp -- $c {
"\\\+" {set state 1}
- "\\\-" {set state 0}
- "[CcDdiMmNnOpPQRrSsTtZz]" {callbind $sck mode "-" [expr {$state ? "+" : "-"}] $c [lindex $comd 0] [lindex $comd 2] $::netname($sck)}
+ "-" {set state 0}
+ "[ABCcDdiMmNnOpPQRrSsTtZz]" {callbind $sck mode "-" [expr {$state ? "+" : "-"}] $c [lindex $comd 0] [lindex $comd 2] $::netname($sck)}
"[beljfqIaykohv]" {callbind $sck mode "-" [expr {$state ? "+" : "-"}] $c [lindex $comd 0] [lindex $comd 2] [lindex $comd [incr ctr]] $::netname($sck)}
}
}
@@ -212,17 +228,18 @@ proc ::ts6::irc-main {sck} {
} {
set four 4
}
- tnda set "channels/$::netname($sck)/$chan/$::netname($::sock)/ts" [lindex $comd 2]
- foreach {nick} [split [lindex $comd $four] " "] {
+ tnda set "channels/$::netname($sck)/$chan/ts" [lindex $comd 2]
+ foreach {nick} $payload {
set un ""
set uo ""
set state uo
foreach {c} [split $nick {}] {
if {[string is integer $c]} {set state un}
- if {$state == "uo"} {set c [tnda get "ts6/$::netname($sck)/prefixe/$c"]}
+ if {$state == "uo"} {set c [tnda get "ts6/$::netname($sck)/prefix/$c"]}
append $state $c
}
- if {""!=$uo} {tnda set "channels/$::netname($sck)/$chan/modes/$::netname($::sock)/$un" $uo}
+ puts stdout "$uo $un"
+ if {""!=$uo} {tnda set "channels/$::netname($sck)/$chan/modes/$un" $uo}
callbind $sck join "-" "-" [lindex $comd 3] $un
}
@@ -245,49 +262,57 @@ proc ::ts6::irc-main {sck} {
set modes [lindex $comd 4]
if {[string match "*o*" $modes]} {set oper 1}
if {"*"!=$loggedin} {
- tnda set "login/$::netname($sck)/$::netname($::sock)/[lindex $comd $num]" $loggedin
+ tnda set "login/$::netname($sck)/[lindex $comd $num]" $loggedin
}
if {"*"!=$realhost} {
- tnda set "rhost/$::netname($sck)/$::netname($::sock)/[lindex $comd $num]" $realhost
+ tnda set "rhost/$::netname($sck)/[lindex $comd $num]" $realhost
} {
- tnda set "rhost/$::netname($sck)/$::netname($::sock)/[lindex $comd $num]" [lindex $comd 6]
+ tnda set "rhost/$::netname($sck)/[lindex $comd $num]" [lindex $comd 6]
}
- tnda set "nick/$::netname($sck)/$::netname($::sock)/[lindex $comd $num]" [lindex $comd 2]
- tnda set "oper/$::netname($sck)/$::netname($::sock)/[lindex $comd $num]" $oper
- tnda set "ident/$::netname($sck)/$::netname($::sock)/[lindex $comd $num]" [lindex $comd 5]
- tnda set "vhost/$::netname($sck)/$::netname($::sock)/[lindex $comd $num]" [lindex $comd 6]
+ tnda set "nick/$::netname($sck)/[lindex $comd $num]" [lindex $comd 2]
+ tnda set "oper/$::netname($sck)/[lindex $comd $num]" $oper
+ tnda set "ident/$::netname($sck)/[lindex $comd $num]" [lindex $comd 5]
+ tnda set "vhost/$::netname($sck)/[lindex $comd $num]" [lindex $comd 6]
callbind $sck conn "-" "-" [lindex $comd $num]
}
"QUIT" {
- tnda set "login/$::netname($sck)/$::netname($::sock)/[lindex $comd 0]" ""
- tnda set "nick/$::netname($sck)/$::netname($::sock)/[lindex $comd 0]" ""
- tnda set "oper/$::netname($sck)/$::netname($::sock)/[lindex $comd 0]" 0
- tnda set "ident/$::netname($sck)/$::netname($::sock)/[lindex $comd 0]" ""
- tnda set "rhost/$::netname($sck)/$::netname($::sock)/[lindex $comd 0]" ""
- tnda set "vhost/$::netname($sck)/$::netname($::sock)/[lindex $comd 0]" ""
+ tnda set "login/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "nick/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "oper/$::netname($sck)/[lindex $comd 0]" 0
+ tnda set "ident/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "rhost/$::netname($sck)/[lindex $comd 0]" ""
+ tnda set "vhost/$::netname($sck)/[lindex $comd 0]" ""
}
"KILL" {
- tnda set "login/$::netname($sck)/$::netname($::sock)/[lindex $comd 2]" ""
- tnda set "nick/$::netname($sck)/$::netname($::sock)/[lindex $comd 2]" ""
- tnda set "oper/$::netname($sck)/$::netname($::sock)/[lindex $comd 2]" 0
- tnda set "ident/$::netname($sck)/$::netname($::sock)/[lindex $comd 2]" ""
- tnda set "rhost/$::netname($sck)/$::netname($::sock)/[lindex $comd 2]" ""
- tnda set "vhost/$::netname($sck)/$::netname($::sock)/[lindex $comd 2]" ""
+ tnda set "login/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "nick/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "oper/$::netname($sck)/[lindex $comd 2]" 0
+ tnda set "ident/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "rhost/$::netname($sck)/[lindex $comd 2]" ""
+ tnda set "vhost/$::netname($sck)/[lindex $comd 2]" ""
}
"PING" {
- puts $sck ":$sid PONG [lindex $comd 3] [lindex $comd 2]"
+ set num [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]]
+ append num [::ts6::b64e $::numeric]
+ if {[lindex $comd 3]==""} {set pong [lindex $comd 0]} {set pong [lindex $comd 3]}
+ puts $sck ":$num PONG $pong [lindex $comd 2]"
}
}
}
proc ::ts6::login {sck {sid $::numeric} {password $::password}} {
- set num [string repeat "0" [expr {3-[string length [b64e $sid]]}]]
- append num [b64e $::numeric]
- puts $sck "PASS $password TS 6 :$num"
- puts $sck "SERVER $servername 1 :Services for IRC Networks"
+ set num [string repeat "0" [expr {3-[string length [::ts6::b64e $::numeric]]}]]
+ append num [::ts6::b64e $::numeric]
+ if {![info exists ::ts6(halfops)]} {tnda set "pfx/halfop" v} {tnda set "pfx/halfop" $::ts6(halfops)}
+ if {![info exists ::ts6(ownermode)]} {tnda set "pfx/owner" o} {tnda set "pfx/owner" $::ts6(ownermode)}
+ if {![info exists ::ts6(protectmode)]} {tnda set "pfx/protect" o} {tnda set "pfx/protect" $::ts6(protectmode)}
+ if {![info exists ::ts6(euid)]} {set ::ts6(euid) 1}
+ puts $sck "PASS $::password TS 6 :$num"
+ puts $sck "CAPAB EUID"
+ puts $sck "SERVER $::servername 1 :Services for IRC Networks"
puts $sck "SVINFO 6 6 0 :[clock format [clock seconds] -format %s]"
puts $sck ":$sid VERSION"
}
diff --git a/modules/0001-eggcompat.tcl b/modules/0001-eggcompat.tcl
@@ -13,47 +13,69 @@ proc protectopcheck {mc ftp} {
if {"v"==$mc && ![channel get $t protectvoice]} {return}
switch -- $mc {
"o" {
- if {[matchattr [tnda get "login/$::netname($::sock)/$p"] |omn $t]} {
- p10 putmode $::sock 77 $t +$mc "$p" [tnda get "channels/[ndaenc $t]/$::netname($::sock)/ts"]
+ if {[matchattr [tnda get "login/$::netname($::sock)/$p"] omn|omn $t]} {
+ $::maintype putmode $::sock 77 $t +$mc "$p" [tnda get "channels/$::netname($::sock)/[ndaenc $t]/ts"]
}
}
"h" {
- if {[matchattr [tnda get "login/$::netname($::sock)/$p"] |l $t]} {
- p10 putmode $::sock 77 $t +$mc "$p" [tnda get "channels/[ndaenc $t]/$::netname($::sock)/ts"]
+ if {[matchattr [tnda get "login/$::netname($::sock)/$p"] l|l $t]} {
+ $::maintype putmode $::sock 77 $t +$mc "$p" [tnda get "channels/$::netname($::sock)/[ndaenc $t]/ts"]
}
}
"v" {
- if {[matchattr [tnda get "login/$::netname($::sock)/$p"] |v $t]} {
- p10 putmode $::sock 77 $t +$mc "$p" [tnda get "channels/[ndaenc $t]/$::netname($::sock)/ts"]
+ if {[matchattr [tnda get "login/$::netname($::sock)/$p"] v|v $t]} {
+ $::maintype putmode $::sock 77 $t +$mc "$p" [tnda get "channels/$::netname($::sock)/[ndaenc $t]/ts"]
}
}
}
}
-proc autoopcheck {c ft} {
- set f [lindex $ft 0];set t [lindex $ft 1]
- if {[matchattr [tnda get "login/$::netname($::sock)/$f"] omn|] && [channel get $c operit]} {
- p10 putmode $::sock 77 $c +o $f [tnda get "channels/[ndaenc $c]/$::netname($::sock)/ts"]
+proc autoopcheck {c f} {
+ puts stdout "$c $f"
+ if {[matchattr [tnda get "login/$::netname($::sock)/$f"] n|] && [channel get $c operit]} {
+ $::maintype putmode $::sock 77 $c +[tnda get "pfx/owner"] $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock)/$f"] |omn $c] && [channel get $c autoop]} {
- p10 putmode $::sock 77 $c +o $f [tnda get "channels/[ndaenc $c]/$::netname($::sock)/ts"]
+ if {[matchattr [tnda get "login/$::netname($::sock)/$f"] |n $c] && [channel get $c autoop]} {
+ $::maintype putmode $::sock 77 $c +[tnda get "pfx/owner"] $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
+ return
+ }
+
+ if {[matchattr [tnda get "login/$::netname($::sock)/$f"] m|] && [channel get $c operit]} {
+ $::maintype putmode $::sock 77 $c +[tnda get "pfx/protect"] $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
+ return
+ }
+ if {[matchattr [tnda get "login/$::netname($::sock)/$f"] |m $c] && [channel get $c autoop]} {
+ $::maintype putmode $::sock 77 $c +[tnda get "pfx/protect"] $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
+ return
+ }
+
+ if {[matchattr [tnda get "login/$::netname($::sock)/$f"] a|]} {
+ $::maintype putmode $::sock 77 $c +o $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
+ return
+ }
+ if {[matchattr [tnda get "login/$::netname($::sock)/$f"] o|] && [channel get $c operit]} {
+ $::maintype putmode $::sock 77 $c +o $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
+ return
+ }
+ if {[matchattr [tnda get "login/$::netname($::sock)/$f"] |o $c] && [channel get $c autoop]} {
+ $::maintype putmode $::sock 77 $c +o $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
return
}
if {[matchattr [tnda get "login/$::netname($::sock)/$f"] l|] && [channel get $c operit]} {
- p10 putmode $::sock 77 $c +h $f [tnda get "channels/[ndaenc $c]/$::netname($::sock)/ts"]
+ $::maintype putmode $::sock 77 $c +[tnda get "pfx/halfop"] $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
return
}
if {[matchattr [tnda get "login/$::netname($::sock)/$f"] |l $c] && [channel get $c autohalfop]} {
- p10 putmode $::sock 77 $c +h $f [tnda get "channels/[ndaenc $c]/$::netname($::sock)/ts"]
+ $::maintype putmode $::sock 77 $c +[tnda get "pfx/halfop"] $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
return
}
if {[matchattr [tnda get "login/$::netname($::sock)/$f"] v|] && [channel get $c operit]} {
- p10 putmode $::sock 77 $c +v $f [tnda get "channels/[ndaenc $c]/$::netname($::sock)/ts"]
+ $::maintype putmode $::sock 77 $c +v $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
return
}
if {[matchattr [tnda get "login/$::netname($::sock)/$f"] |v $c] && [channel get $c autovoice]} {
- p10 putmode $::sock 77 $c +v $f [tnda get "channels/[ndaenc $c]/$::netname($::sock)/ts"]
+ $::maintype putmode $::sock 77 $c +v $f [tnda get "channels/$::netname($::sock)/[ndaenc $c]/ts"]
return
}
}
@@ -63,26 +85,40 @@ proc bitchopcheck {mc ftp} {
set t [lindex $ftp 1]
set p [lindex $ftp 2]
puts stdout "$ftp"
+ if {[tnda get "pfx/owner"]==$mc && ![channel get $t bitch]} {return}
+ if {[tnda get "pfx/protect"]==$mc && ![channel get $t bitch]} {return}
if {"o"==$mc && ![channel get $t bitch]} {return}
if {"h"==$mc && ![channel get $t halfbitch]} {return}
if {"v"==$mc && ![channel get $t voicebitch]} {return}
switch -glob -- $mc {
+ "q" {
+ if {![matchattr [tnda get "login/$::netname($::sock)/$p"] n|n $t]} {
+ puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
+ $::maintype putmode $::sock 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ }
+ }
+ "a" {
+ if {![matchattr [tnda get "login/$::netname($::sock)/$p"] mn|mn $t]} {
+ puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
+ $::maintype putmode $::sock 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ }
+ }
"o" {
- if {![matchattr [tnda get "login/$::netname($::sock)/$p"] |omn $t]} {
+ if {![matchattr [tnda get "login/$::netname($::sock)/$p"] aomn|omn $t]} {
puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
- p10 putmode $::sock 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ $::maintype putmode $::sock 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
}
}
"h" {
- if {![matchattr [tnda get "login/$::netname($::sock)/$p"] |l $t]} {
+ if {![matchattr [tnda get "login/$::netname($::sock)/$p"] l|l $t]} {
puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
- p10 putmode $::sock 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ $::maintype putmode $::sock 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
}
}
"v" {
- if {![matchattr [tnda get "login/$::netname($::sock)/$p"] |v $t]} {
+ if {![matchattr [tnda get "login/$::netname($::sock)/$p"] v|v $t]} {
puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
- p10 putmode $::sock 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ $::maintype putmode $::sock 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
}
}
}
@@ -125,7 +161,7 @@ proc msgmt {from msg} {
set handle [lindex $msg 0 0]
set attr [lindex $msg 0 1]
set chan [lindex $msg 0 2]
- p10 notice $::sock 77 $from "$handle $attr $chan Matchattr result: [matchattr $handle $attr $chan]"
+ $::maintype notice $::sock 77 $from "$handle $attr $chan Matchattr result: [matchattr $handle $attr $chan]"
}
bind $::sock msg 77 "matchattr" msgmt
@@ -236,11 +272,11 @@ proc msgchanset {from msg} {
set ndacname [ndaenc [lindex $msg 0 0]]
set chanset [lindex $msg 0 1]
if {300>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$from"]]"] && ![matchattr [tnda get "login/$::netname($::sock)/$from"] m|m [lindex $msg 0 0]]} {
- p10 notice $::sock 77 $from "Only channel super-operators (300) and above and network masters may use eggdrop-compatible chansets."
+ $::maintype notice $::sock 77 $from "Only channel super-operators (300) and above and network masters may use eggdrop-compatible chansets."
return
}
channel set [lindex $msg 0 0] $chanset
- p10 notice $::sock 77 $from "Eggdrop compatible chanset $chanset set on [lindex $msg 0 0]."
+ $::maintype notice $::sock 77 $from "Eggdrop compatible chanset $chanset set on [lindex $msg 0 0]."
}
proc msgchattr {from msg} {
@@ -262,14 +298,15 @@ proc msgchattr {from msg} {
if {$c == "o"} {set $c "mn|omn"}
if {$c == "m"} {set $c "mn|mn"}
if {$c == "n"} {set $c "n|n"}
+ if {$c == "a"} {set $c "mn|"}
if {![matchattr [tnda get "login/$::netname($::sock)/$from"] $c $chan]} {
- p10 notice $::sock 77 $from "You may only give flags you already possess (Any of flags $c required to set $attrs)."
+ $::maintype notice $::sock 77 $from "You may only give flags you already possess (Any of flags $c required to set $attrs)."
return
}
}
if {"*"!=$chan} {chattr $hand $attrs} {chattr $hand $attrs $chan}
- p10 notice $::sock 77 $from "Global flags for $hand are now [nda get "eggcompat/attrs/global/[string tolower $handle]"]"
- if {$ch != "global"} {p10 notice $::sock 77 $from "Flags on $chan for $hand are now [nda get "eggcompat/attrs/$ndacname/[string tolower $handle]"]"}
+ $::maintype notice $::sock 77 $from "Global flags for $hand are now [nda get "eggcompat/attrs/global/[string tolower $handle]"]"
+ if {$ch != "global"} {$::maintype notice $::sock 77 $from "Flags on $chan for $hand are now [nda get "eggcompat/attrs/$ndacname/[string tolower $handle]"]"}
}
proc nick2hand {nick} {
@@ -288,13 +325,13 @@ proc setuser {nick datafield {dataval "body"} val} {
proc msgxtra {from msg} {
if {[set log [tnda get "login/$::netname($::sock)/$from"]]==""} {
- p10 notice $::sock 77 $from "Until you've registered with the bot, you have no business setting XTRA values."
+ $::maintype notice $::sock 77 $from "Until you've registered with the bot, you have no business setting XTRA values."
return
}
set subfield [lindex $msg 0 0]
set value [join [lrange [lindex $msg 0] 1 end] " "]
setuser $log "XTRA" $subfield $value
- p10 notice $::sock 77 $from "Set your user record XTRA $subfield to $value."
+ $::maintype notice $::sock 77 $from "Set your user record XTRA $subfield to $value."
}
proc chandname2name {channame} {return $channame}
diff --git a/modules/0002-chanserv-thcserv.tcl b/modules/0002-chanserv-thcserv.tcl
@@ -5,15 +5,15 @@ bind $::sock notc 77 "ping" lagresp
proc publag {cname msg} {
set from [lindex $msg 0 0]
- p10 privmsg $::sock 77 $from "\001PING [clock clicks -milliseconds] $cname \001"
+ $::maintype privmsg $::sock 77 $from "\001PING [clock clicks -milliseconds] $cname \001"
}
proc pubcoffee {cname msg} {
switch [expr {int(rand()*4)}] {
- 0 {p10 privmsg $::sock 77 $cname "\001ACTION hands [lindex $msg 1 0] a cup of espresso\001"}
- 1 {p10 privmsg $::sock 77 $cname "\001ACTION hands [lindex $msg 1 0] a cup of Latte\001"}
- 2 {p10 privmsg $::sock 77 $cname "\001ACTION hands [lindex $msg 1 0] a cup of instant coffee\001"}
- 3 {p10 privmsg $::sock 77 $cname "\001ACTION hands [lindex $msg 1 0] a cup of cappucino\001"}
+ 0 {$::maintype privmsg $::sock 77 $cname "\001ACTION hands [lindex $msg 1 0] a cup of espresso\001"}
+ 1 {$::maintype privmsg $::sock 77 $cname "\001ACTION hands [lindex $msg 1 0] a cup of Latte\001"}
+ 2 {$::maintype privmsg $::sock 77 $cname "\001ACTION hands [lindex $msg 1 0] a cup of instant coffee\001"}
+ 3 {$::maintype privmsg $::sock 77 $cname "\001ACTION hands [lindex $msg 1 0] a cup of cappucino\001"}
}
}
@@ -21,16 +21,16 @@ proc pubweed {cname msg} {
set payload [lindex $msg 1 0]
switch [expr {int(rand()*4)}] {
0 {
- p10 privmsg $::sock 77 $cname "\001ACTION packs a bowl of nugs and hands a bong to $payload\001"
+ $::maintype privmsg $::sock 77 $cname "\001ACTION packs a bowl of nugs and hands a bong to $payload\001"
}
1 {
- p10 privmsg $::sock 77 $cname "\001ACTION rolls a joint and hands to $payload\001"
+ $::maintype privmsg $::sock 77 $cname "\001ACTION rolls a joint and hands to $payload\001"
}
2 {
- p10 privmsg $::sock 77 $cname "\001ACTION fills the hookah with dried nugs and hands to $payload\001"
+ $::maintype privmsg $::sock 77 $cname "\001ACTION fills the hookah with dried nugs and hands to $payload\001"
}
3 {
- p10 privmsg $::sock 77 $cname "\001ACTION passes $payload the vape pen\001"
+ $::maintype privmsg $::sock 77 $cname "\001ACTION passes $payload the vape pen\001"
}
}
}
@@ -39,5 +39,5 @@ proc lagresp {from msg} {
set ms [lindex $msg 0 0]
set chan [lindex $msg 0 1]
set ni [tnda get "nick/$::netname($::sock)/$from"]
- p10 privmsg $::sock 77 $chan "$ni, your lag is [expr {[clock clicks -milliseconds] - $ms}] milliseconds according to your client and our measurements."
+ $::maintype privmsg $::sock 77 $chan "$ni, your lag is [expr {[clock clicks -milliseconds] - $ms}] milliseconds according to your client and our measurements."
}
diff --git a/modules/0003-weather.tcl b/modules/0003-weather.tcl
@@ -1,7 +1,7 @@
-p10 sendUid $::sock "W" "weather" "services." "services." 57 "Weather Services"
+$::maintype sendUid $::sock "W" "weather" "services." "services." 57 "Weather Services"
foreach {chan is} [nda get "weather/regchan"] {
if {1!=$is} {continue}
- p10 putjoin $::sock 57 [::base64::decode [string map {[ /} $chan]] [nda get "regchan/$chan/ts"]
+ $::maintype putjoin $::sock 57 [::base64::decode [string map {[ /} $chan]] [nda get "regchan/$chan/ts"]
tnda set "channels/$chan/ts" [nda get "regchan/$chan/$::netname($::sock)/ts"]
}
bind $::sock request "w" "-" weatherjoin
@@ -9,7 +9,7 @@ bind $::sock request "weather" "-" weatherjoin
proc weatherjoin {chan msg} {
set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
- p10 putjoin $::sock 57 $chan [nda get "regchan/$ndacname/ts"]
+ $::maintype putjoin $::sock 57 $chan [nda get "regchan/$ndacname/ts"]
nda set "weather/regchan/$ndacname" 1
}
@@ -190,7 +190,7 @@ proc wunderground::msg {chan logo textf text} {
set counter 0
while {$counter <= [llength $text]} {
if {[lindex $text $counter] != ""} {
- p10 privmsg $::sock 57 $chan "${logo} ${textf}[string map {\\\" \"} [lindex $text $counter]]"
+ $::maintype privmsg $::sock 57 $chan "${logo} ${textf}[string map {\\\" \"} [lindex $text $counter]]"
}
incr counter
}
diff --git a/modules/0004-limitserv.tcl b/modules/0004-limitserv.tcl
@@ -1,7 +1,7 @@
-p10 sendUid $::sock "L" "limitserv" "services." "services." 47 "Channel Limit Adjustment Services"
+$::maintype sendUid $::sock "L" "limitserv" "services." "services." 47 "Channel Limit Adjustment Services"
foreach {chan is} [nda get "limitserv/regchan"] {
if {1!=$is} {continue}
- p10 putjoin $::sock 47 [::base64::decode [string map {[ /} $chan]] [nda get "regchan/$chan/ts"]
+ $::maintype putjoin $::sock 47 [::base64::decode [string map {[ /} $chan]] [nda get "regchan/$chan/ts"]
tnda set "channels/$chan/ts" [nda get "regchan/$chan/$::netname($::sock)/ts"]
}
bind $::sock request "l" "-" limitservjoin
@@ -26,14 +26,14 @@ proc limitservdown {chan msg} {
proc limitservjoin {chan ft} {
set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
- p10 putjoin $::sock 47 $chan [nda get "regchan/$ndacname/ts"]
+ $::maintype putjoin $::sock 47 $chan [nda get "regchan/$ndacname/ts"]
nda set "limitserv/regchan/$ndacname" 1
}
proc limitservdo {} {
foreach {chan is} [nda get "limitserv/regchan"] {
if {1!=$is} {continue}
- p10 putmode $::sock 47 [::base64::decode [string map {[ /} $chan]] "+l" [expr {[tnda get "limitserv/$::netname($::sock)/$chan"] + 10}] [nda get "regchan/$chan/$::netname($::sock)/ts"]
+ $::maintype putmode $::sock 47 [::base64::decode [string map {[ /} $chan]] "+l" [expr {[tnda get "limitserv/$::netname($::sock)/$chan"] + 10}] [nda get "regchan/$chan/$::netname($::sock)/ts"]
}
after 60000 {limitservdo}
}
@@ -42,8 +42,8 @@ proc limitservdochan {cname msg} {
set chan [string map {/ [} [::base64::encode [string tolower $cname]]]
set from [lindex $msg 0 0]
if {150>[nda get "regchan/$chan/levels/[string tolower [tnda get "login/$::netname($::sock)/$from"]]"]} {
- p10 privmsg $::sock 47 $cname "You must be at least halfop to manually trigger autolimit on the channel."
+ $::maintype privmsg $::sock 47 $cname "You must be at least halfop to manually trigger autolimit on the channel."
return
}
- p10 putmode $::sock 47 $cname "+l" [expr {[tnda get "limitserv/$::netname($::sock)/$chan"] + 10}] [nda get "regchan/$chan/$::netname($::sock)/ts"]
+ $::maintype putmode $::sock 47 $cname "+l" [expr {[tnda get "limitserv/$::netname($::sock)/$chan"] + 10}] [nda get "regchan/$chan/$::netname($::sock)/ts"]
}
diff --git a/modules/0005-chanserv.tcl b/modules/0005-chanserv.tcl
@@ -32,7 +32,7 @@ proc chantopic {from msg} {
set topic [join [lrange [lindex $msg 0] 1 end] " "]
if {""==[tnda get "login/$::netname($::sock)/$from"]} {$::maintype notice $::sock 77 $from "You fail at life.";return}
set ndacname [string map {/ [} [::base64::encode [string tolower $cname]]]
- if {150>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$from"]]"] && ![matchattr [tnda get "login/$::netname($::sock)/$from"] lmno|lmno $cname]} {
+ if {150>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$::netname($::sock)/$from"]]"] && ![matchattr [tnda get "login/$::netname($::sock)/$from"] lmno|lmno $cname]} {
$::maintype privmsg $::sock 77 $cname "You must be at least halfop to change the stored channel topic."
return
}
@@ -101,7 +101,7 @@ proc upchanfant {cname msg} {
set from [lindex $msg 0 0]
if {""==[tnda get "login/$::netname($::sock)/$from"]} {$::maintype notice $::sock 77 $from "You fail at life.";return}
set ndacname [string map {/ [} [::base64::encode [string tolower $cname]]]
- if {1>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$from"]]"] && ![string match "\[olvmn\]" [nda get "eggcompat/attrs/$ndacname/[tnda get "login/$::netname($::sock)/$from"]"]]} {
+ if {1>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$::netname($::sock)/$from"]]"] && ![string match "\[olvmn\]" [nda get "eggcompat/attrs/$ndacname/[tnda get "login/$::netname($::sock)/$from"]"]]} {
$::maintype privmsg $::sock 77 $cname "You fail at life."
$::maintype privmsg $::sock 77 $cname "Channel not registered to you."
return
@@ -111,8 +111,10 @@ proc upchanfant {cname msg} {
set st ""
if {""!=[nda get "eggcompat/attrs/$ndacname/[tnda get "login/$::netname($::sock)/$from"]"]} {
if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |v $cname]} {set sm v}
- if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |l $cname]} {set sm h}
- if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |omn $cname]} {set sm o}
+ if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |l $cname]} {set sm [tnda get "pfx/halfop"]}
+ if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |o $cname]} {set sm o}
+ if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |m $cname]} {set sm [tnda get "pfx/protect"]}
+ if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |n $cname]} {set sm [tnda get "pfx/owner"]}
} {
if {$lev >= 1} {set sm "v"; append st "v"}
if {$lev >= 150} {set sm "h"; append st "l"}
@@ -121,7 +123,7 @@ proc upchanfant {cname msg} {
if {$lev >= 500} {append st "n"}
chattr [tnda get "login/$::netname($::sock)/$from"] +$st $cname
}
- $::maintype putmode $::sock 77 $cname $sm $from [tnda get "channels/$ndacname/$::netname($::sock)/ts"]
+ $::maintype putmode $::sock 77 $cname +$sm $from [tnda get "channels/$ndacname/$::netname($::sock)/ts"]
}
proc convertop {from msg} {
@@ -151,7 +153,7 @@ proc requestbot {cname msg} {
set bot [lindex $msg 1 0]
if {""==[tnda get "login/$::netname($::sock)/$from"]} {$::maintype notice $::sock 77 $from "You fail at life.";return}
set ndacname [string map {/ [} [::base64::encode [string tolower $cname]]]
- if {150>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$from"]]"] && ![matchattr [tnda get "login/$::netname($::sock)/$from"] lmno|lmno $cname]} {
+ if {150>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$::netname($::sock)/$from"]]"] && ![matchattr [tnda get "login/$::netname($::sock)/$from"] lmno|lmno $cname]} {
$::maintype privmsg $::sock 77 $cname "You fail at life."
$::maintype privmsg $::sock 77 $cname "You must be at least halfop to request $bot."
return
@@ -230,7 +232,7 @@ proc adduserchan {from msg} {
if {![string is integer $addlevel]} {return}
if {$addlevel > [nda get "regchan/$ndacname/levels/[tnda get "login/$::netname($::sock)/$from"]"]} {$::maintype notice $::sock 77 $from "You can't do that; you're not the channel's Dave";return}
if {[nda get "regchan/$ndacname/levels/$adduser"] > [nda get "regchan/$ndacname/levels/[tnda get "login/$::netname($::sock)/$from"]"]} {$::maintype notice $::sock 77 $from "You can't do that; the person you're changing the level of is more like Dave than you.";return}
- if {$adduser == [tnda get "login/$from"]} {$::maintype notice $::sock 77 $from "You can't change your own level, even if you're downgrading. Sorreh :/$::netname($::sock)/";return}
+ if {$adduser == [tnda get "login/$::netname($::sock)/$from"]} {$::maintype notice $::sock 77 $from "You can't change your own level, even if you're downgrading. Sorreh :/$::netname($::sock)/";return}
$::maintype notice $::sock 77 $from "Guess what? :) User added."
nda set "regchan/$ndacname/levels/[string tolower $adduser]" $addlevel
}
@@ -250,8 +252,10 @@ proc upchan {from msg} {
set st ""
if {""!=[nda get "eggcompat/attrs/$ndacname/[tnda get "login/$::netname($::sock)/$from"]"]} {
if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |v $cname]} {set sm v}
- if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |l $cname]} {set sm h}
- if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |omn $cname]} {set sm o}
+ if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |l $cname]} {set sm [tnda get "pfx/halfop"]}
+ if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |o $cname]} {set sm o}
+ if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |m $cname]} {set sm [tnda get "pfx/protect"]}
+ if {[matchattr [tnda get "login/$::netname($::sock)/$from"] |n $cname]} {set sm [tnda get "pfx/owner"]}
} {
if {$lev >= 1} {set sm "v"; append st "v"}
if {$lev >= 150} {set sm "h"; append st "l"}
@@ -260,7 +264,7 @@ proc upchan {from msg} {
if {$lev >= 500} {append st "n"}
chattr [tnda get "login/$::netname($::sock)/$from"] +$st $cname
}
- $::maintype putmode $::sock 77 $cname $sm $from [tnda get "channels/$ndacname/$::netname($::sock)/ts"]
+ $::maintype putmode $::sock 77 $cname +$sm $from [tnda get "channels/$ndacname/$::netname($::sock)/ts"]
}
proc regnick {from msg} {
diff --git a/modules/0007-quote.tcl b/modules/0007-quote.tcl
@@ -1,7 +1,7 @@
-p10 sendUid $::sock "Q" "quoteserv" "services." "services." 107 "Quote Storage Services"
+$::maintype sendUid $::sock "Q" "quoteserv" "services." "services." 107 "Quote Storage Services"
foreach {chan is} [nda get "quoteserv/regchan"] {
if {1!=$is} {continue}
- p10 putjoin $::sock 107 [::base64::decode [string map {[ /} $chan]] [nda get "regchan/$chan/ts"]
+ $::maintype putjoin $::sock 107 [::base64::decode [string map {[ /} $chan]] [nda get "regchan/$chan/ts"]
tnda set "channels/$chan/ts" [nda get "regchan/$chan/$::netname($::sock)/ts"]
}
bind $::sock request "q" "-" quoteservjoin
@@ -11,7 +11,7 @@ bind $::sock pub "-" "!q" quoteservdo
proc quoteservjoin {chan msg} {
set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
- p10 putjoin $::sock 107 $chan [nda get "regchan/$ndacname/ts"]
+ $::maintype putjoin $::sock 107 $chan [nda get "regchan/$ndacname/ts"]
nda set "quoteserv/regchan/$ndacname" 1
}
@@ -31,37 +31,37 @@ proc quoteservdo {chan msg} {
"sea*" {
set ptn "*[join $para " "]*"
set qts [quotesearch $chan $ptn]
- if {[llength $qts]} {p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] Found quotes numbered #[join $qts ",#"]"} {
- p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] No quotes found for pattern"
+ if {[llength $qts]} {$::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] Found quotes numbered #[join $qts ",#"]"} {
+ $::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] No quotes found for pattern"
}
}
"vi*1st*ma*" {
set ptn "*[join $para " "]*"
set qts [quotesearch $chan $ptn]
- if {[llength $qts]} {set qtn [lindex $qts 0];p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] Quote number #$qtn:";p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] [nda get "quoteserv/quotes/$ndacname/$qtn"]"} {
- p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] No quotes found for pattern"
+ if {[llength $qts]} {set qtn [lindex $qts 0];$::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] Quote number #$qtn:";$::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] [nda get "quoteserv/quotes/$ndacname/$qtn"]"} {
+ $::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] No quotes found for pattern"
}
}
"ad*" {
set qt [join $para " "]
set qtn [expr {([llength [nda get "quoteserv/quotes/$ndacname"]]/2)+3}]
nda set "quoteserv/quotes/$ndacname/$qtn" $qt
- p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] Added quote number #$qtn to database."
+ $::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] Added quote number #$qtn to database."
}
"de*" {
set qtn "[lindex $para 0]"
- if {![string is integer $qtn]} {p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] Please use a valid integer (without the #)"}
- if {150>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$::netname($::sock)/$from"]]"]} {p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] Check your privilege."}
+ if {![string is integer $qtn]} {$::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] Please use a valid integer (without the #)"}
+ if {150>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$::netname($::sock)/$from"]]"]} {$::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] Check your privilege."}
nda set "quoteserv/quotes/$ndacname/$qtn" ""
- p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] Blanked quote number #$qtn in database."
+ $::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] Blanked quote number #$qtn in database."
}
"vi*" {
set qtn "[lindex $para 0]"
- if {![string is integer $qtn]} {p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] Please use a valid integer (without the #)"}
+ if {![string is integer $qtn]} {$::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] Please use a valid integer (without the #)"}
set qt [nda get "quoteserv/quotes/$ndacname/$qtn"]
if {$qt != ""} {
- p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] Quote number #$qtn:"
- p10 privmsg $::sock 107 $chan "\[\002Quotes\002\] $qt"
+ $::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] Quote number #$qtn:"
+ $::maintype privmsg $::sock 107 $chan "\[\002Quotes\002\] $qt"
}
}
"he*" {
@@ -73,7 +73,7 @@ proc quoteservdo {chan msg} {
!quote del - Delete quote. Requires halfops or above.
End of help for Q.}
foreach {helpline} [split $helpfile "\r\n"] {
- p10 notice $::sock 107 $from $helpline
+ $::maintype notice $::sock 107 $from $helpline
}
}
}