cims_interconnect_slave.tcl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # CIMS: Community IRC Messaging Service
  2. # CIMS formerly known as MNET (Message Network)
  3. # Multiple Network Interconnection SLAVE Script
  4. # Copyright (C) 2004 Paul-Dieter Klumpp
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License
  8. # as published by the Free Software Foundation; either version 2
  9. # of the License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. namespace eval ::cims::interconnect {
  20. }
  21. # we get the count as a full message layout from the MASTER interconnect bot.
  22. proc ::cims::interconnect::reply_from_icmaster {rec_botnick cmd rec_data} {
  23. set tmp_network [join [lindex $rec_data 0]]
  24. set rec_network [::putils::kill_spaces $tmp_network]
  25. #putlog "network: '$network'"
  26. set tmp_name [join [lindex $rec_data 1]]
  27. #putlog "tmp_net: '$tmp_network'"
  28. #putlog "tmp_nam: '$tmp_name'"
  29. set rec_freqname [::putils::kill_spaces $tmp_name]
  30. #putlog "name: '$name'"
  31. set rec_source [::putils::kill_spaces [join [lindex $rec_data 2]]]
  32. set rec_text [join [lrange $rec_data 3 end]]
  33. #putlog "rec_text: '$rec_text'"
  34. set allowed [::cims::allowed_netbot $rec_network ${rec_botnick}]
  35. if {$allowed == 0} {
  36. return 0
  37. }
  38. # now the bot is declared as a known bot.
  39. set ::cims::interconnect::receive_count($rec_freqname,$rec_source) $rec_text
  40. }
  41. # called right before the local output... INJECT it ;)
  42. proc ::cims::timeout_reply_from_local_for_netbots_plugin {freqname source} {
  43. upvar output output
  44. if {[info exists ::cims::interconnect::receive_count($freqname,$source)]} {
  45. set output "$output $::cims::interconnect::receive_count($freqname,$source)"
  46. }
  47. }
  48. # ========================================================================================
  49. proc ::cims::interconnect::bindings {} {
  50. bind bot - mnet_interconnect_answer ::cims::interconnect::reply_from_icmaster
  51. }
  52. proc ::cims::interconnect::main {} {
  53. putlog "mnet! = mnet interconnection SLAVE script loaded."
  54. ::cims::interconnect::bindings
  55. }
  56. namespace eval ::cims::interconnect {
  57. # timer weil $botnet-nick nicht sofort von eggdrop gesetzt wird
  58. utimer 3 "::cims::interconnect::main"
  59. }