#### BERLIN !!! Thiz Roxx !!! proc Berlin:Start {} {} ### settings set Berlin(Channel) "#berlin" if {$botnick=="Dev-L" || $botnick=="DevelSmall"} { set Berlin(Channel) "#cybex.stdin" } if {$botnick=="G-Punkt"} { set Berlin(Channel) "#cybex.test" } set Berlin(ChannelIn) "#cybex.stdin" set Berlin(ChannelOut) "#cybex.stdout" set Berlin(ChannelErr) "#cybex.stderr" set Berlin(ChannelDebug) "#cybex.stdout" ## Auth None = Hostmask , LOL = LoL-Tools , Storm = Stormbot.. set Berlin(UseAuthNone) "1" set Berlin(UseAuthLOL) "1" set Berlin(UseAuthStorm) "1" ## WriteHTML - not implemented yet set Berlin(WriteHTML) "1" set Berlin(WritePATH) "~/public_html/botstat" set Berlin(WriteNews) "$Berlin(WritePATH)/$botnick.news.html" set Berlin(WriteVote) "$Berlin(WritePATH)/$botnick.vote.html" set Berlin(WriteAway) "$Berlin(WritePATH)/$botnick.stats.away.shtml" set Berlin(WriteLastchat) "$Berlin(WritePATH)/$botnick.stats.lastchats.shtml" set Berlin(WriteLastJoin) "$Berlin(WritePATH)/$botnick.stats.join.shtml" set Berlin(WriteLastPart) "$Berlin(WritePATH)/$botnick.stats.part.shtml" set Berlin(WriteLastQuit) "$Berlin(WritePATH)/$botnick.stats.quit.shtml" set Berlin(WriteLastNickCh) "$Berlin(WritePATH)/$botnick.stats.nickch.shtml" set Berlin(WritePerm) "755" ## WriteUSER - not implemented yet set Berlin(WriteUer) "0" ### bindings set Berlin(CheckLater) 0 if {![info exists botnick]} { set Berlin(CheckLater) 1 } else { if {$botnick==""} { set Berlin(CheckLater) 1 } } bind msgm n test Berlin:TestMsg; bind pubm n do* Berlin:TestPub; if {$Berlin(CheckLater)=="0"} { bind pubm n $botnick* Berlin:TestPub; } # in use: see tcl-commands.doc -> command extension # 5 6 8 9 10 11 12 13 15 bind pubm - * *Berlin:pubm; bind join - * *Berlin:join; bind part - * *Berlin:part; bind sign - * *Berlin:sign; bind topc - * *Berlin:topc; bind kick - * *Berlin:kick; bind nick - * *Berlin:nick; bind ctcp - ACTION *Berlin:ctcp; bind time - "* * * * *" *Berlin:time; ### internal settings # IRC -> HTML color translation table set Berlin(Color0) "#FFFFFF" set Berlin(Color1) "#000000" set Berlin(Color2) "#00007F" set Berlin(Color3) "#008F00" set Berlin(Color4) "#FF0000" set Berlin(Color5) "#7F0000" set Berlin(Color6) "#9F009F" set Berlin(Color7) "#FF7F00" set Berlin(Color8) "#F0FF00" set Berlin(Color9) "#00F700" set Berlin(Color00) "#FFFFFF" set Berlin(Color01) "#000000" set Berlin(Color02) "#00007F" set Berlin(Color03) "#008F00" set Berlin(Color04) "#FF0000" set Berlin(Color05) "#7F0000" set Berlin(Color06) "#9F009F" set Berlin(Color07) "#FF7F00" set Berlin(Color08) "#F0FF00" set Berlin(Color09) "#00F700" set Berlin(Color10) "#008F8F" set Berlin(Color11) "#00F7FF" set Berlin(Color12) "#0000FF" set Berlin(Color13) "#FF00FF" set Berlin(Color14) "#7F7F7F" set Berlin(Color15) "#CFCFCF" # IRC -> HTML style translation table set Berlin(Style\002) " " set Berlin(Style\003) " " set Berlin(Style\026) " " set Berlin(Style\037) " " ## userfile set BUserT(Login) "0" set BUserS(Name) "" set BUserS(Nicks) "" set BUserS(UHost) "" set BUserS(Handle) "" set BUserS(QAuth) "" set BUserS(Vote) "" set BUserS(News) "" set BUserTemp [list $BUserT(Login)] set BUserSave [list $BUserS(Name) $BUserS(Vote)] set BUser [list $BUserSave $BUserTemp] ## News set BNewsS(Nr) "[list]"; lappend BNewsS(Nr) "0"; set BNewsS(Name) [list]; lappend BNewsS(Name) "0"; set BNewsS(Long) [list]; lappend BNewsS(Long) "Counter und Grundkategorien"; set BNewsS(Kategorie) [list]; lappend BNewsS(Kategorie) "Berlin Games IRC Links Channels"; set BNewsSave [list]; lappend BNewsSave "$BNewsS(Nr) $BNewsS(Name) $BNewsS(Long) $BNewsS(Kategorie)"; set BNews [list]; lappend BNews $BNewsSave; ## votes set BVoteS(Nr) "0" set BVoteS(Name) [list] set BVoteS(Antwort) [list] set BVoteS(Stimmen) [list] set BVoteSave [list $BVoteS(Nr) $BVoteS(Name) $BVoteS(Antwort) $BVoteS(Stimmen)] set BVote [list $BVoteSave] ## stats set BStatT(AwayNickBot) "Berlin cray HateBot Honk LoveBot nubee T-Error Weibchen http *-wie-* Q S L T OO7 007 lorobot PLANETQUAKE Muh-Q http leB0rk statBot^ PlanetQuicky Honecker BeVauGeh " set BStatT(AwayNickConst) "cybex" set BStatT(AwayNickOff) "-afk -away -ill -off -sleep -zz _afk _away _ill _off _sleep _zz ^afk ^away ^ill ^off ^sleep ^zz \|afk \|away \|ill \|off \|sleep \|zz `afk `away `ill `off `sleep `zz \[afk \[away \[ill \[off \[sleep \[zz \]afk \]away \]ill \]off \]sleep \]zz \\afk \\away \\ill \\off \\sleep \\zz " set BStatT(AwayNickPlay) "-q3 _q3 ^q3 \|q3 `q3 \[q3 \]q3 \\q3 -cs _cs ^cs \|cs `cs \[cs \]cs \\cs -ut _ut ^ut \|ut `ut \[ut \]ut \\ut" set BStatT(AwayNickWork) "-wrk -work -school -schule -skewl -uni _wrk _work _school _schule _skewl _uni ^wrk ^work ^school ^schule ^skewl ^uni \|wrk \|work \|school \|schule \|skewl \|uni `wrk `work `school `schule `skewl `uni \[wrk \[work \[school \[schule \[skewl \[uni \]wrk \]work \]school \]schule \]skewl \]uni" set BStatS(Nr) "0" set BStatS(AddNews) "0" set BStatS(AddVote) "0" set BStatT(Op) "0" set BStatT(OpAway) "0" set BStatT(OpBot) "0" set BStatT(OpPlay) "0" set BStatT(OpWork) "0" set BStatT(Voice) "0" set BStatT(VoiceReal) "0" set BStatT(VoiceAway) "0" set BStatT(VoiceBot) "0" set BStatT(VoicePlay) "0" set BStatT(VoiceWork) "0" set BStatT(User) "0" set BStatT(UserAway) "0" set BStatT(UserBot) "0" set BStatT(UserPlay) "0" set BStatT(UserWork) "0" set BStatSave [list $BStatS(Nr) $BStatS(AddNews) $BStatS(AddVote)] ### procs ## standard procs # user # level match # -1 error # 0 nope + 1 handle + 2 voice + 4 op + 8 master + 16 owner + 64 lol + 128 storm proc Berlin:CheckLogin { nick uhost handle channel } { global botnick Berlin; set flags "v" set Auth "0"; set log "CheckLogin" if {$Berlin(UseAuthNone)=="1"} { if {$handle != "*" && $handle != "" } { set log "$log - Handle Match: $handle" set Auth "[expr $Auth + 1]"; if {[matchattr $handle |$flags ${channel}]} { set Auth "[expr $Auth + 2]"; set log "$log and has Voice" } if {[matchattr $handle |o ${channel}]} { set Auth "[expr $Auth + 4]"; set log "$log and has OP" } if {[matchattr $handle |m ${channel}]} { set Auth "[expr $Auth + 8]"; set log "$log and has Master" } if {[matchattr $handle |n ${channel}]} { set Auth "[expr $Auth + 16]"; set log "$log and has Owner" } } } if {$Berlin(UseAuthLOL)=="1"} { set log "$log - LOL-Check: [check $handle $nick $uhost]" if {[check $handle $nick $uhost]} { set Auth "[expr $Auth + 64]"; } } if {$Berlin(UseAuthStorm)=="1"} { set log "$log - Stormbot: [chkaccess $nick $handle $flags ${channel}]" if {[chkaccess $nick $handle $flags ${channel}]=="0"} { set Auth "[expr $Auth + 128]" } } set log "$log - n: $nick u: $uhost h: $handle c: ${channel} -" cydebug $log; return $Auth; } # news # vote # stats proc Berlin:UpdateGetNumber { string } { set result "" foreach char [split $string ""] { if {[string first $char "0123456789"] == -1} { return $result } else { append result $char } } return $result } proc Berlin:UpdateWebify { string } { # Tcl8.1 only: #return [string map {\" " & & < < > >} $string] # Otherwise use this: regsub -all {&} $string {\&} string regsub -all {\"} $string {\"} string regsub -all {<} $string {\<} string regsub -all {>} $string {\>} string return $string } proc Berlin:UpdateStringWeb { string } { global Berlin; set result "" set stack "" for {set i 0} "\$i < [string length $string]" {incr i} { set char [string index $string $i] switch -- $char { "\002" - "\026" - "\037" { if {[string first $char $stack] != -1} { # NOT && if {[string index $stack 0] == $char} { append result [lindex $Berlin(Style${char}) 1]; set stack [string range $stack 1 end]; } } else { append result [lindex $Berlin(Style${char}) 0]; set stack $char$stack; } } "\003" { if {[string first $char $stack] != -1} { if {[string index $stack 0] == $char} { append result [lindex $Berlin(Style${char}) 1]; set stack [string range $stack 1 end]; } } set c2 "" set c [Berlin:UpdateGetNumber [string range $string [expr $i + 1] [expr $i + 2]]] if {[string index $string [expr $i + 2]]=="," } { set c2 [Berlin:UpdateGetNumber [string range $string [expr $i + 3] [expr $i + 4]]]; } if {[string index $string [expr $i + 3]]==","} { set c2 [Berlin:UpdateGetNumber [string range $string [expr $i + 4] [expr $i + 5]]]; } if {$c != "" && $c >= 0 && $c <= 15} { incr i [string length $c]; if {$c2!=""} { incr i [expr [string length $c2] + 1]; } append result "" set stack $char$stack } } default {append result $char} } } foreach char [split $stack ""] { if {$char == "\002" || $char == "\003" || $char == "\026" || $char == "\037"} { append result [lindex $Berlin(Style${char}) 1] } } return $result } proc Berlin:StatMakeUserCount { channel } { global Berlin BStatT; set BStatT(Op) "0"; set BStatT(OpAway) "0"; set BStatT(OpBot) "0"; set BStatT(OpPlay) "0"; set BStatT(OpWork) "0"; set BStatT(Voice) "0"; set BStatT(VoiceReal) "0"; set BStatT(VoiceAway) "0"; set BStatT(VoiceBot) "0"; set BStatT(VoicePlay) "0"; set BStatT(VoiceWork) "0"; set BStatT(User) "0"; set BStatT(UserAway) "0"; set BStatT(UserBot) "0"; set BStatT(UserPlay) "0"; set BStatT(UserWork) "0"; set tmpstr ""; foreach user [chanlist ${channel}] { set awaynick "0"; set botnick "0"; set playnick "0"; set worknick "0"; foreach awaytest $BStatT(AwayNickOff) { if {[string first [string tolower $awaytest] [string tolower $user]] != -1 } { set awaynick "1" } } foreach awaytest $BStatT(AwayNickPlay) { if {[string first [string tolower $awaytest] [string tolower $user]] != -1 } { set playnick "1" } } foreach awaytest $BStatT(AwayNickWork) { if {[string first [string tolower $awaytest] [string tolower $user]] != -1 } { set worknick "1" } } if {[string first $user $BStatT(AwayNickConst)] != -1} { set awaynick "1" } if {[string first $user $BStatT(AwayNickBot)] != -1 } { set botnick "1" } if {[isop $user ${channel}]} { if {$botnick == "1" } { incr BStatT(OpBot) } else { if {$awaynick == "1"} { incr BStatT(OpAway) } elseif {$playnick == "1"} { incr BStatT(OpPlay) } elseif {$worknick == "1"} { incr BStatT(OpWork) } else { incr BStatT(Op) } } } elseif {[isvoice $user ${channel}]} { if {$botnick == "1" } { incr BStatT(VoiceBot) } else { if {$awaynick == "1"} { incr BStatT(VoiceAway); } elseif {$playnick == "1"} { incr BStatT(VoicePlay); } elseif {$worknick == "1"} { incr BStatT(VoiceWork); } else { incr BStatT(Voice); } if {[matchattr [nick2hand $user ${channel}] |v ${channel}] || [matchattr [nick2hand $user ${channel}] v ${channel}] || [matchattr [nick2hand $user ${channel}] |g ${channel}] || [matchattr [nick2hand $user ${channel}] g ${channel}] || [matchattr [nick2hand $user ${channel}] |o ${channel}] || [matchattr [nick2hand $user ${channel}] o ${channel}] || [matchattr [nick2hand $user ${channel}] |m ${channel}] || [matchattr [nick2hand $user ${channel}] m ${channel}] || [matchattr [nick2hand $user ${channel}] |n ${channel}] || [matchattr [nick2hand $user ${channel}] n ${channel}]} { incr BStatT(VoiceReal); } } } else { if {$botnick == "1" } { incr BStatT(UserBot) } else { if {$awaynick == "1"} { incr BStatT(UserAway) } elseif {$playnick == "1"} { incr BStatT(UserPlay) } elseif {$worknick == "1"} { incr BStatT(UserWork) } else { incr BStatT(User) } } } } set tmpstr "" if {$BStatT(Op) > 0} { set tmpstr "$tmpstr " } if {$BStatT(OpAway) > 0} { set tmpstr "$tmpstr " } if {$BStatT(OpPlay) > 0} { set tmpstr "$tmpstr " } if {$BStatT(OpWork) > 0} { set tmpstr "$tmpstr " } if {$BStatT(OpBot) > 0} { set tmpstr "$tmpstr " } set tmpstr "$tmpstr " set tmpstr "$tmpstr " if {$BStatT(Voice) > 0} { set tmpstr "$tmpstr " } if {$BStatT(VoiceAway) > 0} { set tmpstr "$tmpstr " } if {$BStatT(VoicePlay) > 0} { set tmpstr "$tmpstr " } if {$BStatT(VoiceWork) > 0} { set tmpstr "$tmpstr " } if {$BStatT(VoiceBot) > 0} { set tmpstr "$tmpstr " } set tmpstr "$tmpstr " if {$BStatT(VoiceReal) > 0} { set tmpstr "$tmpstr " } set tmpstr "$tmpstr " if {$BStatT(User) > 0} { set tmpstr "$tmpstr " } if {$BStatT(UserAway) > 0} { set tmpstr "$tmpstr " } if {$BStatT(UserPlay) > 0} { set tmpstr "$tmpstr " } if {$BStatT(UserWork) > 0} { set tmpstr "$tmpstr " } if {$BStatT(UserBot) > 0} { set tmpstr "$tmpstr " } set tmpstr "$tmpstr " set tmpstr "$tmpstr " set tmpstr "$tmpstr
Operators:
$BStatT(Op) here(?)
$BStatT(OpAway) away
$BStatT(OpPlay) play
$BStatT(OpWork) work
$BStatT(OpBot) bot(s)
[expr $BStatT(Op) + $BStatT(OpAway) + $BStatT(OpPlay) + $BStatT(OpWork) + $BStatT(OpBot)] total

