commit 1bc4ae6647da72ffba1b701ee6c1578148073638
parent d3273dc58a9a5896c5ec048d132ecfc6c37e2bf8
Author: Jaffa Cake <j4jackj@template.hostname>
Date: Sun, 10 Aug 2014 15:34:22 -0400
added better-workable TS6 support.
Diffstat:
4 files changed, 37 insertions(+), 22 deletions(-)
diff --git a/core/0003-ts6.tcl b/core/0003-ts6.tcl
@@ -133,11 +133,12 @@ proc ::ts6::irc-main {sck} {
set v [string range $val 1 end]
set mod [split $v ")"]
set modechar [split [lindex $mod 1] {}]
- puts stdout "$key $val"
set modepref [split [lindex $mod 0] {}]
+ puts stdout "$key $val $modechar $modepref"
foreach {c} $modechar {x} $modepref {
- tnda set "ts6/$::netname($sck)/prefix/$modepref" $modechar
+ tnda set "ts6/prefix/$c" $x
}
+ puts stdout [tnda get "ts6/prefix"]
}
}
}
@@ -201,7 +202,8 @@ proc ::ts6::irc-main {sck} {
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]
+ tnda set "channels/$::netname($sck)/$chan/ts" [lindex $comd 2]
+ tnda set "userchan/[lindex $comd 0]/$chan" 1
}
"TMODE" {
@@ -235,8 +237,10 @@ proc ::ts6::irc-main {sck} {
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)/prefix/$c"]}
- append $state $c
+ puts stdout "$c $nick"
+ if {$state == "uo" && [info exists ::pfx($c)]} {set c $::pfx($c) ; }
+ if {"un"==$state} {append un $c}
+ if {"uo"==$state} {append uo $c}
}
puts stdout "$uo $un"
if {""!=$uo} {tnda set "channels/$::netname($sck)/$chan/modes/$un" $uo}
@@ -247,6 +251,8 @@ proc ::ts6::irc-main {sck} {
"PART" {
callbind $sck part "-" "-" [lindex $comd 2] [lindex $comd 0]
+ set chan [string map {/ [} [::base64::encode [string tolower [lindex $comd 2]]]]
+ tnda set "userchan/[lindex $comd 0]/$chan" 0
}
"KICK" {
@@ -283,6 +289,9 @@ proc ::ts6::irc-main {sck} {
tnda set "ident/$::netname($sck)/[lindex $comd 0]" ""
tnda set "rhost/$::netname($sck)/[lindex $comd 0]" ""
tnda set "vhost/$::netname($sck)/[lindex $comd 0]" ""
+ foreach {chan _} [tnda get "userchan/[lindex $comd 0]"] {
+ tnda set "userchan/[lindex $comd 0]/$chan" 0
+ }
}
"KILL" {
diff --git a/modules/0001-eggcompat.tcl b/modules/0001-eggcompat.tcl
@@ -286,10 +286,6 @@ proc msgchattr {from msg} {
set attrs [lindex $msg 0 1]
set chan [lindex $msg 0 2]
set ch [lindex $msg 0 2]
- if {$chan==""} {
- set chan "*"
- set ch "global"
- }
foreach {c} [split $attrs {}] {
if {$c == "+"} {continue}
if {$c == "-"} {continue}
@@ -304,9 +300,10 @@ proc msgchattr {from msg} {
return
}
}
- if {"*"!=$chan} {chattr $hand $attrs} {chattr $hand $attrs $chan}
+ if {""==$chan} {chattr $hand $attrs} {chattr $hand $attrs $chan}
$::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]"]"}
+ if {""==[nda get "regchan/$ndacname/levels/[string tolower $hand]"]} {nda set "regchan/$ndacname/levels/[string tolower $hand]" 1}
+ if {$ch != ""} {$::maintype notice $::sock 77 $from "Flags on $chan for $hand are now [nda get "eggcompat/attrs/$ndacname/[string tolower $handle]"]"}
}
proc nick2hand {nick} {
diff --git a/modules/0004-limitserv.tcl b/modules/0004-limitserv.tcl
@@ -10,18 +10,20 @@ bind $::sock join "-" "-" limitservup
bind $::sock part "-" "-" limitservdown
bind $::sock pub "-" "!dolimit" limitservdochan
-after 60000 {limitservdo}
+#after 60000 {limitservdo}
proc limitservup {chan msg} {
set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
if {""==[tnda get "limitserv/$::netname($::sock)/$ndacname"]} {set i 1} {set i [expr {[tnda get "limitserv/$::netname($::sock)/$ndacname"] + 1}]}
tnda set "limitserv/$::netname($::sock)/$ndacname" $i
+ intlimitservdochan $chan
}
proc limitservdown {chan msg} {
set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
if {""==[tnda get "limitserv/$::netname($::sock)/$ndacname"]} {set i 0} {set i [expr {[tnda get "limitserv/$::netname($::sock)/$ndacname"] - 1}]}
tnda set "limitserv/$::netname($::sock)/$ndacname" $i
+ intlimitservdochan $chan
}
proc limitservjoin {chan ft} {
@@ -33,7 +35,9 @@ proc limitservjoin {chan ft} {
proc limitservdo {} {
foreach {chan is} [nda get "limitserv/regchan"] {
if {1!=$is} {continue}
- $::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"]
+ if {[tnda get "limitserv/$::netname($::sock)/$chan"] == [tnda get "limitserv/last/$::netname($::sock)/$chan"]} {continue}
+ $::maintype putmode $::sock 47 [::base64::decode [string map {[ /} $chan]] "+l" [expr {[tnda get "limitserv/$::netname($::sock)/$chan"] + 10}] [nda get "regchan/$chan/ts"]
+ tnda set "limitserv/last/$::netname($::sock)/$chan" [tnda get "limitserv/$::netname($::sock)/$chan"]
}
after 60000 {limitservdo}
}
@@ -45,5 +49,10 @@ proc limitservdochan {cname msg} {
$::maintype privmsg $::sock 47 $cname "You must be at least halfop to manually trigger autolimit on the channel."
return
}
- $::maintype 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/ts"]
+}
+
+proc intlimitservdochan {cname} {
+ set chan [string map {/ [} [::base64::encode [string tolower $cname]]]
+ $::maintype putmode $::sock 47 $cname "+l" [expr {[tnda get "limitserv/$::netname($::sock)/$chan"] + 10}] [nda get "regchan/$chan/ts"]
}
diff --git a/modules/0005-chanserv.tcl b/modules/0005-chanserv.tcl
@@ -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/$::netname($::sock)/$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"]]"]) && ![matchattr [tnda get "login/$::netname($::sock)/$from"] aolvmn|olvmn $cname]} {
$::maintype privmsg $::sock 77 $cname "You fail at life."
$::maintype privmsg $::sock 77 $cname "Channel not registered to you."
return
@@ -123,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/$::netname($::sock)/$ndacname/ts"]
}
proc convertop {from msg} {
@@ -210,17 +210,17 @@ proc regchan {from msg} {
$::maintype notice $::sock 77 $from "Channel already exists."
return
}
- if {-1==[string first "o" [tnda get "channels/$ndacname/modes/$::netname($::sock)/$from"]]} {
+ if {-1==[string first "o" [tnda get "channels/$::netname($::sock)/$ndacname/modes/$from"]]} {
$::maintype notice $::sock 77 $from "You fail at life."
$::maintype notice $::sock 77 $from "You are not an operator."
return
}
$::maintype notice $::sock 77 $from "Guess what? :)"
nda set "regchan/$ndacname/levels/[tnda get "login/$::netname($::sock)/$from"]" 500
- nda set "regchan/$ndacname/ts" [tnda get "channels/$ndacname/$::netname($::sock)/ts"]
- $::maintype putjoin $::sock 77 $cname [tnda get "channels/$ndacname/$::netname($::sock)/ts"]
+ nda set "regchan/$ndacname/ts" [tnda get "channels/$::netname($::sock)/$ndacname/ts"]
+ $::maintype putjoin $::sock 77 $cname [tnda get "channels/$::netname($::sock)/$ndacname/ts"]
chattr [tnda get "login/$::netname($::sock)/$from"] +mno $cname
- callbind $::sock "reg" "-" "-" $cname [tnda get "channels/$ndacname/$::netname($::sock)/ts"]
+ callbind $::sock "reg" "-" "-" $cname [tnda get "channels/$::netname($::sock)/$ndacname/ts"]
}
proc adduserchan {from msg} {
@@ -242,7 +242,7 @@ proc upchan {from msg} {
if {""==[tnda get "login/$::netname($::sock)/$from"]} {$::maintype notice $::sock 77 $from "You fail at life.";return}
set cname [lindex $msg 0 0]
set ndacname [string map {/ [} [::base64::encode [string tolower $cname]]]
- if {1>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$::netname($::sock)/$from"]]"]} {
+ if {1>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$::netname($::sock)/$from"]]"] && ![matchattr [tnda get "login/$::netname($::sock)/$from"] aolvmn|olvmn $cname]} {
$::maintype notice $::sock 77 $from "You fail at life."
$::maintype notice $::sock 77 $from "Channel not registered to you."
return
@@ -264,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/$::netname($::sock)/$ndacname/ts"]
}
proc regnick {from msg} {