File: tabkey

package info (click to toggle)
teknap 1.4-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,428 kB
  • ctags: 6,297
  • sloc: ansic: 55,591; makefile: 545; sh: 112
file content (77 lines) | stat: -rw-r--r-- 1,376 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
/*
 * Binds the TAB key to automatically reply to msgs
 *
 * Author: Brian Weiss <brian@got.net> - 2000, 2001
 *
 * NOTE: TekNap has this feature built-in, although it works slightly
 *       differently so you may find you like this better. Keep in mind, that
 *       using this script disables the other built-in functions for the TAB
 *       key.
 */

/* CONFIG SECTION */

assign MAX_MSG_BUFFER_SIZE 10

/* END CONFIG SECTION */


bind ^I parse_command getlastmsg

alias getlastmsg (void)
{
	^local itm,msgcmd,spc
	@ itm = numitems(tabkey) - 1
	@ msgcmd = CMDCHARS ## [msg]
	@ spc = [ ]
	if (numitems(tabkey))
	{
		if (hashish >= 0)
		{
			type ^U^A$msgcmd $getitem(tabkey $hashish)$spc
			@ hashish = hashish - 1
		}{
			type ^U^A$msgcmd $getitem(tabkey $itm)$spc
			@ hashish = itm - 1
		}
	}{
		@ hashish = [-1]
	}
}

on #-msg 421 "*"
{
	if (#getmatches(tabkey $0))
	{
		fe ($getmatches(tabkey $0)) nickitm
		{
			@ delitem(tabkey $nickitm)
		}
	}
	if (numitems(tabkey) == MAX_MSG_BUFFER_SIZE)
	{
		@ delitem(tabkey 0)
	}
	@ setitem(tabkey $numitems(tabkey) $0)
	@ hashish = [-1]
}

on #-send_msg 421 "*"
{
	if (#getmatches(tabkey $0))
	{
		fe ($getmatches(tabkey $0)) nickitm
		{
			@ delitem(tabkey $nickitm)
		}
	}
	if (numitems(tabkey) == MAX_MSG_BUFFER_SIZE)
	{
		@ delitem(tabkey 0)
	}
	@ setitem(tabkey $numitems(tabkey) $0)
	@ hashish = [-1]
}


/* bmw '01 */