Jump to content
coders-irc_Bot

(mIRC) IAL Fill (better than /WHO On Join)

Recommended Posts

  • Administrators

IALFILL allows for a safe and consistent updating of mIRC's Internal Address List.
This is useful for scripts that need to know user addresses in every channel you join.
It is an alternative to the simple and dangerous "On *:JOIN:#:WHO $chan" that may cause
you to lag or be disconnected for flooding (Quit: Excess Flood or Quit: RESVQ Exceeded).

Exaple uses:
/ialfill on        (automatically update IAL as you join new channels)
/ialfill off       (turns off automatic update of IAL)
/ialfill           (manualy typed command, updates once)
/ialfill 0         (temporarily sets the delay between WHO commands to 0 seconds)
.ialfill           (surpresses all output, use in scripts)

;r_IALFILL.mrc By Raccoon 25-Feb-2012
;# IALFILL allows for a safe and consistent updating of mIRC's Internal Address List.
;# This is useful for scripts that need to know user addresses in every channel you join.
;# It is an alternative to the simple and dangerous "On *:JOIN:#:WHO $chan" that may cause
;# you to lag or be disconnected for flooding (Quit: Excess Flood or Quit: RESVQ Exceeded).
;# 
;# This goes in your Remote Scripts section, mIRC 6.x and 7.x compatable.
;# Written by Raccoon on 25-Feb-2012. EFnet #mIRC.

;# Exaple uses:
;# /ialfill on        (automatically update IAL as you join new channels)
;# /ialfill off       (turns off automatic update of IAL)
;# /ialfill           (manualy typed command, updates once)
;# /ialfill 0         (temporarily sets the delay between WHO commands to 0 seconds)
;# .ialfill           (surpresses all output, use in scripts)
ALIAS IALFILL { ; By Raccoon 25-Feb-2012
  if $1 == on || $1 == auto {
    .enable #IALFILL_JOIN
    echo -qtic notice * IALFILL: Automatic Updating enabled.
  }
  elseif $1 == off {
    .disable #IALFILL_JOIN
    echo -qtic notice * IALFILL: Automatic Updating disabled.
  }
  else {
    ; Permit a custom delay between WHO requests. Default is 2 seconds.
    if $1 isnum { set -eu300 $+(%,IALFILL.,$cid,.delay) $1 }
    var %delay = $iif($($+(%,IALFILL.,$cid,.delay),2) isnum,$v1,2)
    ; Remember if any output should be displayed. (/ialfill vs .ialfill)
    set -eu300 $+(%,IALFILL.,$cid,.show) $show
    .timerIALFILL. $+ $cid 1 %delay IALFILL_next
} }

; IALFILL_next is a timer and event delayed alias that is called internally.
ALIAS IALFILL_next { ; By Raccoon 25-Feb-2012
  var %i = 1, %n = $chan(0)
  ; Find next channel with incomplete IAL.
  WHILE %i <= %n { if !$chan(%i).ial { var %chan = $chan(%i) | BREAK } | inc %i }
  if %chan {
    .enable #IALFILL_WHO
    .raw WHO %chan
    ; Add a 30 second timeout to clean-up if WHO never happens.
    .timerIALFILL. $+ $cid 1 30 IALFILL_done %chan
  }
  else {
    var %show = $($+(%,IALFILL.,$cid,.show),2)
    if %show { echo -stic info * IALFILL: All channels on $network are up to date. }
    unset $+(%,IALFILL.,$cid,.*)
} }

; Hide our /WHO output from spamming the Status Window.
#IALFILL_WHO off
RAW 352:*: { haltdef } ; /WHO enumeration.
RAW 315:*: { IALFILL_done $2 | haltdef } ; End of /WHO list.
#IALFILL_WHO end

; IALFILL_done is a call-back alias that is called internally.
ALIAS IALFILL_done { ; By Raccoon 25-Feb-2012
  var %chan = $1
  var %show = $($+(%,IALFILL.,$cid,.show),2)
  .disable #IALFILL_WHO
  ; Make sure the IAL was successfully filled before continuing, otherwise we may try endlessly.
  ; The !ischan check allows for instances if the channel window is closed during /WHO.
  if $chan(%chan).ial || (%chan !ischan) {
    if %show { echo -stic info * IALFILL: %chan updated. }
    var %delay = $iif($($+(%,IALFILL.,$cid,.delay),2) isnum,$v1,2)
    .timerIALFILL. $+ $cid 1 %delay IALFILL_next
  }
  else {
    ; This should never, unless a server prohibits /WHO or you are extremely lagged.
    echo -stic notice * IALFILL: Unexpected error updating %chan $+ , giving up.
    unset $+(%,IALFILL.,$cid,.*)
} }

; Automatcally fill IAL after joining channels, using a safe delay.
; Use /ialfill on|off to enable/disable.
#IALFILL_JOIN off
RAW 366:*: { .ialfill } ; End of /NAMES list.
#IALFILL_JOIN end

; end of script.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...