|
|
@@ -420,7 +420,7 @@ proc ::cims::xmlDefaultCmd {data} {
|
|
|
|
|
|
namespace eval ::cims {
|
|
|
## some internal variables for messaging and stuff :) not your business after all.
|
|
|
- set mnet(version) "mnet 1.013putils"
|
|
|
+ set mnet(version) "cims!1.013putils"
|
|
|
|
|
|
set mnet_max_history 8
|
|
|
|
|
|
@@ -539,7 +539,6 @@ proc get_httpfile {host file port} {
|
|
|
}
|
|
|
}
|
|
|
proc get_localfile {file} {
|
|
|
- global botnet-nick
|
|
|
|
|
|
set data ""
|
|
|
if {[file isfile "$file"] == 1} {
|
|
|
@@ -556,6 +555,28 @@ proc get_localfile {file} {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#::cims::write_arraytofile "scripts/cims/$botnick.cims" "mnet_freqs_onoff"
|
|
|
+proc ::cims::write_arraytofile {file arrayname} {
|
|
|
+ variable $arrayname
|
|
|
+
|
|
|
+ set array_string [array get $arrayname]
|
|
|
+
|
|
|
+ #putlog "array_string: $array_string"
|
|
|
+
|
|
|
+ set fh [open "$file" "w"]
|
|
|
+ puts $fh $array_string
|
|
|
+ close $fh
|
|
|
+}
|
|
|
+#::cims::read_arrayfromfile "scripts/cims/$botnick.cims" "mnet_freqs_onoff"
|
|
|
+proc ::cims::read_arrayfromfile {file arrayname} {
|
|
|
+ variable $arrayname
|
|
|
+
|
|
|
+ set fh [open "$file" "r"]
|
|
|
+ array set $arrayname [gets $fh]
|
|
|
+ close $fh
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
proc ::cims::dummy {} {
|
|
|
@@ -1028,37 +1049,36 @@ proc ::cims::enable_frequency {nick mask hand chan text} {
|
|
|
variable mnet_colors
|
|
|
variable mnet_freqs
|
|
|
variable mnet_freqs_onoff
|
|
|
- global botnick lastbind
|
|
|
+ global botnick lastbind botnet-nick
|
|
|
|
|
|
- set com $lastbind
|
|
|
-
|
|
|
- # validating incoming vars
|
|
|
- set chan [::cims::proper_channelname $chan]
|
|
|
-
|
|
|
+ set com $lastbind
|
|
|
|
|
|
- # cutting .prefix_enable down to .prefix
|
|
|
- set prefix [string range $com 0 [expr [string first _ $com] -1]]
|
|
|
- #putlog "::cims:: the prefix is $prefix"
|
|
|
+ # validating incoming vars
|
|
|
+ set chan [::cims::proper_channelname $chan]
|
|
|
|
|
|
- set network [join [lindex $mnet_networks_by_prefix($prefix) 0]]
|
|
|
- set name [join [lindex $mnet_networks_by_prefix($prefix) 1]]
|
|
|
- set help [join [lindex $mnet_networks_by_prefix($prefix) 2]]
|
|
|
- set desc [join [lindex $mnet_networks_by_prefix($prefix) 3]]
|
|
|
|
|
|
- #putlog "network: $network"
|
|
|
- set allowed [::cims::allowed_channel $network $name $prefix $nick $mask $chan]
|
|
|
- if {$allowed == 0} {
|
|
|
- return 0
|
|
|
- }
|
|
|
- # now generally allowed.
|
|
|
-
|
|
|
-
|
|
|
- putlog "mnet_freq_status: before $mnet_freqs_onoff($name,$chan)"
|
|
|
- set mnet_freqs_onoff($name,$chan) 1
|
|
|
- putlog "mnet_freq_status: now $mnet_freqs_onoff($name,$chan)"
|
|
|
-
|
|
|
- ::putils::put_local_msg $chan "::cims:: $name _output_ enabled for $chan"
|
|
|
-
|
|
|
+ # cutting .prefix_enable down to .prefix
|
|
|
+ set prefix [string range $com 0 [expr [string first _ $com] -1]]
|
|
|
+ #putlog "::cims:: the prefix is $prefix"
|
|
|
+
|
|
|
+ set network [join [lindex $mnet_networks_by_prefix($prefix) 0]]
|
|
|
+ set name [join [lindex $mnet_networks_by_prefix($prefix) 1]]
|
|
|
+ set help [join [lindex $mnet_networks_by_prefix($prefix) 2]]
|
|
|
+ set desc [join [lindex $mnet_networks_by_prefix($prefix) 3]]
|
|
|
+
|
|
|
+ #putlog "network: $network"
|
|
|
+ set allowed [::cims::allowed_channel $network $name $prefix $nick $mask $chan]
|
|
|
+ if {$allowed == 0} {
|
|
|
+ return 0
|
|
|
+ }
|
|
|
+ # now generally allowed.
|
|
|
+
|
|
|
+ putlog "mnet_freq_status: before $mnet_freqs_onoff($name,$chan)"
|
|
|
+ set mnet_freqs_onoff($name,$chan) 1
|
|
|
+ putlog "mnet_freq_status: now $mnet_freqs_onoff($name,$chan)"
|
|
|
+
|
|
|
+ ::putils::put_local_msg $chan "::cims:: $name _output_ enabled for $chan"
|
|
|
+
|
|
|
}
|
|
|
|
|
|
proc ::cims::disable_frequency {nick mask hand chan text} {
|
|
|
@@ -1104,11 +1124,15 @@ proc ::cims::disable_frequency {nick mask hand chan text} {
|
|
|
|
|
|
proc ::cims::toggle_frequency {nick mask hand chan text} {
|
|
|
# proc triggered by specified $prefix_toggle
|
|
|
- variable mnet mnet_channels mnet_bots mnet_networks_by_prefix \
|
|
|
- mnet_colors \
|
|
|
- mnet_freqs mnet_freqs_onoff
|
|
|
- global botnick lastbind
|
|
|
-
|
|
|
+ variable mnet
|
|
|
+ variable mnet_channels
|
|
|
+ variable mnet_bots
|
|
|
+ variable mnet_networks_by_prefix
|
|
|
+ variable mnet_colors
|
|
|
+ variable mnet_freqs
|
|
|
+ variable mnet_freqs_onoff
|
|
|
+ global botnick lastbind
|
|
|
+
|
|
|
set com $lastbind
|
|
|
|
|
|
# validating incoming vars
|
|
|
@@ -1149,9 +1173,13 @@ proc ::cims::toggle_frequency {nick mask hand chan text} {
|
|
|
#::cims::enable_color
|
|
|
proc ::cims::enable_color {nick mask hand chan text} {
|
|
|
# proc triggered by specified $prefix_enable
|
|
|
- variable mnet mnet_channels mnet_bots mnet_networks_by_prefix \
|
|
|
- mnet_colors_optional mnet_colors_onoff
|
|
|
- global botnick lastbind
|
|
|
+ variable mnet
|
|
|
+ variable mnet_channels
|
|
|
+ variable mnet_bots
|
|
|
+ variable mnet_networks_by_prefix
|
|
|
+ variable mnet_colors_optional
|
|
|
+ variable mnet_colors_onoff
|
|
|
+ global botnick lastbind
|
|
|
|
|
|
set com $lastbind
|
|
|
|
|
|
@@ -1282,11 +1310,16 @@ proc ::cims::toggle_color {nick mask hand chan text} {
|
|
|
#::cims::toggle_color
|
|
|
proc ::cims::status_frequency {nick mask hand chan text} {
|
|
|
# proc triggered by specified $prefix_toggle
|
|
|
- variable mnet mnet_channels mnet_bots mnet_networks_by_prefix \
|
|
|
- mnet_colors_optional mnet_colors_onoff \
|
|
|
- mnet_freqs_onoff \
|
|
|
- mnet_reached_users mnet_reached_chans
|
|
|
- global botnick lastbind
|
|
|
+ variable mnet
|
|
|
+ variable mnet_channels
|
|
|
+ variable mnet_bots
|
|
|
+ variable mnet_networks_by_prefix
|
|
|
+ variable mnet_colors_optional
|
|
|
+ variable mnet_colors_onoff
|
|
|
+ variable mnet_freqs_onoff
|
|
|
+ variable mnet_reached_users
|
|
|
+ variable mnet_reached_chans
|
|
|
+ global botnick lastbind
|
|
|
|
|
|
set com $lastbind
|
|
|
|
|
|
@@ -1313,10 +1346,9 @@ proc ::cims::status_frequency {nick mask hand chan text} {
|
|
|
set status_message "$chan $name: "
|
|
|
|
|
|
if {$mnet_freqs_onoff($name,$chan) == 1} {
|
|
|
- append status_message "frequency output is on. "
|
|
|
-
|
|
|
+ append status_message "frequency output is on. "
|
|
|
} else {
|
|
|
- append status_message "frequency output is off. "
|
|
|
+ append status_message "frequency output is off. "
|
|
|
}
|
|
|
|
|
|
if {$mnet_colors_optional($network) == 1} {
|
|
|
@@ -1610,7 +1642,7 @@ proc ::cims::binds {} {
|
|
|
}
|
|
|
bind bot - mnet_receive ::cims::receive_message
|
|
|
bind bot - mnet_answer ::cims::receive_answer
|
|
|
-bind dcc m mnet_reload ::cims::dcc_configload
|
|
|
+bind dcc m cims_reload ::cims::dcc_configload
|
|
|
|
|
|
proc ::cims::conf_parsing {} {
|
|
|
variable mnet_config
|
|
|
@@ -1640,9 +1672,9 @@ proc ::cims::dcc_configload {dummy1 dummy2 dummy3} {
|
|
|
::cims::netconfigload
|
|
|
}
|
|
|
proc ::cims::netconfigload {} {
|
|
|
- variable mnet_http_config
|
|
|
- variable mnet_local_config
|
|
|
- variable mnet_config
|
|
|
+ variable mnet_http_config
|
|
|
+ variable mnet_local_config
|
|
|
+ variable mnet_config
|
|
|
variable mnet_num_configs
|
|
|
|
|
|
putlog "debug:: $mnet_http_config"
|