AutoPart

By RusselB on Jul 09, 2007

Menu driven controller to allow you to specify channels you don't want to be in. Sort of like the opposite of Auto-Join on invite.

Channels can be added/removed one at a time, or in sets, and are network specific.
A temporary (2 minute) removal can be set up, if you need to be in one of those channels for some reason, but don't want to remove it and then re-add it again later.

Channels are network specific, and the current channel (if any) is automatically inserted in the Add section (this can be overwritten, of course)

menu * {
  Auto-Part
  .Add : .auto-part add $$input(Comma or space separated,e,Enter Channel Name(s),$iif($chan,$chan))
  .Over-Ride Auto-Part : auto-part pause $$input(Comma or space separated,e,Enter Channel Name(s))
  .Remove : auto-part del $$input(Comma or space separated,e,Enter Channel Name(s))
  .Review : auto-part list
}
alias -l auto-part {
  if $1 == add {
    var %ap_channels = $replace($2-,$chr(44),$chr(32))
    while %ap_channels {
      var %ap_channel = $gettok(%ap_channels,1,32)
      .hadd -m AutoPart %ap_channel $network
      echo -a Channel %ap_channel has been added for $network
      %ap_channels = $remtok(%ap_channels,%ap_channel,1,32)
    }
  }
  elseif $1 == del {
    var %ap_channels = $replace($2-,$chr(44),$chr(32))
    while %ap_channels {
      var %ap_channel = $gettok(%ap_channels,1,32)
      .hdel AutoPart %ap_channel
      echo -a Channel %ap_channel has been removed from those for $network
      %ap_channels = $remtok(%ap_channels,%ap_channel,1,32)
    }
  }
  elseif $1 == pause {
    var %ap_channels = $replace($2-,$chr(44),$chr(32))
    while %ap_channels {
      var %ap_channel = $gettok(%ap_channels,1,32)
      .hdel AutoPart %ap_channel
      echo -a Channel %ap_channel has been temporarily removed from those for $network $+ . It will be automatically re-added after 2 minutes
      $+(.timer,%ap_channel) 1 120 hadd -m AutoPart %ap_channel $network
      %ap_channels = $remtok(%ap_channels,%ap_channel,1,32)
    }
  }
  elseif $1 == list {
    var %a = 1, %b = $hget(AutoPart,0).item
    .msg $me Auto-Part Currently Enabled for:
    while %a <= %b {
      .timer 1 %a .msg $me $hget(AutoPart,%a).item on $hget(AutoPart,%a).data
      inc %a
    }
  }
}
on *:start:{
  if !$hget(AutoPart) { .hmake AutoPart 10 }
  if $exists(AutoPart.hsh) { .hload AutoPart AutoPart.hsh }
}
on *:exit:{
  .hsave -o AutoPart AutoPart.hsh
}
on *:disconnect:{
  .hsave -o AutoPart AutoPart.hsh
}
on me:*:join:#:{
  if $hget(AutoPart,$chan) == $network {
    .part $chan
  }
}

Comments

Sign in to comment.
AMDPhenomx4   -  Mar 11, 2011

Thank you for the script.

 Respond  
Bouncer   -  Jul 09, 2007

I like the idea. I am IRCop on a server, and because of that people tend to want me in their rooms. I get invited to alot of rooms over and over again. This would come in handy for me. Nice job RusselB. :)

 Respond  
Lindrian   -  Jul 09, 2007

Yet seems rather usless, but good job anyhow =P

 Respond  
RusselB   -  Jul 09, 2007

On one network that I\'m on, those with a certain level of IRCops (or higher) must be in certain channels, yet those IRCops that don\'t have those levels can be in those channels, but aren\'t required to be. The IRCop configuration file that is on the network does a forced join to those channels when you use the /oper command. Basically this was written so that people could set certain channels that they don\'t want to be in.
Might be used by kids to \'block\' any adult channels that might be present on networks that permit both.

 Respond  
Lindrian   -  Jul 09, 2007

I dont see why this would be needed. But I suppose you have your reasons. The coding itself looks to be well done, great job.

 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.