Berliner/Friends:
$BStatT(Voice) here(?)
$BStatT(VoiceAway) away
$BStatT(VoicePlay) play
$BStatT(VoiceWork) work
$BStatT(VoiceBot) bot(s)
[expr $BStatT(Voice) + $BStatT(VoiceAway) + $BStatT(VoicePlay) + $BStatT(VoiceWork) + $BStatT(VoiceBot)] total
($BStatT(VoiceReal) known by Berlin)

Besucher/User:
$BStatT(User) here(?)
$BStatT(UserAway) away
$BStatT(UserPlay) play
$BStatT(UserWork) work
$BStatT(UserBot) bot(s)
[expr $BStatT(User) + $BStatT(UserAway) + $BStatT(UserPlay) + $BStatT(UserWork) + $BStatT(UserBot)] total

[expr $BStatT(Op) + $BStatT(OpAway) + $BStatT(OpPlay) + $BStatT(OpWork) + $BStatT(OpBot) + $BStatT(Voice) + $BStatT(VoiceAway) + $BStatT(VoicePlay) + $BStatT(VoiceWork) + $BStatT(VoiceBot) + $BStatT(User) + $BStatT(UserAway) + $BStatT(UserPlay) + $BStatT(UserWork) + $BStatT(UserBot)] total
" return "$tmpstr" } proc Berlin:StatAddCustomStatsDefault { Custom nick uhost handle channel {args ""} } { #putcmdlog "Custom $Custom" global Berlin BStatT botnick; #if {$botnick=="Berlin" && ${channel}!=$Berlin(Channel)} { return 0 } set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } #if { $args == "{{}}" } { set args "" } #putcmdlog "args $args" foreach Nr "0 1 2 3 4" { if {![info exist BStatT(Last${Custom}${Nr})]=="1"} { set BStatT(Last${Custom}${Nr}) "" } } foreach Nr "1 2 3 4" { set Back [expr $Nr - 1]; set Last $BStatT(Last${Custom}${Nr}); set BStatT(Last${Custom}${Back}) $Last; } set BStatT(Last${Custom}4) "\[$Berlin(LastUpdateHour):$Berlin(LastUpdateMin)\] ${nick} \@ ${channel} [Berlin:UpdateStringWeb $args]"; Berlin:StatFileCustomDefault $Custom; Berlin:StatAddCustomStatsChan $Custom $nick $uhost $handle ${channel} $args; return 1; } proc Berlin:StatAddCustomStatsChan { Custom nick uhost handle channel {args ""} } { #putcmdlog "Custom $Custom" global Berlin BStatT botnick; #if {$botnick=="Berlin" && ${channel}!=$Berlin(Channel)} { return 0 } set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } #if { $args == "{{}}" } { set args "" } #putcmdlog "args $args" foreach Nr "0 1 2 3 4" { if {![info exist BStatT(Last${channel}${Custom}${Nr})]=="1"} { set BStatT(Last${channel}${Custom}${Nr}) "" } } foreach Nr "1 2 3 4" { set Back [expr $Nr - 1]; set Last $BStatT(Last${channel}${Custom}${Nr}); set BStatT(Last${channel}${Custom}${Back}) $Last; } set BStatT(Last${channel}${Custom}4) "\[$Berlin(LastUpdateHour):$Berlin(LastUpdateMin)\] ${nick} [Berlin:UpdateStringWeb $args]"; Berlin:StatFileCustomChan $Custom ${channel}; return 1; } proc Berlin:StatHTMLLastchatDefault { } { global BStatT; set tmpstr "" foreach Nr "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" { set tmpstr "$tmpstr $BStatT(Lastchat${Nr})" } set tmpstr "$tmpstr
Last Chats:
" return "$tmpstr" } proc Berlin:StatHTMLLastchatChan { channel } { global BStatT; set tmpstr "" foreach Nr "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" { set tmpstr "$tmpstr $BStatT(Lastchat${channel}${Nr})" } set tmpstr "$tmpstr
Last Chats:
" return "$tmpstr" } proc Berlin:StatHTMLCustomDefault { Custom } { global BStatT; set Custom1 $Custom; if {$Custom1 == "TopC"} { set Custom1 "Topic Change" } if {$Custom1 == "NickCh"} { set Custom1 "Nick Change" } set tmpstr "" if {$Custom != "TopC" } { foreach Nr "4 3 2 1 0" { set tmpstr "$tmpstr $BStatT(Last${Custom}${Nr})" } } { foreach Nr "4 3" { set tmpstr "$tmpstr $BStatT(Last${Custom}${Nr})" } } set tmpstr "$tmpstr
Last $Custom1:
" return "$tmpstr" } proc Berlin:StatHTMLCustomChan { Custom channel } { global BStatT; set Custom1 $Custom; if {$Custom1 == "TopC"} { set Custom1 "Topic Change" } if {$Custom1 == "NickCh"} { set Custom1 "Nick Change" } set tmpstr "" if {$Custom != "TopC" } { foreach Nr "4 3 2 1 0" { set tmpstr "$tmpstr $BStatT(Last${channel}${Custom}${Nr})" } } { foreach Nr "4 3" { set tmpstr "$tmpstr $BStatT(Last${channel}${Custom}${Nr})" } } set tmpstr "$tmpstr
Last $Custom1:
" return "$tmpstr" } proc Berlin:StatFileUsercountDefault {} { global Berlin botnick; #if {$botnick!="Dev-L"} {return "-1"} set count [Berlin:StatMakeUserCount $Berlin(Channel)] #putcmdlog "open $Berlin(WriteAway) - $count" set fileid [open $Berlin(WriteAway) w] puts $fileid [join $count] close $fileid #cydebug "Berlin:StatFileUsercountDefault - $count" } proc Berlin:StatFileUsercountChan { channel } { global Berlin botnick; #if {$botnick!="Dev-L"} {return "-1"} if {[string index ${channel} 0]=="#"} { set savech [string range ${channel} 1 end] } else { set savech ${channel} } set count [Berlin:StatMakeUserCount ${channel}] set Berlin(WriteAwayChan) "$Berlin(WritePATH)/$botnick.stats.${savech}.away.shtml" #putcmdlog "open $Berlin(WriteAway) - $count" set fileid [open $Berlin(WriteAwayChan) w] puts $fileid [join $count] close $fileid #cydebug "Berlin:StatFileUsercountDefault - $count" } proc Berlin:StatFileLastchatDefault { } { global Berlin botnick; #if {$botnick!="Dev-L"} {return "-1"} set count [Berlin:StatHTMLLastchatDefault] set fileid [open $Berlin(WriteLastchat) w] puts $fileid [join $count] close $fileid #cydebug "Berlin:StatFileLastchatDefault - $count" } proc Berlin:StatFileLastchatChan { channel } { global Berlin botnick; #if {$botnick!="Dev-L"} {return "-1"} if {[string index ${channel} 0]=="#"} { set savech [string range ${channel} 1 end] } else { set savech ${channel} } set count [Berlin:StatHTMLLastchatChan ${channel} ] set Berlin(WriteAwayChan) "$Berlin(WritePATH)/$botnick.stats.${savech}.lastchats.shtml" set fileid [open $Berlin(WriteAwayChan) w] puts $fileid [join $count] close $fileid #cydebug "Berlin:StatFileLastchatDefault - $count" } proc Berlin:StatFileCustomDefault { Custom } { global Berlin botnick; #if {$botnick!="Dev-L"} {return "-1"} set count [Berlin:StatHTMLCustomDefault $Custom] set Berlin(WriteAwayChan) "$Berlin(WritePATH)/$botnick.stats.[string tolower $Custom].shtml" #putcmdlog "open $Berlin(WriteAway) - $count" set fileid [open $Berlin(WriteAwayChan) w] puts $fileid [join $count] close $fileid #cydebug "Berlin:StatFileUsercountDefault - $count" } proc Berlin:StatFileCustomChan { Custom channel } { global Berlin botnick; #if {$botnick!="Dev-L"} {return "-1"} if {[string index ${channel} 0]=="#"} { set savech [string range ${channel} 1 end] } else { set savech ${channel} } set count [Berlin:StatHTMLCustomChan $Custom ${channel}] set Berlin(WriteAwayChan) "$Berlin(WritePATH)/$botnick.stats.${savech}.[string tolower $Custom].shtml" #putcmdlog "open $Berlin(WriteAway) - $count" set fileid [open $Berlin(WriteAwayChan) w] puts $fileid [join $count] close $fileid #cydebug "Berlin:StatFileUsercountDefault - $count" } set Berlin(WriteAway) "$Berlin(WritePATH)/$botnick.stats.away.shtml" proc Berlin:StatUpdateDefault { } { Berlin:StatFileUsercountDefault; Berlin:StatFileLastchatDefault; } # Command Handler proc Berlin:DoCommand { nick uhost handle channel args } { set hold $args set command [string tolower [lindex $args 0]] if {$command == ""} {return 0} set arg1 [lindex $args 1] if {[string match "#*" $arg1]} { set channel $arg1 set misc1 [lindex $args 2] set misc2 [lindex $args 3] set misc3 [lindex $args 4] set misc4 [lindex $args 5] set misc1end [lrange $args 2 end] set misc2end [lrange $args 3 end] set misc3end [lrange $args 4 end] set misc4end [lrange $args 5 end] if {![validchan $arg1]} {notice $nick "$arg1 is not a registered channel."; return 0} } else { set channel ${channel} set misc1 [lindex $args 1] set misc2 [lindex $args 2] set misc3 [lindex $args 3] set misc4 [lindex $args 4] set misc1end [lrange $args 1 end] set misc2end [lrange $args 2 end] set misc3end [lrange $args 3 end] set misc4end [lrange $args 4 end] } switch -exact -- $command { CheckLogin {cydebug "[Berlin:CheckLogin $nick $uhost $handle ${channel}]"; return 1} } } ## binding procs proc Berlin:TestMsg { nick uhost handle {args ""} } { global Berlin botnick; set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } set channel $Berlin(ChannelIn); #cydebug "[Berlin:CheckLogin $nick $uhost $handle ${channel}]" set arg1 [lindex $args 1]; if {[string match "#*" $arg1]} { if {![validchan $arg1]} {notice $nick "$arg1 is not a registered channel."; return 0} set channel $arg1 } else { puthelp "NOTICE $nick :Please use /MSG $botnick #channel ..."; return 0; } cydebug "[Berlin:DoCommand $nick $uhost $handle ${channel} $args]" } proc Berlin:TestPub { nick uhost handle channel {args ""} } { putcmdlog "Berlin:TestPub" #cydebug "[Berlin:CheckLogin $nick $uhost $handle ${channel}]" cydebug "[Berlin:DoCommand $nick $uhost $handle ${channel} $args]" } #bind pubm - * *Berlin:pubm; proc *Berlin:pubm { nick uhost handle channel {args ""} } { global Berlin BStatT botnick; #putcmdlog "Berlin:pubm" #if {$botnick=="Berlin" && ${channel}!=$Berlin(Channel)} { return 0 } set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } foreach Nr "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" { if {![info exist BStatT(Lastchat${Nr})]=="1"} { set BStatT(Lastchat${Nr}) "" } } foreach Nr "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" { set Back [expr ${Nr} - 1]; set Last $BStatT(Lastchat${Nr}); set BStatT(Lastchat${Back}) $Last; } set BStatT(Lastchat19) "\[$Berlin(LastUpdateHour):$Berlin(LastUpdateMin)\] ${nick} \@ ${channel} [Berlin:UpdateStringWeb [Berlin:UpdateWebify $args]]"; foreach Nr "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" { if {![info exist BStatT(Lastchat${channel}${Nr})]=="1"} { set BStatT(Lastchat${channel}${Nr}) "" } } foreach Nr "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" { set Back [expr ${Nr} - 1]; set Last $BStatT(Lastchat${channel}${Nr}); set BStatT(Lastchat${channel}${Back}) $Last; } set BStatT(Lastchat${channel}19) "\[$Berlin(LastUpdateHour):$Berlin(LastUpdateMin)\] ${nick} [Berlin:UpdateStringWeb [Berlin:UpdateWebify $args]]"; Berlin:StatFileLastchatChan ${channel}; Berlin:StatFileLastchatDefault; return 1; } #bind join - * *Berlin:join; proc *Berlin:join { nick uhost handle channel } { Berlin:StatFileUsercountChan ${channel}; Berlin:StatAddCustomStatsDefault "Join" $nick $uhost $handle ${channel}; #Berlin:StatUpdateDefault; } #bind part - * *Berlin:part; proc *Berlin:part { nick uhost handle channel args } { set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } if { [string match "*http://*.*" $args] || [string match "*.*/*" $args] || [string match "*www.*" $args] || [string match "* #*" $args] || [string match "#*" $args]} { set args "-X-" } Berlin:StatFileUsercountChan ${channel}; Berlin:StatAddCustomStatsDefault "Part" $nick $uhost $handle ${channel} $args; #Berlin:StatUpdateDefault; } #bind sign - * *Berlin:sign; proc *Berlin:sign { nick uhost handle channel args } { set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } if { [string match "*http://*.*" $args] || [string match "*.*/*" $args] || [string match "*www.*" $args] || [string match "* #*" $args] || [string match "#*" $args]} { set args "-X-" } Berlin:StatFileUsercountChan ${channel}; Berlin:StatAddCustomStatsDefault "Quit" $nick $uhost $handle ${channel} $args; #Berlin:StatUpdateDefault; } #bind topc - * *Berlin:topc; proc *Berlin:topc { nick uhost handle channel args } { set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } Berlin:StatFileUsercountChan ${channel}; Berlin:StatAddCustomStatsDefault "TopC" $nick $uhost $handle ${channel} $args; #Berlin:StatUpdateDefault; } #bind kick - * *Berlin:kick; # { } proc *Berlin:kick { nick uhost handle channel dest args } { set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } #if {$dest==$args || $args=="" } { set kick ""; } else { set kick "$args"; } set nick "$nick > $dest" Berlin:StatFileUsercountChan ${channel}; Berlin:StatAddCustomStatsDefault "Kick" $nick $uhost $handle ${channel} $args; #Berlin:StatUpdateDefault; } #bind nick - * *Berlin:nick; proc *Berlin:nick { nick uhost handle channel args } { set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } Berlin:StatFileUsercountChan ${channel}; Berlin:StatAddCustomStatsDefault "NickCh" $nick $uhost $handle ${channel} $args; #Berlin:StatUpdateDefault; } #bind ctcp - ACTION *Berlin:ctcp; proc *Berlin:ctcp {nick uhost handle channel keyword args} { set arg [lindex [split $args "{"] 1] set arg [lindex [split $arg "}"] 0] if {$arg != "" && $arg != $args} { set args $arg } if { ($args == "\{\{\}\}") || ($args == "\{\}") || ($args == "{{}}") || ($args == "{}") } { set args "" } #Berlin:StatFileUsercountChan ${channel}; #Berlin:StatAddCustomStatsDefault "NickCh" $nick $uhost $handle ${channel} $args; #Berlin:StatUpdateDefault; } #bind time - "* * * * *" *Berlin:time; proc *Berlin:time { min hour args } { global Berlin BStatT; set Berlin(LastUpdateHour) "$hour" set Berlin(LastUpdateMin) "$min" #putcmdlog "Berlin:time { $hour $min $args }" foreach Nr "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" { if {![info exist BStatT(Lastchat${Nr})]=="1"} { set BStatT(Lastchat${Nr}) "" } } Berlin:StatUpdateDefault; } ## init procs proc Berlin:LogInit { } { global Berlin; #if {$Berlin(UseAuthNone)=="1"} { cydebug "Attention: Use Hostmask login" } #if {$Berlin(UseAuthLOL)=="1"} { cydebug "Attention: Use LOL-Tools login" } #if {$Berlin(UseAuthStorm)=="1"} { cydebug "Attention: Use Stormbot login" } } proc Berlin:Rehash { } { global Berlin; putlog "$Berlin(PrgName) $Berlin(Version) rehashed" Berlin:LogInit; } proc Berlin:Init { } { global Berlin; putlog "$Berlin(Author) $Berlin(PrgName) $Berlin(Version) loaded" Berlin:LogInit; } ### basement if {![info exist lol(version_number)]!="1"} { set Berlin(UseAuthLOL) "0" } if {![info exist stormver]=="1"} { set Berlin(UseAuthStorm) "0" } set Berlin(PrgName) "Berlin" set Berlin(Author) "CyBex" set Berlin(Version) "Version 0.1.5" if {![info exist Berlin(Loaded)]=="1"} { ## First Edit 06.Apr.2002 ## Last Edit 06.Apr.2002 set Berlin(Loaded) "1" set Berlin(Base) "CyStd" set Berlin(LastUpdateHour) "0" set Berlin(LastUpdateMin) "0" Berlin:Init; rehash; } else { Berlin:Rehash; } ### the end