prefect relay

By R3b3l on Jun 05, 2010

This will allow you to relay, or link, if you will, two or more channels across two or more networks.this code only work in
mirc 6.35 with nbs-irc 2.39 version.thanks
then press alt+r
copy this code in remote
and
Documentation at the top of the script.
please pass your comments on my effort.

;======================================================
;                   Relay by R3b3|
;======================================================
;
;    This will allow you to relay, or link, if you
; will, two or more channels across two or more 
; networks.
;   
;
; Configuration:
;   Relay.networks, this is a list, seperated by a 
;     space, of all the networks we are going to be 
;     relaying across.
alias -l relay.networks { return HellsWinter NFinate UnderNet }
;
;   Relay.channels, this is a list, seperated by a 
;     space, of the channel names that we are going 
;     to be relaying, the channel names corrispond to 
;     the relay.networks above.
alias -l relay.channels { return #hw-test #nf-test #un-test }
;
;   Relay.fmt.text, this is the format of normal 
;     relayed text.
;     $1  = Nick
;     $2  = Channel
;     $3  = Network
;     $4- = Text
alias -l relay.fmt.text { return $+(<,$1,/,$2,@,$3,>) $4- }
;
;   Relay.fmt.action, this is the format of /me 
;     relayed text.
;     $1  = Nick
;     $2  = Channel
;     $3  = Network
;     $4- = Text
alias -l relay.fmt.action { return * $+($1,/,$2,@,$3,) $4- }
;
;   Relay.fmt.quit, this is the format of relayed
;     quits.
;     $1  = Nick
;     $2  = Channel
;     $3  = Network
;     $4- = Quit Message
;
alias -l relay.fmt.quit { return * $+($1,@,$3) Quit $4- }
;
;   Relay.fmt.join, this is the format of relayed 
;     joins.
;     $1  = Nick
;     $2  = Channel
;     $3  = Network
alias -l relay.fmt.join { return * $+($1,@,$3) Joins $2 }
;
;   Relay.fmt.part, this is the format of relayed
;     parts.
;     $1  = Nick
;     $2  = Channel
;     $3  = Network
;     $4- = Part Message (if available)
alias -l relay.fmt.part { return * $+($1,@,$3) Parts $2 ( $+ $4- $+ ) }
;
;   Relay.fmt.kick, this is the format of relayed
;     parts.
;     $1  = Nick
;     $2  = Channel
;     $3  = Network
;     $4  = Kicker
;     $5- = Kick Message
alias -l relay.fmt.kick { return * $+($4,@,$3) Kicks $+($1,@,$3) Out of $2 ( $+ $5- $+ ) }
;
;   Relay.fmt.mode, this is the format of relayed 
;     modes.
;     $1  = Nick
;     $2  = Channel
;     $3  = Network
;     $4- = Modes
alias -l relay.fmt.mode { return * $+($1,@,$3) Sets mode: $4- }
;
;   Relay.fmt.topic, this is the format of relayed 
;     topics.
;     $1  = Nick
;     $2  = Channel
;     $3  = Network
;     $4- = Topic
alias -l relay.fmt.topic { return * $+($1,@,$3) Sets topic: $4- }
;
;
; Examples:
;   alias -l relay.networks { return UnderNet QuakeNet Efnet }
;   alias -l relay.channels { return #mycoolchannel #my.cool.channel #my_cool_channel }
;     This will set up a relay between the following
;       three channels:
;       #mycoolchannel (on undernet)
;       #my.cool.channel (on quakenet)
;       #my_cool_channel (on efnet)
;
;
; Contact:
;   Cobi@winbots.org
;   Cobi on NFinate (irc.nfinate.org, #nfinate)
;   Cobi on Undernet (#phase, #rss, #game-trivia)
;   Cobi on Winbots (#winbots)
;   Cobi-Wan-Kenobi on Quakenet (#icechat)
;   Cobi on SearchIRC Forums
;   Winbots on UnrealIRCd Forums
;   Cobi on mirc.net
;
; ChangeLog:
;   1.0
;     Initial Release.
;
; Source Code:

on *:text:*:#:{ 
  var %tok = $findtok($relay.networks,$network,1,32) 
  if ($chan == $gettok($relay.channels,%tok,32)) { 
    var %lcv = 1 
    var %tot = $gettok($relay.networks,0,32) 
    while (%lcv <= %tot) { 
      var %cid = $cid 
      var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
      if (%ncid != %cid) { 
        var %net = $network 
        scid %ncid 
        msg $gettok($relay.channels,%lcv,32) $relay.fmt.text($nick,$chan,%net,$1-) 
        scid %cid 
      } 
      inc %lcv 
    } 
  } 
} 
on *:action:*:#: { 
  var %tok = $findtok($relay.networks,$network,1,32) 
  if ($chan == $gettok($relay.channels,%tok,32)) { 
    var %lcv = 1 
    var %tot = $gettok($relay.networks,0,32) 
    while (%lcv <= %tot) { 
      var %cid = $cid 
      var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
      if (%ncid != %cid) { 
        var %net = $network 
        scid %ncid 
        msg $gettok($relay.channels,%lcv,32) $relay.fmt.action($nick,$chan,%net,$1-)
        scid %cid 
      } 
      inc %lcv 
    } 
  } 
} 
on *:quit: { 
  var %tok = $findtok($relay.networks,$network,1,32) 
  if ($nick ison $gettok($relay.channels,%tok,32)) { 
    var %lcv = 1 
    var %tot = $gettok($relay.networks,0,32) 
    while (%lcv <= %tot) { 
      var %cid = $cid 
      var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
      if (%ncid != %cid) { 
        var %net = $network 
        scid %ncid 
        msg $gettok($relay.channels,%lcv,32) $relay.fmt.quit($nick,$gettok($relay.channels,%tok,32),%net,$1-)
        scid %cid 
      } 
      inc %lcv 
    } 
  } 
} 
on *:join:#: { 
  if ($nick != $me) { 
    var %tok = $findtok($relay.networks,$network,1,32) 
    if ($chan == $gettok($relay.channels,%tok,32)) { 
      var %lcv = 1 
      var %tot = $gettok($relay.networks,0,32) 
      while (%lcv <= %tot) { 
        var %cid = $cid 
        var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
        if (%ncid != %cid) { 
          var %net = $network 
          scid %ncid 
          msg $gettok($relay.channels,%lcv,32) $relay.fmt.join($nick,$chan,%net)
          scid %cid 
        } 
        inc %lcv 
      } 
    } 
  } 
} 
on *:part:#: { 
  if ($nick != $me) { 
    var %tok = $findtok($relay.networks,$network,1,32) 
    if ($chan == $gettok($relay.channels,%tok,32)) { 
      var %lcv = 1 
      var %tot = $gettok($relay.networks,0,32) 
      while (%lcv <= %tot) { 
        var %cid = $cid 
        var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
        if (%ncid != %cid) { 
          var %net = $network 
          scid %ncid 
          msg $gettok($relay.channels,%lcv,32) $relay.fmt.part($nick,$chan,%net,$1-) 
          scid %cid 
        } 
        inc %lcv 
      } 
    } 
  } 
} 
on *:KICK:#: { 
  var %tok = $findtok($relay.networks,$network,1,32) 
  if ($chan == $gettok($relay.channels,%tok,32)) { 
    var %lcv = 1 
    var %tot = $gettok($relay.networks,0,32) 
    while (%lcv <= %tot) { 
      var %cid = $cid 
      var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
      if (%ncid != %cid) { 
        var %net = $network 
        scid %ncid 
        msg $gettok($relay.channels,%lcv,32) $relay.fmt.kick($knick,$chan,%net,$nick,$1-) 
        scid %cid 
      } 
      inc %lcv 
    } 
  } 
} 
on *:rawmode:#: { 
  var %tok = $findtok($relay.networks,$network,1,32) 
  if ($chan == $gettok($relay.channels,%tok,32)) { 
    var %lcv = 1 
    var %tot = $gettok($relay.networks,0,32) 
    while (%lcv <= %tot) { 
      var %cid = $cid 
      var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
      if (%ncid != %cid) { 
        var %net = $network 
        scid %ncid 
        msg $gettok($relay.channels,%lcv,32) $relay.fmt.mode($nick,$chan,%net,$1-)
        scid %cid 
      } 
      inc %lcv 
    } 
  } 
} 
on *:topic:#: { 
  var %tok = $findtok($relay.networks,$network,1,32) 
  if ($chan == $gettok($relay.channels,%tok,32)) { 
    var %lcv = 1 
    var %tot = $gettok($relay.networks,0,32) 
    while (%lcv <= %tot) { 
      var %cid = $cid 
      var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
      if (%ncid != %cid) { 
        var %net = $network 
        scid %ncid 
        msg $gettok($relay.channels,%lcv,32) $relay.fmt.topic($nick,$chan,%net,$1-) 
        scid %cid 
      } 
      inc %lcv 
    } 
  } 
} 
alias -l getcidfromnet { 
  var %lcv = 1 
  var %tot = $scon(0) 
  while (%lcv <= %tot) { 
    if ($scon(%lcv).network == $1) { return $scon(%lcv).cid } 
    inc %lcv 
  } 
} 

