Auto-Rejoin on Ban or Block

By raccoon on Nov 18, 2012

Automatically rejoin channels you have been banned or blocked from joining.

Great for making sure your unattended client stays in all its channels, weathering through netsplits and takeovers or the occasional kick-ban.

Comments and Likes appreciated, especially if you find this useful.

; r_autorejoin.mrc * Version 2.2 * 21-Nov-2012 * Raccoon/EFnet
; This script has no dependencies. It belongs in the Remotes section.

;*******************************************************************************
;* Automatically rejoin channels you have been banned or blocked from joining. *
;* The script will keep retrying until you close the channel or get back in.   *
;* First 12 tries at +10,+20... seconds, and then between 10-30 minutes random.*
;* Requires 'Rejoin channel when kicked' and 'Keep channels open' are enabled. *
;* Also some extras: Rejoin on Invite, and Rejoin on Freenode's /quote remove  *
;* Written by Raccoon on 21-Nov-2012. #mIRC/EFNet #mSL/SwiftIRC www.hawkee.com *
;*******************************************************************************

;----- Begin "Auto-Rejoin When Blocked" by Raccoon -----
RAW 474:*: fail_join $2 until ban is lifted...
RAW 471:*: fail_join $2 until limit is increased...
RAW 473:*: fail_join $2 until invite-only is removed...
RAW 475:*: fail_join $2 until key is removed...
RAW 477:*: fail_join $2 until auth-only is removed...
RAW 480:*Cannot join channel*: fail_join $2 until SSL-only is removed...
RAW 489:*Cannot join channel*: fail_join $2 until SSL-only is removed...
RAW 437:*temporarily unavailable*: fail_join $2 until channel becomes available...

ALIAS -l fail_join { ; By Raccoon 21-Nov-2012
  if ($1 ischan) {
    inc -eu1830 %FAILJOIN. $+ $cid $+ $1
    var %n = $($+(%,FAILJOIN.,$cid,$1),2)
    var %t = $iif(%n isnum 1-12,$calc(%n * 10),$r(600,1800))
    .timerFAILJOIN. $+ $cid $+ $1 1 %t _timer_rejoin $chsafe($1)
    var %str = Attempting to rejoin $2-
    if (%n == 1) { .timer 1 0 echo -tic notice $chsafe($1) * %str }
    else { haltdef }
} }

ALIAS -l _timer_rejoin { ; By Raccoon 21-Nov-2012
  if ($1 ischan) && ($me !ison $1) { !join $1 $chan($1).key }
  else { unset %FAILJOIN. $+ $cid $+ $1 }
}

;366 $me $chan :End of /NAMES list.
RAW 366:*: { unset %FAILJOIN. $+ $cid $+ $2 }

;Use in /timers to sanitize channel names like #$($p(hacked!)). By Raccoon.
ALIAS -l chsafe { return $iif($ isin $1,$!replace( $replace($1,$,`$) ,`$,$),$1) }

;*** EXTRAS ***

;Auto-rejoin open channel when Invited. Useful for mistake kick-bans.
On *:INVITE:#: if ($chan ischan) { !join $chan $chan($chan).key }

;Auto-rejoin on forced part via '/quote remove $chan $nick' command on Freenode.
On me:*:PART:#: { ; By Raccoon 18-Nov-2012
  if $regex($1-,/requested by (\S+) \(\S+\)/) {
    var %r = $r(10,30)
    echo -stic notice * Forcibly Parted from $chan by $regml(1) $+ . Rejoining in %r seconds...
    .timer 1 %r !join -n $chsafe($chan)
} }
;----- End "Auto-Rejoin When Blocked" by Raccoon -----

;v1.0 27-Aug-2012 - Auto Rejoin when Banned, initial script.
;v1.1 12-Sept-2012 - Added $chsafe() to sanitize potential exploits.
;v2.0 18-Nov-2012 - Rewritten to support all blocks; +b/+l/+i/+k/netsplit.
;v2.1 18-Nov-2012 - Added support for other channel join blocks (auth/ssl/etc).
;                   Also threw in some extras: Rejoin on Invite, and on /remove.
;v2.2 21-Nov-2012 - Fixed: Instance of %chan should be $1 in timer's name.
;TODO: Attempt retrying channels that haven't been joined yet (no channel window).
;      This will require some custom @window listing channels in queue to rejoin.

;http://www.hawkee.com/snippet/9729/
;http://kthx.net/paste/abpw70srhzc40808kocgs

Comments

Sign in to comment.
NaZaRa   -  Nov 21, 2012

OkAy I thought it was only with /set ;)

 Respond  
raccoon   -  Nov 21, 2012

It works for /inc and /set because they are special. Test with -s.

  • Inc %FAILJOIN.64##xyzzy to 1
 Respond  
NaZaRa   -  Nov 20, 2012

"inc -eu1830 %FAILJOIN. $+ $cid $+ $1"

%failjoin is resolve before the $+ use thz %failjoin. [ $+ $cid $+ $1 ]

 Respond  
raccoon   -  Nov 18, 2012

Latest update: v2.2 -- Fixed: Instance of %chan should be $1 in timer's name.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.