636 |
putdcc "Added bot '$bot' with address '$address' and hostmask '$host'" |
putdcc "Added bot '$bot' with address '$address' and hostmask '$host'" |
637 |
} |
} |
638 |
|
|
639 |
|
bind dcc nm +user ::tcldrop::dcc::+USER |
640 |
|
proc ::tcldrop::dcc::+USER {handle idx text} { |
641 |
|
set user [::tcldrop::slindex $text 0] |
642 |
|
set hostmask [::tcldrop::slindex $text 1] |
643 |
|
adduser $user $hostmask |
644 |
|
putcmdlog "#$handle# +user $text" |
645 |
|
putdcc $idx "Added $user ($hostmask) with [chattr $user] flags" |
646 |
|
} |
647 |
|
|
648 |
bind dcc n -user ::tcldrop::dcc::-USER |
bind dcc n -user ::tcldrop::dcc::-USER |
649 |
proc ::tcldrop::dcc::-USER {handle idx text} { |
proc ::tcldrop::dcc::-USER {handle idx text} { |
650 |
if {[deluser $text]} { |
if {[deluser $text]} { |
713 |
set changes [::tcldrop::slindex $text 1] |
set changes [::tcldrop::slindex $text 1] |
714 |
set channel [::tcldrop::slindex $text 2] |
set channel [::tcldrop::slindex $text 2] |
715 |
if {[set chattr [chattr $who $changes $channel]] == {*}} { |
if {[set chattr [chattr $who $changes $channel]] == {*}} { |
716 |
putdcc "No such user." |
putdcc {No such user.} |
717 |
} else { |
} else { |
718 |
putcmdlog "#$handle# chattr $text" |
putcmdlog "#$handle# chattr $text" |
719 |
putdcc $idx "Global flags for $who are now +[lindex [split $chattr |] 0]" |
putdcc $idx "Global flags for $who are now +[lindex [split $chattr |] 0]" |
723 |
} |
} |
724 |
} |
} |
725 |
|
|
726 |
|
bind dcc nmto save ::tcldrop::dcc::SAVE |
727 |
|
proc ::tcldrop::dcc::SAVE {handle idx text} { |
728 |
|
save |
729 |
|
putcmdlog "#$handle# save $text" |
730 |
|
putdcc $idx {Saving user file...} |
731 |
|
} |
732 |
|
|
733 |
|
bind dcc nmtof uptime ::tcldrop::dcc::UPTIME |
734 |
|
proc ::tcldrop::dcc::UPTIME {handle idx text} { |
735 |
|
putcmdlog "#$handle# uptime $text" |
736 |
|
# FixMe: Add an [uptime] proc that returns the seconds that the bot has been running. |
737 |
|
putdcc $idx "Online for [duration [uptime]]." |
738 |
|
} |
739 |
|
|
740 |
|
bind dcc nmt backup ::tcldrop::dcc::BACKUP |
741 |
|
proc ::tcldrop::dcc::BACKUP {handle idx text} { |
742 |
|
putcmdlog "#$handle# backup $text" |
743 |
|
putdcc $idx {Backing up data files...} |
744 |
|
# FixMe: Add a [backup] command that calls the "backup" bindings. The bindings should in turn do the backing up of the user/channel files. |
745 |
|
backup |
746 |
|
} |
747 |
|
|
748 |
|
bind dcc n comment ::tcldrop::dcc::COMMENT |
749 |
|
proc ::tcldrop::dcc::COMMENT {handle idx text} { |
750 |
|
set who [::tcldrop::slindex $text 0] |
751 |
|
set comment [::tcldrop::slindex $text 1] |
752 |
|
setuser $who COMMENT $comment |
753 |
|
putcmdlog "#$handle# comment $text" |
754 |
|
putdcc $idx {Changed comment.} |
755 |
|
} |
756 |
|
|
757 |
|
bind dcc n reload ::tcldrop::dcc::RELOAD |
758 |
|
proc ::tcldrop::dcc::RELOAD {handle idx text} { |
759 |
|
putcmdlog "#$handle# reload $text" |
760 |
|
putdcc $idx {Reloading user file...} |
761 |
|
reload |
762 |
|
} |
763 |
|
|
764 |
|
bind dcc n rehash ::tcldrop::dcc::REHASH |
765 |
|
proc ::tcldrop::dcc::REHASH {handle idx text} { |
766 |
|
putcmdlog "#$handle# rehash $text" |
767 |
|
putdcc $idx {Rehashing..} |
768 |
|
rehash |
769 |
|
} |
770 |
|
|
771 |
|
bind dcc n die ::tcldrop::dcc::DIE |
772 |
|
proc ::tcldrop::dcc::DIE {handle idx text} { |
773 |
|
putcmdlog "#$handle# die $text" |
774 |
|
putdcc $idx {Dieing...} |
775 |
|
die |
776 |
|
} |
777 |
|
|
778 |
|
bind dcc n loadmod ::tcldrop::dcc::LOADMOD |
779 |
|
proc ::tcldrop::dcc::LOADMOD {handle idx text} { |
780 |
|
loadmodule $text |
781 |
|
putcmdlog "#$handle# loadmod $text" |
782 |
|
putdcc $idx "Module loaded: $text" |
783 |
|
} |
784 |
|
|
785 |
|
bind dcc n unloadmod ::tcldrop::dcc::UNLOADMOD |
786 |
|
proc ::tcldrop::dcc::UNLOADMOD {handle idx text} { |
787 |
|
unloadmodule $text |
788 |
|
putcmdlog "#$handle# unloadmod $text" |
789 |
|
putdcc $idx "Module unloaded: $text" |
790 |
|
} |
791 |
|
|
792 |
bind time - {* * * * *} ::tcldrop::dcc::AutoLinkBots |
bind time - {* * * * *} ::tcldrop::dcc::AutoLinkBots |
793 |
proc ::tcldrop::dcc::AutoLinkBots {minute hour day month year} { |
proc ::tcldrop::dcc::AutoLinkBots {minute hour day month year} { |