File: newnick

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 (66 lines) | stat: -rw-r--r-- 1,943 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
if (word(2 $loadinfo()) != [pf]) {
	load -pf $word(1 $loadinfo());
	return;
};

#	Copyright (c) 2005 EPIC Software Labs
#	Written by BlackJac@EFNet
#
#	Version: 1.0.2005.05.16.1
#
#	This script simulates the automatic nickname-mangling feature of epic4 for
#	epic5.
#
#	Settings:
#		set auto_new_nick [on|off|toggle]
#			Enables or disables automatic nickname-mangling. If this is
#			on and your current nickname is already in use, it will at-
#			tempt to use the nicknames listed in auto_new_nick_list (if
#			specified) first, then try to append auto_new_nick_char to
#			the nickname, and finally try to "mangle" your nickname by
#			moving the last character to the front.
#		set auto_new_nick_char [<character>]
#			Character to append to your current nickname if it is al-
#			ready in use and you are either not using auto_new_nick_list
#			or you are already at the end of the list.
#		set auto_new_nick_length [<positive integer>]
#			Maximum nickname length assumed for the network you are on.
#		set auto_new_nick_list [<string>]
#			List of nicknames to try (in order) if your current nickname
#			is already in use. Leave a space between each nickname.

package newnick;
load addset;

alias newnick.mangle (nick, void) {
	@ :length = getset(auto_new_nick_length);
	return ${@nick < length ? nick ## getset(auto_new_nick_char) : right(1 $nick) ## mid(0 ${length - 1} $nick)};
};

^on ^new_nickname "*" {
	if (getset(auto_new_nick) == [on]) {
		if (:nicklist = getset(auto_new_nick_list)) {
			if (!(:nick = word(${findw($2 $nicklist) + 1} $nicklist))) {
				@ :nick = newnick.mangle($2);
			};
		} else {
			@ :nick = newnick.mangle($2);
		};
		xeval -s $0 nick $nick;
	} else {
		input "Nickname: " {
			nick $0;
		};
	};
};

addset auto_new_nick bool;
set auto_new_nick on;

addset auto_new_nick_char char;
set auto_new_nick_char _;

addset auto_new_nick_length int;
set auto_new_nick_length 9;

addset auto_new_nick_list str;