tclserv

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 34f646f25679c01344b0f432b8e21f218ac8ee92
parent 21b7fd4d58f57f9e9b3ef619b3d248e1bec1fdd0
Author: Ellenor Malik ellenor@umbrellix.net <j4jackj@gmx.com>
Date:   Wed, 26 Sep 2018 15:32:13 -0700

rawrgh

Diffstat:
Acore/0002-statemachine.tcl | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcore/0999-conn.tcl | 5+++--
Mcore/2003-ts6.tcl | 58++++++++++++++++++++++++++++++----------------------------
Mlanguage.txt | 1+
Mmodules/debugserv.tcl | 14+++++++++++++-
Mmodules/quoteserv.tcl | 99++++++++++++++++++++++++++++++-------------------------------------------------
6 files changed, 174 insertions(+), 92 deletions(-)

diff --git a/core/0002-statemachine.tcl b/core/0002-statemachine.tcl @@ -0,0 +1,89 @@ + +proc nick2uid {sck nick} { + foreach {u n} [tnda get "nick/$::netname($sck)"] { + if {[string tolower $n] == [string tolower $nick]} {return $u} + } + return "" +} +proc intclient2uid {sck nick} { + foreach {u n} [tnda get "intclient/$::netname($sck)"] { + if {[string tolower $n] == [string tolower $nick]} {return $u} + } + return "" +} +proc uid2nick {sck u} { + return [tnda get "nick/$::netname($sck)/$u"] +} +proc uid2rhost {sck u} { + return [tnda get "rhost/$::netname($sck)/$u"] +} +proc uid2host {sck u} { + return [tnda get "vhost/$::netname($sck)/$u"] +} +proc uid2ident {sck u} { + return [tnda get "ident/$::netname($sck)/$u"] +} +proc nick2host {sck nick} { + return [tnda get "vhost/$::netname($sck)/[nick2uid $netname $nick]"] +} +proc nick2ident {sck nick} { + return [tnda get "ident/$::netname($sck)/[nick2uid $netname $nick]"] +} +proc nick2rhost {sck nick} { + return [tnda get "rhost/$::netname($sck)/[nick2uid $netname $nick]"] +} +proc nick2ipaddr {sck nick} { + return [tnda get "ipaddr/$::netname($sck)/[nick2uid $netname $nick]"] +} +proc getts {sck chan} { + return [tnda get "channels/$::netname($sck)/[ndaenc $chan]/ts"] +} +proc getpfx {sck chan nick} { + return [tnda get "channels/$::netname($sck)/[ndaenc $chan]/modes/[nick2uid $netname $nick]"] +} +proc getupfx {sck chan u} { + return [tnda get "channels/$::netname($sck)/[ndaenc $chan]/modes/$u"] +} +proc getpfxchars {sck modes} { + set o "" + foreach {c} [split $modes {}] { + append o [nda get "netinfo/$::netname($sck)/prefix/$c"] + } + return $o +} +proc getmetadata {sck nick metadatum} { + return [tnda get "metadata/$::netname($sck)/[nick2uid $netname $nick]/[ndcenc $metadatum]"] +} +proc getcertfp {sck nick} { + return [tnda get "certfps/$::netname($sck)/[nick2uid $netname $nick]"] +} + +proc checkop {mc s c p n} { + set f $s + set t $c + if {[tnda get "netinfo/$n/pfxchar/$mc"]==""} {return} +putcmdlog "up $mc $f $t $p $n" + set chan [string map {/ [} [::base64::encode [string tolower $t]]] + tnda set "channels/$n/$chan/modes/$p" [format {%s%s} [string map [list $mc ""] [tnda get "channels/$n/$chan/modes/$p"]] $mc] +} + +proc checkdeop {mc s c p n} { + set f $s + set t $c + if {[tnda get "netinfo/$n/pfxchar/$mc"]==""} {return} +putcmdlog "down $mc $f $t $p $n" + set chan [string map {/ [} [::base64::encode [string tolower $t]]] + tnda set "channels/$n/$chan/modes/$p" [string map [list $mc ""] [tnda get "channels/$n/$chan/modes/$p"]] +} + +proc uid2intclient {sck u} { + return [tnda get "intclient/$::netname($sck)/$u"] +} + +proc getfreeuid {sck} { +set work 1 +set cns [list] +foreach {_ cnum} [tnda get "intclient/$::netname($sck)"] {lappend cns $cnum} +while {0!=$work} {set num [expr {[rand 30000]+10000}];if {[lsearch -exact $cns $num]==-1} {set work 0}} +return $num +} diff --git a/core/0999-conn.tcl b/core/0999-conn.tcl @@ -39,14 +39,15 @@ proc mknetwork {headlines block} { lappend pfx $p lappend pfx $m } - tnda set "ts6/$netname/prefix" $pfx + tnda set "netinfo/$netname/prefix" $pfx } { # safe defaults, will cover charybdis and chatircd - tnda set "ts6/$netname/prefix" [list @ o % h + v] + tnda set "netinfo/$netname/prefix" [list @ o % h + v] } # open a connection set socke [connect $host $port [list $proto irc-main]] after 500 $proto login $socke $numeric $pass $netname $servername + llbind - dead - $socke [list after 5000 [list mknetwork $headlines $block]] # store it up # postblock network $headlines $block } diff --git a/core/2003-ts6.tcl b/core/2003-ts6.tcl @@ -44,7 +44,7 @@ proc ::ts6::sendUid {sck nick ident host dhost uid {realname "* Unknown *"} {mod set sendid [::ts6::b64e $uid] set sendnn [string repeat "A" [expr {6-[string length $sendid]}]] append sendnn $sendid - if {![tnda get "ts6/$::netname($sck)/euid"]} { + if {![tnda get "netinfo/$::netname($sck)/euid"]} { 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 %s 0 %s%s %s * :%s" $sid $nick [clock format [clock seconds] -format %s] $modes $ident $dhost $sid $sendnn $host $realname] @@ -80,7 +80,7 @@ proc ::ts6::setnick {sck uid newnick} { proc ::ts6::sethost {sck targ topic} { set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::sid($sck)]]}]] append sid [::ts6::b64e $::sid($sck)] - if {![tnda get "ts6/$::netname($sck)/euid"]} { + if {![tnda get "netinfo/$::netname($sck)/euid"]} { putl $sck [format ":%s ENCAP * CHGHOST %s %s" $sid $targ $topic] } { putl $sck [format ":%s CHGHOST %s %s" $sid $targ $topic] @@ -231,7 +231,7 @@ proc ::ts6::putjoin {sck uid targ {ts ""}} { proc ::ts6::validchan {sck channelname} { if {[string is digit [string index $channelname 0]] && [string length $channelname] == 9} {return 0} ;# valid handle, not valid channel - if {[string first [string index $channelname 0] [tnda get "ts6/$::netname($sck)/[ndaenc CHANTYPES]"]] != -1} {return 1} ;# could be valid channel, so let's just say yes + if {[string first [string index $channelname 0] [tnda get "netinfo/$::netname($sck)/[ndaenc CHANTYPES]"]] != -1} {return 1} ;# could be valid channel, so let's just say yes } proc ::ts6::quitstorm {sck sid comment {doinit 1}} { @@ -256,6 +256,7 @@ proc ::ts6::irc-main {sck} { putl stdout "We're dead, folks." # firellbind $sck evnt "-" "ts6.dead" $::netname($sck) $sck firellbind $sck evnt "-" "dead" $::netname($sck) $sck + firellbind - evnt "-" "dead" $sck $::netname($sck) close $sck } gets $sck line @@ -302,14 +303,15 @@ proc ::ts6::irc-main {sck} { } "SQUIT" { - set sid [string repeat "0" [expr {3-[string length [::ts6::b64e $::sid($sck)]]}]];append sid [::ts6::b64e $::sid($sck)] + set ssid [string repeat "0" [expr {3-[string length [::ts6::b64e $::sid($sck)]]}]];append ssid [::ts6::b64e $::sid($sck)] set failedserver [lindex $comd [expr {$one + 1}]] # is it us? - if {$failedserver == $sid} { + if {$failedserver == $ssid} { #yes, it's us. putcmdlog "We're dead, folks." firellbind $sck evnt "-" "ts6.dead" $::netname($sck) firellbind $sck evnt "-" "dead" $::netname($sck) + firellbind - evnt "-" "dead" $sck $::netname($sck) return } # Mark all servers with an uplink in failedservers as split @@ -346,37 +348,37 @@ proc ::ts6::irc-main {sck} { foreach {key val} [split $tok "="] { if {$key == "PREFIX"} { # We're in luck! Server advertises its PREFIX in VERSION reply to servers. - if {[tnda get "ts6/$::netname($sck)/pfxissjoin"] == 1} {continue} + if {[tnda get "netinfo/$::netname($sck)/pfxissjoin"] == 1} {continue} set v [string range $val 1 end] set mod [split $v ")"] set modechar [split [lindex $mod 1] {}] set modepref [split [lindex $mod 0] {}] foreach {c} $modechar {x} $modepref { - tnda set "ts6/$::netname($sck)/prefix/$c" $x + tnda set "netinfo/$::netname($sck)/prefix/$c" $x } foreach {x} $modechar {c} $modepref { - tnda set "ts6/$::netname($sck)/pfxchar/$c" $x + tnda set "netinfo/$::netname($sck)/pfxchar/$c" $x } } elseif {$key == "SJOIN"} { # We're in luck! Server advertises its PREFIX in VERSION reply to servers. - tnda set "ts6/$::netname($sck)/pfxissjoin" 1 + tnda set "netinfo/$::netname($sck)/pfxissjoin" 1 set v [string range $val 1 end] set mod [split $v ")"] set modechar [split [lindex $mod 1] {}] set modepref [split [lindex $mod 0] {}] foreach {c} $modechar {x} $modepref { - tnda set "ts6/$::netname($sck)/prefix/$c" $x + tnda set "netinfo/$::netname($sck)/prefix/$c" $x } foreach {x} $modechar {c} $modepref { - tnda set "ts6/$::netname($sck)/pfxchar/$c" $x + tnda set "netinfo/$::netname($sck)/pfxchar/$c" $x } } elseif {$key == "CHANMODES"} { set spt [split $val ","] - tnda set "ts6/$::netname($sck)/chmparm" [format "%s%s" [lindex $spt 0] [lindex $spt 1]] - tnda set "ts6/$::netname($sck)/chmpartparm" [lindex $spt 2] - tnda set "ts6/$::netname($sck)/chmnoparm" [lindex $spt 3] + tnda set "netinfo/$::netname($sck)/chmparm" [format "%s%s" [lindex $spt 0] [lindex $spt 1]] + tnda set "netinfo/$::netname($sck)/chmpartparm" [lindex $spt 2] + tnda set "netinfo/$::netname($sck)/chmnoparm" [lindex $spt 3] } else { - tnda set "ts6/$::netname($sck)/[ndaenc $key]" $val + tnda set "netinfo/$::netname($sck)/[ndaenc $key]" $val } } } @@ -395,7 +397,7 @@ proc ::ts6::irc-main {sck} { } "NOTICE" { - if {![tnda get "ts6/$::netname($sck)/connected"]} {return} + if {![tnda get "netinfo/$::netname($sck)/connected"]} {return} if {[::ts6::validchan $sck [lindex $comd 2]]} { set client chan firellbind $sck pubnotc "-" [string tolower [lindex [split $payload " "] 0]] [lindex $comd 2] [lindex $comd 0] [join [lrange [split $payload " "] 1 end] " "] @@ -447,7 +449,7 @@ proc ::ts6::irc-main {sck} { set state 1 } elseif {$c == "-"} { set state 0 - } elseif {[string match [format "*%s*" $c] [tnda get "ts6/$::netname($sck)/chmparm"]] || ($state&&[string match [format "*%s*" $c] [tnda get "ts6/$::netname($sck)/chmpartparm"]])} { + } elseif {[string match [format "*%s*" $c] [tnda get "netinfo/$::netname($sck)/chmparm"]] || ($state&&[string match [format "*%s*" $c] [tnda get "netinfo/$::netname($sck)/chmpartparm"]])} { firellbind $sck mode "-" [expr {$state ? "+" : "-"}] $c [lindex $comd 0] [lindex $comd 3] [lindex $comd [incr ctr]] $::netname($sck) } else { firellbind $sck mode "-" [expr {$state ? "+" : "-"}] $c [lindex $comd 0] [lindex $comd 3] "" $::netname($sck) @@ -476,10 +478,10 @@ proc ::ts6::irc-main {sck} { set uo "" set state uo set un [string range $nick end-8 end] - set uo [string map [tnda get "ts6/$::netname($sck)/prefix"] [string range $nick 0 end-9]] + set uo [string map [tnda get "netinfo/$::netname($sck)/prefix"] [string range $nick 0 end-9]] # foreach {c} [split $nick {}] { # if {[string is digit $c]} {set state un} -# if {$state == "uo"} {set c [tnda get "ts6/$::netname($sck)/prefix/$c"] ; } +# if {$state == "uo"} {set c [tnda get "netinfo/$::netname($sck)/prefix/$c"] ; } # if {"un"==$state} {append un $c} # if {"uo"==$state} {append uo $c} # } @@ -643,11 +645,11 @@ proc ::ts6::irc-main {sck} { } "CAPAB" { - tnda set "ts6/$::netname($sck)/euid" 0 + tnda set "netinfo/$::netname($sck)/euid" 0 foreach {cw} [split $payload " "] { - if {$cw == "EUID"} {tnda set "ts6/$::netname($sck)/euid" 1} + if {$cw == "EUID"} {tnda set "netinfo/$::netname($sck)/euid" 1} } - tnda set "ts6/$::netname($sck)/connected" 1 + tnda set "netinfo/$::netname($sck)/connected" 1 } "PING" { @@ -673,12 +675,12 @@ proc ::ts6::login {sck {osid "42"} {password "link"} {servname "net"} {servernam set sock($servname) $sck set sid($sck) $osid set sid($servname) $osid - tnda set "ts6/$::netname($sck)/connected" 0 - tnda set "ts6/$::netname($sck)/euid" 0 + tnda set "netinfo/$::netname($sck)/connected" 0 + tnda set "netinfo/$::netname($sck)/euid" 0 #if {$halfops == ""} {tnda set "pfx/halfop" v} {tnda set "pfx/halfop" $halfops} #if {![info exists ::ts6(ownermode)]} {tnda set "pfx/owner" o} {tnda set "pfx/owner" $ownermode)} #if {![info exists ::ts6(protectmode)]} {tnda set "pfx/protect" o} {tnda set "pfx/protect" $protectmode} - if {$useeuid == ""} {tnda set "ts6/$::netname($sck)/euid" 1} {tnda set "ts6/$::netname($sck)/euid" $useeuid} + if {$useeuid == ""} {tnda set "netinfo/$::netname($sck)/euid" 1} {tnda set "netinfo/$::netname($sck)/euid" $useeuid} putl $sck "PASS $password TS 6 :$num" putl $sck "CAPAB :UNKLN BAN KLN RSFNC EUID ENCAP IE EX CLUSTER EOPMOD SVS SERVICES QS" @@ -741,7 +743,7 @@ proc ::ts6::getupfx {sck chan u} { proc ::ts6::getpfxchars {sck modes} { set o "" foreach {c} [split $modes {}] { - append o [nda get "ts6/$::netname($sck)/prefix/$c"] + append o [nda get "netinfo/$::netname($sck)/prefix/$c"] } return $o } @@ -755,7 +757,7 @@ proc ::ts6::getcertfp {sck nick} { proc ::ts6::checkop {mc s c p n} { set f $s set t $c - if {[tnda get "ts6/$n/pfxchar/$mc"]==""} {return} + if {[tnda get "netinfo/$n/pfxchar/$mc"]==""} {return} putcmdlog "up $mc $f $t $p $n" set chan [string map {/ [} [::base64::encode [string tolower $t]]] tnda set "channels/$n/$chan/modes/$p" [format {%s%s} [string map [list $mc ""] [tnda get "channels/$n/$chan/modes/$p"]] $mc] @@ -764,7 +766,7 @@ putcmdlog "up $mc $f $t $p $n" proc ::ts6::checkdeop {mc s c p n} { set f $s set t $c - if {[tnda get "ts6/$n/pfxchar/$mc"]==""} {return} + if {[tnda get "netinfo/$n/pfxchar/$mc"]==""} {return} putcmdlog "down $mc $f $t $p $n" set chan [string map {/ [} [::base64::encode [string tolower $t]]] tnda set "channels/$n/$chan/modes/$p" [string map [list $mc ""] [tnda get "channels/$n/$chan/modes/$p"]] diff --git a/language.txt b/language.txt @@ -20,3 +20,4 @@ quoteserv.enopriv 14>5>4> You do not have the required privileges to execute quoteserv.removed 14>3>9> Removed quote number %s (by %s) from database. quoteserv.removedcontents 14>2>12> Removed quote was: %s quoteserv.left 14>7>8> The quote service was requested to leave by %s. Ja mata! +quoteserv.disabled 14>7>8> Sorry, the quote service is disabled for %s. diff --git a/modules/debugserv.tcl b/modules/debugserv.tcl @@ -32,10 +32,15 @@ proc debugservenabled {chan} { return 1 } +proc debugserv.armdns {headline block} { + +} + proc debugserv.oneintro {headline block} { set net [lindex $headline 0] set nsock $::sock($net) - dictassign $block logchan logchan nick nick ident ident host host modes modes realname realname rehashprivs rehashprivs idcommand nspass nickserv nickserv nsserv nsserv + dictassign $block logchan logchan nick nick ident ident host host modes modes realname realname rehashprivs rehashprivs idcommand nspass nickserv nickserv nsserv nsserv \ + dnsconf dnsconf tnda set "debugserv/$net/rehashprivs" $rehashprivs tnda set "debugserv/$net/logchan" $logchan #tnda set "debugserv/$net/nspass" $nspass @@ -68,10 +73,17 @@ proc debugserv.oneintro {headline block} { llbind $nsock msg [tnda get "debugserv/$net/ourid"] "metadata" [list debugserv.metadata $net] llbind $nsock msg [tnda get "debugserv/$net/ourid"] "rehash" [list debugserv.rehash $net] # llbind $nsock pub - "gettext" [list debugserv.gettext $net] + llbind $nsock pub - "!usage" [list debugserv.pusage $net] + debugserv.armdns $headline $dnsconf puts stdout "llbind $nsock msg [tnda get "debugserv/$net/ourid"] metadata [list debugserv.metdata $net]" puts stdout [format "Connected for %s: %s %s %s" $net $nick $ident $host] } +proc debugserv.pusage {n c i m} { + set uptime [exec uptime] + % [expr {$c != $i ? "privmsg" : "notice"}] [tnda get "debugserv/$n/ourid"] $c $uptime +} + proc debugserv.rehash {n i m} {debugserv.crehash $n $i $i $m} proc debugserv.crehash {n c i m} { diff --git a/modules/quoteserv.tcl b/modules/quoteserv.tcl @@ -113,6 +113,7 @@ quoteserv.usevalidint ^C14>^C5>^C4>^C Please use a valid integer, without the #. quoteserv.enopriv ^C14>^C5>^C4>^C You do not have the required privileges to execute the command queued (requires flags +%s in ChanServ, or oper permissions %$ quoteserv.removed ^C14>^C3>^C9>^C Removed quote number %s (by %s) from database. quoteserv.removedcontents ^C14>^C2>^C12>^C Removed quote was: %s +quoteserv.disabled >>> Sorry, I'm disabled for %s. } proc quoteservdo {n chan from m} { @@ -123,77 +124,65 @@ proc quoteservdo {n chan from m} { set subcmd [lindex [split $m " "] 0] set para [lrange [split $m " "] 1 end] set opara [lrange [split $m " "] 1 end] + if {$chan == 0} { + set chan [string tolower [lindex $opara 0]] + set targ $from + set ndacname [string map {/ [} [::base64::encode [string tolower [lindex $opara 0]]]] + set para [lrange $para 1 end] + if {![quoteservenabled [lindex $opara 0]]} { + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.disabled $chan] + return + } + } else { + set targ $chan + } switch -nocase -glob -- $subcmd { "se*" { - if {$chan == 0} { - set chan $from - set ndacname [string map {/ [} [::base64::encode [string tolower [lindex $opara 0]]]] - set para [lrange $para 1 end] - if {![quoteservenabled [lindex $opara 0]]} {return} - } set ptn [format "*%s*" [join $para " "]] set qts [quotesearch $chan $ptn] if {[llength $qts] != 0} { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.results #[join $qts ", #"]] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.results #[join $qts ", #"]] } { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.noresults] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.noresults] } } "vi*1st*ma*" { - if {$chan == 0} { - set chan $from - set ndacname [string map {/ [} [::base64::encode [string tolower [lindex $opara 0]]]] - set para [lrange $para 1 end] - if {![quoteservenabled [lindex $opara 0]]} {return} - } set ptn [format "*%s*" [join $para " "]] set qts [quotesearch $chan $ptn] if {[llength $qts]} { set qtn [lindex $qts 0] set qt [nda get "quoteserv/[curctx net]/quotes/$ndacname/q$qtn"] set qb [nda get "quoteserv/[curctx net]/quotes/$ndacname/u$qtn"] - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.qheader $qtn $qb] - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.quote $qt] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.qheader $qtn $qb] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.quote $qt] } { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.noresults] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.noresults] } } "ad*" { - if {$chan == 0} { - set chan $from - set ndacname [string map {/ [} [::base64::encode [string tolower [lindex $opara 0]]]] - set para [lrange $para 1 end] - if {![quoteservenabled [lindex $opara 0]]} {return} - } set qt [join $para " "] set qtn [expr {([llength [nda get "quoteserv/[curctx net]/quotes/$ndacname"]]/6)+1}] nda set "quoteserv/[curctx net]/quotes/$ndacname/q$qtn" $qt nda set "quoteserv/[curctx net]/quotes/$ndacname/u$qtn" [format "(%s) %s!%s@%s" [tnda get "login/[curctx net]/$from"] [% uid2nick $from] [% uid2ident $from] [% uid2host $from]] nda set "quoteserv/[curctx net]/quotes/$ndacname/a$qtn" [string tolower [tnda get "login/[curctx net]/$from"]] - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.added $qtn] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.added $qtn] } "gad*" { set qt [join $para " "] set qtn [expr {([llength [nda get "quoteserv/[curctx net]/quotes/$ndacname"]]/6)+3}] if {![operHasPrivilege [curctx net] $from [tnda get "quoteserv/[curctx net]/operflags"]]} { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] } { nda set "quoteserv/[curctx net]/gquotes/q$qtn" $qt nda set "quoteserv/[curctx net]/gquotes/u$qtn" [format "(%s) %s!%s@%s" [tnda get "login/[curctx net]/$from"] [% uid2nick $from] [% uid2ident $from] [% uid2host $from]] nda set "quoteserv/[curctx net]/gquotes/a$qtn" [tnda get "login/[curctx net]/$from"] - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.added $qtn] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.added $qtn] } } "de*" { - if {$chan == 0} { - set chan $from - set ndacname [string map {/ [} [::base64::encode [string tolower [lindex $opara 0]]]] - set para [lrange $para 1 end] - if {![quoteservenabled [lindex $opara 0]]} {return} - } set qtn [lindex $para 0] if {![string is integer $qtn]} { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.usevalidint] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.usevalidint] } if {[ismodebutnot $chan $from v] || [operHasPrivilege [curctx net] $from [tnda get "quoteserv/[curctx net]/operflags"]] || [string tolower [uid2hand $from]] == [nda get "quoteserv/[curctx net]/quotes/$ndacname/a$qtn"]} { set qt [nda get "quoteserv/[curctx net]/quotes/$ndacname/q$qtn"] @@ -202,74 +191,62 @@ proc quoteservdo {n chan from m} { nda unset "quoteserv/[curctx net]/quotes/$ndacname/q$qtn" nda unset "quoteserv/[curctx net]/quotes/$ndacname/u$qtn" nda unset "quoteserv/[curctx net]/quotes/$ndacname/a$qtn" - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.removed $qtn $qb] - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.removedcontents $qt] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.removed $qtn $qb] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.removedcontents $qt] } { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] } } "gde*" { set qtn [lindex $para 0] - if {![string is integer $qtn]} {% privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.usevalidint]} + if {![string is integer $qtn]} {% privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.usevalidint]} if {[operHasPrivilege [curctx net] $from [tnda get "quoteserv/[curctx net]/operflags"]]} { nda unset "quoteserv/[curctx net]/gquotes/q$qtn" "" nda unset "quoteserv/[curctx net]/gquotes/u$qtn" "" nda unset "quoteserv/[curctx net]/gquotes/a$qtn" "" - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan "\[\002Quotes\002\] Blanked quote number #$qtn in database." + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ "\[\002Quotes\002\] Blanked quote number #$qtn in database." } { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] } } "jo*" { - if {$chan == 0} { - set chan $from - } set tochan [lindex $para 0] if {[ismodebutnot $tochan $from v] || [operHasPrivilege [curctx net] $from [tnda get "quoteserv/[curctx net]/operflags"]]} { quoteservjoin $tochan } { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] } } "goa*" - "pa*" - "le*" { - if {$chan == 0} { - set chan $from - } set tochan [lindex $para 0] if {[ismodebutnot $tochan $from v] || [operHasPrivilege [curctx net] $from [tnda get "quoteserv/[curctx net]/operflags"]]} { quoteservpart $tochan [format "(%s) %s!%s@%s" [tnda get "login/[curctx net]/$from"] [% uid2nick $from] [% uid2ident $from] [% uid2host $from]] } { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]] } } "vi*" { - if {$chan == 0} { - set chan $from - set ndacname [string map {/ [} [::base64::encode [string tolower [lindex $opara 0]]]] - set para [lrange $para 1 end] - if {![quoteservenabled [lindex $opara 0]]} {return} - } set qtn [lindex $para 0] - if {![string is integer $qtn]} {% privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.usevalidint]} + if {![string is integer $qtn]} {% privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.usevalidint]} set qt [nda get "quoteserv/[curctx net]/quotes/$ndacname/q$qtn"] set qb [nda get "quoteserv/[curctx net]/quotes/$ndacname/u$qtn"] if {$qt != ""} { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.qheader $qtn $qb] - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.quote $qt] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.qheader $qtn $qb] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.quote $qt] } { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.noresults] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.noresults] } } "gvi*" { set qtn [lindex $para 0] - if {![string is integer $qtn]} {% privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.usevalidint]} + if {![string is integer $qtn]} {% privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.usevalidint]} set qt [nda get "quoteserv/[curctx net]/gquotes/q$qtn"] set qb [nda get "quoteserv/[curctx net]/gquotes/u$qtn"] if {$qt != ""} { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.qheader $qtn $qb] - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.quote $qt] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.qheader $qtn $qb] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.quote $qt] } { - % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.noresults] + % privmsg [tnda get "quoteserv/[curctx net]/ourid"] $targ [gettext quoteserv.noresults] } } "he*" {