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
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* This contains an implementation of the multi-prefix IRC extension. This fixes
* a protocol level bug where the following can happen:
* foo MODE +h
* foo MODE +o
* bar JOINs the channel (and receives @foo)
* foo MODE -o
* foo knows that it has mode +h, but bar does not know foo has +h set.
*
* https://docs.inspircd.org/2/modules/namesx/
* https://ircv3.net/specs/extensions/multi-prefix-3.1
*/
import { ircHandlerPriorities } from "resource:///modules/ircHandlerPriorities.sys.mjs";
export var isupportNAMESX = {
name: "ISUPPORT NAMESX",
// Slightly above default ISUPPORT priority.
priority: ircHandlerPriorities.DEFAULT_PRIORITY + 10,
isEnabled: () => true,
commands: {
NAMESX(aMessage) {
this.sendMessage("PROTOCTL", "NAMESX");
return true;
},
},
};
export var capMultiPrefix = {
name: "CAP multi-prefix",
// Slightly above default ISUPPORT priority.
priority: ircHandlerPriorities.HIGH_PRIORITY,
isEnabled: () => true,
commands: {
"multi-prefix": function (aMessage) {
// Request to use multi-prefix if it is supported.
if (
aMessage.cap.subcommand === "LS" ||
aMessage.cap.subcommand === "NEW"
) {
this.addCAP("multi-prefix");
this.sendMessage("CAP", ["REQ", "multi-prefix"]);
} else if (
aMessage.cap.subcommand === "ACK" ||
aMessage.cap.subcommand === "NAK"
) {
this.removeCAP("multi-prefix");
} else {
return false;
}
return true;
},
},
};
|