; ################################### ; ; Basic v23042002 ; blue-elf, belf@mircscripter.com ; ; mixed script features ; ; ################################### on *:start:{ ; MDX fix for WinXP if ($os == XP) { var %f = $+(",$mircexe,.manifest") if (!$isfile(%f)) { write -c %f write %f write %f write %f Internet Relay Chat Software write %f var %t = Basic did not find a mirc.exe.manifest file on startup. $+ $str($crlf,2) $+ $& This file has been created and is necessary for some of the features to work properly. $+ $str($crlf,2) $+ $& Please do not delete the mirc.exe.manifest file in the future. $+ $str($crlf,2) $+ $& mIRC will close now. $+ $str($crlf,2) $+ (Please restart it manually) !.echo -q $input(%t,68,Basic) .timer 1 0 exit halt } } var %files = dll\mdx\BARS.MDX dll\mdx\CTL_GEN.MDX dll\mdx\dialog.mdx dll\mdx\MDX.DLL dll\mdx\VIEWS.MDX dll\popups\POPUPS.DLL, %i = 1 while ($gettok(%files,%i,32)) { if (!$isfile($ifmatch)) { .timer 1 2 exit _err Required DLL files not found! Please reinstall. $+ $str($crlf,2) $+ Exiting... } inc %i } ; this is a fix for the missing files problem var %i = 1, %rfiles = cprot.mrc basic.mrc dialog.mrc ulist.mrc recent.mrc raw.mrc display.mrc btheme.mrc mtheme.mrc sounds.mrc menus.mrc var %tmp, %failure = 0 while ($gettok(%rfiles,%i,32)) { %tmp = $ifmatch if (!$script(%tmp)) { %tmp = sys\ $+ %tmp if ($isfile(%tmp)) .load -rs %tmp else %failure = 1 } inc %i } var %i = 1, %tmp while ($gettok(basic.als channel.als system.als,%i,32)) { %tmp = $ifmatch if (!$alias(%tmp)) { %tmp = sys\ $+ %tmp if ($isfile(%tmp)) .load -a %tmp else %failure = 1 } inc %i } if ((%failure) || ($script(0) < 11) || ($alias(0) < 3)) { .timer 1 2 exit echo 4 -s Missing script files. Please reinstall. Exiting... } ; sys if (!$isdir(temp\)) mkdir temp\ if (!$isdir(themes\)) mkdir themes\ if (!$isdir(sys\networks\)) mkdir sys\networks\ if ($group(#recallserver) == on) if (!$_mopt(3,5)) if ($_(irc,lastserver)) editbox -s /server $ifmatch posstart if ($_(titlebar,Disconnected)) titlebar $_(titlebar,DisconnectedText) if ($isfile(todo.txt)) loadbuf -s todo.txt if ($_(about,pop)) about } on *:connect:{ _sysTitleBarTimer $cid _SysLoadFilterList _netconnect _load.kickmsgs AutoAwayEnable if ($isalias(autonickregain)) autonickregain } on *:notify:{ if ($nick == $_mnick) && ($group(#autonickregain) == on) halt if ($_themes) notifyshow } #autonickregain off alias autonickregain { if ($_mnick) if ($me != $_mnick) .notify $_mnick } on *:unotify:{ if ($nick == $_mnick) { regainnick $nick .notify -r $nick halt } elseif ($_themes) unotifyshow } #autonickregain end on *:unotify:if ($_themes) unotifyshow alias -l _mnick { return $_(autonickregain,nick) } alias -l regainnick { if (($1 == $_mnick) && ($1 != $me)) nick $1 } alias _sysTitleBarUpdate { if (!$_connected) _sysTitleBarOff elseif (($1) && ($scid($1).status == connected) && ($1 == $activecid)) titlebar $_tbar($1) else { var %cid, %x = $scon(0) while (%x) { %cid = $scon(%x).cid if (%cid == $activecid) { scid %cid titlebar $_tbar(%cid) break } dec %x } scid -r } } alias -l _tbar { var %f, %t, %tmp = $_(titlebar,Connected), %pos, %i = 1 if (($istok(%tmp,current nick,46)) && ($istok(%tmp,usermode,46))) { %pos = $findtok(%tmp,current nick,46) %tmp = $puttok($remtok(%tmp,usermode,46),me,%pos,46) } while ($gettok(%tmp,%i,46)) { %t = $ifmatch if (%t == me) %f = %f $me $+ [[ $+ $usermode $+ ]]  if (%t == date) %f = %f $date(mm-dd-yy)  if (%t == time) %f = %f $time(h:nnTT)  if (%t == away status) %f = %f status[ $+ $iif($away,gone,here) $+ ]]  if (%t == current nick) %f = %f $me  if (%t == usermode) %f = $usermode  if (%t == self-lag) %f = %f lag[ $+ $_iif($($+(%,Sys.SelfLag.,$1),2),??) $+ ]]  if (%t == system uptime) %f = %f up[ $+ $_trimdur($uptime(system,2)) $+ ]]  if (%t == channel) { if ($active ischan) %f = %f $chr(160) $+ $remove($nick($active,$me).pnick,$me) $+ $active  } if (%t == server uptime) { if ($server) %f = %f online[ $+ $_trimdur($uptime(server,2)) $+ ]]  else %f = %f [offline]  } if (%t == server) %f = %f $server  inc %i } if (%f) return $left($replace(%f,,-),-1) } alias _sysTitleBarOff { if (!$_connected) { .timer.SysTitleBarUpdate off if ($_(titlebar,Disconnected)) titlebar $_(titlebar,DisconnectedText) } } alias _sysTitleBarTimer { if (($_(titlebar,Update)) && ($_(titlebar,UpdateSec))) { .timer.SysTitleBarUpdate -i 0 $_(titlebar,UpdateSec) _sysTitleBarUpdate if ($istok($_(titlebar,Connected),self-lag,46)) $+(.timer.,$1,.SysSelfLag) 0 30 _sysSelfLag $1 } else titlebar } alias -l _sysSelfLag { if ($status == connected) { set %Sys.SelfLag. $+ $1 ?? set %Sys.SentLag. $+ $1 $ctime .raw ^Self-Lag } } raw 421:*^Self-Lag*:{ if (($($+(%,Sys.SentLag.,$cid),2)) && ($($+(%,Sys.SelfLag.,$cid),2) == ??) && ($timer($+(.SysTitleBarUpdate)))) { set %Sys.SelfLag. $+ $cid $calc($ctime - $($+(%,Sys.SentLag.,$cid),2)) _sysTitleBarUpdate $cid } halt } raw 433:*:{ var %nicks = $readini(sys\networks\nicks.ini,n,$network,nicks) if ($findtok(%nicks,$2,32)) { if ($gettok(%nicks,$calc($ifmatch + 1),32)) nick $ifmatch else nick $gettok(%nicks,1,32) } } on *:disconnect:{ ; just in case mirc screws up if ($timer($+(.,$cid,.SysSelfLag))) $+(.timer,$ifmatch) off unset $+(%,sys.dnwin.,$calc($cid),.*) $+(%,ial.,$calc($cid)) $+(%,Sys.RequestWarning.,$calc($cid),.*) $+(%,Sys.SelfLag.,$calc($cid)) $+(%,Sys.SentLag.,$calc($cid)) if ($group(#recallserver) == on) { _set irc lastserver $server $port $+(.timer.,$cid,.SysAutoAway) off } if ($_(windows,closestatus)) window -c "Status Window" if (!$_connected) { .timer.SysTitleBarUpdate off .timer.*.SysSelfLag off if ($_(titlebar,Disconnected)) titlebar $_(titlebar,DisconnectedText) else titlebar unset %sys.dnwin.* %ial.* %Sys.RequestWarning.* %Sys.SelfLag.* %Sys.SentLag.* %showcomchan.* } } ; window [switches] [-tN,..,N] [+bdeflLmnstx] <@name> [x y [w h]] [/command] [popup.txt] [font [size]] [iconfile [N]] ; /_selfprot alias _selfprot { ; if (!$_(selfprot,$1)) return var %max = $_(selfprot,$+($1,max)), %num = $+(selfprot,$+($1,sec)), %ign = $_(selfprot,$+($1,ign)) if ((!%max) || (!%num)) return var %inc = $+(%,sys.selfprot.inc.,$server), %sec = $+(%,sys.selfprot.sec.,$server) inc $(%inc) if ($(%sec,2) == $null) set $(%sec) $ctime elseif ($(%inc,2) >= %max) { if ($calc($ctime - $(%sec,2)) <= %num) { var %time = $ifmatch if (%ign) .ignore $+(-,$replace($1,CTCP,t,DCC,d,Notice,n,Msg,p),u,%ign) $2 if ($_(selfprot,kickban)) gkb $3 $2 $1 flood: $(%inc,2) in $+(%time,/,%max,s) if ($_(selfprot,closewindows)) close -mcs $2 ; add perm ignore alias if ((!$appactive) && ($_(selfprot,flashmirc))) flash $1 Flood from $2 if ($_(selfprot,beepalert)) { if ($_isfile($_(selfprot,alertsound))) splay $shortfn($ifmatch) else beep } } unset $(%inc) unset $(%sec) } } on *:text:*:?:_selfprot Msg $wildsite $nick ; /_SysRequestFilter [text] ; Msg Ntc Snd Cht All HWn Rep Ex alias _SysRequestFilter { if ((($1 == Snd) || ($1 == Cht)) && ($($+(%,sys.dcc.auth.,$cid,$gettok($3,1,33)),2))) { var %type = $lower($+($left($1,1),req)), %old = $($+($,%type),2), %com = $+(.,%type) %com auto +m .timer 1 1 %com %old return } if (!$_(Filter,$1)) return if ($_(Filter,Ex)) { var %h = _SysFilter if (!$hget(%h)) _SysLoadFilterList if ($hmatch(%h,$3)) return } if (($_(Filter,Rep)) && (!$($+(%,Sys.RequestWarning.,$2,.,$3),2))) { if ($_(Filter,ExAutoReply) != $null) var %m = $_repc($ifmatch) else var %m = I am not accepting $_SysFilterType($1) right now. .notice $gettok($3,1,33) [Auto-Reply] %m set -u300 $+(%,Sys.RequestWarning.,$2,.,$3) 1 } var %w = $+(@[,$cid,]Private requests), %ws = $iif($_(desktop,PrivateRequests),-dlhnkv,-lhnkv) if (!$window(%w)) { window %ws -t8,19,75 %w $_winfo(%w) @PrivReq $_winfo(%w).font $_winfo(%w).size $shortfn($mircexe) 5 titlebar %w ( $+ $_iif($network,$server) $+ ) _usefont $_(filter,fontmsg) %w } aline %w $tab($time(h:nn) >,$replace($1,Ntc,Notice,Msg,Message,Snd,Send,Cht,Chat),$3,$iif($4 != $null,$4-,--)) window -bg1 %w if (!$_(Filter,HWn)) window -w %w halt } alias _SysLoadFilterList { var %i = $lines($exmpt.dat) while (%i) { if ($read($exmpt.dat,%i) != $null) hadd -m _SysFilter $ifmatch 1 dec %i } } alias -l _SysFilterType { return $replacecs($1,Msg,messages,Ntc,notices,Cht,DCC Chats,Snd,DCC Sends,All,any private requests) } on *:close:@[*]Private requests:savewinpos $target menu @PrivReq { $gettok($_wg(3),1,33) .Whois:wi $gettok($_wg(3),1,33) .Whois++:wii $gettok($_wg(3),1,33) .Uwho:uwho $gettok($_wg(3),1,33) .DNS ..Nick:dns $gettok($_wg(3),1,33) ..Host:dns $gettok($_wg(3),2,64) - $_wm(Kick) .$submenu($_rfpop($1,k,$_wg(3))) $_wm(KickBan) .$submenu($_rfpop($1,kb,$_wg(3))) - $_wm(Query):query $gettok($_wg(3),1,33) - $_wm(CTCP) .Ping:ctcp $gettok($_wg(3),1,33) ping .Finger:ctcp $gettok($_wg(3),1,33) finger .Version:ctcp $gettok($_wg(3),1,33) version .Time:ctcp $gettok($_wg(3),1,33) time .- .Other...:if ($input(Enter a CTCP request to send to $gettok($_wg(3),1,33) ,1,CTCP)) ctcp $gettok($_wg(3),1,33) $ifmatch $_wm(DCC) .Send...:dcc send $gettok($_wg(3),1,33) .Chat:dcc chat $gettok($_wg(3),1,33) - $_wm(Ignore...):_aig $_wg(3) - $_wm(Copy) .Whole line:{ clipboard $replace($sline($active,1),$chr(9),$chr(32)) var %a = $input(Text has been copied to clipboard,68,Copy) } .- .Nickname:{ var %tmp = $gettok($_wg(3),1,33) clipboard %tmp var %a = $input( " $+ %tmp $+ " has been copied to the clipboard,68,Copy) } .Address:{ var %tmp = $gettok($_wg(3),2,33) clipboard %tmp var %a = $input( " $+ %tmp $+ " has been copied to the clipboard,68,Copy) } .Fulladdress:{ var %tmp = $_wg(3) clipboard %tmp var %a = $input( " $+ %tmp $+ " has been copied to the clipboard,68,Copy) } .- .Message only:{ var %tmp = $gettok($sline($active,1),-1,9) clipboard %tmp var %a = $input(The message $+ $str($crlf,2) $+ $+(",%tmp,") $+ $str($crlf,2) $+ has been copied to clipboard,68,Copy) } .Stripped message:{ var %tmp = $strip($gettok($sline($active,1),-1,9)) clipboard %tmp var %a = $input(The message $+ $str($crlf,2) $+ $+(",%tmp,") $+ $str($crlf,2) $+ has been copied to clipboard,68,Copy) } Window .Change font...:font .$iif($_(filter,fontmsg),$style(1)) Use chat font:_set filter fontmsg $iif($_(filter,fontmsg),0,1) .- .Clear:clear $active .Close:window -c $active } alias readlog if ($_isfile(temp\away.log)) notepad $ifmatch alias remlog if ($_isfile(temp\away.log)) if ($input(Are you sure you want to delete the away.log?,72,Delete away logfile)) .remove temp\away.log on ^*:open:?:*:{ _SysRequestFilter Msg $cid $fulladdress $1- if ($away) { if ($_(away,log)) { if ($1 == ACTION) var %l = * $nick $2- else var %l = < $+ $nick $+ > $1- write temp\away.log $timestamp %l } if ($_(away,window)) { var %w = @[ $+ $cid $+ ]Away Messages, %ws = $iif($_(desktop,AwayLog),-nkd,-nk) if (!$window(%w)) window %ws %w $_winfo(%w) @AwayMessages $_winfo(%w).font $_winfo(%w).size $shortfn($mircexe) 5 aline %w $timestamp < $+ $nick $+ > $1- .timer -m 1 0 close -m $nick } if (($_(away,flashonquery)) && (!$appactive)) { flash -r30 - MSG: $nick if ($_isfile($_(away,flashsound))) splay $+(",$ifmatch,") else beep 5 } } } menu @AwayMessages { &Delete away.log ...:remlog - &Font...:font &Close window:window -c $active } alias -l loadbuflog { if (($_(windows,_openlog)) && ($_(windows,_openlogmethod) > 1) && ($_logfile($1))) loadbuf $1 $+(",$_logfile($1),") } on *:open:?:*:loadbuflog $nick on *:open:=:{ loadbuflog $+(=,$nick) if ((!$query($nick)) || (!$_(CloseQuery,Chat))) return if ($_(CloseQuery,Time)) { if ($_(CloseQuery,Secs)) .timer 1 $ifmatch close -m $nick } else close -m $nick } alias autocycle { updatenl if ($me !isop $1) if ($nick($$1,0,a) == 1) if ($nick($1,1) == $me) hop -c $1 } #autocycle on #autocycle end on *:part:#:{ if ($group(#autocycle) == on) autocycle # _rejoin # } alias AutoAwayEnable if ($_(Away,AutoAway)) if ($_(Away,AutoAwayTime)) .timer. $+ $cid $+ .SysAutoAway 0 30 AutoAwayCheck alias AutoAwayCheck { if (!$_(Away,AutoAway)) $+(.timer.,$cid,.SysAutoAway) off elseif ($idle >= $calc($_(Away,AutoAwayTime) * 60)) AutoAway $ifmatch } ; /AutoAway [on|off] [time] [reason] alias AutoAway { if ($1 == $null) { echo -a AutoAway is currently: $iif($_(Away,AutoAway),ON,OFF) if ($_(Away,AutoAwayTime)) echo -a AutoAway after: $ifmatch min(s) idle. } elseif (($1 == ON) || ($1 == OFF)) { _set Away AutoAway $iif($1 == ON,1,0) if (($2 isnum) && ($2 > 0) && (!$_(Away,AutoAwayTime))) _set Away AutoAway $int($2) echo -a AutoAway is now $upper($1) $+ , triggered after $_(Away,AutoAwayTime) min(s) idle. } elseif ($server) away ...autodead after $int($calc($1 / 60)) min(s) idle.. } alias _away { if (!$away) { var %m = Enter away message (leave empty or cancel to use default away message)., %m = $input(%m,1,Set away) away $iif(%m != $null,%m,$_repc($_(Away,Reason))) } } ; Add AwaySwitches and use %::log %::pager in the theme. alias away { if (!$away) { var %l = $iif($_(Away,Log),on,off), %p = $iif($_(Away,Pager),on,off), %r = $1-, %a = [l: $+ %l $+ /p: $+ %p $+ ]] if (%r == $null) %r = $_iif($_repc($_(Away,Reason)),is away - brb) $+(.timer.,$cid,.SysAutoAway) off .raw AWAY : $+ %r %a if (($_(Away,UseAnick)) && ($_(Away,AwayNick))) { nick $_(Away,AwayNick) _set Away OrigNick $me } else _set Away OrigNick if (($_(Away,Method) == verbose) && ($chan(0))) { var %t, %i = 1, %c = $_(away,verboseexcept) while ($chan(%i)) { %t = $ifmatch if (!$istok(%c,%t,44)) describe %t %r %a inc %i } } if ($_(Away,AntiIdle)) if ($_(Away,AntiIdleTime)) .timer. $+ $cid $+ .Sys.AntiIdle 0 $ifmatch aidle $cid } elseif (($away) && ($1)) .raw AWAY : $+ $1- else { if (($_(Away,Method) == verbose) && ($chan(0))) { var %t, %i = 1, %c = $_(Away,VerboseExcept) while ($chan(%i)) { %t = $ifmatch if (!$istok(%c,%t,44)) describe %t is back inc %i } } .raw AWAY AutoAwayEnable .timer. $+ $cid $+ .Sys.AntiIdle off if ($_(Away,OrigNick)) { if ($ifmatch != $me) nick $ifmatch } _set Away OrigNick } } alias back away alias -l aidle { set %aidle $+ $1 1 .raw PRIVMSG $me :. } ctcp !*:PAGE:?:{ if ($_(Away,Pager)) { if ($_isfile($_(Away,PagerSound))) splay $shortfn($ifmatch) else beep 5 if (!$appactive) flash Page/ $+ $nick } } raw 301:*:{ var %var = $+(%,aidle,$cid) if (($2 == $me) && ($(%var,2))) { unset $(%var) haltdef } } raw 378:*:halt ; recall server #recallserver off on *:exit:if ($server) _set irc lastserver $server $port #recallserver end #dnwin off on *:keydown:@[*]Notices:9:{ var %num = $+(%,sys.dnwin.,$cid,.lastloop), %lst = $+(%,sys.dnwin.,$cid,.nicks) if ($(%num,2) < $numtok($(%lst,2),44)) inc $(%num) else set $(%num) 1 var %n = $gettok($(%lst,2),$(%num,2),44) if (($istok(nickserv memoserv chanserv,%n,32)) && (*.dal.net iswm $server)) editbox -pa / $+ %n elseif ((%n == X) && (*.undernet.org iswm $server)) editbox -pa /msg X@channels.undernet.org else editbox -pa /notice %n halt } #dnwin end ; I'm a bad scripter :/ #dnwinfontmsg on #dnwinfontmsg end ;/_SysRequestFilter [text] ; Msg=0 Ntc=0 Snd=1 Cht=1 All=0 HWn=1 Rep=1 Ex=0 on ^*:notice:*:?:{ _selfprot Notice $wildsite $nick _SysRequestFilter Ntc $server $fulladdress $1- if ($group(#dnwin) != on) return var %w = @[ $+ $cid $+ ]Notices, %e, %ws = $iif($_(desktop,DNWin),-nkdev,-nkev) if (!$window(%w)) { window %ws %w $_winfo(%w) @Notices $_winfo(%w).font $_winfo(%w).size $shortfn($mircexe) 5 titlebar %w ( $+ $_iif($network,$server) $+ ) _usefont $iif($group(#dnwinfontmsg) == on,1,0) %w } ; insert format support here later. if (($group(#mts.text) == on) && ($gts(notice))) { set -u %::nick $nick set -u %::text $1- set -u %::address $address set -u %::target $target _sysdisp notice notice %w } elseif ($group(#display.basic) == on) echo -i %w  $+ $c5 $+ - $+ $nick ( $+ $address $+ )- $1- else echo $colour(notice) -ti %w - $+ $nick $+ - $1- set $+(%,sys.dnwin.,$cid,.nicks) $addtok($($+(%,sys.dnwin.,$cid,.nicks),2),$nick,44) titlebar %w ( $+ $fulladdress $+ ) if (($fulladdress == NickServ!service@dal.net) && (*.dal.net iswm $server)) %e = /nickserv elseif (($fulladdress == MemoServ!service@dal.net) && (*.dal.net iswm $server)) %e = /memoserv elseif (($fulladdress == X!cservice@undernet.org) && (*.undernet.org iswm $server)) %e = /msg x@channels.undernet.org else %e = /notice $nick editbox -p %w %e haltdef } on *:close:@[*]Notices:savewinpos $target menu @Notices { &Disable and close:{ .disable #dnwin window -c $active } - Change &font...:font $iif($group(#dnwinfontmsg) == on,$style(1)) Use chat font: $iif($group(#dnwinfontmsg) == on,.disable,.enable #dnwinfontmsg) - &Inflate:_inflate $active &Minimize:window -n $active &Close:window -c $active } #ctcpcloak off ctcp *:*:*:{ _antiidlectcp $nick $1 if ($target == $me) _selfprot $iif($1 == DCC,DCC,CTCP) $wildsite $nick if ($1 != DCC) { if ($1 == PING) .ctcpreply $nick PING $2- halt } if ($target == $me) if (($2 == chat) || ($2 == send)) _SysRequestFilter $remove($2,a,e) $server $fulladdress } #ctcpcloak end ctcp *:*:*:{ ; this is really silly if ($istok(OP VOICE INVITE UNBAN IDENT PASS HELP,$1,32)) return _antiidlectcp $nick $1 _selfprot $iif($1 == DCC,DCC,CTCP) $wildsite $nick if (($1 == DCC) && ($target == $me)) { if (($2 == chat) || ($2 == send)) _SysRequestFilter $remove($2,a,e) $server $fulladdress return } addlast c $timestamp $+([,$nick $upper($1),]) $2- _ctcpreply $nick $1- if ($_themes) ctcpshow $1- else { ; Show CTCP's in active var %s = -s, %r = $2-, %n = $nick if (($1 == PING) && ($2 isnum)) var %r if ($target ischan) { var %s = #, %n = $+(%n,:,#) if ($ewin) %s = -s } elseif ($_mopt(4,19)) %s = -a elseif (@* iswm $active) %s = -s if ($activecid != $cid) %s = -s echo $colour(ctcp) %s $chr(91) $+ %n $1 $+ $chr(93) %r } halt } #ial.limit on alias _antiidlectcp { if (($1 == $me) && ($2 == .)) halt } raw 366:*:{ var %j = $+(%,join.,$cid) if ($istok($(%j,2),$2,44)) { ; ial if (($_(IAL,Limit) == $null) || ($_(IAL,Limit) !isnum) || ($_(IAL,Limit) < 0)) _set IAL Limit 150 if ($nick($2,0) <= $_(IAL,Limit)) $+(.timer.,$cid,.sysIALUpdate.,$2) 1 3 ialupdate $2 $cid else { if ($_(IAL,ShowStatus)) { set -u %::text IAL for $2 is not being updated. if ($group(#display.mts) == on) _sysdisp info echo $2 elseif ($group(#display.basic) == on) .timer 1 1 echo -tli $2 $pre %::text else .timer 1 1 echo $color(info) -tli $2 *** %::text } } set $(%j) $remtok($(%j,2),$2,44) if (!$numtok($(%j,2),44)) unset $(%j) ; auto channel modes if (($nick($2,0,a) == 1) && ($me isop $2)) { var %modes = $remove($+($_sysgo($2,AutoChanModesDefault),$iif($_sysgo($2,AutoChanModesOtherS),$_sysgo($2,AutoChanModesOtherM))),+), %key = $_sysgo($2,AutoChanModesKey), %limit = $_sysgo($2,AutoChanModesLimit) ; ; *** Set %modes to $null ; Khaled? Why the heck does this $null being treated as literal??? ; if ((k isincs %modes) && (%key == $null)) %modes = $removecs(%modes,k) if ((l isincs %modes) && (%limit !isnum)) %modes = $removecs(%modes,l) ; $eval it twice because the stupid $null is being treated as literal if ($eval(%modes,2)) { if (lk isincs %modes) mode $2 $+(+,%modes) %limit %key elseif (kl isincs %modes) mode $2 $+(+,%modes) %key %limit elseif ((l isincs %modes) && (k !isincs %modes)) mode $2 $+(+,%modes) %limit elseif ((k isincs %modes) && (l !isincs %modes)) mode $2 $+(+,%modes) %key else mode $2 $+(+,%modes) } } } } #ial.limit end on me:*:join:#:{ ; IAL set %join. $+ $cid $addtok($($+(%,join.,$cid),2),#,44) if ($group(#ial.limit) == off) .timer. $+ $cid $+ .SysIALUpdate. $+ # 1 3 ialupdate # $cid ; Open Log if (($_(windows,_openlog)) && ($_(windows,_openlogmethod)) && ($ifmatch != 2)) if ($_logfile(#)) loadbuf # $+(",$ifmatch,") } raw 352:*:if ($istok($($+(%,ial.,$cid),2),$2,44)) haltdef raw 315:*:{ var %l = $+(%,ial.,$cid) if ($istok($(%l,2),$2,44)) { if (($_(IAL,ShowStatus)) && ($me ison $2)) { set -u %::text IAL for $2 updated if ($group(#display.mts) == on) _sysdisp info echo $2 elseif ($group(#display.basic) == on) echo -tli $2 $pre %::text else echo $color(info) -tli $2 *** %::text } if ($calc($numtok($(%l,2),44) -1)) set $(%l) $remtok($(%l,2),$2,44) else unset $(%l) haltdef } } alias -l ialupdate { if ($me ison $1) { set %ial. $+ $2 $addtok($($+(%,ial.,$2),2),$1,44) .raw WHO $1 } } on *:quit:{ if ($nick == $me) { if ($_(irc,recallserver)) _set irc lastserver $server $port return } if (($_(CloseQuery,Quit)) && ($query($nick))) { if ($_(CloseQuery,Time)) { if ($_(CloseQuery,Secs)) .timer 1 $ifmatch close -m $nick } else close -m $nick } if ($_(irc,autocycchans)) { var %x = $chan(0) while ($chan(%x)) { autocycle $ifmatch dec %x } } if (($group(#autonickregain) == on) && ($nick == $_mnick)) nick $nick } alias dns { if (!$1) return set -u2 %sys.show $show if ($1 == -c) !.dns -c elseif (!$show) !.dns $1- else { var %d = $iif($1 == -h,$2,$1) ; remember what we are attempting to resolve ; BECAUSE MIRC CANNOT REMEMBER IT AND $DNS(1) RETURNS NOTHING IF IT DOESN'T RESOLVE!@#$%^&* hadd -m @dns %d %d if ($_(DNS,Dur)) hadd -m @dns %d $+ .dur $ctime if ($_themes) _themedns $1- else !dns $1- } } alias -l _dnsmenu { if ($1 isnum 1-7) return $_dnspre($1) $chr(9) $gettok($2,$1,9) :/ } alias -l _dnspre { return $gettok(DNS.Nick.Address.Resolved to.IP.Named Address.Lookup Duration,$1,46) } menu @dns { $iif($sline($active,1).ln > 1,&More) .$submenu($_dnsmenu($1,$sline($active,1))) - &Font...:font &Close:savewinpos $active | window -c $active } on *:close:@DNS Results:savewinpos $target ; this is a pretty bloated on dns event =/ ; i'm very disappointed with $dns() identifier. on *:dns:{ var %s = -ati, %bsc = $group(#display.basic), %mts = $group(#display.mts), %col = $color(other) if (($activecid != $cid) || (@* iswm $active)) %s = -sti ; create the window first var %w = @DNS Results if (($_(DNS,Win)) && (!$window(%w))) { window $iif($_(desktop,DNSWin),-lkdni,-lkni) -t20,40,60,80,100,120 %w $_winfo(%w) @dns $_winfo(%w).font $_winfo(%w).size $shortfn($mircexe) aline %w $tab(DNS,Nick,Address,Resolved,IP Address,Named Address,Lookup Duration) } var %nick = $nick, %addr = $address, %radd = $raddress, %iadd = $iaddress, %nadd = $naddress, %dur, %time, %dns var %list = %nick %addr %radd %iadd %nadd, %i = 1 while ($gettok(%list,%i,32) != $null) { if ($hget(@dns,$ifmatch) != $null) { %dns = $ifmatch hdel @dns %dns break } inc %i } if ($_(dns,dur)) { if ($hget(@dns,$+(%dns,.dur))) { %dur = $duration($calc($ctime - $ifmatch)) hdel @dns $+(%dns,.dur) } else { %dur = unknown } } if ($window(%w)) { aline %w $tab(%dns,$_iif(%nick,-),$_iif(%addr,-),$_iif(%radd,unresolved),$_iif(%iadd,-),$_iif(%nadd,-),%dur) window -b %w } else { ; grab nick and address info for basic and mirc displays var %tmp = $+(%nick,:,%addr) if ((!%nick) && (%addr)) %tmp = %addr if ((!%addr) && (%nick)) %tmp = %nick if ((!%addr) && (!%nick)) %tmp = if ($remove(%tmp,:)) %tmp = ( $+ %tmp $+ ) if (%bsc == on) { if (%radd) echo %s $pre %dns is resolved to %radd %tmp else echo %s $pre Unable to resolve %dns } elseif (%mts == on) { ; a slightly different treatment for mts because it's not compliant with mirc 6.x set -u %::nick %nick set -u %::address %addr set -u %::raddress %radd set -u %::naddress %nadd set -u %::iaddress %iadd var %ignorantthemers = $iif($raddress,DNSRESOLVE,DNSERROR) if (!$gts(%ignorantthemers)) { %ignorantthemers = echo set -u %::parentext $remove(%tmp,$chr(40),$chr(41)) if ($raddress) set -u %::text %dns is resolved to %radd else set -u %::text Unable to resolve %dns } _sysdisp other %ignorantthemers %s } ; show lookup duration after ALL the results are displayed. set -u %::text Lookup completed in %dur if (%bsc == on) { echo %s $pre %::text halt } ; why doesn't this thing work? ; elseif (%mts == on) _sysdisp other echo %s elseif (%mts == on) { if ($gts(echo)) { var %e = $ifmatch if (!script* iswm %e) { $eval(%e,2) | halt } } echo %s $gts(prefix) %::text halt } else .timer -m 1 0 echo %col -sti *** %::text } } ; servers list dialog spop { title "Servers" size -1 -1 293 131 option dbu button "&OK", 1, 82 115 37 12, ok button "&Cancel", 2, 122 115 37 12, cancel button "&Help", 3, 162 115 37 12 button "&Add ->", 4, 122 45 37 11 button "<- &Remove", 5, 122 60 37 11 text "Current list:", 7, 162 6 50 7 list 8, 4 19 114 90, sort size extsel vsbar list 9, 162 15 115 95, size extsel vsbar scroll "", 10, 282 56 8 16, range 30 text "Group:", 11, 5 8 27 7 combo 12, 33 6 85 150, sort drop } on *:dialog:spop:init:*:.timer 1 0 _lserv on *:dialog:spop:scroll:10:_dlgscroll spop 9 10 on *:dialog:spop:sclick:1:{ _lcw _set servers _progress Updating favorite servers var %i = 1, %total = $did(9).lines while ($did(9,%i)) { _set servers %i $ifmatch _progress² %i %total inc %i } _progress² 1 1 } on *:dialog:spop:sclick:2:.timer 1 0 _lcw on *:dialog:spop:sclick:3:_bld $dname | bhelp servers list on *:dialog:spop:sclick:4:{ var %x = 1, %total = $did(8,0).sel while (%x <= %total) { if (!$didwm(9,$did(8,$did(8,%x).sel),1)) did -a spop 9 $did(8,$did(8,%x).sel) inc %x } did -u spop 8 _lsu } on *:dialog:spop:sclick:5:{ while ($did(9,1).sel) did -d spop 9 $ifmatch _lsu } on *:dialog:spop:sclick:9:_lsu on *:dialog:spop:sclick:12:_lgf $did(12,$did(12).sel) alias -l _lserv { _progress Generating servers list var %server, %f = $readini($mircini,n,files,servers), %i = 0, %l = $calc(($lines(%f) - 1) + 30) if (!$isfile(%f)) return while ($readini(%f,n,servers,$+(n,%i))) { var %t = $ifmatch, %group = $gettok(%t,-1,58), %win = $+(@_ServerList.,%group) if ((!$didwm(spop,12,%group,1)) && (%group !isnum)) { window -slh %win 1 1 1 1 did -a spop 12 %group } if (($wildtokcs($wildtokcs(%t,*SERVER:*,1,32),*.*,2,58)) || ($wildtokcs($wildtokcs(%t,*SERVER:*,1,32),*.*,1,58))) { %server = $ifmatch if ($window(%win)) aline %win %server } _progress² %i %l inc %i } did -c spop 12 1 _lgf $did(spop,12,1) var %x = 1 while (%x <= 30) { if ($_(servers,%x)) did -a spop 9 $ifmatch _progress² $calc(%x + %i) %l inc %x } _progress² %l %l _lsu _showdlg spop } alias -l _lsu did -z spop 10 1 $did(spop,9).lines alias -l _lcw { var %a = 1, %b = $window(@_ServerList.*,0) if (%b) _progress Clearing servers cache. Please wait... while ($window(@_ServerList.*,1)) { window -c $ifmatch _progress² %a %b inc %a } } alias -l _lgf { if ($window($+(@_ServerList.,$1))) { did -r spop 8 filter -wo $ifmatch spop 8 * } } on *:active:@_ServerList.*:window -h $target on *:close:@_ServerList.*:if ($dialog(spop)) did -x $ifmatch ; progress bar ; /_progress alias _progress { .timerProgEnd off var %w = @Progress if (!$window(%w)) { window -BdohkpC +fLd %w 1 1 300 60 window -ar %w } %Sys.ProgressBarText = $1- ... 0% var %c = 1 0 0 $window(%w).dw $window(%w).dh drawrect -nrf %w $rgb(face) %c drawrect -n %w 1 %c drawtext -nr %w $rgb(text) "MS Sans Serif" 12 10 10 %Sys.ProgressBarText drawrect -nrf %w $rgb(255,255,255) 1 10 33 272 12 drawrect -n %w 1 1 10 33 273 13 drawdot %w } ; /_progress² [text] alias _progress² { if ($window(@Progress)) { if ($3-) { drawrect -nrf @Progress $rgb(face) 1 2 2 297 30 drawtext -nr @Progress $rgb(text) "MS Sans Serif" 12 10 10 $3- ... $_perc($1,$2) } else { var %x = $width(%Sys.ProgressBarText,MS Sans Serif,12,0,1) - 3 drawrect -nrf @Progress $rgb(face) 1 %x 10 $calc(298 - %x) 15 drawtext -nr @Progress $rgb(text) "MS Sans Serif" 12 %x 10 $_perc($1,$2) } drawrect -nrf @Progress $rgb(0,128,192) 1 11 34 $calc(271 * ((($1 * 100) / $2) / 100)) 11 drawdot @Progress if (($calc(270 * ((($1 * 100) / $2) / 100)) == 270) || ($1 >= $2)) .timerSys.³ -m 1 500 _prog.end } else _prog.end } alias -l _prog.end { .timerProgEnd -im 1 100 window -c @Progress unset %Sys.ProgressBarText } alias -l _perc return $int($remove($percent($1,$2),%)) $+ % alias -l percent return $round($calc(($1 * 100) / $2),3) $+ $chr(37) menu status,channel,query,chat { &Window .&Inflate ..Current &window:_inflate $active ..&All windows:scid -a inflate -a ..- ..&Channels:inflate -c ..&Queries:inflate -q ..&DCC Chats:inflate -d ..&Status windows:inflate -s ..&Custom windows:inflate -@ .&Cascade:mdi -c .&Tile:mdi -t .&Arrange icons:mdi -a .- .Clear activ&e window:clear -a .Clear &all windows:scid -a clearall } ; network settings dialog networks { title "Network settings" size -1 -1 198 167 option dbu button "&Ok", 1, 95 152 32 12, ok button "&Cancel", 2, 129 152 32 12, cancel button "&Help", 3, 163 152 32 12 text "Networks:", 4, 4 4 29 8 list 5, 4 14 54 118, sort size button "&Add...", 6, 5 136 25 12 button "&Rem", 8, 33 136 25 12 tab "General", 7, 61 2 134 146 text "Nicks:", 9, 70 40 25 8, tab 7 list 10, 96 38 65 63, tab 7 size vsbar button "Add...", 11, 164 40 25 12, tab 7 button "Rem", 12, 164 53 25 12, tab 7 button "Up", 13, 164 73 25 12, tab 7 button "Down", 14, 164 86 25 12, tab 7 text "Modes:", 15, 70 111 25 8, tab 7 edit "", 17, 96 109 65 11, tab 7 tab "Perform", 16 check "On connect, perform these commands:", 18, 67 22 106 10, tab 16 edit "", 19, 67 35 123 108, tab 16 multi return hsbar vsbar tab "Autojoin", 20 box "Options:", 21, 68 21 122 33, tab 20 check "Enable auto-join", 22, 74 30 53 10, tab 20 check "Time interval per channel:", 23, 74 40 73 10, tab 20 edit "", 24, 149 39 15 11, tab 20 text "secs.", 25, 168 41 15 8, tab 20 list 26, 68 58 91 85, tab 20 size extsel button "Ad&d...", 27, 163 60 25 12, tab 20 button "&Edit...", 28, 163 74 25 12, tab 20 button "De&l", 29, 163 88 25 12, tab 20 button "&Up", 30, 163 113 25 12, tab 20 button "Do&wn", 31, 163 127 25 12, tab 20 } alias -l _ajoinset { if ($did(networks,5).sel) hadd -m NetSetTemp $+($1,,$did(networks,5,$ifmatch)) $2- } alias nets { _opendlg networks } alias -l _netnickfile { return sys\networks\nicks.ini } alias _netconnect { if ($ngs($network,Modes)) .raw MODE $me $ifmatch $+ $lf if (($ngs($network,Perform)) && ($_isfile($+(sys\networks\,$network,_perform.txt)))) .play -sc $ifmatch 0 if (($ngs($network,Autojoin)) && ($_isfile($_autojoinfile($network)))) { if (($ngs($network,AutojoinInt)) && ($ngs($network,AutojoinSec))) { var %s = $ifmatch, %i = 1, %t = 1 while ($read($_autojoinfile($network),n,%i)) { .timer 1 %t !join -n $ifmatch inc %t %s inc %i } } else { var %i = 1 while ($read($_autojoinfile($network),n,%i)) { !join -n $ifmatch inc %i } } } } dialog addnet { title "Add network" size -1 -1 109 54 option dbu button "&Ok", 1, 28 38 25 12, ok button "&Cancel", 2, 56 38 25 12, cancel text "Enter a network to be added or select from the dropdown list.", 3, 3 3 102 16, center combo 4, 3 21 102 150, result sort edit drop } alias _addnet { return $dialog(addnet,addnet,-4) } alias _hnetw { return @_networkslist } alias _addnetload { var %w = $_hnetw window -hl +d %w 1 1 1 1 var %g = 1, %grp while ($server(%g).group) { %grp = $ifmatch if ((%grp !isnum) && (!$fline(%w,%grp,1))) aline %w %grp inc %g } } on *:dialog:addnet:init:*:{ if ($window($_hnetw)) filter -wo $ifmatch $dname 4 did -c $dname 4 1 } on *:dialog:networks:init:*:{ ; # to be removed next mIRC version mdxinit $dname 26 100,75 Channel,Key _progress Loading network settings cache _addnetload _hfree NetSetTemp var %f = sys\networks\networks.txt if ($_isfile(%f)) filter -cfo $ifmatch $dname 5 * else write -c %f var %tmp, %i = 1, %t = $lines(%f) while (%i <= %t) { %tmp = $read(%f,nl,%i) if (%tmp) { window -h $+(@_NetworkPerform.,%tmp) 0 0 0 0 if ($_isfile($+(sys\networks\,%tmp,_perform.txt))) filter -fw $ifmatch $+(@_NetworkPerform.,%tmp) * } _nadd %tmp Nicks $readini($_netnickfile,n,%tmp,nicks) _nadd %tmp Modes $ngs(%tmp,Modes) _nadd %tmp Perform $ngs(%tmp,Perform) ; autojoin _nadd %tmp ajoin_switch $ngs(%tmp,Autojoin) _nadd %tmp ajoin_timesw $ngs(%tmp,AutojoinInt) _nadd %tmp ajoin_sec $ngs(%tmp,AutojoinSec) if ($_isfile($_autojoinfile(%tmp))) { var %x = 1, %af = $ifmatch, %tf = $_tempnetfile(%tmp) while ($read(%af,n,%x)) { write %tf $replace($ifmatch,$chr(32),$chr(9)) inc %x } } _progress² %i %t inc %i } _progress² 1 1 } on *:dialog:networks:sclick:1:{ _progress Saving network settings.. var %mf = sys\networks\networks.txt, %sf = sys\networks\settings.ini if ($did(5).lines) filter -cif $dname 5 %mf * else write -c %mf var %i = 1 while ($did(5,%i)) { var %net = $ifmatch, %tmp = $+(Nicks,,%net) if ($hget(NetSetTemp,%tmp)) writeini $_netnickfile %net nicks $ifmatch else remini $_netnickfile %net if ($window($+(@_NetworkPerform.,%net))) filter -wfc $ifmatch $+(sys\networks\,%net,_perform.txt) * ; this is using write/rem because it reads modes later. if i put 0, basic will do a /mode $me 0 on connect. if ($ngv(Modes,%net)) writeini %sf %net Modes $ifmatch else remini %sf %net Modes writeini %sf %net Perform $_iif($ngv(Perform,%net),0) writeini %sf %net Autojoin $_iif($ngv(ajoin_switch,%net),0) writeini %sf %net AutojoinInt $_iif($ngv(ajoin_timesw,%net),0) writeini %sf %net AutojoinSec $_iif($ngv(ajoin_sec,%net),0) _saveautojoinlist %net _progress² %i $did(5).lines inc %i } if ($hget(NetSetTemp,REMOVE_CHAN)) { var %list = $ifmatch, %y = 1, %rem while ($gettok(%list,%y,32)) { %rem = $ifmatch remini %sf %rem if ($_isfile($_autojoinfile(%rem))) .remove -b $ifmatch if ($_isfile($+(sys\networks\,%rem,_perform.txt))) .remove -b $ifmatch remini sys\networks\nicks.ini %rem inc %y } } _progress² 1 1 _closenetwin _hfree NetSetTemp } on *:dialog:networks:sclick:2:{ _closenetwin _hfree NetSetTemp var %s = $findfile(temp\,_networksettings*.tmp,0,.remove $+(",$1-,")) } on *:dialog:networks:sclick:3:_bld $dname | bhelp network settings on *:dialog:networks:sclick:5:{ did -r $dname 10 var %net = $did(5,$did(5).sel), %nicks = $_iif($hget(NetSetTemp,$+(Nicks,$chr(1),%net)),$readini($_netnickfile,n,%net,nicks)) if (%nicks) didtok -a $dname 10 32 %nicks if (%net) { filter -woc $+(@_NetworkPerform.,%net) $dname 19 * did -r $dname 17,24,26 did -u $dname 22,23 if ($ngv(ajoin_switch,%net)) did -c $dname 22 if ($ngv(ajoin_timesw,%net)) did -c $dname 23 if ($ngv(ajoin_sec,%net)) did -a $dname 24 $ifmatch if ($ngv(Modes,%net)) did -a $dname 17 $ifmatch did $iif($ngv(Perform,%net),-c,-u) $dname 18 if ($_isfile($_tempnetfile(%net))) { var %f = $ifmatch, %x = 1 while ($read(%f,n,%x)) { did -a $dname 26 $replace($ifmatch,$chr(32),$chr(9)) inc %x } } } } on *:dialog:networks:sclick:6:{ if ($_addnet(Enter a new network to add)) { var %tmp = $ifmatch if (!$didwm(5,%tmp,1)) { did -a $dname 5 %tmp window -h $+(@_NetworkPerform.,%tmp) 0 0 0 0 } } _showdlg $dname } on *:dialog:networks:sclick:8:{ if ($did(5).sel) { hadd -m NetSetTemp REMOVE_CHAN $addtok($hget(NetSetTemp,REMOVE_CHAN),$did(5,$ifmatch),32) did -d $dname 5 $ifmatch did -r $dname 10,17,19,26,24 did -u $dname 18,22,23 } } on *:dialog:networks:sclick:11:{ _nwl var %net = $did(5,$did(5).sel) if ($input(Enter a new nick to add for %net ,1,Add nick)) { var %tmp = $ifmatch, %blah = $+(Nicks,$chr(1),%net) if (!$didwm(10,%tmp,1)) { hadd -m NetSetTemp %blah $addtok($hget(NetSetTemp,%blah),%tmp,32) did -a $dname 10 %tmp } } _showdlg $dname } on *:dialog:networks:sclick:12:{ _nwl if ($did(10).sel) { var %l = $ifmatch, %n = $+(Nicks,$chr(1),$did(5,$did(5).sel)) hadd -m NetSetTemp %n $remtok($hget(NetSetTemp,%n),$did(10,%l),32) did -d $dname 10 $ifmatch } } on *:dialog:networks:sclick:13:_nwm - on *:dialog:networks:sclick:14:_nwm + on *:dialog:networks:edit:17:{ _nwl if ($did(5,$did(5).sel)) .timerNetEdit -m 1 0 hadd -m NetSetTemp $+(Modes,$chr(1),$ifmatch) $did(17) } on *:dialog:networks:sclick:18:{ _nwl if ($did(5,$did(5).sel)) hadd -m NetSetTemp $+(Perform,$chr(1),$ifmatch) $did(18).state } on *:dialog:networks:edit:19:if ($did(5,$did(5).sel)) .timerNetEdit -m 1 0 filter -iwc $dname 19 $+(@_NetworkPerform.,$ifmatch) * on *:dialog:networks:sclick:22:_ajoinset ajoin_switch $did(22).state on *:dialog:networks:sclick:23:_ajoinset ajoin_timesw $did(23).state on *:dialog:networks:edit:24:_ajoinset ajoin_sec $did(24) on *:dialog:networks:sclick:28:{ var %net = $did(5,$did(5).sel) if (!%net) return if ($did(26).sel) { var %l = $ifmatch, %chan = $_netstrip($did(26,%l)) if ($input(Edit autojoin entry,1,Autojoin edit channel,%chan)) { ; interestingly, $input preserves spaces :-) so I have to tokenize to remove extra spaces ;-) ; if this is not tokenized, the $chr(9) will be out of place because of adjacent spaces. tokenize 32 $ifmatch did -o $dname 26 %l $replace($1-,$chr(32),$chr(9)) write $+(-l,$calc(%l -1)) $_tempnetfile(%net) $1- } } } on *:dialog:networks:sclick:27:{ _nwl if ($did(5,$did(5).sel)) { var %net = $ifmatch, %file = $_tempnetfile(%net) var %t = Enter channel and password (optional). $+ $str($crlf,2) $+ Example: #mIRC ChannelKeyFormIRC if ($input(%t,1,Autojoin add channel)) { did -i $dname 26 $calc($did(26).lines + 1) $replace($ifmatch,$chr(32),$chr(9)) write %file $ifmatch } } _showdlg $dname } on *:dialog:networks:sclick:29:{ var %l = $did(26).sel, %net = $did(5,$did(5).sel), %file = $_tempnetfile(%net) if ((%l) && (%net)) { var %tmp = $read(%file,ns,$gettok($_netstrip($did(26,%l)),1,32)) if ($readn) write $+(-dl,$ifmatch) %file did -d $dname 26 %l } } on *:dialog:networks:sclick:30:_autojoinupdown - + on *:dialog:networks:sclick:31:_autojoinupdown + - on *:active:@_NetworkPerform.*:window -h $target alias -l _closenetwin { while ($window(@_NetworkPerform.*,1)) window -c $ifmatch | window -c $_hnetw } alias -l _nwl { var %e, %t = Network settings error, %n = networks if (!$did(%n,5).lines) %e = $input(You must add %n first.,260,%t) elseif (!$did(%n,5).sel) %e = $input(No network selected.,260,%t) if (%e) { _showdlg networks halt } } alias -l _argh { if (($1 == -) && ($2 > 2)) return $2 if (($1 == +) && ($2 >= 2) && ($2 < $did(networks,26).lines)) return $2 } ; /_autojoinupdown + - alias -l _autojoinupdown { var %d = $dname, %net = $did(%d,5,$did(%d,5).sel), %sel = $did(%d,26).sel if (!%net) return if ($_argh($1,%sel)) { var %l1 = $ifmatch, %l2 = $calc(%l1 $1 1), %a = $mdxsucks($did(%d,26,%l2)), %b = $mdxsucks($did(%d,26,%l1)) did -o %d 26 %l1 $replace(%a,$chr(32),$chr(9)) did -o %d 26 %l2 $replace(%b,$chr(32),$chr(9)) did -c %d 26 %l2 ; rewrite temp file var %x = $read($_tempnetfile(%net),ns,$gettok(%a,1,32)), %l1 = $readn write $+(-dl,$calc(%l1 $2 1)) $_tempnetfile(%net) write $+(-il,$calc((%l1 $2 1) $1 1)) $_tempnetfile(%net) %b } did -f %d 26 } alias -l _nwm { if ($did(networks,10).sel) { var %l = $ifmatch, %t = $did(networks,10,%l) if ((($1 == -) && (%l == 1)) || (($1 == +) && (%l == $did(networks,10).lines))) return did -d networks 10 %l did -i networks 10 $calc(%l $1 1) %t did -c networks 10 $didwm(networks,10,%t,1) } } ; this gets rid of the 0 + 0 0 0 0 just for this dialog anyway. alias -l mdxsucks { var %c = $gettok($gettok($1,1,9),-1,32), %p = $gettok($1,2,9), %p = $iif($numtok(%p,32) == 5,$gettok(%p,5,32)) return %c %p } alias -l _netstrip { return $remove($replace($1,$chr(9),$chr(32)),0 +fs 0 0 0,+fs 0 0 0) } alias -l _tempnetfile { return $+(temp\_networksettings,$1,.tmp) } alias -l _autojoinfile { return $+(sys\networks\,$1,_autojoin.txt) } alias -l _nadd { hadd -m NetSetTemp $+($2,,$1) $3- } ; ngv = net get var alias -l ngv { return $hget(NetSetTemp,$+($1,,$2)) } alias -l ngs { return $readini(sys\networks\settings.ini,n,$1,$2) } alias -l _saveautojoinlist { if ($_isfile($_tempnetfile($1))) { var %tempfile = $ifmatch, %newfile = $_autojoinfile($1), %a = 1, %z = $lines(%tempfile) write -c %newfile while (%a <= %z) { if ($read(%tempfile,n,%a)) write %newfile $ifmatch inc %a } .remove %tempfile } else .remove $_autojoinfile($1) } ; backup dialog backup { title "System Backup" size -1 -1 137 118 option dbu text "Backup folder:", 1, 3 6 40 8 edit "", 2, 45 5 79 11, autohs button "?", 3, 126 4 8 12 box "Back up...:", 4, 2 16 133 37 check "...script files.", 5, 38 24 60 10 check "...personal settings.", 6, 38 38 60 10 text "Status:", 7, 3 56 25 8 list 8, 2 65 133 35 button "&Backup", 9, 16 102 32 12, ok button "&Close", 10, 52 102 32 12, cancel button "&Help", 11, 88 102 32 12 } alias backup { _opendlg backup } on *:dialog:backup:sclick:*:{ var %d = $did if (%d == 11) { _bld $dname | bhelp backup } if ((%d == 3) && ($sdir($left($mircdir,3),Select a backup folder))) did -o $dname 2 1 $ifmatch if (%d == 9) { if ((!$did(2)) || ((!$did(5).state) && (!$did(6).state))) halt var %w = WARNING: System backup will overwrite files in the backup folder if the names in the backup folder $& are the same as your files. $+ $str($crlf,2) $+ Are you sure you want to continue? if (!$input(%w,264,Backup)) { _showdlg $dname halt } echo here halt if (!$isdir($did(2))) { if (($regex($did(2),[/*?"<>|])) || ($count($did(2),:) > 1)) { %sys.last.dialog = $dname _err Invalid foldername. } did -a $dname 8 Creating backup folder... mkdir $did(2) } did -r $dname 8 if ($did(5).state) { var %types = *.als *.pop *.mrc, %i = 1 while ($gettok(%types,%i,32)) { !.echo -q $findfile(sys\,$ifmatch,0,1,_backup $1-) inc %i } } if ($did(6).state) { !.echo -q $finddir(sys\,*,0,_backupdir $1-) _backup sys\default.ini _backup sys\channels.ini _backup sys\banlist.ini _backup sys\users.ini } did -a $dname 8 Total files saved: $calc($did(8).lines - 1) did -c $dname 8 $did(8).lines halt } } ; create subdirectories first if they don't exist. alias -l _backup { var %d = $_baktrimdir($1-), %e = $did(backup,2) did -a backup 8 Saving %d to %e .copy -o $+(",$1-,") $+(",%e,$nopath($1-),") } alias -l _backupdir { !.echo -q $findfile($1-,*.*,0,_backup $1-) } alias -l _baktrimdir { return $gettok($1,$+($findtok($1,sys,92),-),92) } ; startup dialog pos { title "Perform On Start" size -1 -1 198 167 option dbu button "&Ok", 1, 48 152 32 12, ok button "&Cancel", 2, 83 152 32 12, cancel button "&Help", 3, 118 152 32 12 tab "General", 4, 3 3 190 143 check "Perform these commands whenever mIRC starts.", 6, 8 25 127 10, tab 4 edit "", 7, 8 37 176 102, tab 4 autohs autovs hsbar vsbar tab "Connect", 5 check "Automatically connect to these servers on start.", 8, 8 134 127 10, tab 5 text "Server:", 9, 13 30 21 8, tab 5 edit "", 10, 37 29 118 11, tab 5 autohs text "Port:", 11, 13 42 13 8, tab 5 edit "", 12, 37 41 33 11, tab 5 autohs text "Password:", 13, 73 42 27 8, tab 5 edit "", 14, 101 41 54 11, tab 5 autohs box "Add/Edit:", 15, 8 20 181 36, tab 5 button "&Add", 16, 160 28 25 12, tab 5 default list 17, 8 60 149 72, tab 5 size extsel button "&Edit", 18, 161 60 25 12, tab 5 button "&Rem", 19, 161 73 25 12, tab 5 button "&Up", 20, 161 105 25 12, tab 5 button "&Down", 21, 161 118 25 12, tab 5 list 22, 1 1 1 1, tab 5 hide } alias -l plugsp { if ($chr(160) isin $1) return $1 return $1 $+ $chr(160) } ; [-i nick anick email name] on *:dialog:pos:init:*:{ mdxinit pos 17 140,75,75 Server,Port,Password if ($_(pos,switch)) did -c pos 6 if ($_isfile($_datfile(perform_on_start.txt))) loadbuf -o pos 7 $ifmatch if ($_(pos,autoconnect)) did -c pos 8 var %i = 1, %l while ($_(auto_server,%i)) { tokenize 32 $ifmatch %l = $tab($1,$plugsp($2),$plugsp($3)) did -i pos 17 $calc(%i + 1) %l did -a pos 22 %l inc %i } } ; ok button on *:dialog:pos:sclick:1:{ _set pos switch $did(6).state _set pos autoconnect $did(8).state if ($did(7)) savebuf -o pos 7 $_datfile(perform_on_start.txt) else .remove -b $_datfile(perform_on_start.txt) if (!$did(17,2)) { _set auto_server return } var %i = 1 while ($did(22,%i)) { _set auto_server %i $replace($ifmatch,$chr(9),$chr(32)) inc %i } } on *:dialog:pos:sclick:3:{ _bld $dname bhelp perform on start } on *:dialog:pos:sclick:16:{ if ($did(10)) { ; hack for mdx since I'm too lazy to actually learn it var %x = $tab($did(10),$+($did(12),$chr(160)),$+($did(14),$chr(160))) did -i pos 17 $calc($did(17).lines + 1) %x did -a pos 22 %x did -r pos 10,12,14 did -f pos 10 } } on *:dialog:pos:sclick:18:{ if ($did(17).sel > 1) { var %l = $ifmatch tokenize 32 $mdxgetline($did(17,%l)) did -a pos 10 $1 did -a pos 12 $remove($2,$chr(160)) did -a pos 14 $remove($3,$chr(160)) did -d pos 17 %l did -d pos 22 $calc(%l - 1) } } on *:dialog:pos:sclick:19:{ var %i = $did(17,0).sel while ($did(17,%i).sel) { did -d pos 17 $ifmatch did -d pos 22 $calc($ifmatch - 1) dec %i } } ; up on *:dialog:pos:sclick:20:{ if ($did(17).sel > 2) { var %ln = $ifmatch, %one = $did(22,$calc(%ln - 1)) did -d pos 17 %ln did -i pos 17 $calc(%ln - 1) %one did -cf pos 17 $calc(%ln - 1) did -d pos 22 $calc(%ln - 1) did -i pos 22 $calc(%ln - 2) %one } } ; down on *:dialog:pos:sclick:21:{ if ($did(17).sel < $did(17).lines) { var %ln = $ifmatch, %one = $did(22,$calc(%ln - 1)) did -d pos 17 %ln did -i pos 17 $calc(%ln + 1) %one did -cf pos 17 $calc(%ln + 1) did -d pos 22 $calc(%ln - 1) did -i pos 22 %ln %one } } alias pstart { _opendlg pos } alias -l posstart { if (($_(pos,switch)) && ($_isfile($_datfile(perform_on_start.txt)))) .play -sc $ifmatch 0 if ($_(pos,autoconnect)) { var %i = 1, %s while ($_(auto_server,%i)) { %s = $ifmatch server $iif(%i > 1,-m) $remove(%s,$chr(160)) inc %i } } } ; end perform on start on *:input:*:{ if ((/* iswm $1) && (!$ctrlenter)) { if (($remove($1,/) == query) && ($2)) set %showcomchan. $+ $cid $+ $2 $true elseif (((/+* iswm $1) || (/-* iswm $1)) && ($me isop $active)) { mode # $remove($1-,/) halt } } } ; /rejoin [N] [#channel] ; N is seconds delay ; default is 7 seconds alias rejoin { set -u %sys.show 1 if ($2) var %t = $iif($1 isnum,$1,7), %c = #$2 elseif ($1) var %t = 7, %c = #$1, %h = $_hn(rejoin) if ($me !ison %c) return if (i isincs $gettok($chan(%c).mode,1,32)) _err Unable to /rejoin invite only channels. if (($chan(%c).limit) && ($calc($nick(#,0) - 1) <= $ifmatch)) _err Unable to /rejoin %c $+ . Channel limit maxxed out. if ($chan(%c).key != $null) hadd -m %h $+(%c,.key) $ifmatch hadd -m %h $+(%c,.rejoin) %t .raw PART %c iecho Rejoining %c in $hget($_hn(rejoin),$+(%c,.rejoin)) seconds... } alias -l _rejoin { var %s = $hget($_hn(rejoin),$+($1,.rejoin)) if (%s) .timer 1 %s join $1 $hget($_hn(rejoin),$+($1,.key)) } ; customizable function keys alias fkeys { _opendlg basic .timer 1 0 did -c basic 106 } ; $fkey(command) - $fkey(/resend) would return the function key for /resend alias fkey { var %f = $readini($fkeys.dat,$remove($1,/),fkey) var %f2 = $readini($fkeys.dat,$1,fkey) return $iif(%f,%f,$iif(%f2,$switchcase(%f2),$upper($1))) } alias -l switchcase { if (c* iswm $1) return Ctrl+ $+ $upper($mid($1,2)) if (s* iswm $1) return Shift+ $+ $upper($mid($1,2)) return $upper($1) } ; $func(fkey) - $func(F1) would return the command used for F1 alias func return $readini($fkeys.dat,$1,com) alias fcom { var %i = 1, %array = cf? cf?? f? sf? sf?? ctrl* shift* while ($gettok(%array,%i,32)) { if ($ifmatch iswm $fkey($1)) return Press inc %i } return Type } alias fdisp return $fcom($1) $fkey($1) ; $read(filename, [ntsw], [matchtext], [N]) ; /fset com alias fset { if (($3) && ($3 != -Empty-)) { writeini -n $fkeys.dat $1- if ($read($fkeys.txt,ns,$3)) writeini -n $fkeys.dat $3 fkey $1 } else { if ($func($1)) remini $fkeys.dat $ifmatch if ($ini($fkeys.dat,$1)) remini $fkeys.dat $1 } } alias -l fm { if ($2 == -Empty-) did -u basic $1 elseif ($didwm(basic,$1,$2,1)) did -c basic $1 $ifmatch } on *:dialog:basic:sclick:99:{ did -u $dname 139,138,137 var %f = $did(99,$did(99).sel) if (%f == f4) did -b $dname 136,137 elseif (!$did(136).enabled) did -e $dname 136,137 did -o $dname 134 1 %f did -o $dname 135 1 $+(Shift+,%f) did -o $dname 136 1 $+(Ctrl+,%f) if ($($+(%,sys.fkeytmp.,%f),2)) fm 139 $ifmatch elseif ($func(%f)) fm 139 $ifmatch if ($($+(%,sys.fkeytmp.Ctrl+,%f),2)) fm 137 $ifmatch elseif ($($+(%,sys.fkeytmp.Shift+,%f),2)) fm 138 $ifmatch elseif ($func($+(s,%f))) { if ($didwm(138,$ifmatch,1)) did -c $dname 138 $ifmatch } elseif ($func($+(c,%f))) { if ($didwm(137,$ifmatch,1)) did -c $dname 137 $ifmatch } } on *:dialog:basic:sclick:102:{ var %text = $gettok($did(102,$did(102).sel),1,32) if ($readini($fkeys.txt,description,%text)) { did -o $dname 141 1 $crlf $+ $did(102,$did(102).sel) $str($crlf,2) $+ $ifmatch } elseif ($did(102).sel) did -o $dname 141 1 $crlf $+ $did(102,$ifmatch) $+ $str($crlf,2) $+ No description available } on *:dialog:basic:init:*:{ var %com = loadbuf -otcommands $dname, %f = $fkeys.txt didtok -a $dname 99 32 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 %com 137 %f %com 138 %f %com 139 %f %com 102 %f did -a $dname 137,138,139 -Empty- } alias -l fsettmp { var %n = basic if ($did(%n,$1,$did(%n,$1).sel)) set %sys.fkeytmp. $+ $did(%n,$2).text $ifmatch else unset $+(%,sys.fkeytmp.,$did(%n,$2).text) } alias -l _openfkey { if (!$dialog(fkey)) !.echo -q $dialog(fkey,fkey,-4) } on *:dialog:basic:sclick:101:.timer -m 1 1 _openfkey on *:dialog:basic:sclick:104:{ if ($did(102).sel) { var %l = $ifmatch, %c = $did(102,%l) if ($input(Are you sure you want to remove %c from the commands list?,264,Remove command)) { set %sys.fkeytmp.del $addtok(%sys.fkeytmp.del,%c,1) did -d basic 102 %l did -o basic 141 1 Select a command from the list to view its description. } } } on *:dialog:basic:sclick:139:fsettmp 139 134 on *:dialog:basic:sclick:138:fsettmp 138 135 on *:dialog:basic:sclick:137:fsettmp 137 136 on *:dialog:basic:sclick:3:{ var %i = 1 while (%i <= 12) { if ($($+(%,sys.fkeytmp.,F,%i),2)) fset $+(F,%i) com $ifmatch if ($($+(%,sys.fkeytmp.,Ctrl+F,%i),2)) fset $+(cF,%i) com $ifmatch if ($($+(%,sys.fkeytmp.,Shift+F,%i),2)) fset $+(sF,%i) com $ifmatch inc %i } if (%sys.fkeytmp.del) { var %i = 1, %tmp, %f = $fkeys.txt while ($gettok(%sys.fkeytmp.del,%i,1)) { %tmp = $read(%f,ns,$ifmatch) if ($readn) write $+(-dl,$ifmatch) %f if ($readini(%f,n,description,%tmp)) remini %f description %tmp inc %i } return ; another lame workaround because $read(blah,ns,string) is broken var %w = @_broken$read $+ $ticks, %f = $fkeys.txt window -hsl %w loadbuf -tcommands %w %f iline %w 1 [commands] remini %f commands var %i = 1, %s while ($gettok(%sys.fkeytmp.del,%i,1)) { %s = $ifmatch if ($fline(%w,%s,1)) { dline %w $ifmatch if ($readini(%f,n,description,%s)) remini %f description %s } inc %i } savebuf -a %w %f window -c %w } unset %sys.fkeytmp.* } on *:dialog:basic:sclick:4:unset %sys.fkeytmp.* alias F1 { if ($func(F1)) $ifmatch else help } alias F2 $func(F2) alias F3 $func(F3) alias F4 $func(F4) alias F5 $func(F5) alias F6 $func(F6) alias F7 $func(F7) alias F8 $func(F8) alias F9 $func(F9) alias F10 $func(F10) alias F11 $func(F11) alias F12 $func(F12) ; shift alias sF1 $func(sF1) alias sF2 $func(sF2) alias sF3 $func(sF3) alias sF4 $func(sF4) alias sF5 $func(sF5) alias sF6 $func(sF6) alias sF7 $func(sF7) alias sF8 $func(sF8) alias sF9 $func(sF9) alias sF10 $func(sF10) alias sF11 $func(sF11) alias sF12 $func(sF12) ; ctrl alias cF1 $func(cF1) alias cF2 $func(cF2) alias cF3 $func(cF3) alias cF5 $func(cF5) alias cF6 $func(cF6) alias cF7 $func(cF7) alias cF8 $func(cF8) alias cF9 $func(cF9) alias cF10 $func(cF10) alias cF11 $func(cF11) alias cF12 $func(cF12) dialog -l fkey { title "Function key commands editor" size -1 -1 171 43 option dbu button "&Ok", 1, 52 28 32 12, ok button "&Cancel", 2, 86 28 32 12, cancel text "Command:", 3, 2 5 35 8 text "Description:", 4, 2 15 35 8 edit "", 5, 39 3 130 11, autohs edit "", 6, 39 15 130 11, autohs } on *:dialog:fkey:init:*:did -cfe fkey 5 on *:dialog:fkey:sclick:2:_showdlg basic on *:dialog:fkey:sclick:1:{ if ($did(5) != $null) { var %w = @_ $+ $ticks, %com = $iif(/* !iswm $did(5),$+(/,$did(5)),$did(5)) window -hl %w 1 1 1 1 if ($_isfile($fkeys.txt)) { aline %w [commands] loadbuf -tcommands %w $ifmatch remini $fkeys.txt commands } aline %w %com savebuf -a %w $fkeys.txt window -c %w if ($did(6) != $null) writeini $fkeys.txt description %com $did(6) if ($dialog(basic)) { did -r basic 102 loadbuf -otcommands basic 102 $fkeys.txt } } _showdlg basic } ; xnotify dialog xnotify { title "Notify list" size -1 -1 248 142 option dbu icon mirc.exe, 13 button "&Ok", 1, 66 130 37 11, ok button "&Cancel", 2, 105 130 37 11, cancel button "&Help", 3, 144 130 37 11 box "Add/Edit:", 4, 1 0 246 47 text "Nick:", 5, 4 11 20 8, right edit "", 6, 25 9 88 11 text "Network:", 7, 116 10 25 8, right combo 8, 142 8 60 50, edit drop text "Note:", 9, 4 23 20 8, right edit "", 10, 25 21 177 11 text "Sound:", 11, 4 35 20 8, right button "", 12, 26 34 166 11 button "!", 13, 194 34 8 11 button "&Add/Update", 14, 207 9 37 11 list 15, 1 48 202 72, size button "&Edit", 16, 207 74 37 11 button "&Remove", 17, 207 86 37 11 check "Enable ¬ify", 18, 2 120 42 10 } on *:dialog:xnotify:init:*:{ mdxinit $dname 15 100,100,100,50 Nick,Network,Note,Sound } ; clone scanner dialog clone { title "Clone scan" size -1 -1 241 142 option dbu icon $shortfn($mircexe), 17 text "Channel:", 1, 3 3 25 8, right combo 2, 30 2 60 50, size drop ;text "Search string:", 3, 95 3 36 8, disable ;edit "", 4, 134 2 80 10, autohs disable ;button "Go!", 5, 217 2 20 10, ok button "Scan", 5, 95 2 30 10, default list 6, 0 15 241 118, size edit "", 7, -1 132 243 10, read list 8,1 1 1 1,hide button "Ok", 9, 1 1 1 1, hide ok button "positioner", 10, 1 1 1 1, hide } on *:dialog:clone:init:*:{ mdxinit $dname 6 230,174,71 Hostmask,Nick,Status mdxResizeFix $dname mdx SetControlMDX $dname 10 Positioner minbox > dll\mdx\dialog.mdx var %i = 1 while ($chan(%i)) { did -a $dname 2 $ifmatch inc %i } if ($didwm(2,%_sys.clonewin.chan,1)) did -c $dname 2 $ifmatch } on *:dialog:clone:sclick:5:{ if (!$did(2)) return if (!$chan($did(2)).ial) _err IAL is not yet updated for $did(2) $+ . $+ $crlf $+ Please wait or to manually update it, type /who $did(2) did -r $dname 6 clonewin $did(2) } on *:dialog:clone:sclick:6:{ did -i $dname 6 1 page $devent tokenize 32 $did(6,1) if ($did(6).sel > 1) { var %mouse = $mouse.dx $mouse.dy, %event = $1 tokenize 9 $did(8,$calc($ifmatch - 1)) if (%event == rclick) { if ($2 == $null) return else popclonewinmenu %mouse $1- } } } alias popclonewinmenu { var %x = $1, %y = $2, %m = clwin tokenize 32 $3- _mnu New %m 5 7 _itm %m +D 1 $2 $cr halt _itm %m _itm %m 3 &Whois $cr whois $2 _itm %m +> 4 C&TCP $cr ctcp _mnu New ctcp 5 5 C&TCP $cr ctcp _itm ctcp 1 &Ping $cr ctcp $2 ping _itm ctcp 2 &Finger $cr ctcp $2 finger _itm ctcp 3 &Version $cr ctcp $2 version _itm ctcp 4 &Time $cr ctcp $2 time _itm ctcp _itm ctcp 6 &Specify... $cr _clonectcp $2 _itm %m _itm %m 6 &Warn... $cr _clonewinwarn $did(clone,2) $address($2,2) _itm %m $iif($me !isop $did(clone,2),+d) 7 &Filterkick... $cr _clonewinfk $2 _itm %m $iif($me !isop $did(clone,2),+d) 8 &Kick $cr kick $did(clone,2) $2 clone from $address($2,2) _itm %m $iif($me !isop $did(clone,2),+d) 9 Kick&Ban $cr _kb $did(clone,2) $2 clone from $address($2,2) _itm %m _itm %m +> 11 User&lists $cr lists _mnu New lists 5 5 User&lists $cr lists _itm lists 1 &Friend... $cr _clonewinfriend $2 $did(clone,2) _itm lists 1 &Ban... $cr _clonewinban $2 $did(clone,2) _itm %m _itm %m 13 &Close window $cr .timer 1 0 dialog -x clone popit %m +cC %x %y } alias clonewin { var %chan = $_achan($1), %ticks = $ticks if (!%chan) _err You're not in a channel ialcheck %chan set -u2 %_sys.clonewin.chan %chan if ((%lastclonescan != $cid) && ($dialog(clone))) dialog -x clone set -u60 %lastclonescan $cid _opendlg clone ; I can't do /did -r clone 6,8 because of MDX did -r clone 6 did -r clone 8 hfree -w @_clonescandlg.* var %i = 1, %hash = $+(@_clonescandlg.,$ticks), %mask, %line while ($nick(%chan,%i)) { %mask = $address($ifmatch,2) hadd -m $+(@_clonescandlg.,%mask) nicks $addtok($hget($+(@_clonescandlg.,%mask),nicks),$ifmatch,32) if ($gettok($hget($+(@_clonescandlg.,%mask),nicks),2,32)) hadd -m %hash %mask 1 inc %i } ; you know, this would have been a hell of a lot faster if it didn't have to be in a dialog.. :/ %i = 1 while ($hmatch(%hash,*,%i)) { var %ii = 1, %mask = $ifmatch, %nick while ($gettok($hget($+(@_clonescandlg.,%mask),nicks),%ii,32)) { %nick = $ifmatch %line = $_invisiblemask(%ii,%mask) $chr(9) %nick $chr(9) $& $iif($left($nick(%chan,%nick).pnick,1) isin $prefix,$replace($ifmatch,@,Op,+,Voice,$chr(37),Half-Op,.,Owner),Normal) did -a clone 6 %line did -a clone 8 %line inc %ii } did -a clone 6 $chr(160) did -a clone 8 $chr(160) inc %i } did -ra clone 7 Total hosts with clones found: $calc(%i - 1) $+ , Scan completed in: $calc(($ticks - %ticks) / 1000) $+ s hfree -w @_clonescandlg.* } alias -l _invisiblemask { if ($1 == 1) return $2 return $str($chr(160),$len($2)) } alias _clonewinwarn { var %i = 1, %nick, %msg = $input(Enter warning message to send to $2 $+ ,33,Clone warning,WARNING: Clones are not allowed in $1) if (!%msg) halt while ($ialchan($2,$1,%i).nick) { %nick = $ifmatch .timer 1 %i .notice %nick %msg inc %i } } alias _clonewinfriend { set -u %addf.mask $_iif($address($1,5),$+($1,!*@*)) set -u %addf.chan $2 set -u %addf.net $_network _opendlg adduser } alias _clonewinban { set -u %addban.mask $_iif($address($1,5),$+($1,!*@*)) set -u %addban.chan $2 set -u %addban.net $network _opendlg addban } alias _clonewinfk { _sysfk $did(clone,2) $address($1,2) clones detected from $address($1,2) } alias _clonectcp { if ($input(Enter CTCP request to send to $1,1,CTCP)) ctcp $1 $ifmatch _showdlg clone } ; these aliases need a good rewrite, I know :/ alias clone { clones } alias clones { var %c = $_achan($1) ialcheck %c if ($_themes) %:echo = iecho else %:echo = echo $color(info) -ti %c *** var %t = . $iif($nick(%c,0) >= 200,This might take a while.) %:echo Scanning for clones in %c $+ %t var %z = $ticks, %i = 1, %l = $+(%,Sys.CloneList.,#) while ($nick(%c,%i)) { var %n = $ifmatch, %m = $address(%n,2), %a = $+(%,Sys.CloneMask.,%c,$chr(1),%m) set $(%a) $addtok($(%a,2),%n,1) if ($numtok($(%a,2),1) > 1) set $(%l) $addtok($(%l,2),%m,32) inc %i } var %i = 1, %y = $(%l,2) while ($gettok(%y,%i,32)) { %:echo %i $+ . Clones from $ifmatch 4 $+ $replace($($+(%,Sys.CloneMask.,%c,,$ifmatch),2),,$chr(32)) inc %i } unset $($+(%,Sys.CloneMask.,%c,$chr(1),*)) $(%l) if (%i == 1) %:echo No clones found in %c $+ . %:echo Clone scan in: $calc(($ticks - %z) / 1000) seconds. } ; /ck [-ovxb] <#channel> [reason] ; - clonekick ; -o exempt ops ; -v exempt voiced ; -b ban address ; -x exempt users in userlist but only with x flag alias ck { if (($1) && (!$2)) return if (-* iswm $1) var %s = $remove($1,-), %c = $2, %r = $3- else var %s, %c = $1, %r = $2- if (($me !isop %c) || (!%d) || ($ialcheck(%c))) return var %l, %v = % $+ _sys.tmp. $+ $cid $+ ._clonecom., %i = 1 while ($nick(%c,%i)) { var %n = $ifmatch, %m = $address(%n,5), %w = $address(%n,2) inc %i if ((($($+(%v,%m,.exempt),2)) || ((o isincs %s) && (%n isop %c)) || ((v isincs %s) && (%n isvo %c)) || ((x isincs %s) && ($_isuser($network,%c,%m).exempt)))) { set -u $($+(%v,%m,.exempt)) 1 continue } var %h = $($+(%v,%w,.list)) set -u $(%h) $addtok($(%h,2),%n,44) if ($gettok($(%h,2),2,44)) _sysfk %c %w %r } } alias ckb { ck -b $_achan($1) $1- } ; simple /server dialog alias conn { _opendlg connect } dialog connect { title "Connect" size -1 -1 176 119 option dbu icon $shortfn($mircexe), 14 text "Server:", 1, 16 5 25 8, right text "Port:", 2, 94 16 16 8, right text "Password:", 3, 16 16 26 8, right text "Nick:", 4, 16 41 25 8, right text "Alternative:", 5, 11 52 30 8, right text "Email:", 6, 16 66 25 8, right text "Real name:", 7, 5 79 36 8, right text "Join channel:", 8, 5 91 36 8, right edit "", 9, 43 3 112 11, autohs edit "", 10, 43 15 50 11, autohs combo 11, 112 15 42 50, sort size edit drop check "New server window.", 12, 44 28 61 10 edit "", 13, 43 40 63 11, autohs edit "", 14, 43 51 63 11, autohs edit "", 15, 43 64 63 11, autohs combo 16, 43 77 99 50, sort size edit drop edit "", 17, 43 89 99 11, autohs button "&Connect", 18, 55 104 32 12, ok default button "C&ancel", 19, 89 104 32 12, cancel } ; /server [-mnsar] [port] [password] [-i nick anick email name] [-j #channel pass] on *:dialog:connect:init:*:{ did -a $dname 13 $mnick did -a $dname 14 $anick did -a $dname 15 $email if ($_isfile($_datfile(names.txt))) { filter -fo $ifmatch $dname 16 * did -c $dname 16 $r(1,$lines($ifmatch)) } didtok -a $dname 11 44 6667,6668,6669,7000 did -c $dname 11 1 if (%sys.newcon) did -c $dname 12 unset %sys.newcon } on *:dialog:connect:sclick:18:{ if (!$did(9)) return var %m = $did(9) $did(10) $did(11) var %i = $did(13) $did(14) $did(15) $did(16) var %c = $did(17) !server $iif($did(12).state,-m) %m $iif(%i,-i) %i $iif(%c,-j) %c } ; /match [-w] ; searches the active channel for any matches of given ; if there's a wildcard in the string, use iswm comparison, if not, use isin. alias match { var %w = $_matchwin if (($1 == -w) && ($2)) { window -knl -t5,20,30 %w $_winfo(%w) @Address Match $_winfo(%w).font $_winfo(%w).size $shortfn($mircexe) titlebar %w ( $+ $_iif($network,$server) $+ ) _match $2 } else _match $1 } alias -l _match { set -u %sys.show $true if ($active !ischan) _err /match: You're not in a channel. iecho Scanning # for any matches of $$1 var %i = 1, %op = $iif(* isin $1 || ? isin %string,iswm,isin), %r = 0 while ($nick(#,%i)) { var %n = $ifmatch, %m $address(%n,5) if ($1 %op %m) { inc %r _matchshow %r $+ . %n $_matchhilite(%m,$1) } inc %i } _matchshow Found %r matches of $1 in # $+ . } alias -l _matchhilite { var %str = $remove($2,*,?) if (%str) return $replace($1,%str,$+(04,%str,)) return $1 } alias -l _matchwin { return @[ $+ $cid $+ ]Address Match } alias -l _matchshow { if ($window($_matchwin)) { if (*. iswm $1) aline $_matchwin $tab($1,$2,$3) else titlebar $_matchwin - $1- .timerMatchShow -m 1 1 window -ra $_matchwin $chr(124) window -b $_matchwin } else iecho $1- } alias -l _slm { return $gettok($sline($active,1),$1,9) } alias -l _mcc { if (($1 isnum) && ($1 <= $chan(0))) { if ($comchan($2,$1).op) return $comchan($2,$1) :kick $comchan($2,$1) $2 return : } } alias -l _mcc2 { if (($1 isnum) && ($1 <= $chan(0))) { if ($comchan($2,$1).op) return $comchan($2,$1) :_kb $comchan($2,$1) $2 return : } } alias -l _mitm { if ($_slm(1-)) return $1- else return $style(2) $1- } on *:close:@[*]Address Match:savewinpos $target menu @Address Match { $_slm(2):return - $_mitm(Whois):wi $_slm(2) $_mitm(Whois++):wii $_slm(2) - $_mitm(CTCP) .Ping:ping $_slm(2) .Finger:ctcp $_slm(2) finger .Version:ctcp $_slm(2) version .- .Other:var %c = $input(Enter a CTCP request to send to $_slm(2),1,CTCP) | if (%c) ctcp $_slm(2) %c - Kick .$submenu($_mcc($1,$_slm(2))) Kickban .$submenu($_mcc2($1,$_slm(2))) - Close:close -@ $active } ; eof