### ### vim:ts=8 ai si sw=4 sta sm: ### $Id: tabkey++,v 1.7 2007/05/15 08:53:16 sec Exp sec $ ### An enhanced tabkey (tabkey,v 1.3 1997/01/17) ### # requires: ^u erase_line; ^a bginning_of_line; ^e end_of_line # words(); notword(); substword() # warning: re-aliases /msg # This script uses SERIAL NUMBER #55 # tabkey++, This implementation by Sec!sec@42.org with thanks to: # Freddy!develop@dachbu.de for CMDCHAR fixes. alias tk.help { echo *** This is an enhanced tabkey Script echo *** New features include: echo *** + line doesn't get erased on Tab (TODO: keep cursorpos) echo *** + tracks nickchanges of others echo *** + "${K}msg ${K}me" is a "${K}describe " echo *** + "${K}msg #wall" is a ${K}wallop echo *** + "${K}msg #" is also stored in tabkey-list echo *** + removes nicknames on "No such nick/channel" echo *** echo *** ^I - cycle forward through list echo *** ^R - cycle backward through list echo *** ^X^X - remove current nickname echo *** ${K}tk.nicklist - list all nicknames echo *** ${K}tk.addnick - add one nick echo *** \$tk.msgmax - max number of nicks to store \($tk.msgmax\) } eval if (!match(%+tk% $script_info)){ assign script_info $script_info+tk };set client_info Sec$script_info # searches thru list forwards (tab) or backwards (ctrl R) bind ^I parse_command ^tk.getmsg 1 $tk.msglist bind ^R parse_command ^tk.getmsg -1 $tk.msglist bind meta2-^X parse_command tk.delnick # shows all the current nicknames in the list. alias tk.nicklist echo *** Nickname List: $tk.msglist # Adds nicknames to the list.. alias tk.addnick if ([$1]) { tk.addnick $1- };tk.addmsg $0 $tk.msglist # Set this to the max number of nickname you want on the list at a time @ tk.msgmax = 6 # From here down are internal aliases and 'ON's. # keeps list of unique nicks from newest message to oldest message. alias tk.addmsg { @ tk.matched = rmatch($0 $^\1-) if (tk.matched) { @ tk.msglist = [$(0-${tk.matched-1}) $(${tk.matched+1}-)] }{ @ tk.msglist = [$(0-${tk.msgmax-1})] } @ tk.msgcnt = 0 ^assign -tk.matched } # searches thru list forwards or backwards. ($0==1==forward),($0==-1==back) alias tk.getmsg { @ tk.msgcnt = tk.msgcnt + [$0] if ( #tk.msglist < tk.msgcnt ) {@ tk.msgcnt = 1} if (tk.msgcnt <= 0) {@ tk.msgcnt = #tk.msglist} @ tk.junk = K ## [msg] if ( [$[4]L] == [${K}msg] ) { type $tk.junk $^\^^{[$($tk.msgcnt)]} $words(3- $L) }{ type $tk.junk $^\^^{[$($tk.msgcnt)]}  } } # Adds nick to list when message is received. Doesn't effect output. on #-msg 55 * ^tk.addmsg $0 $tk.msglist on #-dcc_chat 55 * ^tk.addmsg \=$0 $tk.msglist on #-talk 55 * ^tk.addmsg \@$0 $tk.msglist on #-RAW_IRC 55 "% WALLOPS *" ^tk.addmsg #wall $tk.msglist # deletes current nick from list alias tk.delnick { if (tk.msgcnt == 0) { @ tk.msgcnt = 1 } echo *** Nickname: $word(${tk.msgcnt-1} $tk.msglist) removed. @ tk.msglist = [$notword($tk.msgcnt $tk.msglist)] type ^U } # Track nickchanges on #-nick 55 * ^assign tk.msglist $substword($match($0 $tk.msglist) $1 $tk.msglist) # the /msg alias - so we can have channels and /me's all in one :) alias msg { ^tk.addmsg $0 $tk.msglist if ([$0]==[#wall]){ wallops $1- }{ if ([$1]==[${K}me]){ describe $0 $2- }{ ${K}${K}msg $0- } } } # delete No such nick/channel's on #-401 55 * ^assign tk.msglist $notword($rmatch($1 $tk.msglist) $tk.msglist) #------------------------------------------------------------------------------# # The $notword, $words and $substword function are fairly common # and might already be defined. You may then safely omit them here. #------------------------------------------------------------------------------# # The $notword(index string) function. alias notword { if ([$0] > 0) { if (([$0] > 1) && ([$0] < rmatch($~ $1-))) { @ _.nw.sep = [ ] } { @ _.nw.sep = [] } @ function_return = [$(1-${[$0]-1})] ## [$_.nw.sep] ## [$(${[$0]+1}-)] } { @ function_return = [$1-] } } # The $words(index string) function. (index may be a range) alias words ^assign function_return $($0) # The $substword(index word string) function. # (Okay, i admit it's not the nicest one :) alias substword { if ([$0] > 0) { if ([$0] > 1) { @ _.nw.sep = [ ] }{ @ _.nw.sep = [] } if ([$0] < rmatch($~ $2-)){ @ _.nw.sep2 = [ ] }{ @ _.nw.sep2 = [] } @ function_return = [$(2-${[$0]})] ## [$_.nw.sep] ## [$1] ## [$_.nw.sep2] ## [$(${[$0]+2}-)] }{ @ function_return = [$2-] } }