Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
Now it will show the clone nicks as well. Personally, I dont like that little popup window. Window height should change according to the length of text (that is: the number of clones found and the font you are currently using) - that would be a mess! See below for an alternative... on ^*:HOTLINK:*:#: {
var %nr = 1, %prefix
while ($mid($prefix,%nr,1)) { var %prefix = $addtok(%prefix,$v1,44) | inc %nr }
if ($remove($1, [ %prefix ,<,> ] ) ison $chan) { clonescanwindow $v1 $chan }
; mouse moving over another word in the channel window: hide clonecheck-window
elseif ($window($+(@clonecheck,$chr(160),*),1)) { window -h $v1 }
halt
}
; the clonescan-and-show alias
alias -l clonescanwindow {
; store active window to a var
var %a = $active, %w = $+(@clonecheck,$chr(160),$2)
; create a new- or restore and rename the old clonecheck-window
if ($window($+(@clonecheck,$chr(160),*),1)) {
renwin $v1 %w
window -o %w
}
else { window -doCk0w0 +L %w -1 -1 300 80 }
clear %w
if ($ialchan($+(*!*@,$ial($1).host),$2,0) == 1) { aline 9 %w $chr(2) no clones $+ $chr(15) of $1 }
else {
; clones found: list the clones
var %c.num = $calc($v1 -1), %nr = 1, %clones
while ($ialchan($+(*!*@,$ial($1).host),$2,%nr).nick) {
if ($v1 != $1) { var %clones = $addtok(%clones,$v1,32) }
inc %nr
}
aline 4 %w $chr(2) %c.num $iif((%c.num == 1),clone,clones) $+ $chr(15) of $1
aline -p %w %clones
sline %w 2
}
; refocus stored active window
window -a %a
}
menu @clonecheck* {
close window "clonecheck" : window -c $active
} ...I prefer this one, using the new $tip feature  menu channel {
-
$iif(($group(#mousepointerclones) == on),$style(1)) Mousepointer Clonescan...
.$iif(($group(#mousepointerclones) == on),$style(1)) enable : .enable #mousepointerclones
.$iif(($group(#mousepointerclones) == off),$style(1)) disable : .disable #mousepointerclones
}
#mousepointerclones off
on ^*:hotlink:*:#: {
; cycle possible nick prefixes to allow hotlink on pnicks
var %nr = 1, %prefix
while ($mid($prefix,%nr,1)) { var %prefix = $addtok(%prefix,$v1,44) | inc %nr }
if ($remove($1, [ %prefix ,<,> ] ) ison $chan) {
var %nick = $v1
; if no clone hotlink for that nick active
if ((!$($+(%,clonetip.queued.,%nick),2)) && (!$tip($+(clonetip.,%nick)))) {
set -u5 $+(%,clonetip.queued.,%nick) 1
var %host = $+(*!*@,$ial(%nick).host)
; if clones of that user present
if ($ialchan(%host,$chan,0) > 1 ) {
var %c.num = $calc($v1 -1), %nr = 1, %clones
; make a list of all clones
while ($ialchan(%host,$chan,%nr).nick) {
if ($v1 != %nick) { var %clones = $addtok(%clones,$+(•,$chr(160),$v1),32) }
inc %nr
}
; set tip layout
var %title = Clones found on $chan
var %line1 = $+($chr(2),%nick,$chr(2),:) %c.num $iif((%c.num == 1),Clone,Clones) $crlf
var %line2 = %host $crlf $+ $chr(160) $crlf
var %linex = $replace(%clones,$chr(32),$crlf) $crlf $+ $chr(160)
; show tip
noop $tip($+(clonetip.,%nick),%title,%line1 $+ %line2 $+ %linex,3,$null,$null,$null,$activewid)
}
}
}
halt
}
#mousepointerclones end EDIT: An alternative regsub suggestion (I'm not that good with regex) instead of the "remove prefix" part: on ^*:hotlink:*:#: {
if ($regsubex($1,/[^\w\-\]\\_^[{}|`]/g,$null) ison $chan) {
var %nick = $v1
...rest of hotlink... 2nd EDIT: $tip(name) will return $true if (quote) "it was successfully created", not if the tip was triggered and thus "queued". So I added a little "set -u" to prevent "text flooding" in the same window if you move the mouse over multiple clones quickly.
Last edited by Horstl; 22/08/07 06:18 PM.
|