<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/18336" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2011-02-26T14:55:41-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/18336</id>

		<entry>
		<author><name><![CDATA[judgey2K10]]></name></author>
		<updated>2011-02-26T14:55:41-04:00</updated>

		<published>2011-02-26T14:55:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96222#p96222</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96222#p96222"/>
		<title type="html"><![CDATA[chanrelay.tcl 3.0]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96222#p96222"><![CDATA[
Hey i want this script to relay only one way (not to both networks) I have tryed to play with settings but nothing works keeps relaying both channels.<br><br>Anyone could take a look for me would be great.<br><br>Cheers<div class="codebox"><p>Code: </p><pre><code># chanrelay.tcl 3.0## A way to link your channels## Author: CrazyCat &lt;crazycat@c-p-f.org&gt;# http://www.eggdrop.fr# irc.zeolia.net #eggdrop## DESCRIPTION #### This TCL is a complete relay script wich works with botnet.# All you have to do is to include this tcl in all the eggdrop who# are concerned by it.## You can use it as a spy or a full duplex communication tool.## It don't mind if the eggdrops are on the same server or not,# it just mind about the channels and the handle of each eggdrop.## CHANGELOG #### Complete modification of configuration# Use of namespace# No more broadcast, the relay is done with putbot## TODO #### Enhance configuration# Allow save of configuration# Multi-languages## CONFIGURATION #### For each eggdrop in the relay, you have to# indicate his botnet nick, the chan and the network.## Syntax:# set regg(USERNAME) {#"chan""#CHANNEL"#"network""NETWORK"#}# with:# USERNAME : The username sets in eggdrop.conf (case-sensitive)# optionaly, you can override default values:# * highlight (0/1/2): is speaker highlighted ?# * snet (y/n): is speaker'network shown ?# * transmit (y/n): does eggdrop transmit his channel activity ?# * receive (y/n): does eggdrop diffuse other channels activity ?namespace eval crelay {        variable regg    variable default        set regg(Liam) {        "chan""#chan"        "network""some network"        "highlight"0        "log""y"    }        set regg(Liam123) {        "chan""#chan"        "network""some network"    }                set default {        "highlight"1; # 0 : none, 1 : bold, 2 : underline        "snet""y"        "transmit""y"        "receive""y"        "log""n"    }        # transmission configuration    set trans_pub "y"; # transmit the pub    set trans_act "y"; # transmit the actions (/me)    set trans_nick "y"; # transmit the nick changement    set trans_join "y"; # transmit the join    set trans_part "y"; # transmit the part    set trans_quit "y"; # transmit the quit    set trans_topic "y"; # transmit the topic changements    set trans_kick "y"; # transmit the kicks    set trans_mode "y"; #transmit the mode changements    set trans_who "y"; # transmit the who list        # reception configuration    set recv_pub "y"; # recept the pub    set recv_act "y"; # recept the actions (/me)    set recv_nick "y"; # recept the nick changement    set recv_join "y"; # recept the join    set recv_part "y"; # recept the part    set recv_quit "y"; # recept the quit    set recv_topic "y"; # recept the topic changements    set recv_kick "y"; # recept the kicks    set recv_mode "y"; # recept the mode changements    set recv_who "y"; # recept the who list        variable author "CrazyCat"    variable version "3.0"}#####################################    DO NOT EDIT ANYTHING BELOW    #####################################proc ::crelay::init {args} {    variable me    array set me $::crelay::default    array set me $::crelay::regg($::username)    ::crelay::set:hl $me(highlight);        if { $me(transmit) == "y" } {        bind msg o|o "trans" ::crelay::set:trans        if { $::crelay::trans_pub == "y" } { bind pubm - * ::crelay::trans:pub }        if { $::crelay::trans_act == "y" } { bind ctcp - "ACTION" ::crelay::trans:act }        if { $::crelay::trans_nick == "y" } { bind nick - * ::crelay::trans:nick }        if { $::crelay::trans_join == "y" } { bind join - * ::crelay::trans:join }        if { $::crelay::trans_part == "y" } { bind part - * ::crelay::trans:part }        if { $::crelay::trans_quit == "y" } { bind sign - * ::crelay::trans:quit }        if { $::crelay::trans_topic == "y" } { bind topc - * ::crelay::trans:topic }        if { $::crelay::trans_kick == "y" } { bind kick - * ::crelay::trans:kick }        if { $::crelay::trans_mode == "y" } { bind mode - * ::crelay::trans:mode }        if { $::crelay::trans_who == "y" } { bind pub - "!who" ::crelay::trans:who }    }        if { $me(receive) =="y" } {        bind msg o|o "recv" set:recv        if { $::crelay::recv_pub == "y" } { bind bot - "&gt;pub" ::crelay::recv:pub }        if { $::crelay::recv_act == "y" } { bind bot - "&gt;act" ::crelay::recv:act }        if { $::crelay::recv_nick == "y" } { bind bot - "&gt;nick" ::crelay::recv:nick }        if { $::crelay::recv_join == "y" } { bind bot - "&gt;join" ::crelay::recv:join }        if { $::crelay::recv_part == "y" } { bind bot - "&gt;part" ::crelay::recv:part }        if { $::crelay::recv_quit == "y" } { bind bot - "&gt;quit" ::crelay::recv:quit }        if { $::crelay::recv_topic == "y" } { bind bot - "&gt;topic" ::crelay::recv:topic }        if { $::crelay::recv_kick == "y" } { bind bot - "&gt;kick" ::crelay::recv:kick }        if { $::crelay::recv_mode == "y" } { bind bot - "&gt;mode" ::crelay::recv:mode }        if { $::crelay::recv_who == "y" } {            bind bot - "&gt;who" ::crelay::recv:who            bind bot - "&gt;wholist" ::crelay::recv:wholist        }    }        bind msg o|o "rc.status" crelay::help::status    bind msg - "rc.help" crelay::help::cmds    bind msg o|o "rc.light" crelay::set::light    bind msg o|o "rc.net" crelay::set::snet        variable eggdrops    variable chans    variable networks    foreach bot [array names ::crelay::regg] {array set tmp $::crelay::regg($bot)        lappend eggdrops $bot        lappend chans $tmp(chan)        lappend networks $tmp(network)    }    bind evnt -|- prerehash [namespace current]::deinit    putlog "CHANRELAY $::crelay::version lauched"}proc ::crelay::deinit {args} {    catch {unbind evnt -|- prerehash [namespace current]::deinit}    catch {        unbind msg o|o "trans" ::crelay::set:trans        unbind pubm - * [namespace current]::trans:pubunbind ctcp - "ACTION" [namespace current]::trans:actunbind nick - * [namespace current]::trans:nickunbind join - * [namespace current]::trans:joinunbind part - * [namespace current]::trans:partunbind sign - * [namespace current]::trans:quitunbind topc - * [namespace current]::trans:topicunbind kick - * [namespace current]::trans:kickunbind mode - * [namespace current]::trans:modeunbind pub - "!who" [namespace current]::trans:who    }    catch {unbind msg o|o "recv" set:recvunbind bot - "&gt;pub" [namespace current]::recv:pubunbind bot - "&gt;act" [namespace current]::recv:actunbind bot - "&gt;nick" [namespace current]::recv:nickunbind bot - "&gt;join" [namespace current]::recv:joinunbind bot - "&gt;part" [namespace current]::recv:partunbind bot - "&gt;quit" [namespace current]::recv:quitunbind bot - "&gt;topic" [namespace current]::recv:topicunbind bot - "&gt;kick" [namespace current]::recv:kickunbind bot - "&gt;mode" [namespace current]::recv:modeunbind bot - "&gt;who" ::crelay::recv:whounbind bot - "&gt;wholist" ::crelay::recv:wholist    }    catch {unbind msg o|o "rc.status" [namespace current]::help:statusunbind msg - "rc.help" [namespace current]::help:cmdsunbind msg o|o "rc.light" [namespace current]::set:lightunbind msg o|o "rc.net" [namespace current]::set:snet    }    foreach child [namespace children] {catch {[set child]::deinit}    }    namespace delete [namespace current]}namespace eval crelay {    variable hlnick    variable snet    # Setting of hlnick    proc set:light { nick uhost handle arg } {# message bindingswitch $arg {    "bo" { ::crelay::set:hl 1; }    "un" { ::crelay::set:hl 2; }    "off" { ::crelay::set:hl 0; }    default { puthelp "NOTICE $nick :you must chose \002(bo)\002ld , \037(un)\037derline or (off)" }}return 0;    }        proc set:hl { arg } {# global hlnick setting functionswitch $arg {    1 { set ::crelay::hlnick "\002"; }    2 { set ::crelay::hlnick "\037"; }    default { set ::crelay::hlnick ""; }}    }        # Setting of show network    proc set:snet {nick host handle arg } {if { $arg == "yes" } {    set ::crelay::snet "y"} elseif { $arg == "no" } {    set ::crelay::snet "n"} else { puthelp "NOTICE $nick :you must chose yes or no" }    }        # proc setting of transmission by msg    proc set:trans { nick host handle arg } {if { $me(transmit) == "y" } {    if { $arg == "" } {putquick "NOTICE $nick :you'd better try /msg $::botnick trans help"    }    if { [lindex [split $arg] 0] == "help" } {putquick "NOTICE $nick :usage is /msg $::botnick trans &lt;value&gt; on|off"putquick "NOTICE $nick :with &lt;value&gt; = pub, act, nick, join, part, quit, topic, kick, mode, who"return 0    } else {set proc_change "[namespace current]::trans_[lindex [split $arg] 0]"switch [lindex [split $arg] 0] {    "pub" { set type pubm }    "act" { set type ctcp }    "nick" { set type nick }    "join" { set type join }    "part" { set type part }    "quit" { set type sign }    "topic" { set type topc }    "kick" { set type kick }    "mode" { set type mode }    "who" { set type who }}if { [lindex [split $arg] 1] == "on" } {    bind $type - * $proc_change} elseif { [lindex [split $arg] 1] == "off" } {    unbind $type - * $proc_change} else {    putquick "NOTICE $nick :[lindex [split $arg] 1] is not a correct value, choose \002on\002 or \002off\002"}    }} else {    putquick "NOTICE $nick :transmission is not activated, you can't change anything"}    }        # proc setting of reception by msg    proc set:recv { nick host handle arg } {if { $me(receive) == "y" } {    if { $arg == "" } {putquick "NOTICE $nick :you'd better try /msg $::botnick recv help"    }    if { [lindex [split $arg] 0] == "help" } {putquick "NOTICE $nick :usage is /msg $::botnick recv &lt;value&gt; on|off"putquick "NOTICE $nick :with &lt;value&gt; = pub, act, nick, join, part, quit, topic, kick, mode, who"return 0    } else {set change "&gt;[lindex [split $arg] 0]"set proc_change "[namespace current]::recv_[lindex [split $arg] 0]"if { [lindex [split $arg] 1] == "on" } {    bind  bot - $change $proc_change} elseif { [lindex [split $arg] 1] == "off" } {    unbind bot - $change $proc_change} else {    putquick "NOTICE $nick :[lindex [split $arg] 1] is not a correct value, choose \002on\002 or \002off\002"}    }} else {    putquick "NOTICE $nick :reception is not activated, you can't change anything"}    }        # Generates an user@network name    # based on nick and from bot    proc make:user { nick frm_bot } {    array set him $::crelay::regg($frm_bot)        if { $::crelay::me(snet) == "y" } {            set speaker [concat "$::crelay::hlnick\($nick@$him(network)\)$::crelay::hlnick"]        } else {            set speaker $::crelay::hlnick$nick$::crelay::hlnick        }        return $speaker    }        # Logs virtual channel activity     proc cr:log { lev chan line } {if { $::crelay::me(log) == "y" } {    putloglev $lev "$chan" "$line"    }        return 0    }        # Global transmit procedure    proc trans:bot { usercmd chan usernick text } {        set transmsg [concat $usercmd $usernick $text]        if {$chan == $::crelay::me(chan)} {            foreach bot [array names ::crelay::regg] {            if {$bot != $::botnick} {                putbot $bot $transmsg            }            }        } else {            return 0        }    }    # proc transmission of pub (trans_pub = y)    proc trans:pub {nick uhost hand chan text} {        if { [string tolower [lindex [split $text] 0]] == "!who" } { return 0; }        trans:bot "&gt;pub" $chan $nick [join [split $text]]    }        # proc transmission of action (trans_act = y)    proc trans:act {nick uhost hand chan key text} {        set arg [concat $key $text]        trans:bot "&gt;act" $chan $nick $arg    }        # proc transmission of nick changement    proc trans:nick {nick uhost hand chan newnick} {        trans:bot "&gt;nick" $chan $nick $newnick    }        # proc transmission of join    proc trans:join {nick uhost hand chan} {        trans:bot "&gt;join" $chan $chan $nick    }        # proc transmission of part    proc trans:part {nick uhost hand chan text} {        set arg [concat $chan $text]        trans:bot "&gt;part" $chan $nick $arg    }        # proc transmission of quit    proc trans:quit {nick host hand chan text} {        trans:bot "&gt;quit" $chan $nick $text    }        # proc transmission of topic changement    proc trans:topic {nick uhost hand chan topic} {        set arg [concat $chan $topic]        trans:bot "&gt;topic" $chan $nick $arg    }        # proc transmission of kick    proc trans:kick {nick uhost hand chan victim reason} {        set arg [concat $victim $chan $reason]        trans:bot "&gt;kick" $chan $nick $arg    }        # proc transmission of mode changement    proc trans:mode {nick uhost hand chan mc {victim ""}} {        if {$victim != ""} {append mc " $victim" }        set text [concat $nick $chan $mc]        trans:bot "&gt;mode" $chan $nick $text    }        # proc transmission of "who command"    proc trans:who {nick uhost handle chan args} {        if { [lindex [split $args] 1] != "" } {            set him [lsearch -nocase $::crelay::networks [lindex [split $args] 1]]            if { $him == -1 } {                putserv "PRIVMSG $nick :$args est un réseau inconnu";                return 0            } else {                putbot [lindex $::crelay::eggdrops $him] "&gt;who" $chan $nick            }        } else {            trans:bot "&gt;who" $chan $nick ""        }    }    # proc reception of pub    proc recv:pub {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 0] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :$speaker&gt; [join [lrange $argl 1 end]]"            cr:log p "$::crelay::me(chan)" "&lt;[lindex $argl 0]&gt; [join [lrange $argl 1 end]]"        }        return 0    }        # proc reception of action    proc recv:act {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 0] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :* $speaker [join [lrange $argl 2 end]]"            cr:log p "$::crelay::me(chan)" "Action: [join [lrange $argl 0 end]]"        }        return 0    }        # proc reception of nick changement    proc recv:nick {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 0] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :*** $speaker is now known as [join [lrange $argl 1 end]]"            cr:log j "$::crelay::me(chan)" "Nick change: [lindex $argl 0] -&gt; [join [lrange $argl 1 end]]"        }        return 0    }        # proc reception of join    proc recv:join {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 1] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :--&gt; $speaker has joined channel [lindex $argl 0]"            cr:log j "$::crelay::me(chan)" "[lindex $argl 1] joined $::crelay::me(chan)."        }        return 0    }        # proc reception of part    proc recv:part {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 0] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :&lt;-- $speaker has left channel [lindex $argl 1] ([join [lrange $argl 2 end]])"            cr:log j "$::crelay::me(chan)" "[lindex $argl 0] left $::crelay::me(chan) ([join [lrange $argl 2 end]])"        }        return 0    }        # proc reception of quit    proc recv:quit {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 0] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :-//- $speaker has quit ([join [lrange $argl 1 end]])"            cr:log j "$::crelay::me(chan)" "[lindex $argl 0] left irc: [join [lrange $argl 1 end]]"        }        return 0    }        # proc reception of topic changement    proc recv:topic {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 0] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :*** $speaker changes topic of [lindex $argl 1] to '[join [lrange $argl 2 end]]'"        }        return 0    }        # proc reception of kick    proc recv:kick {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 2] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :*** $speaker has been kicked from [lindex $argl 2] by [lindex $argl 0]: [join [lrange $argl 3 end]]"            cr:log k "$::crelay::me(chan)" "[lindex $argl 1] kicked from $::crelay::me(chan) by [lindex $argl 0]:[join [lrange $argl 3 end]]"        }        return 0    }        # proc reception of mode changement    proc recv:mode {frm_bot command arg} {        if {[set him [lsearch $::crelay::eggdrops $frm_bot]] &gt;= 0} {            set argl [split $arg]            set speaker [make:user [lindex $argl 1] $frm_bot]            putquick "PRIVMSG $::crelay::me(chan) :*** $speaker set mode [join [lrange $argl 2 end]]"        }        return 0    }        # reception of !who command    proc recv:who {frm_bot command arg} {        set nick $arg        set ulist ""        set cusr 0        foreach user [chanlist $::crelay::me(chan)] {            if { $user == $::botnick } { continue; }            if { [isop $user $::crelay::me(chan)] == 1 } {                set st "@"            } elseif { [ishalfop $user $::crelay::me(chan)] == 1 } {                set st "%"            } elseif { [isvoice $user $::crelay::me(chan)] == 1 } {                set st "%"            } else {                set st ""            }            incr cusr 1            append ulist " $st$user"            if { $cusr == 5 } {                putbot $frm_bot "&gt;wholist $::crelay::me(chan) $nick $ulist"                set ulist ""                set cusr 0            }        }        if { $ulist != "" } {            putbot $frm_bot "&gt;wholist $::crelay::me(chan) $nick $ulist"        }    }        # Proc reception of a who list    proc recv:wholist {frm_bot command arg} {        set nick [join [lindex [split $arg] 1]]        set speaker [make:user $frm_bot $frm_bot]        putserv "NOTICE $nick :$speaker [join [lrange [split $arg] 2 end]]"    }            ######################################    # Private messaging    #        bind msg - "say" prv:say_send    proc prv:say_send {nick uhost handle text} {        set dest [join [lindex [split $text] 0]]        set msg [join [lrange [split $text] 1 end]]        set vict [join [lindex [split $dest @] 0]]        set net [join [lindex [split $dest @] 1]]        if { $vict == "" || $net == "" } {            putserv "PRIVMSG $nick :Use \002!say user@network your message to \037user\037\002";            return 0        }        set him [lsearch -nocase $::crelay::networks $net]        if { $him == -1 } {            putserv "PRIVMSG $nick :I don't know any network called $net.";    putserv "PRIVMSG $nick :Available networks: [join [split $::crelay::networks]]"            return 0        }        if { [string length $msg] == 0 } {            putserv "PRIVMSG $nick :Did you forget your message to $vict@$net ?";            return 0        }        putbot [lindex $::crelay::eggdrops $him] "&gt;pvmsg $vict $nick@$::crelay::me(network) $msg"    }        bind bot - "&gt;pvmsg" prv:say_get    proc prv:say_get {frm_bot command arg} {        set dest [join [lindex [split $arg] 0]]        set from [join [lindex [split $arg] 1]]        set msg [join [lrange [split $arg] 2 end]]        if { [onchan $dest $::crelay::me(chan)] == 1 } {            putserv "PRIVMSG $dest :$from: $msg"        }    }    ######################################    # proc for helping    #        # proc status    proc help:status { nick host handle arg } {    putquick "PRIVMSG $nick :Chanrelay status for $::crelay::me(chan)@$crelay::me(network)"putquick "PRIVMSG $nick :\002 Global status\002"putquick "PRIVMSG $nick :\037type\037   -- | trans -|- recept |"putquick "PRIVMSG $nick :global -- | -- $me(transmit) -- | -- $me(receive) -- |"putquick "PRIVMSG $nick :pub    -- | -- $::crelay::trans_pub -- | -- $::recv_pub -- |"putquick "PRIVMSG $nick :act    -- | -- $::crelay::trans_act -- | -- $::recv_act -- |"putquick "PRIVMSG $nick :nick   -- | -- $::crelay::trans_nick -- | -- $::recv_nick -- |"putquick "PRIVMSG $nick :join   -- | -- $::crelay::trans_join -- | -- $::recv_join -- |"putquick "PRIVMSG $nick :part   -- | -- $::crelay::trans_part -- | -- $::recv_part -- |"putquick "PRIVMSG $nick :quit   -- | -- $::crelay::trans_quit -- | -- $::recv_quit -- |"putquick "PRIVMSG $nick :topic  -- | -- $::crelay::trans_topic -- | -- $::recv_topic -- |"putquick "PRIVMSG $nick :kick   -- | -- $::crelay::trans_kick -- | -- $::recv_kick -- |"putquick "PRIVMSG $nick :mode   -- | -- $::crelay::trans_mode -- | -- $::recv_mode -- |"putquick "PRIVMSG $nick :who   -- | -- $::crelay::trans_who -- | -- $::recv_who -- |"putquick "PRIVMSG $nick :nicks appears as $::crelay::hlnick$nick$::crelay::hlnick"putquick "PRIVMSG $nick :\002 END of STATUS"    }            # proc help    proc help:cmds { nick host handle arg } {putquick "NOTICE $nick :/msg $::botnick trans &lt;type&gt; on|off to change the transmissions"putquick "NOTICE $nick :/msg $::botnick recv &lt;type&gt; on|off to change the receptions"putquick "NOTICE $nick :/msg $::botnick rc.status to see my actual status"putquick "NOTICE $nick :/msg $::botnick rc.help for this help"putquick "NOTICE $nick :/msg $::botnick rc.light &lt;bo|un|off&gt; to bold, underline or no higlight"putquick "NOTICE $nick :/msg $::botnick rc.net &lt;yes|no&gt; to show the network"    }    }::crelay::initputlog "CHANRELAY $::crelay::version by \002$::crelay::author\002 loaded - http://www.eggdrop.fr"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11576">judgey2K10</a> — Sat Feb 26, 2011 2:55 pm</p><hr />
]]></content>
	</entry>
	</feed>
