cims_interconnect_slave.tcl 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. # vim: expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent:
  20. namespace eval ::cims::interconnect {
  21. }
  22. # we get the count as a full message layout from the MASTER interconnect bot.
  23. proc ::cims::interconnect::reply_from_icmaster {rec_botnick cmd rec_data} {
  24. set tmp_network [join [lindex $rec_data 0]]
  25. set rec_network [::putils::kill_spaces $tmp_network]
  26. #putlog "network: '$network'"
  27. set tmp_name [join [lindex $rec_data 1]]
  28. #putlog "tmp_net: '$tmp_network'"
  29. #putlog "tmp_nam: '$tmp_name'"
  30. set rec_freqname [::putils::kill_spaces $tmp_name]
  31. #putlog "name: '$name'"
  32. set rec_source [join [lindex $rec_data 2]]
  33. set rec_text [join [lrange $rec_data 3 end]]
  34. #putlog "rec_text: '$rec_text'"
  35. set allowed [::cims::allowed_netbot $rec_network ${rec_botnick}]
  36. if {$allowed == 0} {
  37. return 0
  38. }
  39. # now the bot is declared as a known bot.
  40. set ::cims::interconnect::receive_count($rec_freqname,$rec_source) $rec_text
  41. }
  42. # called right before the local output... INJECT it ;)
  43. proc ::cims::timeout_reply_from_local_for_netbots_plugin {freqname source} {
  44. upvar output output
  45. if {[info exists ::cims::interconnect::receive_count($freqname,$source)]} {
  46. set output "$output $::cims::interconnect::receive_count($freqname,$source)"
  47. }
  48. }
  49. # ========================================================================================
  50. proc ::cims::interconnect::bindings {} {
  51. bind bot - mnet_interconnect_answer ::cims::interconnect::reply_from_icmaster
  52. }
  53. proc ::cims::interconnect::main {} {
  54. putlog "mnet! = mnet interconnection SLAVE script loaded."
  55. ::cims::interconnect::bindings
  56. }
  57. namespace eval ::cims::interconnect {
  58. # timer weil $botnet-nick nicht sofort von eggdrop gesetzt wird
  59. utimer 3 "::cims::interconnect::main"
  60. }