commit fef2d5658a5b944bf78705f6be7a18d3a3121d88
parent e68b6c8b6c37a6b65ea85de3f5c160876e61dd69
Author: Ellenor Malik ellenor@umbrellix.net <j4jackj@gmx.com>
Date: Sat, 23 Jun 2018 07:23:11 -0700
Rawr.
Diffstat:
8 files changed, 485 insertions(+), 87 deletions(-)
diff --git a/core/2003-ts6.tcl b/core/2003-ts6.tcl
@@ -1,8 +1,9 @@
-source nda.tcl
+#source nda.tcl
#source 9999-protocol-common.tcl
namespace eval ts6 {
+proc putcmdlog {args} {}
proc ::ts6::b64e {numb} {
set b64 [split "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" {}]
@@ -253,13 +254,14 @@ proc ::ts6::irc-main {sck} {
global sid sock socksid
if {[eof $sck]} {close $sck}
gets $sck line
+ setctx $::netname($sck)
#puts stdout $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 0 [expr {$gotsplitwhere - 1}]] " "]}
- if {$gotsplitwhere==-1} {set payload [lindex $comd end]} {set payload [split [string range $line [expr {$gotsplitwhere + 2}] end] " "]}
+ if {$gotsplitwhere==-1} {set payload [lindex $comd end]} {set payload [string range $line [expr {$gotsplitwhere + 2}] end]}
if {$gotsplitwhere != -1} {lappend comd $payload}
if {[lindex $comd 0] == "PING"} {putl $sck "PONG $::snames($sck) :$payload"}
if {[lindex $comd 0] == "SERVER"} {putl $sck "VERSION"}
@@ -697,13 +699,13 @@ proc ::ts6::uid2rhost {netname u} {
return [tnda get "rhost/$netname/$u"]
}
proc ::ts6::uid2host {netname u} {
- return [tnda get "host/$netname/$u"]
+ return [tnda get "vhost/$netname/$u"]
}
proc ::ts6::uid2ident {netname u} {
return [tnda get "ident/$netname/$u"]
}
proc ::ts6::nick2host {netname nick} {
- return [tnda get "host/$netname/[nick2uid $netname $nick]"]
+ return [tnda get "vhost/$netname/[nick2uid $netname $nick]"]
}
proc ::ts6::nick2ident {netname nick} {
return [tnda get "ident/$netname/[nick2uid $netname $nick]"]
diff --git a/core/4000-eggcom.tcl b/core/4000-eggcom.tcl
@@ -1,8 +1,8 @@
#source chanserv.conf
-#bind $::sock($::cs(netname)) mode "-" "+" bitchopcheck
-#bind $::sock($::cs(netname)) mode "-" "-" protectopcheck
-#bind $::sock($::cs(netname)) join "-" "-" autoopcheck
+#bind [curctx sock] mode "-" "+" bitchopcheck
+#bind [curctx sock] mode "-" "-" protectopcheck
+#bind [curctx sock] join "-" "-" autoopcheck
proc protectopcheck {mc f t p} {
if {"o"==$mc && ![channel get $t protectop]} {return}
@@ -10,25 +10,25 @@ proc protectopcheck {mc f t p} {
if {"v"==$mc && ![channel get $t protectvoice]} {return}
switch -- $mc {
"o" {
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$p"] omn|omn $t]} {
- $::maintype putmode $::sock($::cs(netname)) 77 $t +$mc "$p" [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $t]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$p"] omn|omn $t]} {
+ [curctx proto] putmode [curctx sock] 77 $t +$mc "$p" [tnda get "channels/[curctx net]/[ndaenc $t]/ts"]
}
}
"h" {
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$p"] l|l $t]} {
- $::maintype putmode $::sock($::cs(netname)) 77 $t +$mc "$p" [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $t]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$p"] l|l $t]} {
+ [curctx proto] putmode [curctx sock] 77 $t +$mc "$p" [tnda get "channels/[curctx net]/[ndaenc $t]/ts"]
}
}
"v" {
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$p"] v|v $t]} {
- $::maintype putmode $::sock($::cs(netname)) 77 $t +$mc "$p" [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $t]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$p"] v|v $t]} {
+ [curctx proto] putmode [curctx sock] 77 $t +$mc "$p" [tnda get "channels/[curctx net]/[ndaenc $t]/ts"]
}
}
}
}
proc finduserbyid {n} {
- tnda get "login/$::netname($::sock($::cs(netname)))/$f"
+ tnda get "login/[curctx net]/$f"
}
proc autoopcheck {c f} {
@@ -42,56 +42,56 @@ proc autoopcheck {c f} {
proc tcs:opcheck {c f {globe 0} {auto nmolv}} {
# puts stdout "$c $f"
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] |k $c]} {
+ if {[matchattr [tnda get "login/[curctx net]/$f"] |k $c]} {
# obviously optimised for charybdis... ???
- $::maintype putmode $::sock($::cs(netname)) 77 $c +b "*![tnda get "ident/$::netname($::sock($::cs(netname)))/$f"]@[tnda get "vhost/$::netname($::sock($::cs(netname)))/$f"]" [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
- $::maintype kick $::sock($::cs(netname)) 77 $c $f "Autokicked (+k attribute)"
+ [curctx proto] putmode [curctx sock] 77 $c +b "*![tnda get "ident/[curctx net]/$f"]@[tnda get "vhost/[curctx net]/$f"]" [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
+ [curctx proto] kick [curctx sock] 77 $c $f "Autokicked (+k attribute)"
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] n|] && $globe} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +[tnda get "pfx/owner"] $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] n|] && $globe} {
+ [curctx proto] putmode [curctx sock] 77 $c +[tnda get "pfx/owner"] $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] |n $c] && ([string first "o" $auto] != -1)} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +[tnda get "pfx/owner"] $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] |n $c] && ([string first "o" $auto] != -1)} {
+ [curctx proto] putmode [curctx sock] 77 $c +[tnda get "pfx/owner"] $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] m|] && $globe} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +[tnda get "pfx/protect"] $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] m|] && $globe} {
+ [curctx proto] putmode [curctx sock] 77 $c +[tnda get "pfx/protect"] $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] |m $c] && ([string first "o" $auto] != -1)} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +[tnda get "pfx/protect"] $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] |m $c] && ([string first "o" $auto] != -1)} {
+ [curctx proto] putmode [curctx sock] 77 $c +[tnda get "pfx/protect"] $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] a|]} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +o $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] a|]} {
+ [curctx proto] putmode [curctx sock] 77 $c +o $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] o|] && $globe} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +o $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] o|] && $globe} {
+ [curctx proto] putmode [curctx sock] 77 $c +o $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] |o $c] && ([string first "o" $auto] != -1)} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +o $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] |o $c] && ([string first "o" $auto] != -1)} {
+ [curctx proto] putmode [curctx sock] 77 $c +o $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] l|] && $globe} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +[tnda get "pfx/halfop"] $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] l|] && $globe} {
+ [curctx proto] putmode [curctx sock] 77 $c +[tnda get "pfx/halfop"] $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] |l $c] && ([string first "h" $auto] != -1)} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +[tnda get "pfx/halfop"] $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] |l $c] && ([string first "h" $auto] != -1)} {
+ [curctx proto] putmode [curctx sock] 77 $c +[tnda get "pfx/halfop"] $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] v|] && $globe} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +v $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] v|] && $globe} {
+ [curctx proto] putmode [curctx sock] 77 $c +v $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
- if {[matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$f"] |v $c] && ([string first "v" $auto] != -1)} {
- $::maintype putmode $::sock($::cs(netname)) 77 $c +v $f [tnda get "channels/$::netname($::sock($::cs(netname)))/[ndaenc $c]/ts"]
+ if {[matchattr [tnda get "login/[curctx net]/$f"] |v $c] && ([string first "v" $auto] != -1)} {
+ [curctx proto] putmode [curctx sock] 77 $c +v $f [tnda get "channels/[curctx net]/[ndaenc $c]/ts"]
return
}
}
@@ -108,33 +108,33 @@ proc bitchopcheck {mc ftp} {
if {"v"==$mc && ![channel get $t voicebitch]} {return}
switch -glob -- $mc {
"q" {
- if {![matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$p"] n|n $t]} {
+ if {![matchattr [tnda get "login/[curctx net]/$p"] n|n $t]} {
puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
- $::maintype putmode $::sock($::cs(netname)) 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ [curctx proto] putmode [curctx sock] 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
}
}
"a" {
- if {![matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$p"] mn|mn $t]} {
+ if {![matchattr [tnda get "login/[curctx net]/$p"] mn|mn $t]} {
puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
- $::maintype putmode $::sock($::cs(netname)) 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ [curctx proto] putmode [curctx sock] 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
}
}
"o" {
- if {![matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$p"] aomn|omn $t]} {
+ if {![matchattr [tnda get "login/[curctx net]/$p"] aomn|omn $t]} {
puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
- $::maintype putmode $::sock($::cs(netname)) 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ [curctx proto] putmode [curctx sock] 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
}
}
"h" {
- if {![matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$p"] l|l $t]} {
+ if {![matchattr [tnda get "login/[curctx net]/$p"] l|l $t]} {
puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
- $::maintype putmode $::sock($::cs(netname)) 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ [curctx proto] putmode [curctx sock] 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
}
}
"v" {
- if {![matchattr [tnda get "login/$::netname($::sock($::cs(netname)))/$p"] v|v $t]} {
+ if {![matchattr [tnda get "login/[curctx net]/$p"] v|v $t]} {
puts stdout "M $t -$mc $p [nda get "regchan/[ndaenc $t]/ts"]"
- $::maintype putmode $::sock($::cs(netname)) 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
+ [curctx proto] putmode [curctx sock] 77 $t "-$mc" "$p" [nda get "regchan/[ndaenc $t]/ts"]
}
}
}
@@ -183,10 +183,10 @@ proc msgmt {from msg} {
set handle [lindex $msg 0]
set attr [lindex $msg 1]
set chan [lindex $msg 2]
- $::maintype notice $::sock($::cs(netname)) 77 $from "$handle $attr $chan Matchattr result: [matchattr $handle $attr $chan]"
+ [curctx proto] notice [curctx sock] 77 $from "$handle $attr $chan Matchattr result: [matchattr $handle $attr $chan]"
}
-#bind $::sock($::cs(netname)) msg 77 "matchattr" msgmt
+#bind [curctx sock] msg 77 "matchattr" msgmt
proc matchattr {handle attr {chan "*"}} {
set handle [string tolower $handle]
@@ -284,21 +284,21 @@ proc validuser {n} {
if {""==[nda get "usernames/$n"]} {return 0} {return 1}
}
-#bind $::sock($::cs(netname)) msg 77 "chanset" msgchanset
-#bind $::sock($::cs(netname)) msg 77 "chattr" msgchattr
-#bind $::sock($::cs(netname)) msg 77 "setxtra" msgxtra
+#bind [curctx sock] msg 77 "chanset" msgchanset
+#bind [curctx sock] msg 77 "chattr" msgchattr
+#bind [curctx sock] msg 77 "setxtra" msgxtra
#set botnick $cs(nick)
#chattr $cs(admin) +mnolv
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($::cs(netname)))/$from"] m|m [lindex $msg 0 0]]} {
- $::maintype notice $::sock($::cs(netname)) 77 $from "Only channel super-operators (300) and above and network masters may use eggdrop-compatible chansets."
+ if {300>[nda get "regchan/$ndacname/levels/[string tolower [tnda get "login/$from"]]"] && ![matchattr [tnda get "login/[curctx net]/$from"] m|m [lindex $msg 0 0]]} {
+ [curctx proto] notice [curctx 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
- $::maintype notice $::sock($::cs(netname)) 77 $from "Eggdrop compatible chanset $chanset set on [lindex $msg 0 0]."
+ [curctx proto] notice [curctx sock] 77 $from "Eggdrop compatible chanset $chanset set on [lindex $msg 0 0]."
}
proc msgchattr {from msg} {
@@ -318,23 +318,27 @@ proc msgchattr {from msg} {
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($::cs(netname)))/$from"] $c $chan]} {
- $::maintype notice $::sock($::cs(netname)) 77 $from "You may only give flags you already possess (Any of flags $c required to set $attrs)."
+ if {![matchattr [tnda get "login/[curctx net]/$from"] $c $chan]} {
+ [curctx proto] notice [curctx 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}
- $::maintype notice $::sock($::cs(netname)) 77 $from "Global flags for $hand are now [nda get "eggcompat/attrs/global/[string tolower $handle]"]"
+ [curctx proto] notice [curctx sock] 77 $from "Global flags for $hand are now [nda get "eggcompat/attrs/global/[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($::cs(netname)) 77 $from "Flags on $chan for $hand are now [nda get "eggcompat/attrs/$ndacname/[string tolower $handle]"]"}
+ if {$ch != ""} {[curctx proto] notice [curctx sock] 77 $from "Flags on $chan for $hand are now [nda get "eggcompat/attrs/$ndacname/[string tolower $handle]"]"}
}
proc nick2hand {nick} {
foreach {uid nic} [tnda get "nick"] {
- if {$nick == $nic} {return [tnda get "login/$::netname($::sock($::cs(netname)))/$uid"]}
+ if {$nick == $nic} {return [tnda get "login/[curctx net]/$uid"]}
}
}
+proc uid2hand {uid} {
+ return [tnda get "login/[curctx net]/$uid"]
+}
+
proc getuser {nick datafield {dataval "body"}} {
return [nda get "usernames/$nick/setuser/[ndaenc $datafield]/[ndaenc $dataval]"]
}
@@ -344,17 +348,60 @@ proc setuser {nick datafield {dataval "body"} val} {
}
proc msgxtra {from msg} {
- if {[set log [tnda get "login/$::netname($::sock($::cs(netname)))/$from"]]==""} {
- $::maintype notice $::sock($::cs(netname)) 77 $from "Until you've registered with the bot, you have no business setting XTRA values."
+ if {[set log [tnda get "login/[curctx net]/$from"]]==""} {
+ [curctx proto] notice [curctx 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
- $::maintype notice $::sock($::cs(netname)) 77 $from "Set your user record XTRA $subfield to $value."
+ [curctx proto] notice [curctx sock] 77 $from "Set your user record XTRA $subfield to $value."
}
proc chandname2name {channame} {return $channame}
proc channame2dname {channame} {return $channame}
proc islinked {bot} {return 0}
+
+
+proc operHasPrivilege {n i p} {
+ # this bit requires irca.
+ set metadatum [tnda get "metadata/$n/$i/[ndcenc PRIVS]"]
+ set md [split $metadatum " "]
+ set pl [split $p " ,"]
+ foreach {pv} $pl {
+ if {[lsearch $md $pv] != -1} {return 1}
+ }
+ return 0
+}
+
+proc operHasAllPrivileges {n i p} {
+ # this bit requires irca.
+ set metadatum [tnda get "metadata/$n/$i/[ndcenc PRIVS]"]
+ set md [split $metadatum " "]
+ set pl [split $p " ,"]
+ foreach {pv} $pl {
+ if {[lsearch $md $pv] == -1} {return 0}
+ }
+ return 1
+}
+
+proc isop {chan id} {
+ return [ismode $chan $id o]
+}
+
+proc isvoice {chan id} {
+ return [ismode $chan $id v]
+}
+
+proc ishalf {chan id} {
+ return [ismode $chan $id h]
+}
+
+proc ismode {chan id mode} {
+ if {[string first $mode [[curctx proto] getupfx [curctx net] $chan $id]] != -1} {return 1} {return 0}
+}
+
+proc ismodebutnot {chan id mode} {
+ if {[string length [[curctx proto] getupfx [curctx net] $chan $id]] > 0 && [string first $mode [[curctx proto] getupfx [curctx net] $chan $id]] == -1} {return 1} {return 0}
+}
diff --git a/language.txt b/language.txt
@@ -1,11 +1,22 @@
-debugserv.metadata 14/2/12/ Metadata %s for %s: %s
-debugserv.nometadata 14/7/8/ %s, you do not have any metadata set by the ircd.
-continuant 14/2/12/ %s
-debugserv.rehashed 14/3/9/ As you so politely demand, %s.
-debugserv.isoper 14/3/9/ %s (UID %s) is an oper on this network.
-debugserv.isntoper 14/5/4/ %s (UID %s) is 4NOT an oper on this network.
-debugserv.youreoper 14/3/9/ YOU (UID %s) are an oper on this network.
-debugserv.yourentoper 14/5/4/ YOU (UID %s) are 4NOT an oper on this network.
-debugserv.youvenoprivs 14/5/4/ YOU (UID %s) do 4NOT have the required privileges to execute the commanded action.
-debugserv.youvenoprivs2 14/5/4/ YOU (UID %s) do 4NOT have the required privileges to execute the commanded action. (Requires %s)
-debugserv.impostornickserv 14/5/4/ NickServ specified in config file (nick %s, UID %s, intended server %s, whose SID is "%s" - check links if blank) is gone or an impostor! Not identifying with NickServ - DebugServ WILL NOT BE ABLE TO ACCESS SOME CHANNELS.
+debugserv.metadata 14>2>12> Metadata %s for %s: %s
+debugserv.nometadata 14>7>8> %s, you do not have any metadata set by the ircd.
+continuant 14>2>12> %s
+debugserv.rehashed 14>3>9> As you so politely demand, %s.
+debugserv.isoper 14>3>9> %s (UID %s) is an oper on this network.
+debugserv.isntoper 14>5>4> %s (UID %s) is 4NOT an oper on this network.
+debugserv.youreoper 14>3>9> YOU (UID %s) are an oper on this network.
+debugserv.yourentoper 14>5>4> YOU (UID %s) are 4NOT an oper on this network.
+debugserv.youvenoprivs 14>5>4> YOU (UID %s) do 4NOT have the required privileges to execute the commanded action.
+debugserv.youvenoprivs2 14>5>4> YOU (UID %s) do 4NOT have the required privileges to execute the commanded action. (Requires %s)
+debugserv.impostornickserv 14>5>4> NickServ specified in config file (nick %s, UID %s, intended server %s, whose SID is "%s" - check links if blank) is gone or an impostor! Not identifying with NickServ - DebugServ WILL NOT BE ABLE TO ACCESS SOME CHANNELS.
+quoteserv.impostornickserv 14>5>4> NickServ specified in config file (nick %s, UID %s, intended server %s, whose SID is "%s" - check links if blank) is gone or an impostor! Not identifying with NickServ - DebugServ WILL NOT BE ABLE TO ACCESS SOME CHANNELS.
+quoteserv.results 14>3>9> Quotes: Found results numbered %s
+quoteserv.noresults 14>5>4> Quotes: Found NO results for your search.
+quoteserv.qheader 14>2>12> Quote number %s, by %s:
+quoteserv.quote 14>2>12> %s
+quoteserv.added 14>3>9> Added quote number %s to database.
+quoteserv.usevalidint 14>5>4> Please use a valid integer, without the #.
+quoteserv.enopriv 14>5>4> You do not have the required privileges to execute that command (requires oper permissions %s).
+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!
diff --git a/main.tcl b/main.tcl
@@ -68,7 +68,7 @@ proc save.db {name var no oper} {
# should not block for long
puts -nonewline $there $db
close $there
- after 12500 catch [list file delete -- [format "%s.bk%s" $name $now]]
+ after 12500 [list catch [list file delete -- [format "%s.bk%s" $name $now]]]
return
}
@@ -77,9 +77,12 @@ mysrc nda.tcl
set lastsave [clock seconds]
-if {[file exists [pwd]/services.db]} {
- set nd [readbfile [format "%s/%s" [pwd] services.db]]
+if {[file exists services.db]} {
+ puts stdout "reading the nda dict"
+ set nd [readbfile services.db]
+ puts stdout $nd
}
+set nd [readbfile services.db]
set globwd [pwd]
set gettext [list]
diff --git a/modules/debugserv.tcl b/modules/debugserv.tcl
@@ -26,6 +26,11 @@ proc debugserv.find6sid {n s {hunting 0}} {
return ""
}
+proc debugservenabled {chan} {
+ if {[string tolower $chan] != [string tolower [tnda get "debugserv/[curctx]logchan"]} {return 0}
+ return 1
+}
+
proc debugserv.oneintro {headline block} {
set net [lindex $headline 0]
set nsock $::sock($net)
@@ -90,23 +95,17 @@ proc debugserv.crehash {n c i m} {
proc debugserv.pmetadata {n c i m} {
# net chan id msg
-# puts stdout "debugserv.pmetadata called $n $c $i $m"
- catch [set command {
setctx $n
+ if {($c != $i) && ![debugservenabled]} {return}
set metadatalist [tnda get "metadata/$n/$i"]
if {[llength $metadatalist] < 2} {
$::nettype($n) [expr {$c != $i ? "privmsg" : "notice"}] [curctx sock] [tnda get "debugserv/$n/ourid"] $c [gettext debugserv.nometadata [$::nettype($n) uid2nick $n $i]]
}
-# puts stdout $metadatalist
foreach {.datum value} $metadatalist {
set datum [ndcdec ${.datum}]
$::nettype($n) [expr {$c != $i ? "privmsg" : "notice"}] [curctx sock] [tnda get "debugserv/$n/ourid"] $c [set totmsg [gettext debugserv.metadata $datum [$::nettype($n) uid2nick $n $i] $value]]
- } }] zere
- puts stdout [tnda get "oper/$n"]
+ }
$::nettype($n) [expr {$c != $i ? "privmsg" : "notice"}] [curctx sock] [tnda get "debugserv/$n/ourid"] $c [gettext [expr {[tnda get "oper/$n/$i"] == 1 ? "debugserv.isoper" : "debugserv.isntoper"}] [$::nettype($n) uid2nick $n $i] $i]
-# puts stdout [curctx sock]
-# puts stdout $command
-# puts stdout $zere
}
proc debugserv.metadata {n i m} {
diff --git a/modules/quoteserv.tcl b/modules/quoteserv.tcl
@@ -0,0 +1,302 @@
+blocktnd quoteserv
+blocktnd qshelp
+
+source quoteserv.help
+
+bind - evnt - confloaded quoteserv.connect
+
+proc quoteserv.connect {arg} {
+ puts stdout [format "there are %s quoteserv blocks" [set blocks [tnda get "openconf/[ndcenc quoteserv]/blocks"]]]
+ for {set i 1} {$i < ($blocks + 1)} {incr i} {
+ after 1000 [list quoteserv.oneintro [tnda get [format "openconf/%s/hdr%s" [ndcenc quoteserv] $i]] [tnda get [format "openconf/%s/n%s" [ndcenc quoteserv] $i]]]
+ }
+}
+
+proc quoteserv.find6sid {n s {hunting 0}} {
+ # we're trying to get the sid of the server named $s
+ # if hunting, we're looking for the first splat match
+ set servs [tnda get "servers/$n"]
+ foreach {.k dv} $servs {
+ set k [string toupper [ndadec ${.k}]]
+ # name description uplink sid - we only need two
+ dictassign $dv name sname
+ if {$hunting} {
+ if {[string match [string tolower $s] [string tolower $sname]] == 1} {return $k}
+ } {
+ if {[string tolower $s] == [string tolower $sname]} {return $k}
+ }
+ }
+ return ""
+}
+
+proc quoteserv.oneintro {headline block} {
+ set net [lindex $headline 0]
+ set nsock $::sock($net)
+ setctx $net
+ dictassign $block logchan logchan nick nick ident ident host host modes modes realname realname operflags rehashprivs idcommand nspass \
+ nickserv nickserv nsserv nsserv
+ tnda set "quoteserv/[curctx net]/operflags" $rehashprivs
+ tnda set "quoteserv/[curctx net]/logchan" $logchan
+ #tnda set "quoteserv/[curctx net]/nspass" $nspass
+ setctx $net
+ $::nettype($net) sendUid $nsock $nick $ident $host $host [set ourid [$::nettype($net) getfreeuid $net]] [expr {($realname == "") ? "* Debug Service *" : $realname}] $modes
+ tnda set "quoteserv/[curctx net]/ourid" $ourid
+# bind $nsock pub - ".metadata" [list quoteserv.pmetadata $net]
+# bind $nsock pub - ".rehash" [list quoteserv.crehash $net]
+ if {[string length $nspass] != 0 && [string length $nickserv] != 0} {
+ # only works if nettype is ts6!
+ if {[string first [quoteserv.find6sid $net $nsserv] [$::nettype($net) nick2uid $net $nickserv]] == 0} {
+ $::nettype($net) privmsg $nsock $ourid $nickserv $nspass
+ } {
+ $::nettype($net) privmsg $nsock $ourid $logchan [gettext quoteserv.impostornickserv $nickserv [$::nettype($net) nick2uid $n $nickserv] $nsserv [quoteserv.find6sid $net $nsserv]]
+ }
+ }
+ after 650 $::nettype($net) putjoin $nsock $ourid $logchan
+ after 700 [list $::nettype($net) putmode $nsock $ourid $logchan "+ao" [format "%s %s" [$::nettype($net) intclient2uid $net $ourid] [$::nettype($net) intclient2uid $net $ourid]]]
+# bind $nsock msg [tnda get "quoteserv/[curctx net]/ourid"] "metadata" [list quoteserv.metadata $net]
+# bind $nsock msg [tnda get "quoteserv/[curctx net]/ourid"] "rehash" [list quoteserv.rehash $net]
+# bind $nsock pub - "gettext" [list quoteserv.gettext $net]
+# puts stdout "bind $nsock msg [tnda get "quoteserv/[curctx net]/ourid"] metadata [list quoteserv.metdata $net]"
+ puts stdout [format "Connected for %s: %s %s %s" $net $nick $ident $host]
+ bind $nsock pub - "!quote" [list quoteservdo $net]
+ bind $nsock evnt - privmsg [list qs.pmdo $net]
+ puts stdout $::nd
+ foreach {chan is} [nda get "quoteserv/[curctx net]/regchan"] {
+ puts stdout "to join $chan on [curctx]"
+ if {1!=$is} {continue}
+ quoteservjoin [ndadec $chan] 0
+# [curctx proto] putjoin [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] [::base64::decode [string map {[ /} $chan]] [nda get "regchan/$chan/ts"]
+# tnda set "channels/$chan/ts" [nda get "regchan/$chan/$::netname([curctx sock])/ts"]
+ }
+}
+
+proc qs.pmdo {n i t m} {
+ set whoarewe [tnda get "intclient/$n/$t"]
+ if {$whoarewe != [tnda get "quoteserv/[curctx net]/ourid"]} {return}
+ quoteservdo $n 0 $i $m
+}
+
+proc quoteservjoin {chan {setting 1}} {
+ set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
+ puts stdout "to join $chan on [curctx]"
+ [curctx proto] putjoin [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan
+ [curctx proto] putmode [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan "+ao" \
+ [format "%s %s" [[curctx proto] intclient2uid [curctx net] [tnda get "quoteserv/[curctx net]/ourid"]]\
+ [[curctx proto] intclient2uid [curctx net] [tnda get "quoteserv/[curctx net]/ourid"]]]
+ if {$setting} {nda set "quoteserv/[curctx net]/regchan/$ndacname" 1}
+}
+
+proc quoteservpart {chan {who "the script"} {msg isunused}} {
+ set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
+ [curctx proto] putpart [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.left $who]
+ nda set "quoteserv/[curctx net]/regchan/$ndacname" 0
+ nda unset "quoteserv/[curctx net]/regchan/$ndacname"
+}
+
+proc quoteservenabled {chan} {
+ set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
+ if {[nda get "quoteserv/[curctx net]/regchan/$ndacname"] == 1} {return 1} {return 0}
+}
+
+
+if 0 {
+here's the program with the gettext
+
+quoteserv.impostornickserv ^C14>^C5>^C4>^C NickServ specified in config file (nick %s, UID %s, intended server %s, whose SID is "%s" - check links if blank) i$
+quoteserv.results ^C14>^C3>^C9>^C Quotes: Found results numbered %s
+quoteserv.noresults ^C14>^C5>^C4>^C Quotes: Found NO results for your search.
+quoteserv.qheader ^C14>^C2>^C12>^C Quote number %s, by %s:
+quoteserv.quote ^C14>^C2>^C12>^C %s
+quoteserv.added ^C14>^C3>^C9>^C Added quote number %s to database.
+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
+}
+
+proc quoteservdo {n chan from m} {
+ setctx $n
+ set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
+ if {![quoteservenabled $chan] && $chan != 0} {return}
+ # Q isn't in channel, no need to check quotes
+ set subcmd [lindex [split $m " "] 0]
+ set para [lrange [split $m " "] 1 end]
+ set opara [lrange [split $m " "] 1 end]
+ 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} {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.results #[join $qts ", #"]]
+ } {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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"]
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.qheader $qtn $qb]
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.quote $qt]
+ } {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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"] [[curctx proto] uid2nick [curctx net] $from] [[curctx proto] uid2ident [curctx net] $from] [[curctx proto] uid2host [curctx net] $from]]
+ nda set "quoteserv/[curctx net]/quotes/$ndacname/a$qtn" [string tolower [tnda get "login/[curctx net]/$from"]]
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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"]]} {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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"] [[curctx proto] uid2nick [curctx net] $from] [[curctx proto] uid2ident [curctx net] $from] [[curctx proto] uid2host [curctx net] $from]]
+ nda set "quoteserv/[curctx net]/gquotes/a$qtn" [tnda get "login/[curctx net]/$from"]
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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]} {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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"]
+ set qb [nda get "quoteserv/[curctx net]/quotes/$ndacname/u$qtn"]
+ set qa [nda get "quoteserv/[curctx net]/quotes/$ndacname/a$qtn"]
+ 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"
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.removed $qtn $qb]
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.removedcontents $qt]
+ } {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.enopriv [tnda get "quoteserv/[curctx net]/operflags"]]
+ }
+ }
+ "gde*" {
+ set qtn [lindex $para 0]
+ if {![string is integer $qtn]} {[curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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" ""
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan "\[\002Quotes\002\] Blanked quote number #$qtn in database."
+ } {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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
+ } {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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"] [[curctx proto] uid2nick [curctx net] $from] [[curctx proto] uid2ident [curctx net] $from] [[curctx proto] uid2host [curctx net] $from]]
+ } {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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]} {[curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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 != ""} {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.qheader $qtn $qb]
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.quote $qt]
+ } {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.noresults]
+ }
+ }
+ "gvi*" {
+ set qtn [lindex $para 0]
+ if {![string is integer $qtn]} {[curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [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 != ""} {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.qheader $qtn $qb]
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.quote $qt]
+ } {
+ [curctx proto] privmsg [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $chan [gettext quoteserv.noresults]
+ }
+ }
+ "he*" {
+# set helpfile { ---- Quotes Help ----
+#!quote search - Search for quotes matching
+#!quote view1stmatch - Search for quotes matching and view first matching quote.
+#!quote view - View quote
+#!quote add - Add quote.
+#!quote del - Delete quote. Requires halfops or above.
+#End of help for Q.}
+ set helplist [tnda get "openconf/[ndcenc qshelp]/n1"]
+ dictassign $helplist main helpfile
+ foreach {helpline} $helpfile {
+ [curctx proto] notice [curctx sock] [tnda get "quoteserv/[curctx net]/ourid"] $from $helpline
+ }
+ }
+ }
+}
+
+proc requestq {n i m} {
+}
+
+proc quotesearch {chan pattern} {
+ set ndacname [string map {/ [} [::base64::encode [string tolower $chan]]]
+ set ret [list]
+ foreach {qnum qvalue} [nda get "quoteserv/[curctx net]/quotes/$ndacname"] {
+ if {[string index $qnum 0] != "q"} {continue}
+ if {[string match -nocase $pattern $qvalue]} {lappend ret [string range $qnum 1 end]}
+ }
+ return $ret
+}
diff --git a/quoteserv.help b/quoteserv.help
@@ -0,0 +1,18 @@
+qshelp {
+ main {
+ { ---- Quotes Help ----}
+ {!quote search - Search for quotes matching}
+ {!quote gsearch - Search for global quotes matching}
+ {!quote view1stmatch - Search for quotes matching and view first matching quote.}
+ {!quote view - View quote.}
+ {!quote gview - View global quote.}
+ {!quote add - Add quote.}
+ {!quote gadd - Add global quote. Requires oper.}
+ {!quote del - Delete quote. Requires oper or to be the creator of the quote.}
+ {!quote join <#channel> - Join a new channel. You must be halfop or better in said channel, or oper}
+ {!quote goaway <#channel> - Leave a channel. You must be halfop or better in said channel, or oper}
+ {All commands may be used in PM. The channel name must be after the command name in this case (except global quotes).}
+ {You must not use the !quote prefix, in the case of PM.}
+ {End of help.}
+ }
+}
diff --git a/services.conf.example b/services.conf.example
@@ -18,6 +18,7 @@ network "pand" "services.invalid" {
#set netname($sock) "pand"
loadmodule debugserv
+loadmodule quoteserv
# module confs after here, load before here
@@ -33,3 +34,18 @@ debugserv "pand" {
nsserv services.umbrellix.net
idcommand "IDENTIFY InvictusWAUS None"
}
+
+
+quoteserv "umb" {
+ logchan #services
+ nick QuoteServ
+ ident Quote
+ host Umbrellix/Special/TclServ/QuoteServ
+ modes +oiS
+ comment "Or +oiDS if you dont want it to hear channel convos"
+ comment "NSPass can be a username space password, if your nickserv is an atheme nickserv."
+ nickserv "NickServ"
+ nsserv services.umbrellix.net
+ idcommand "IDENTIFY InvictusWAUS 5467"
+ operflags "oper:quote,oper:admin"
+}