#version 1.1.2 /* * autocycle.dsm - Auto-Cycle module for DarkStar/EPIC4 * * Copyright (c) 2002 Brian Weiss * See the 'COPYRIGHT' file included with DarkStar for more information. * * This script uses serial number 425 for all /on hooks. * * Automatically cycles empty and opless channels. Users should be aware that * this feature has been known to be trouble. Especially when connected to * multiple servers within a single session. Use at your own risk. */ /****** CLEANUP QUEUE ******/ queue cleanup.autocycle { ^on #channel_signoff 425 -"*" ^on #channel_sync 425 -"*" ^on #leave 425 -"*" ^on #leave 425 -'\$servernick() *' @ delarray(synced_channels) } /****** CONFIG VARIABLES ******/ config.add -b AUTO_CYCLE 0 /****** INTERNAL ALIASES ******/ alias autocycle.cycle (chan, void) { if (CONFIG[AUTO_CYCLE] && matchitem(autocycle.synced_channels $chan) > -1 && !ischanop($servernick() $chan) && numonchannel($chan) <= 2) { xecho -b Auto-cycling $chan to gain ops @ :key = key($chan) //part $chan wait //join $chan $key } } /****** ON HOOKS ******/ on #-channel_signoff 425 "*" { unless ([$1] == servernick()) { autocycle.cycle $0 $1 } } /* * Store the names of synced channels so we can make sure * not to prematurely cycle. */ on #-channel_sync 425 "*" { @ setitem(autocycle.synced_channels $numitems(autocycle.synced_channels) $0) } on #-leave 425 "*" { unless ([$0] == servernick()) { autocycle.cycle $1 } } /* * Cleanup the autocycle.synced_channels array. */ on #-leave 425 '$servernick() *' { for itm in ($getmatches(autocycle.synced_channels $1)) { @ delitem(synced_channels $itm) } } /* EOF */