on *:LOAD:{
R.help
set %R.np on
}
alias R.help {
echo -a ;======== RELAY v1.1 ========
echo -a ;=============================
echo -a ; A script to relay messages
echo -a ; between the same channel on
echo -a ; different networks
echo -a ;-----------------------------
echo -a ; by: MaxP
echo -a ; (#logic :: DALnet & Aniverse)
echo -a ;=============================
echo -a ; This addon well relay all messages between the same channel name on all the networks your on and have joined that channel.
echo -a ; to see the nicks on the same channel (different network) type !whodat <network>
echo -a ; to see the topic on the same channel (different network) type !whodat <network>
echo -a ; to manualy turn the network prefix on/off type /prefix
echo -a ; ie. If Im on #logic on both Aniverse and DALnet, the trigger !whodat DALnet well tell me who is on #logic of DALnet.
echo -a ; The events that are auto messaged are: PART, JOIN, QUIT, and Nick Change.
echo -a ; The addon can be disabled from the menubar
}
menu menubar {
relay
.$iif($group(#relay) == on,$style(1)) ON: .enable #relay
.$iif($group(#relay) == off,$style(1)) OFF: .disable #relay
.-
.$iif(%R.np == on,$style(1)) Network Prefix: Prefix
.-
.Help: R.help
.-
.unload:{ unload -rs $script }
}
alias §erver {
;<-c|v> <network/server>
var %n = 1
while ($scon(%n)) {
if (($scon(%n).$network == $2) || ($scon(%n).$server == $2)) {
if ($1 == -v) { return $iif($scon(%n).$status == connected,OK,NC) }
elseif ($1 == -c) { return scon %n }
}
inc %n
}
return NA
}
#relay on
on *:ACTION:*:#:{ do describe # $+(02», $+ $nick(#,$nick).pnick,02«) $1- }
on *:TEXT:*:#:{
if ($1 == !whodat) {
if (!$2) {
if ($net(#)) { whodat $nick $ifmatch # | return }
else { notice $nick the syntax for !whodat is: !whodat <network> | return }
}
whodat $nick $2 # | return
}
if ($1 == !topic) {
if (%R.net) { notice $nick I am currently checking the topic for another user please try again in a few moments. | return }
if (!$2) {
if ($net(#)) { R.topic $nick $ifmatch # | return }
else { notice $nick the syntax for !topic is: !topic <network> | return }
}
R.topic $nick $2 # | return
}
do msg # $+(02»,12 $+ $nick(#,$nick).pnick,02«) $1-
}
on *:INPUT:#:{
if ($1 == !whodat) {
if (!$2) {
if ($net(#)) { .timer 1 1 whodat $me $ifmatch # | return }
else { .timer 1 1 echo -a the syntax for !whodat is: !whodat <network> | return }
}
.timer 1 1 whodat $me $2 # | return
}
elseif ($1 == /me) { do describe # [ $me ] $2- | return }
elseif ($left($1,1) == /) { return }
else { do msg # [ $me ] $1- }
}
on *:PART:#:{ do msg # [ $nick ] PART }
on *:KICK:#:{ do msg # $knick was kicked on $network by $nick (Reason: $1- ) }
on *:JOIN:#:{ do msg # [ $nick ] JOIN }
on *:QUIT:{ var %n = 1 | while ($comchan($nick,%n)) { .timer 1 1 do msg $ifmatch [ $nick ] QUIT ( $1- ) | inc %n } }
on *:NICK:{ var %n = 1 | while ($comchan($newnick,%n)) { .timer 1 1 do msg $ifmatch $+ $nick is now known as $newnick | inc %n } }
on *:DISCONNECT:{ do msg -a I am now DISCONNECTED from $network }
on *:CONNECT:{ .timer 1 5 do msg -a I am now CONNECTED to $network }
#relay end
alias -l c {
if ($§erver(-v,$1) != OK) { halt }
return $§erver(-c,$1)
}
;<do> <chan> <txt>
alias -l do {
var %net = $network, %cid = $cid, %chan = $2, %n
if ($2 == -a) {
var %m = 1, %chan = $chan(%m)
}
:1
%n = 1
while ($scon(%n)) {
if ($scon(%n).$status == connected) && ($scon(%n).$network != %net) {
scon %n
if ($me ison %chan) { $1 %chan $iif(%R.np == on,( $+ %net $+ )) $3- }
}
inc %n
}
if ($2 == -a) {
scon %cid
inc %m
if ($chan(%m)) { %chan = $ifmatch | goto 1 }
}
}
;<chan>
alias -l net {
var %n = 1 | var %c | var %net = $network | var %w
while ($scon(%n)) {
scon %n
if ($me ison $1) && ($scon(%n).$status == connected) {
if ($scon(%n).$network != %net) { %w = $ifmatch }
inc %c
}
inc %n
}
return $iif(%c == 2,%w)
}
alias Prefix { set %R.np $iif(%R.np == on,off,on) | echo -a Network prefix for Relay has been turned: $iif(%R.np == on,ON,OFF) }
;;Trigger(s)
;<nick><network><chan>
alias -l whodat {
var %net = $network
if ($§erver(-v,$2) == OK) { $iif($1 != $me,notice $1,echo -a) Nicks on $2 chatting on $3 }
else { $iif($1 != $me,notice $1,echo -a) I am not connected to: $2 | halt }
var %n = 1 | var %l = 1 | var %m
$c($2)
while ($nick($3,%n).pnick) {
%m = %m $ifmatch
if (%l == 4) { $c(%net) | $iif($1 != $me,.timer 1 $calc( %n / 4) notice $1 %m,echo -a %m) | var %m | var %l | $c($2) }
inc %l
inc %n
}
$c(%net)
if (%m) { $iif($1 != $me,.timer 1 $int($calc( %n / 4)) notice $1 %m,echo -a %m) }
}
alias -l R.topic {
if ($§erver(-v,$2) != OK) { $iif($1 != $me,notice $1,echo -a) I am not connected to: $2 | halt }
set %R.net $network
set %R.nick $1
set %R.chan $3
.timer 1 6 unset %R.*
$c($2)
.topic $3
}
raw 332:*:{
if (%R.net) {
var %net = $network
$c(%R.net)
$iif(%R.nick != $me,notice %R.nick,echo -a) Topic for %R.chan on %net
$iif(%R.nick != $me,notice %R.nick,echo -a) $2-
unset %R.*
}
}