/[tcldrop]/tcldrop/modules/dcc.tcl
ViewVC logotype

Diff of /tcldrop/modules/dcc.tcl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by fireegl, Fri Nov 14 21:36:11 2003 UTC revision 1.17 by fireegl, Sun Nov 16 02:55:37 2003 UTC
# Line 552  proc ::tcldrop::dcc::start {event} { Line 552  proc ::tcldrop::dcc::start {event} {
552  # Here goes all the DCC binds:  # Here goes all the DCC binds:
553  bind dcc n tcl ::tcldrop::dcc::TCL  bind dcc n tcl ::tcldrop::dcc::TCL
554  proc ::tcldrop::dcc::TCL {handle idx text} {  proc ::tcldrop::dcc::TCL {handle idx text} {
555            putcmdlog "#$handle# tcl $text"
556          if {[catch { uplevel \#0 $text } out]} {          if {[catch { uplevel \#0 $text } out]} {
557                  set out "TCL error: $out"                  set out "TCL error: $out"
558          } else {          } else {
# Line 562  proc ::tcldrop::dcc::TCL {handle idx tex Line 563  proc ::tcldrop::dcc::TCL {handle idx tex
563    
564  bind dcc n set ::tcldrop::dcc::SET  bind dcc n set ::tcldrop::dcc::SET
565  proc ::tcldrop::dcc::SET {handle idx text} {  proc ::tcldrop::dcc::SET {handle idx text} {
566          set variable [lindex [set text [split $text]] 0]          putcmdlog "#$handle# set $text"
567          set value [join [lrange $text 1 end]]          set variable [::tcldrop::::tcldrop::slindex $text 0]
568            set value [join [::tcldrop::slrange $text 1 end]]
569          if {[catch { uplevel \#0 [list set $variable $value] } out]} {          if {[catch { uplevel \#0 [list set $variable $value] } out]} {
570                  set out "Error: $out"                  set out "Error: $out"
571          } else {          } else {
# Line 574  proc ::tcldrop::dcc::SET {handle idx tex Line 576  proc ::tcldrop::dcc::SET {handle idx tex
576    
577  bind dcc - help ::tcldrop::dcc::HELP  bind dcc - help ::tcldrop::dcc::HELP
578  proc ::tcldrop::dcc::HELP {handle idx text} {  proc ::tcldrop::dcc::HELP {handle idx text} {
579            putcmdlog "#$handle# help $text"
580          putdcc $idx "There's no help here!  FixMe!"          putdcc $idx "There's no help here!  FixMe!"
581  }  }
582    
# Line 583  proc ::tcldrop::dcc::QUIT {handle idx te Line 586  proc ::tcldrop::dcc::QUIT {handle idx te
586          if {[idx2sock $idx] == {stdout}} {          if {[idx2sock $idx] == {stdout}} {
587                  putdcc $idx {Sorry, console users can't .quit   (FixMe!)}                  putdcc $idx {Sorry, console users can't .quit   (FixMe!)}
588          } else {          } else {
589                    putcmdlog "#$handle# quit $text"
590                  putdcc $idx {Bu-Bye!}                  putdcc $idx {Bu-Bye!}
591                  # FixMe: This should be $nick $uhost instead:                  # FixMe: This should be $nick $uhost instead:
592                  putlog "[format $::tcldrop::lang(0xe16) $handle $idx]"                  putlog "[format $::tcldrop::lang(0xe16) $handle $idx]"
# Line 590  proc ::tcldrop::dcc::QUIT {handle idx te Line 594  proc ::tcldrop::dcc::QUIT {handle idx te
594          }          }
595  }  }
596    
597    bind dcc - whoami ::tcldrop::dcc::WHOAMI
598    proc ::tcldrop::dcc::WHOAMI {handle idx text} {
599            putcmdlog "#$handle# whoami $text"
600            putdcc $idx "You are $handle@${::botnet-nick}"
601    }
602    
603    bind dcc - -host ::tcldrop::dcc::-HOST
604    proc ::tcldrop::dcc::-HOST {handle idx text} {
605            set who [::tcldrop::slindex $text 0]
606            set host [::tcldrop::slindex $text 1]
607            # FixMe: This should let anyone with higher flags that the person they want to -host remove their host, I think..
608            if {(([string equal -nocase $handle $who]) || ([matchattr $handle n])) && ([delhost $who $host])} {
609                    putcmdlog "#$handle# -host $who $host"
610                    putdcc $idx "Removed '$host' from $who"
611            }
612    }
613    
614    bind dcc nmt bots ::tcldrop::dcc::BOTS
615    proc ::tcldrop::dcc::BOTS {handle idx text} {
616            putcmdlog "#$handle# bots"
617            putdcc $idx "Bots: [join [bots] {, }]."
618            putdcc $idx "(Total: [llength [bots]])"
619    }
620    
621    bind dcc - newpass ::tcldrop::dcc::NEWPASS
622    proc ::tcldrop::dcc::NEWPASS {handle idx text} {
623            chpass $handle $text
624            putcmdlog "#$handle# newpass..."
625            putdcc $idx "Changed password to '$text'"
626    }
627    
628    bind dcc nmt +bot ::tcldrop::dcc::+BOT
629    proc ::tcldrop::dcc::+BOT {handle idx text} {
630            set bot [::tcldrop::slindex $text 0]
631            set address [::tcldrop::slindex $text 1]
632            set host [::tcldrop::slindex $text 2]
633            addbot $bot $address
634            addhost $bot $host
635            putcmdlog "#$handle# +bot $text"
636            putdcc "Added bot '$bot' with address '$address' and hostmask '$host'"
637    }
638    
639    bind dcc n -user ::tcldrop::dcc::-USER
640    proc ::tcldrop::dcc::-USER {handle idx text} {
641            if {[deluser $text]} {
642                    putcmdlog "#$handle# -bot $text"
643                    putdcc $idx "Deleted $text."
644            }
645    }
646    
647    bind dcc nmt -bot ::tcldrop::dcc::-BOT
648    proc ::tcldrop::dcc::-BOT {handle idx text} {
649            if {[matchattr $text b]} {
650                    -USER $handle $idx $text
651            }
652    }
653    
654    bind dcc nmt link ::tcldrop::dcc::LINK
655    proc ::tcldrop::dcc::LINK {handle idx text} {
656            if {[matchattr $text b]} {
657                    putcmdlog "#$handle# link $text"
658                    putdcc "Attempting to link to $text..."
659                    link $text
660            }
661    }
662    
663    bind dcc nmt chaddr ::tcldrop::dcc::CHADDR
664    proc ::tcldrop::dcc::CHADDR {handle idx text} {
665            set bot [::tcldrop::slindex $text 0]
666            if {[matchattr $bot b]} {
667                    set address [split [::tcldrop::slindex $text 1] "\\/:"]
668                    set botport [lindex $address 1]
669                    set userport [lindex $address 2]
670                    if {$userport == {}} { set userport $botport }
671                    set address [lindex $address 0]
672                    setuser $bot BOTADDR [list $address $botport $userport]
673                    putcmdlog "#$handle# chaddr $text"
674                    putdcc $idx {Changed bots address.}
675            }
676    }
677    
678    # FixMe: Allow non-owners to use this securely:
679    bind dcc n chpass ::tcldrop::dcc::CHPASS
680    proc ::tcldrop::dcc::CHPASS {handle idx text} {
681            set who [::tcldrop::slindex $text 0]
682            set pass [::tcldrop::slindex $text 1]
683            chpass $who $pass
684            putcmdlog "#$handle# chpass $who \[something\]"
685            putdcc $idx {Changed password.}
686    }
687    
688    bind dcc - +host ::tcldrop::dcc::+HOST
689    proc ::tcldrop::dcc::+HOST {handle idx text} {
690            set who [::tcldrop::slindex $text 0]
691            set host [::tcldrop::slindex $text 1]
692            # FixMe: This shouldn't be restricted to owners:
693            if {[string equal -nocase $who $handle] || [matchattr $handle n]} {
694                    addhost $who $host
695                    putcmdlog "#$handle# +host $text"
696                    putdcc $idx "Added '$host' to $who."
697            }
698    }
699    
700    # FixMe: This shouldn't be restricted to just owners:
701    bind dcc n chattr ::tcldrop::dcc::CHATTR
702    proc ::tcldrop::dcc::CHATTR {handle idx text} {
703            set who [::tcldrop::slindex $text 0]
704            set changes [::tcldrop::slindex $text 1]
705            set channel [::tcldrop::slindex $text 2]
706            if {[set chattr [chattr $who $changes $channel]] == {*}} {
707                    putdcc "No such user."
708            } else {
709                    putcmdlog "#$handle# chattr $text"
710                    putdcc $idx "Global flags for $who are now +[lindex [split $chattr |] 0]"
711                    if {$channel != {}} {
712                            putdcc $idx "Channel flags for $who on $channel are now +[lindex [split $chattr |] end]."
713                    }
714            }
715    }
716    
717    
718    
719  bind time - {* * * * *} ::tcldrop::dcc::AutoLinkBots  bind time - {* * * * *} ::tcldrop::dcc::AutoLinkBots
720  proc ::tcldrop::dcc::AutoLinkBots {minute hour day month year} {  proc ::tcldrop::dcc::AutoLinkBots {minute hour day month year} {

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26