|
@@ -19,7 +19,7 @@
|
|
|
|
|
|
|
|
namespace eval ::cims::admin {
|
|
namespace eval ::cims::admin {
|
|
|
variable admin_channels {"#messagenet" "#quad.dev" "#qwnet"}
|
|
variable admin_channels {"#messagenet" "#quad.dev" "#qwnet"}
|
|
|
- variable mnet_admin_version "Mnet!1.013namespaced"
|
|
|
|
|
|
|
+ variable mnet_admin_version "cims!A!1.14namespaced+savesettings"
|
|
|
|
|
|
|
|
# include my/our little eggdrop utilities and helper library. ;-) Putils!
|
|
# include my/our little eggdrop utilities and helper library. ;-) Putils!
|
|
|
if {[file isfile "scripts/cims/putils.tcl"] == 1} {
|
|
if {[file isfile "scripts/cims/putils.tcl"] == 1} {
|
|
@@ -30,6 +30,7 @@ namespace eval ::cims::admin {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
# allowcheck for admin commands..
|
|
# allowcheck for admin commands..
|
|
|
proc ::cims::admin::allowed_channel {nick mask hand chan admin_channels} {
|
|
proc ::cims::admin::allowed_channel {nick mask hand chan admin_channels} {
|
|
|
global botnick botnet-nick lastbind
|
|
global botnick botnet-nick lastbind
|
|
@@ -171,12 +172,15 @@ proc ::cims::admin::has_channelrecord {chan} {
|
|
|
|
|
|
|
|
proc ::cims::admin::trylink {nick mask hand chan text} {
|
|
proc ::cims::admin::trylink {nick mask hand chan text} {
|
|
|
variable admin_channels
|
|
variable admin_channels
|
|
|
- variable mnet_admin_version
|
|
|
|
|
- variable mnet
|
|
|
|
|
global botnet-nick
|
|
global botnet-nick
|
|
|
|
|
|
|
|
- set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
- set botslist [userlist b]
|
|
|
|
|
|
|
+ set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
+ set botslist [userlist b]
|
|
|
|
|
+
|
|
|
|
|
+ set allowed [::cims::admin::allowed_channel $nick $mask $hand $chan $admin_channels]
|
|
|
|
|
+ if {$allowed == 0} {
|
|
|
|
|
+ return 0
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
foreach _try_bot $botslist {
|
|
foreach _try_bot $botslist {
|
|
|
if {[islinked ${_try_bot}] == 0} {
|
|
if {[islinked ${_try_bot}] == 0} {
|
|
@@ -195,25 +199,63 @@ proc ::cims::admin::trylink {nick mask hand chan text} {
|
|
|
|
|
|
|
|
proc ::cims::admin::trylink_test {_try_bot nick} {
|
|
proc ::cims::admin::trylink_test {_try_bot nick} {
|
|
|
variable admin_channels
|
|
variable admin_channels
|
|
|
- variable mnet_admin_version
|
|
|
|
|
- variable mnet
|
|
|
|
|
global botnet-nick
|
|
global botnet-nick
|
|
|
|
|
|
|
|
- set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
|
|
+ set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
|
|
|
- if {[islinked ${_try_bot}] == 1} {
|
|
|
|
|
- ::putils::put_nick ${nick} "Mnet! \"${proper_botnick}\" \00309succeeded\003 to link to \"${_try_bot}\"! :)"
|
|
|
|
|
- } else {
|
|
|
|
|
- ::putils::put_nick ${nick} "Mnet! \"${proper_botnick}\" \00304FAILED\003 to link to \"${_try_bot}\"! :("
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if {[islinked ${_try_bot}] == 1} {
|
|
|
|
|
+ ::putils::put_nick ${nick} "Mnet! \"${proper_botnick}\" \00309succeeded\003 to link to \"${_try_bot}\"! :)"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ::putils::put_nick ${nick} "Mnet! \"${proper_botnick}\" \00304FAILED\003 to link to \"${_try_bot}\"! :("
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+proc ::cims::admin::savesettings {nick mask hand chan text} {
|
|
|
|
|
+ variable admin_channels
|
|
|
|
|
+ global botnet-nick botnick
|
|
|
|
|
+
|
|
|
|
|
+ set allowed [::cims::admin::allowed_channel $nick $mask $hand $chan $admin_channels]
|
|
|
|
|
+ if {$allowed == 0} {
|
|
|
|
|
+ return 0
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
+
|
|
|
|
|
+ ::putils::put_nick ${nick} "Mnet! \"${proper_botnick}\" saves settings."
|
|
|
|
|
+
|
|
|
|
|
+ namespace eval ::cims {
|
|
|
|
|
+ set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
+ ::putils::write_f_array "scripts/cims/save/${proper_botnick}.cims" [array get mnet_freqs_onoff]
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+proc ::cims::admin::loadsettings {nick mask hand chan text} {
|
|
|
|
|
+ variable admin_channels
|
|
|
|
|
+ global botnet-nick botnick
|
|
|
|
|
+
|
|
|
|
|
+ set allowed [::cims::admin::allowed_channel $nick $mask $hand $chan $admin_channels]
|
|
|
|
|
+ if {$allowed == 0} {
|
|
|
|
|
+ return 0
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
+
|
|
|
|
|
+ ::putils::put_nick ${nick} "Mnet! \"${proper_botnick}\" restores settings."
|
|
|
|
|
+
|
|
|
|
|
+ namespace eval ::cims {
|
|
|
|
|
+ set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
+ array set mnet_freqs_onoff [::putils::read_f_array "scripts/cims/save/${proper_botnick}.cims"]
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
proc ::cims::admin::reload {nick mask hand chan text} {
|
|
proc ::cims::admin::reload {nick mask hand chan text} {
|
|
|
variable admin_channels
|
|
variable admin_channels
|
|
|
global botnet-nick
|
|
global botnet-nick
|
|
|
|
|
|
|
|
-
|
|
|
|
|
set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
|
|
|
|
|
|
set allowed [::cims::admin::allowed_channel $nick $mask $hand $chan $admin_channels]
|
|
set allowed [::cims::admin::allowed_channel $nick $mask $hand $chan $admin_channels]
|
|
@@ -224,15 +266,13 @@ proc ::cims::admin::reload {nick mask hand chan text} {
|
|
|
set cmd "dummy"
|
|
set cmd "dummy"
|
|
|
# reload config... be sure this script works or the bot will DIE!
|
|
# reload config... be sure this script works or the bot will DIE!
|
|
|
putlog "mnet! = reloading configs by admin"
|
|
putlog "mnet! = reloading configs by admin"
|
|
|
- mnet:dcc_configload ${cmd} ${cmd} ${cmd}
|
|
|
|
|
|
|
+ ::cims::dcc_configload ${cmd} ${cmd} ${cmd}
|
|
|
::putils::put_nick ${nick} "Mnet! \"${proper_botnick}\" Configs reload triggered."
|
|
::putils::put_nick ${nick} "Mnet! \"${proper_botnick}\" Configs reload triggered."
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
proc ::cims::admin::main {nick mask hand chan text} {
|
|
proc ::cims::admin::main {nick mask hand chan text} {
|
|
|
variable admin_channels
|
|
variable admin_channels
|
|
|
- variable mnet_admin_version
|
|
|
|
|
- variable mnet
|
|
|
|
|
global botnet-nick
|
|
global botnet-nick
|
|
|
|
|
|
|
|
set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
set proper_botnick [::putils::proper_botnick ${botnet-nick}]
|
|
@@ -246,8 +286,8 @@ proc ::cims::admin::main {nick mask hand chan text} {
|
|
|
set tmp_value [lindex ${text} 1]
|
|
set tmp_value [lindex ${text} 1]
|
|
|
|
|
|
|
|
|
|
|
|
|
- set cmd [string tolower [mnet:kill_spaces ${tmp_cmd}]]
|
|
|
|
|
- set value [string tolower [mnet:kill_spaces ${tmp_value}]]
|
|
|
|
|
|
|
+ set cmd [string tolower [::putils::kill_spaces ${tmp_cmd}]]
|
|
|
|
|
+ set value [string tolower [::putils::kill_spaces ${tmp_value}]]
|
|
|
|
|
|
|
|
if {${cmd} == "add"} {
|
|
if {${cmd} == "add"} {
|
|
|
|
|
|
|
@@ -311,6 +351,19 @@ proc ::cims::admin::main {nick mask hand chan text} {
|
|
|
::cims::admin::rehash $nick $mask $hand $chan $text
|
|
::cims::admin::rehash $nick $mask $hand $chan $text
|
|
|
return 0
|
|
return 0
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if {${cmd} == "savesettings"} {
|
|
|
|
|
+ # savesettings
|
|
|
|
|
+ ::cims::admin::savesettings $nick $mask $hand $chan $text
|
|
|
|
|
+ return 0
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if {${cmd} == "loadsettings"} {
|
|
|
|
|
+ # loadsettings
|
|
|
|
|
+ ::cims::admin::loadsettings $nick $mask $hand $chan $text
|
|
|
|
|
+ return 0
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
if {${cmd} == "version"} {
|
|
if {${cmd} == "version"} {
|
|
|
# tells version
|
|
# tells version
|
|
@@ -320,7 +373,7 @@ proc ::cims::admin::main {nick mask hand chan text} {
|
|
|
|
|
|
|
|
|
|
|
|
|
# none of the above worked .. so we are here:
|
|
# none of the above worked .. so we are here:
|
|
|
- ::putils::put_nick ${nick} "mnet! possible commands are: add remove reload channels rehash version"
|
|
|
|
|
|
|
+ ::putils::put_nick ${nick} "mnet! possible commands are: add remove reload channels rehash version savesettings loadsettings"
|
|
|
::putils::put_nick ${nick} "mnet! use either \002!mnet_botnetnickname <command>\002 to admin a single bot or just \002!mnet_<command>\002 to admin ALL bots that listen to your words here."
|
|
::putils::put_nick ${nick} "mnet! use either \002!mnet_botnetnickname <command>\002 to admin a single bot or just \002!mnet_<command>\002 to admin ALL bots that listen to your words here."
|
|
|
::putils::put_nick ${nick} "add #channelname || bot joins a channel"
|
|
::putils::put_nick ${nick} "add #channelname || bot joins a channel"
|
|
|
::putils::put_nick ${nick} "remove #channelname || bot parts a channel"
|
|
::putils::put_nick ${nick} "remove #channelname || bot parts a channel"
|
|
@@ -328,9 +381,8 @@ proc ::cims::admin::main {nick mask hand chan text} {
|
|
|
::putils::put_nick ${nick} "channels || tells some channel-infos"
|
|
::putils::put_nick ${nick} "channels || tells some channel-infos"
|
|
|
::putils::put_nick ${nick} "rehash || rehashes the bot, reloads all botscripts"
|
|
::putils::put_nick ${nick} "rehash || rehashes the bot, reloads all botscripts"
|
|
|
::putils::put_nick ${nick} "version || tells version"
|
|
::putils::put_nick ${nick} "version || tells version"
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ::putils::put_nick ${nick} "savesettings || saves channel output settings to file"
|
|
|
|
|
+ ::putils::put_nick ${nick} "loadsettings || restores channel output settings from file"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -346,6 +398,9 @@ proc ::cims::admin::bindings {} {
|
|
|
bind pub - !mnet_rehash ::cims::admin::rehash
|
|
bind pub - !mnet_rehash ::cims::admin::rehash
|
|
|
bind pub - !mnet_version ::cims::admin::version
|
|
bind pub - !mnet_version ::cims::admin::version
|
|
|
bind pub - !mnet_trylink ::cims::admin::trylink
|
|
bind pub - !mnet_trylink ::cims::admin::trylink
|
|
|
|
|
+ bind pub - !mnet_savesettings ::cims::admin::savesettings
|
|
|
|
|
+ bind pub - !mnet_loadsettings ::cims::admin::loadsettings
|
|
|
|
|
+
|
|
|
|
|
|
|
|
putlog "mnet! = mnet adminscript loaded: $mnet_admin_version"
|
|
putlog "mnet! = mnet adminscript loaded: $mnet_admin_version"
|
|
|
}
|
|
}
|
|
@@ -358,3 +413,4 @@ namespace eval ::cims::admin {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|