Comments

Sign in to comment.
Cobi   -  Jul 07, 2011

I don't mind people copying my scripts elsewhere. I typically license my scripts under the GPL. I just don't like it when others replace my name with their name and then repost it.

 Respond  
jaytea   -  Jul 05, 2011

i don't know Cobi, i think you're just being paranoid ;)

seriously though, this happens all too often. it would be fun if Hawkee could create a 'name & shame' section where we post the names of people that have plagiarized code, with a link to the originals.

 Respond  
Cobi   -  Jul 04, 2011

Looks suspiciously like http://mirc.net/projects.php?view_snippet=1125901875 and http://mirc.net/projects.php?go=1125901875 ...
And it even has the original author's contact information at the bottom, just not at the top ...

Hmm ....

 Respond  
jasonh   -  Jun 26, 2011

does not work

 Respond  
Jethro   -  Jun 05, 2010

I haven't looked at your whole code, but at first glance, you could've just used one alias like this:

on *:text:*:#:relay
on *:action:*:#:relay
on *:quit:relay
on !*:join:#:relay
on !*:part:#:relay
on *:kick:#:relay
on *:rawmode:#:relay
on *:topic:#:relay
alias -l relay {
  var %tok = $findtok($relay.networks,$network,1,32) 
  if ($chan == $gettok($relay.channels,%tok,32)) { 
    var %lcv = 1 
    var %tot = $gettok($relay.networks,0,32) 
    while (%lcv <= %tot) { 
      var %cid = $cid 
      var %ncid = $getcidfromnet($gettok($relay.networks,%lcv,32)) 
      if (%ncid != %cid) { 
        var %net = $network 
        scid %ncid 
        msg $gettok($relay.channels,%lcv,32) $relay.fmt.part($nick,$chan,%net,$1-) 
        scid %cid 
      } 
      inc %lcv 
    } 
  } 
}

This saves you many bytes. Again, you may need to make some needed adjustment, as I only looked at your code briefly.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.