[color:#840017]
; If you're not opped, this script will not fire; you couldn't possibly do anything about it if
; you weren't opped in that channel, so why bother looking?
; [/color]
on ^@*:JOIN:#:{
[color:#840017]
; If the userid:
; · starts with a ~
; · is all lower-case alphabetical characters only
; · 8 or 9 characters after the ~
; [/color]
if ($regex($address, /^(~[a-z]{8,9})@.*$/)) {
[color:#840017]
; Then reformat the join line to reflect a possible drone join
; [color:#2B5932]* [color:#FF0000][Possible Drone][/color] Joins: Nickname ([color:#FF0000]~abwgohety[/color]@12-34-56-78.host.com)[/color]
; [/color]
echo $color(join) -it $chan * $+($chr(3),$color(ctcp),[Possible Drone],$chr(3)) $&
Joins: $nick $+($chr(40),$chr(3),$color(ctcp),$regml(1),$chr(3),@,$site,$chr(41))
haltdef
[color:#840017]
; Add their nick to the channel's entry in PossibleDrones.ini to be removed by their
; departure from the channel or by their response to the CTCP VERSION sent them in the next
; step. Using the ctime as the value allows you to check later how long it's been since you
; asked for their version reply (in effect, pinging and VERSIONing at the same time).
; [/color]
writeini PossibleDrones.ini $chan $nick $ctime
[color:#840017]
; Quietly send them a CTCP VERSION, which is blocked on clients only by ignoring all CTCPs
; and slightly less likely to be scripted in on drones.
; [/color]
.ctcp $nick VERSION
}
}
[color:#840017]
; Now we'll need something to capture the VERSION reply, if there is any.
; [/color]
on *:CTCPREPLY:VERSION*:{
[color:#840017]
; %i will be the loop index through $chan(), if necessary.
; %ctime will be used to calculate their ping time from the value stored in the ini file.
; [/color]
var %i = 1, %ctime = $ctime
[color:#840017]
; If the userid matches a possible drone, then check each channel and echo out the All-Clear
; for this user.
; [/color]
if $regex($address, /^(~[a-z]{8,9})@.*$/) {
[color:#840017]
; Check each channel
; [/color]
while $chan(%i) {
[color:#840017]
; Store the current channel in a variable since it will be used past another if statement
; and therefore $ifmatch will be overwritten with a new value.
; [/color]
var %chan = $ifmatch
[color:#840017]
; If there is a value stored for this $nick for this %chan, retrieve it
; [/color]
if ($readini(PossibleDrones.ini, %chan, $nick)) {
[color:#840017]
; Echo out their ping and version reply
; [/color]
echo $color(info2) -it %chan * Possible drone $&
replied in $duration($calc(%ctime - $ifmatch)) «» $2-
[color:#840017]
; Remove this entry from the ini file.
; [/color]
.remini PossibleDrones.ini %chan $nick
}
[color:#840017]
; Go to the next channel.
; [/color]
inc %i
}
}
}
[color:#840017]
; Script self-cleanup
;
; For every non-me user leaving the channel, either through part, kick or quit:
; [/color]
on !*:PART:#:{
[color:#840017]
; If this user matches a possible drone...
; [/color]
if ($regex($address, /^(~[a-z]{8,9})@.*$/)) {
[color:#840017]
; Remove their channel/nick entry from the ini file.
; [/color]
.remini PossibleDrones.ini $chan $nick
}
}
on !*:KICK:#:{
[color:#840017]
; If this user matches a possible drone...
; [/color]
if ($regex($address, /^(~[a-z]{8,9})@.*$/)) {
[color:#840017]
; Remove their channel/nick entry from the ini file.
; [/color]
.remini PossibleDrones.ini $chan $nick
}
}
on !*:QUIT:{
[color:#840017]
; If this user does not match a possible drone, then stop processing.
; [/color]
if (!$regex($address, /^(~[a-z]{8,9})@.*$/)) halt
[color:#840017]
; Otherwise, %i will be the loop index for the common channels.
; [/color]
var %i = 1
[color:#840017]
; For each channel you share,
; [/color]
while $comchan(%i,$nick) {
[color:#840017]
; Try to remove their entry, whether present or not.
; [/color]
.remini PossibleDrones.ini $ifmatch $nick
[color:#840017]
; Go to the next channel.
; [/color]
inc %i
}
}
[color:#840017]
; If you deop yourself, remove the entries for that channel from the ini file.
; [/color]
on me:*:DEOP:#: if ($opnick == $me) remini PossibleDrones.ini $chan
[color:#840017]
; If you part a channel, remove the entries for that channel from the ini file.
; [/color]
on me:*:PART:#: remini PossibleDrones.ini $chan
[color:#840017]
; If you exit mIRC, remove the entire ini file.
; [/color]
on *:EXIT: .remove PossibleDrones.ini