# version:1.2 loader:pf # $Id: nickcomp.dsm,v 1.25 2007/03/24 07:09:08 brian Exp $ # # nickcomp.dsm - Nick completion module for DarkStar/EPIC5 # Written by shade # Modified for DarkStar and maintained by Brian Weiss # # This script uses serial number 0 for all /ON hooks. # # Most of this was taken from the nick completion module that shade # wrote for my BitchX/EPIC4 script called playdough and has been placed # in the public domain. # queue cleanup.nickcomp { ^on input -"%: *"; }; addconfig -b NICK_COMPLETION 1; addconfig NICK_COMPLETION_CHAR :; addconfig NICK_COMPLETION_PATTERNS $$0 $$0% ?$$0 ?$$0%; addconfig NICK_COMPLETION_THRESHOLD 2; addformat NICK_COMPLETION $$1: $$2-; alias nickcomp.getnick { eval ^local patterns $CONFIG.NICK_COMPLETION_PATTERNS; for patt in ($patterns) { @:findnick = pattern($patt $onchannel($C)); if (#findnick > CONFIG.NICK_COMPLETION_THRESHOLD) return; @ function_return = findnick ? word(0 $findnick) : function_return; }; }; on ^input "%: *" { if (CONFIG.NICK_COMPLETION) { @ :complete = nickcomp.getnick($before($CONFIG.NICK_COMPLETION_CHAR $*)); sendline ${complete ? fparse2(NICK_COMPLETION $complete $1-) : [$*]}; }{ sendline $*; }; };