mIRC Home    About    Download    Register    News    Help

Print Thread
Chat relay from one server and channel to another. #245890 12/05/14 07:39 PM
Joined: Jun 2013
Posts: 43
G
GamingTom Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jun 2013
Posts: 43
Hi, I need some quick help on a function I would like to incorporate.

What I would like is, for example, if a message is sent on the irc.test1.net server and #firsttest channel, that message should be repeated into the irc.test2.org server and #secondtest channel.

I don't know if there is an example of this anywhere, but when I googled it, I couldn't find anything. So, if anyone could link me something, or give me some help, it would be greatly appreciated. If you need any more information, please just ask! Many thanks.
-Tom

Edit - May be worth to note that both servers have a different password.

Last edited by GamingTom; 12/05/14 09:20 PM.
Re: Chat relay from one server and channel to another. [Re: GamingTom] #245928 14/05/14 10:13 AM
Joined: Apr 2014
Posts: 191
B
blessing Offline
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
You might want to use network name for checking instead of server name. To know network name use //echo $network
I believe the code must be like this.
Code:
on *:TEXT:*:#firstchannel:{
  if $network == firstnetwork { scid -at1 relay # $replace($1-,|,-,%,-,$,-) }
}

alias -l relay {
  if $network == secondnetwork && $me ison #secondchannel {
    msg #secondchannel ( $1 ) $2-
  }
}

Last edited by blessing; 14/05/14 11:55 AM.
Re: Chat relay from one server and channel to another. [Re: blessing] #245929 14/05/14 11:23 AM
Joined: Jul 2006
Posts: 3,530
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,530
Quote:
$replace($1-.|,-,%,-,$,-)

What's with the .| at the end, why do you add that to $1-?
In any case, replacing $ and % by - is just incorrect, if you want to properly escape those, you must use the safe alias. It's best to use $safe() around $chan too, which might become a problem in the future (though for now, a static channel name is used, no injection is possible)


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Chat relay from one server and channel to another. [Re: Wims] #245932 14/05/14 12:01 PM
Joined: Apr 2014
Posts: 191
B
blessing Offline
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Ups, it is typo. My bad.
Like Wims said, this one use $safe() alias. Thanks wink

Code:
on *:TEXT:*:#firstchannel:{
  if $network == firstnetwork { scid -at1 relay $safe(#) $safe($1-) }
}

alias -l relay {
  if $network == secondnetwork && $me ison #secondchannel {
    msg #secondchannel ( $1 ) $2-
  }
}

alias safe return $!decode( $encode($1-, m) ,m)