Explorar o código

the slave script for the drones

Paul Klumpp %!s(int64=12) %!d(string=hai) anos
pai
achega
8884dadb0a
Modificáronse 1 ficheiros con 74 adicións e 0 borrados
  1. 74 0
      cims_interconnect_slave.tcl

+ 74 - 0
cims_interconnect_slave.tcl

@@ -0,0 +1,74 @@
+# CIMS: Community IRC Messaging Service
+# CIMS formerly known as MNET (Message Network)
+# Multiple Network Interconnection SLAVE Script
+# Copyright (C) 2004 Paul-Dieter Klumpp
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+namespace eval ::cims::interconnect {
+}
+
+# we get the count as a full message layout from the MASTER interconnect bot.
+proc ::cims::interconnect::reply_from_icmaster {rec_botnick cmd rec_data} {
+
+	set tmp_network [join [lindex $rec_data 0]]
+	set rec_network [::putils::kill_spaces $tmp_network]
+	#putlog  "network: '$network'"
+
+	set tmp_name [join [lindex $rec_data 1]]
+	#putlog "tmp_net: '$tmp_network'"
+	#putlog "tmp_nam: '$tmp_name'"
+	set rec_freqname  [::putils::kill_spaces $tmp_name]
+	#putlog  "name: '$name'"
+
+	set rec_source  [::putils::kill_spaces [join [lindex $rec_data 2]]]
+
+	set rec_text [join [lrange $rec_data 3 end]]
+	#putlog "rec_text: '$rec_text'"
+
+	set allowed [::cims::allowed_netbot $rec_network ${rec_botnick}]
+	if {$allowed == 0} {
+		return 0
+	}
+	# now the bot is declared as a known bot.
+
+	set ::cims::interconnect::receive_count($rec_freqname,$rec_source) $rec_text
+
+}
+
+# called right before the local output... INJECT it ;)
+proc ::cims::timeout_reply_from_local_for_netbots_plugin {freqname source} {
+	upvar output output
+
+	if {[info exists ::cims::interconnect::receive_count($freqname,$source)]} {
+		set output "$output $::cims::interconnect::receive_count($freqname,$source)"
+	} 
+}
+
+# ========================================================================================
+
+proc ::cims::interconnect::bindings {} {
+	bind bot - mnet_interconnect_answer		::cims::interconnect::reply_from_icmaster
+}
+
+proc ::cims::interconnect::main {} {
+  putlog "mnet! = mnet interconnection SLAVE script loaded."
+	::cims::interconnect::bindings
+}
+
+namespace eval ::cims::interconnect {
+  # timer weil $botnet-nick nicht sofort von eggdrop gesetzt wird
+  utimer 3 "::cims::interconnect::main"
+}