File: suppressmotd

package info (click to toggle)
epic5 2.0.1-1
  • links: PTS
  • area: main
  • in suites: buster, sid, stretch
  • size: 4,696 kB
  • ctags: 6,357
  • sloc: ansic: 69,814; makefile: 715; ruby: 227; sh: 178; perl: 13
file content (45 lines) | stat: -rw-r--r-- 1,199 bytes parent folder | download | duplicates (3)
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
if (word(2 $loadinfo()) != [pf]) { load -pf $word(1 $loadinfo()); return; };

#
# Here's the story.  We want to suppress server-side MOTDs.
# I don't know why anyone would want to do this, but eh, this
# used to be an epic function and i removed it and people noticed
# it so I'm honor bound to script it at the very least.
#
load addset;
addset suppress_server_motd bool;
set suppress_server_motd off;

# # #
@ negser = getserial(HOOK - 0);
@ posser = getserial(HOOK + 0);

# The first time we see the MOTD, trigger the "doing motd" flag.
on #^375 $negser * {
	if (!done_motd[$lastserver()]) {
		^assign doing_motd[$lastserver()] 1;
	};
};
# When we see the end of the first MOTD, trigger the "done motd" flag.
on #^376 $posser * {
	if (doing_motd[$lastserver()]) {
		^assign -doing_motd[$lastserver()];
		^assign done_motd[$lastserver()] 1;
	};
};
# When the connection is closed, reset the flag.
on #^server_lost $posser * {
	^assign -done_motd[$lastserver()];
};

# Only suppress the first MOTD from each server connection.
for i in (372 375 376 377) { 
    on ^$i * { 
	if (getset(suppress_server_motd) == 'ON' && doing_motd[$lastserver()]) {
		return;
	};
	xecho -b $1-;
    };
};

#hop'y2k+3