File: nickcomp

package info (click to toggle)
epic5 3.0.3-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: ansic: 75,810; makefile: 648; ruby: 227; python: 215; sh: 78; perl: 13
file content (67 lines) | stat: -rw-r--r-- 1,642 bytes parent folder | download | duplicates (5)
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
if (word(2 $loadinfo()) != 'pf') {
	load -pf $word(1 $loadinfo());
	return;
};

#	Copyright (c) 2006 EPIC Software Labs
#	Written by BlackJac@EFNet
#
#	Version: 2.0.2006.06.08.1
#
#	This script will automatically complete a partially matching
#	nickname when you type it in a channel.
#
#	Settings:
#		set nickcomp [on|off|toggle]
#			Turns nick completion on or off.
#		set nickcomp_char [<character>]
#			Use this character to indicate a nick completion
#			should be attempted.
#		set nickcomp_len [<positive integer>]
#			Require at least this many input characters in order
#			to attempt a nick completion.
#		set nickcomp_multi [on|off|toggle]
#			Determines whether a nick completion should return
#			multiple matching nicks in a comma-separated list, or
#			just the first match.

package nickcomp;

load addset;

addset nickcomp bool {
	if (*0 == 'on') {
		alias nickcomp (pattern, void) {
			if (pattern) {
				if (onchannel($pattern $C)) {
					return $pattern($pattern $onchannel($C));
				};
				if (:nicklist = pattern($pattern* $onchannel($C))) {
					return ${getset(nickcomp_multi) == 'on' ? unsplit(, $nicklist) : word(0 $nicklist)};
				};
				return $pattern;
			};
		};
		^on ^input '%$$getset(nickcomp_char) *' {
			@ :nick = before($getset(nickcomp_char) $0);
			sendline ${@nick >= getset(nickcomp_len) ? nickcomp($nick) : nick}$getset(nickcomp_char) $1-;
		};
	} else if (@) {
		alias -nickcomp;
		^on ^input -'%$$getset(nickcomp_char) *';
	};
};

set nickcomp on;

addset nickcomp_char str;

set nickcomp_char :;

addset nickcomp_len int;

set nickcomp_len 3;

addset nickcomp_multi bool;

set nickcomp_multi off;