File: tabkey

package info (click to toggle)
ircii 4.4-3
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 4,256 kB
  • ctags: 2,797
  • sloc: ansic: 36,743; sh: 907; makefile: 483; lex: 16
file content (96 lines) | stat: -rw-r--r-- 3,450 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# @(#) $Id: tabkey,v 1.3 1997/01/17 19:15:43 mrg Exp $
#------------------------------------------------------------------------------#
# updated for 2.2.2
# This keeps track of the nicks of people you MSG.  You can then
# just hit the tab key ^I to flip through the list of people
# you sent MSGs to.  
# Assign tk.msgmax to the number of nicknames you wish to store
# Modified by Chetnik (s902211@yallara.cs.rmit.oz.au)
#         and Daemon  (frechett@spot.colorado.edu)
# It will now keep unique nicknames in the list ordered from the most recent
# message received or sent to the oldest message received or sent.
# Ctrl R will flip thru the list backwards (Reverse).
# Crtl-X Ctrl-X deletes the currently displayed or current nick from the list.
# /addnick <nickname list>	will add the nicknames to the list.
# /nicklist 			will show the current list of names
# If a nickname which has 'never' existed is messaged, it will not be added to
# the list.

# 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
# Delete current nickname or currently displayed nickname from list
bind ^X^X parse_command tk.delnick
# shows all the current nicknames in the list.
alias nicklist echo *** Nickname List: $tk.msglist
# Adds nicknames to the list.. 
alias addnick if ([$1]) { 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 = 10

# From here down are internal aliases and 'ON's.
# This script uses SERIAL NUMBER  #55
# 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}-)]
	}
	#else
	{	@ 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]
	type ^U$tk.junk $^\^^{[$($tk.msgcnt)]} 
}
# some initialisation.  You can comment these out if you want to.
# ^on #-401 55 * if ([$AUTO_WHOWAS] != [ON]) { ^whowas $1 }
# ^on ^406 * {
#	^assign tk.msglist $notword($rmatch($1 $tk.msglist) $tk.msglist)
#	if ([$AUTO_WHOWAS] == [ON]) { echo *** $1- }
#}
	

# Adds nick to list when message is sent or received. Doesn't effect output.
on #-send_msg 55 * ^tk.addmsg $0 $tk.msglist
on #-msg 55 * ^tk.addmsg $0 $tk.msglist
on #-send_dcc_chat 55 * ^tk.addmsg \=$0 $tk.msglist
on #-dcc_chat 55 * ^tk.addmsg \=$0 $tk.msglist
on #-send_talk 55 * ^tk.addmsg \@$0 $tk.msglist
on #-talk 55 * ^tk.addmsg \@$0 $tk.msglist

# deletes current nick from list
alias tk.delnick {
	if (tk.msgcnt == 0)
	{
		echo *** Nickname: $word(0 $tk.msglist) removed.
		@ tk.msglist = [$notword(1 $tk.msglist)]
	}
	{
		echo *** Nickname: $word(${tk.msgcnt-1} $tk.msglist) removed.
		@ tk.msglist = [$notword($tk.msgcnt $tk.msglist)]
	}
	type ^U
}
# The $notword() 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-]
    }
}
#------------------------------------------------------------------------------#