@lordbex/thelounge 4.4.3-blowfish → 4.5.0-blowfish-pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -7
- package/dist/defaults/config.js +31 -2
- package/dist/package.json +94 -91
- package/dist/server/client.js +188 -194
- package/dist/server/clientManager.js +75 -72
- package/dist/server/command-line/index.js +44 -43
- package/dist/server/command-line/install.js +37 -70
- package/dist/server/command-line/outdated.js +12 -17
- package/dist/server/command-line/start.js +25 -26
- package/dist/server/command-line/storage.js +26 -31
- package/dist/server/command-line/uninstall.js +16 -23
- package/dist/server/command-line/upgrade.js +20 -26
- package/dist/server/command-line/users/add.js +33 -40
- package/dist/server/command-line/users/edit.js +18 -24
- package/dist/server/command-line/users/index.js +12 -16
- package/dist/server/command-line/users/list.js +11 -39
- package/dist/server/command-line/users/remove.js +16 -22
- package/dist/server/command-line/users/reset.js +34 -35
- package/dist/server/command-line/utils.js +231 -87
- package/dist/server/config.js +61 -52
- package/dist/server/helper.js +29 -28
- package/dist/server/identification.js +39 -34
- package/dist/server/index.js +1 -3
- package/dist/server/log.js +19 -16
- package/dist/server/models/chan.js +36 -33
- package/dist/server/models/msg.js +15 -19
- package/dist/server/models/network.js +102 -104
- package/dist/server/models/prefix.js +4 -7
- package/dist/server/models/user.js +5 -10
- package/dist/server/path-helper.js +8 -0
- package/dist/server/plugins/auth/ldap.js +177 -112
- package/dist/server/plugins/auth/local.js +10 -15
- package/dist/server/plugins/auth.js +6 -35
- package/dist/server/plugins/changelog.js +30 -27
- package/dist/server/plugins/clientCertificate.js +33 -37
- package/dist/server/plugins/dev-server.js +15 -21
- package/dist/server/plugins/inputs/action.js +9 -14
- package/dist/server/plugins/inputs/away.js +1 -3
- package/dist/server/plugins/inputs/ban.js +9 -14
- package/dist/server/plugins/inputs/blow.js +9 -14
- package/dist/server/plugins/inputs/connect.js +5 -10
- package/dist/server/plugins/inputs/ctcp.js +7 -12
- package/dist/server/plugins/inputs/disconnect.js +1 -3
- package/dist/server/plugins/inputs/ignore.js +23 -29
- package/dist/server/plugins/inputs/ignorelist.js +12 -18
- package/dist/server/plugins/inputs/index.js +8 -34
- package/dist/server/plugins/inputs/invite.js +7 -12
- package/dist/server/plugins/inputs/kick.js +7 -12
- package/dist/server/plugins/inputs/kill.js +1 -3
- package/dist/server/plugins/inputs/list.js +1 -3
- package/dist/server/plugins/inputs/mode.js +10 -15
- package/dist/server/plugins/inputs/msg.js +13 -18
- package/dist/server/plugins/inputs/mute.js +9 -15
- package/dist/server/plugins/inputs/nick.js +9 -14
- package/dist/server/plugins/inputs/notice.js +5 -7
- package/dist/server/plugins/inputs/part.js +11 -16
- package/dist/server/plugins/inputs/quit.js +7 -13
- package/dist/server/plugins/inputs/rainbow.js +55 -0
- package/dist/server/plugins/inputs/raw.js +1 -3
- package/dist/server/plugins/inputs/rejoin.js +7 -12
- package/dist/server/plugins/inputs/topic.js +7 -12
- package/dist/server/plugins/inputs/whois.js +1 -3
- package/dist/server/plugins/irc-events/away.js +14 -20
- package/dist/server/plugins/irc-events/cap.js +16 -22
- package/dist/server/plugins/irc-events/chghost.js +14 -13
- package/dist/server/plugins/irc-events/connection.js +61 -63
- package/dist/server/plugins/irc-events/ctcp.js +22 -28
- package/dist/server/plugins/irc-events/error.js +20 -26
- package/dist/server/plugins/irc-events/help.js +7 -13
- package/dist/server/plugins/irc-events/info.js +7 -13
- package/dist/server/plugins/irc-events/invite.js +7 -13
- package/dist/server/plugins/irc-events/join.js +30 -27
- package/dist/server/plugins/irc-events/kick.js +21 -17
- package/dist/server/plugins/irc-events/link.js +122 -109
- package/dist/server/plugins/irc-events/list.js +23 -26
- package/dist/server/plugins/irc-events/message.js +46 -52
- package/dist/server/plugins/irc-events/mode.js +66 -63
- package/dist/server/plugins/irc-events/modelist.js +29 -35
- package/dist/server/plugins/irc-events/motd.js +10 -16
- package/dist/server/plugins/irc-events/names.js +3 -6
- package/dist/server/plugins/irc-events/nick.js +26 -23
- package/dist/server/plugins/irc-events/part.js +19 -15
- package/dist/server/plugins/irc-events/quit.js +17 -14
- package/dist/server/plugins/irc-events/sasl.js +9 -15
- package/dist/server/plugins/irc-events/spgroups.js +38 -0
- package/dist/server/plugins/irc-events/spjoin.js +52 -0
- package/dist/server/plugins/irc-events/topic.js +12 -18
- package/dist/server/plugins/irc-events/unhandled.js +12 -12
- package/dist/server/plugins/irc-events/welcome.js +7 -13
- package/dist/server/plugins/irc-events/whois.js +20 -24
- package/dist/server/plugins/massEventAggregator.js +214 -0
- package/dist/server/plugins/messageStorage/sqlite.js +322 -141
- package/dist/server/plugins/messageStorage/text.js +21 -26
- package/dist/server/plugins/packages/index.js +105 -74
- package/dist/server/plugins/packages/publicClient.js +7 -16
- package/dist/server/plugins/packages/themes.js +11 -16
- package/dist/server/plugins/storage.js +28 -33
- package/dist/server/plugins/sts.js +12 -17
- package/dist/server/plugins/uploader.js +40 -43
- package/dist/server/plugins/webpush.js +23 -51
- package/dist/server/server.js +318 -271
- package/dist/server/storageCleaner.js +29 -37
- package/dist/server/utils/fish.js +349 -389
- package/dist/shared/irc.js +3 -6
- package/dist/shared/linkify.js +7 -14
- package/dist/shared/types/chan.js +6 -9
- package/dist/shared/types/changelog.js +1 -2
- package/dist/shared/types/config.js +1 -2
- package/dist/shared/types/mention.js +1 -2
- package/dist/shared/types/msg.js +3 -5
- package/dist/shared/types/network.js +1 -2
- package/dist/shared/types/storage.js +1 -2
- package/dist/shared/types/user.js +1 -2
- package/index.js +14 -10
- package/package.json +94 -91
- package/public/css/style.css +9 -6
- package/public/css/style.css.map +1 -1
- package/public/fonts/font-awesome/fa-brands-400.ttf +0 -0
- package/public/fonts/font-awesome/fa-brands-400.woff2 +0 -0
- package/public/fonts/font-awesome/fa-duotone-900.ttf +0 -0
- package/public/fonts/font-awesome/fa-duotone-900.woff2 +0 -0
- package/public/fonts/font-awesome/fa-light-300.ttf +0 -0
- package/public/fonts/font-awesome/fa-light-300.woff2 +0 -0
- package/public/fonts/font-awesome/fa-regular-400.ttf +0 -0
- package/public/fonts/font-awesome/fa-regular-400.woff2 +0 -0
- package/public/fonts/font-awesome/fa-solid-900.ttf +0 -0
- package/public/fonts/font-awesome/fa-solid-900.woff2 +0 -0
- package/public/fonts/font-awesome/fa-thin-100.ttf +0 -0
- package/public/fonts/font-awesome/fa-thin-100.woff2 +0 -0
- package/public/fonts/font-awesome/fa-v4compatibility.ttf +0 -0
- package/public/fonts/font-awesome/fa-v4compatibility.woff2 +0 -0
- package/public/js/bundle.js +1 -1
- package/public/js/bundle.js.map +1 -1
- package/public/js/bundle.vendor.js +1 -1
- package/public/js/bundle.vendor.js.LICENSE.txt +24 -6
- package/public/js/bundle.vendor.js.map +1 -1
- package/public/js/loading-error-handlers.js +1 -1
- package/public/service-worker.js +1 -1
- package/public/themes/default.css +1 -1
- package/public/themes/morning.css +1 -1
- package/dist/webpack.config.js +0 -224
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const irc_1 = require("../../../shared/irc");
|
|
9
|
-
const helper_1 = __importDefault(require("../../helper"));
|
|
10
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
11
|
-
const chan_1 = require("../../../shared/types/chan");
|
|
12
|
-
const fish_1 = require("../../utils/fish");
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import LinkPrefetch from "./link.js";
|
|
3
|
+
import { cleanIrcMessage } from "../../../shared/irc.js";
|
|
4
|
+
import Helper from "../../helper.js";
|
|
5
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
6
|
+
import { ChanType } from "../../../shared/types/chan.js";
|
|
7
|
+
import { tryDecryptFishLine } from "../../utils/fish";
|
|
13
8
|
const nickRegExp = /(?:\x03[0-9]{1,2}(?:,[0-9]{1,2})?)?([\w[\]\\`^{|}-]+)/g;
|
|
14
9
|
function convertForHandle(type, data) {
|
|
15
10
|
return { ...data, type: type };
|
|
16
11
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
handleMessage(convertForHandle(msg_2.MessageType.NOTICE, data));
|
|
12
|
+
export default (function (irc, network) {
|
|
13
|
+
irc.on("notice", (data) => {
|
|
14
|
+
handleMessage.call(this, convertForHandle(MessageType.NOTICE, data));
|
|
21
15
|
});
|
|
22
|
-
irc.on("action",
|
|
23
|
-
handleMessage(convertForHandle(
|
|
16
|
+
irc.on("action", (data) => {
|
|
17
|
+
handleMessage.call(this, convertForHandle(MessageType.ACTION, data));
|
|
24
18
|
});
|
|
25
|
-
irc.on("privmsg",
|
|
26
|
-
handleMessage(convertForHandle(
|
|
19
|
+
irc.on("privmsg", (data) => {
|
|
20
|
+
handleMessage.call(this, convertForHandle(MessageType.MESSAGE, data));
|
|
27
21
|
});
|
|
28
|
-
irc.on("wallops",
|
|
22
|
+
irc.on("wallops", (data) => {
|
|
29
23
|
data.from_server = true;
|
|
30
|
-
handleMessage(convertForHandle(
|
|
24
|
+
handleMessage.call(this, convertForHandle(MessageType.WALLOPS, data));
|
|
31
25
|
});
|
|
32
26
|
function handleMessage(data) {
|
|
33
27
|
let chan;
|
|
@@ -43,13 +37,13 @@ exports.default = (function (irc, network) {
|
|
|
43
37
|
// Check if the sender is in our ignore list
|
|
44
38
|
const shouldIgnore = !self &&
|
|
45
39
|
network.ignoreList.some(function (entry) {
|
|
46
|
-
return
|
|
40
|
+
return Helper.compareHostmask(entry, data);
|
|
47
41
|
});
|
|
48
42
|
// Server messages that aren't targeted at a channel go to the server window
|
|
49
43
|
if (data.from_server &&
|
|
50
44
|
(!data.target ||
|
|
51
45
|
!network.getChannel(data.target) ||
|
|
52
|
-
network.getChannel(data.target)?.type !==
|
|
46
|
+
network.getChannel(data.target)?.type !== ChanType.CHANNEL)) {
|
|
53
47
|
chan = network.getLobby();
|
|
54
48
|
from = chan.getUser(data.nick);
|
|
55
49
|
}
|
|
@@ -65,43 +59,43 @@ exports.default = (function (irc, network) {
|
|
|
65
59
|
chan = network.getChannel(target);
|
|
66
60
|
if (typeof chan === "undefined") {
|
|
67
61
|
// Send notices that are not targeted at us into the server window
|
|
68
|
-
if (data.type ===
|
|
62
|
+
if (data.type === MessageType.NOTICE) {
|
|
69
63
|
showInActive = true;
|
|
70
64
|
chan = network.getLobby();
|
|
71
65
|
}
|
|
72
66
|
else {
|
|
73
|
-
chan =
|
|
74
|
-
type:
|
|
67
|
+
chan = this.createChannel({
|
|
68
|
+
type: ChanType.QUERY,
|
|
75
69
|
name: target,
|
|
76
70
|
});
|
|
77
|
-
|
|
71
|
+
this.emit("join", {
|
|
78
72
|
network: network.uuid,
|
|
79
73
|
chan: chan.getFilteredClone(true),
|
|
80
74
|
shouldOpen: false,
|
|
81
75
|
index: network.addChannel(chan),
|
|
82
76
|
});
|
|
83
|
-
|
|
84
|
-
chan.loadMessages(
|
|
77
|
+
this.save();
|
|
78
|
+
chan.loadMessages(this, network);
|
|
85
79
|
}
|
|
86
80
|
}
|
|
87
81
|
from = chan.getUser(data.nick);
|
|
88
82
|
// Attempt mIRC FiSH Blowfish decryption if applicable
|
|
89
83
|
if (chan.blowfishKey) {
|
|
90
|
-
const decrypted =
|
|
84
|
+
const decrypted = tryDecryptFishLine(data.message, chan.blowfishKey);
|
|
91
85
|
if (decrypted !== null) {
|
|
92
86
|
data.message = decrypted;
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
// Query messages (unless self or muted) always highlight
|
|
96
|
-
if (chan.type ===
|
|
90
|
+
if (chan.type === ChanType.QUERY) {
|
|
97
91
|
highlight = !self;
|
|
98
92
|
}
|
|
99
|
-
else if (chan.type ===
|
|
93
|
+
else if (chan.type === ChanType.CHANNEL) {
|
|
100
94
|
from.lastMessage = data.time || Date.now();
|
|
101
95
|
}
|
|
102
96
|
}
|
|
103
97
|
// msg is constructed down here because `from` is being copied in the constructor
|
|
104
|
-
const msg = new
|
|
98
|
+
const msg = new Msg({
|
|
105
99
|
type: data.type,
|
|
106
100
|
time: data.time ? new Date(data.time) : undefined,
|
|
107
101
|
text: data.message,
|
|
@@ -114,19 +108,19 @@ exports.default = (function (irc, network) {
|
|
|
114
108
|
msg.showInActive = true;
|
|
115
109
|
}
|
|
116
110
|
// remove IRC formatting for custom highlight testing
|
|
117
|
-
const cleanMessage =
|
|
111
|
+
const cleanMessage = cleanIrcMessage(data.message);
|
|
118
112
|
// Self messages in channels are never highlighted
|
|
119
113
|
// Non-self messages are highlighted as soon as the nick is detected
|
|
120
114
|
if (!msg.highlight && !msg.self) {
|
|
121
115
|
msg.highlight = network.highlightRegex?.test(data.message);
|
|
122
116
|
// If we still don't have a highlight, test against custom highlights if there's any
|
|
123
|
-
if (!msg.highlight &&
|
|
124
|
-
msg.highlight =
|
|
117
|
+
if (!msg.highlight && this.highlightRegex) {
|
|
118
|
+
msg.highlight = this.highlightRegex.test(cleanMessage);
|
|
125
119
|
}
|
|
126
120
|
}
|
|
127
121
|
// if highlight exceptions match, do not highlight at all
|
|
128
|
-
if (msg.highlight &&
|
|
129
|
-
msg.highlight = !
|
|
122
|
+
if (msg.highlight && this.highlightExceptionRegex) {
|
|
123
|
+
msg.highlight = !this.highlightExceptionRegex.test(cleanMessage);
|
|
130
124
|
}
|
|
131
125
|
if (data.group) {
|
|
132
126
|
msg.statusmsgGroup = data.group;
|
|
@@ -138,30 +132,30 @@ exports.default = (function (irc, network) {
|
|
|
138
132
|
}
|
|
139
133
|
}
|
|
140
134
|
// No prefetch URLs unless are simple MESSAGE or ACTION types
|
|
141
|
-
if ([
|
|
142
|
-
(
|
|
135
|
+
if ([MessageType.MESSAGE, MessageType.ACTION].includes(data.type)) {
|
|
136
|
+
LinkPrefetch(this, chan, msg, cleanMessage);
|
|
143
137
|
}
|
|
144
|
-
chan.pushMessage(
|
|
138
|
+
chan.pushMessage(this, msg, !msg.self);
|
|
145
139
|
// Do not send notifications if the channel is muted or for messages older than 15 minutes (znc buffer for example)
|
|
146
140
|
if (!chan.muted && msg.highlight && (!data.time || data.time > Date.now() - 900000)) {
|
|
147
141
|
let title = chan.name;
|
|
148
142
|
let body = cleanMessage;
|
|
149
|
-
if (msg.type ===
|
|
143
|
+
if (msg.type === MessageType.ACTION) {
|
|
150
144
|
// For actions, do not include colon in the message
|
|
151
145
|
body = `${data.nick} ${body}`;
|
|
152
146
|
}
|
|
153
|
-
else if (chan.type !==
|
|
147
|
+
else if (chan.type !== ChanType.QUERY) {
|
|
154
148
|
// In channels, prepend sender nickname to the message
|
|
155
149
|
body = `${data.nick}: ${body}`;
|
|
156
150
|
}
|
|
157
|
-
// If a channel is active on any
|
|
151
|
+
// If a channel is active on any this, highlight won't increment and notification will say (0 mention)
|
|
158
152
|
if (chan.highlight > 0) {
|
|
159
|
-
title += ` (${chan.highlight} ${chan.type ===
|
|
153
|
+
title += ` (${chan.highlight} ${chan.type === ChanType.QUERY ? "new message" : "mention"}${chan.highlight > 1 ? "s" : ""})`;
|
|
160
154
|
}
|
|
161
155
|
if (chan.highlight > 1) {
|
|
162
156
|
body += `\n\n… and ${chan.highlight - 1} other message${chan.highlight > 2 ? "s" : ""}`;
|
|
163
157
|
}
|
|
164
|
-
|
|
158
|
+
this.manager.webPush.push(this, {
|
|
165
159
|
type: "notification",
|
|
166
160
|
chanId: chan.id,
|
|
167
161
|
timestamp: data.time || Date.now(),
|
|
@@ -169,9 +163,9 @@ exports.default = (function (irc, network) {
|
|
|
169
163
|
body: body,
|
|
170
164
|
}, true);
|
|
171
165
|
}
|
|
172
|
-
// Keep track of all mentions in channels for this
|
|
173
|
-
if (msg.highlight && chan.type ===
|
|
174
|
-
|
|
166
|
+
// Keep track of all mentions in channels for this this
|
|
167
|
+
if (msg.highlight && chan.type === ChanType.CHANNEL) {
|
|
168
|
+
this.mentions.push({
|
|
175
169
|
chanId: chan.id,
|
|
176
170
|
msgId: msg.id,
|
|
177
171
|
type: msg.type,
|
|
@@ -179,8 +173,8 @@ exports.default = (function (irc, network) {
|
|
|
179
173
|
text: msg.text,
|
|
180
174
|
from: msg.from,
|
|
181
175
|
});
|
|
182
|
-
if (
|
|
183
|
-
|
|
176
|
+
if (this.mentions.length > 100) {
|
|
177
|
+
this.mentions.splice(0, this.mentions.length - 100);
|
|
184
178
|
}
|
|
185
179
|
}
|
|
186
180
|
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
8
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
9
|
-
exports.default = (function (irc, network) {
|
|
10
|
-
const client = this;
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import Msg from "../../models/msg.js";
|
|
3
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
4
|
+
export default (function (irc, network) {
|
|
11
5
|
// The following saves the channel key based on channel mode instead of
|
|
12
6
|
// extracting it from `/join #channel key`. This lets us not have to
|
|
13
7
|
// temporarily store the key until successful join, but also saves the key
|
|
14
8
|
// if a key is set or changed while being on the channel.
|
|
15
|
-
irc.on("channel info",
|
|
9
|
+
irc.on("channel info", (data) => {
|
|
16
10
|
if (!data.modes) {
|
|
17
11
|
return;
|
|
18
12
|
}
|
|
@@ -26,26 +20,26 @@ exports.default = (function (irc, network) {
|
|
|
26
20
|
const char = text[1];
|
|
27
21
|
if (char === "k") {
|
|
28
22
|
targetChan.key = add ? mode.param : "";
|
|
29
|
-
|
|
23
|
+
this.save();
|
|
30
24
|
}
|
|
31
25
|
});
|
|
32
|
-
const msg = new
|
|
33
|
-
type:
|
|
26
|
+
const msg = new Msg({
|
|
27
|
+
type: MessageType.MODE_CHANNEL,
|
|
34
28
|
text: `${data.raw_modes} ${data.raw_params.join(" ")}`,
|
|
35
29
|
});
|
|
36
|
-
targetChan.pushMessage(
|
|
30
|
+
targetChan.pushMessage(this, msg);
|
|
37
31
|
});
|
|
38
|
-
irc.on("user info",
|
|
32
|
+
irc.on("user info", (data) => {
|
|
39
33
|
const serverChan = network.getLobby();
|
|
40
|
-
const msg = new
|
|
41
|
-
type:
|
|
34
|
+
const msg = new Msg({
|
|
35
|
+
type: MessageType.MODE_USER,
|
|
42
36
|
raw_modes: data.raw_modes,
|
|
43
37
|
self: false,
|
|
44
38
|
showInActive: true,
|
|
45
39
|
});
|
|
46
|
-
serverChan.pushMessage(
|
|
40
|
+
serverChan.pushMessage(this, msg);
|
|
47
41
|
});
|
|
48
|
-
irc.on("mode",
|
|
42
|
+
irc.on("mode", (data) => {
|
|
49
43
|
let targetChan;
|
|
50
44
|
if (data.target === irc.user.nick) {
|
|
51
45
|
targetChan = network.getLobby();
|
|
@@ -56,9 +50,9 @@ exports.default = (function (irc, network) {
|
|
|
56
50
|
return;
|
|
57
51
|
}
|
|
58
52
|
}
|
|
59
|
-
const msg = new
|
|
53
|
+
const msg = new Msg({
|
|
60
54
|
time: data.time,
|
|
61
|
-
type:
|
|
55
|
+
type: MessageType.MODE,
|
|
62
56
|
from: targetChan.getUser(data.nick),
|
|
63
57
|
text: `${data.raw_modes} ${data.raw_params.join(" ")}`,
|
|
64
58
|
self: data.nick === irc.user.nick,
|
|
@@ -72,53 +66,62 @@ exports.default = (function (irc, network) {
|
|
|
72
66
|
if (users.length > 0) {
|
|
73
67
|
msg.users = users;
|
|
74
68
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
69
|
+
// Mode update logic - needs to run regardless of buffering
|
|
70
|
+
const updateModes = () => {
|
|
71
|
+
let usersUpdated = false;
|
|
72
|
+
const userModeSortPriority = {};
|
|
73
|
+
const supportsMultiPrefix = network.irc.network.cap.isEnabled("multi-prefix");
|
|
74
|
+
irc.network.options.PREFIX.forEach((prefix, index) => {
|
|
75
|
+
userModeSortPriority[prefix.symbol] = index;
|
|
76
|
+
});
|
|
77
|
+
data.modes.forEach((mode) => {
|
|
78
|
+
const add = mode.mode[0] === "+";
|
|
79
|
+
const char = mode.mode[1];
|
|
80
|
+
if (char === "k") {
|
|
81
|
+
targetChan.key = add ? mode.param : "";
|
|
82
|
+
this.save();
|
|
83
|
+
}
|
|
84
|
+
if (!mode.param) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const user = targetChan.findUser(mode.param);
|
|
88
|
+
if (!user) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
usersUpdated = true;
|
|
92
|
+
if (!supportsMultiPrefix) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const changedMode = network.serverOptions.PREFIX.modeToSymbol[char];
|
|
96
|
+
if (!add) {
|
|
97
|
+
_.pull(user.modes, changedMode);
|
|
98
|
+
}
|
|
99
|
+
else if (!user.modes.includes(changedMode)) {
|
|
100
|
+
user.modes.push(changedMode);
|
|
101
|
+
user.modes.sort(function (a, b) {
|
|
102
|
+
return userModeSortPriority[a] - userModeSortPriority[b];
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
if (!usersUpdated) {
|
|
94
107
|
return;
|
|
95
108
|
}
|
|
96
|
-
usersUpdated = true;
|
|
97
109
|
if (!supportsMultiPrefix) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const changedMode = network.serverOptions.PREFIX.modeToSymbol[char];
|
|
101
|
-
if (!add) {
|
|
102
|
-
lodash_1.default.pull(user.modes, changedMode);
|
|
110
|
+
// TODO: This is horrible
|
|
111
|
+
irc.raw("NAMES", data.target);
|
|
103
112
|
}
|
|
104
|
-
else
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return userModeSortPriority[a] - userModeSortPriority[b];
|
|
113
|
+
else {
|
|
114
|
+
this.emit("users", {
|
|
115
|
+
chan: targetChan.id,
|
|
108
116
|
});
|
|
109
117
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
client.emit("users", {
|
|
120
|
-
chan: targetChan.id,
|
|
121
|
-
});
|
|
118
|
+
};
|
|
119
|
+
// Try to process through mass event aggregator
|
|
120
|
+
const wasBuffered = this.massEventAggregator.processMessage(network, targetChan, msg, updateModes);
|
|
121
|
+
if (!wasBuffered) {
|
|
122
|
+
// Not in mass event mode - process normally
|
|
123
|
+
targetChan.pushMessage(this, msg);
|
|
124
|
+
updateModes();
|
|
122
125
|
}
|
|
123
126
|
});
|
|
124
127
|
});
|
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
8
|
-
const chan_1 = require("../../../shared/types/chan");
|
|
9
|
-
exports.default = (function (irc, network) {
|
|
10
|
-
const client = this;
|
|
11
|
-
irc.on("banlist", (list) => {
|
|
12
|
-
const data = list.bans.map((ban) => ({
|
|
13
|
-
hostmask: ban.banned,
|
|
14
|
-
banned_by: ban.banned_by,
|
|
15
|
-
banned_at: ban.banned_at * 1000,
|
|
16
|
-
}));
|
|
17
|
-
handleList(chan_1.SpecialChanType.BANLIST, "Ban list", list.channel, data);
|
|
18
|
-
});
|
|
19
|
-
irc.on("inviteList", (list) => {
|
|
20
|
-
const data = list.invites.map((invite) => ({
|
|
21
|
-
hostmask: invite.invited,
|
|
22
|
-
invited_by: invite.invited_by,
|
|
23
|
-
invited_at: invite.invited_at * 1000,
|
|
24
|
-
}));
|
|
25
|
-
handleList(chan_1.SpecialChanType.INVITELIST, "Invite list", list.channel, data);
|
|
26
|
-
});
|
|
27
|
-
function handleList(type, name, channel, data) {
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
3
|
+
import { SpecialChanType, ChanType } from "../../../shared/types/chan.js";
|
|
4
|
+
export default (function (irc, network) {
|
|
5
|
+
const handleList = (type, name, channel, data) => {
|
|
28
6
|
if (data.length === 0) {
|
|
29
|
-
const msg = new
|
|
7
|
+
const msg = new Msg({
|
|
30
8
|
time: new Date(),
|
|
31
|
-
type:
|
|
9
|
+
type: MessageType.ERROR,
|
|
32
10
|
text: `${name} is empty`,
|
|
33
11
|
});
|
|
34
12
|
let chan = network.getChannel(channel);
|
|
@@ -37,19 +15,19 @@ exports.default = (function (irc, network) {
|
|
|
37
15
|
msg.showInActive = true;
|
|
38
16
|
chan = network.getLobby();
|
|
39
17
|
}
|
|
40
|
-
chan.pushMessage(
|
|
18
|
+
chan.pushMessage(this, msg, true);
|
|
41
19
|
return;
|
|
42
20
|
}
|
|
43
21
|
const chanName = `${name} for ${channel}`;
|
|
44
22
|
let chan = network.getChannel(chanName);
|
|
45
23
|
if (typeof chan === "undefined") {
|
|
46
|
-
chan =
|
|
47
|
-
type:
|
|
24
|
+
chan = this.createChannel({
|
|
25
|
+
type: ChanType.SPECIAL,
|
|
48
26
|
special: type,
|
|
49
27
|
name: chanName,
|
|
50
28
|
data: data,
|
|
51
29
|
});
|
|
52
|
-
|
|
30
|
+
this.emit("join", {
|
|
53
31
|
network: network.uuid,
|
|
54
32
|
chan: chan.getFilteredClone(true),
|
|
55
33
|
shouldOpen: false,
|
|
@@ -58,10 +36,26 @@ exports.default = (function (irc, network) {
|
|
|
58
36
|
}
|
|
59
37
|
else {
|
|
60
38
|
chan.data = data;
|
|
61
|
-
|
|
39
|
+
this.emit("msg:special", {
|
|
62
40
|
chan: chan.id,
|
|
63
41
|
data: data,
|
|
64
42
|
});
|
|
65
43
|
}
|
|
66
|
-
}
|
|
44
|
+
};
|
|
45
|
+
irc.on("banlist", (list) => {
|
|
46
|
+
const data = list.bans.map((ban) => ({
|
|
47
|
+
hostmask: ban.banned,
|
|
48
|
+
banned_by: ban.banned_by,
|
|
49
|
+
banned_at: ban.banned_at * 1000,
|
|
50
|
+
}));
|
|
51
|
+
handleList(SpecialChanType.BANLIST, "Ban list", list.channel, data);
|
|
52
|
+
});
|
|
53
|
+
irc.on("inviteList", (list) => {
|
|
54
|
+
const data = list.invites.map((invite) => ({
|
|
55
|
+
hostmask: invite.invited,
|
|
56
|
+
invited_by: invite.invited_by,
|
|
57
|
+
invited_at: invite.invited_at * 1000,
|
|
58
|
+
}));
|
|
59
|
+
handleList(SpecialChanType.INVITELIST, "Invite list", list.channel, data);
|
|
60
|
+
});
|
|
67
61
|
});
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
8
|
-
exports.default = (function (irc, network) {
|
|
9
|
-
const client = this;
|
|
10
|
-
irc.on("motd", function (data) {
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
3
|
+
export default (function (irc, network) {
|
|
4
|
+
irc.on("motd", (data) => {
|
|
11
5
|
const lobby = network.getLobby();
|
|
12
6
|
if (data.motd) {
|
|
13
|
-
const msg = new
|
|
14
|
-
type:
|
|
7
|
+
const msg = new Msg({
|
|
8
|
+
type: MessageType.MONOSPACE_BLOCK,
|
|
15
9
|
command: "motd",
|
|
16
10
|
text: data.motd,
|
|
17
11
|
});
|
|
18
|
-
lobby.pushMessage(
|
|
12
|
+
lobby.pushMessage(this, msg);
|
|
19
13
|
}
|
|
20
14
|
if (data.error) {
|
|
21
|
-
const msg = new
|
|
22
|
-
type:
|
|
15
|
+
const msg = new Msg({
|
|
16
|
+
type: MessageType.MONOSPACE_BLOCK,
|
|
23
17
|
command: "motd",
|
|
24
18
|
text: data.error,
|
|
25
19
|
});
|
|
26
|
-
lobby.pushMessage(
|
|
20
|
+
lobby.pushMessage(this, msg);
|
|
27
21
|
}
|
|
28
22
|
});
|
|
29
23
|
});
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.default = (function (irc, network) {
|
|
4
|
-
const client = this;
|
|
5
|
-
irc.on("userlist", function (data) {
|
|
1
|
+
export default (function (irc, network) {
|
|
2
|
+
irc.on("userlist", (data) => {
|
|
6
3
|
const chan = network.getChannel(data.channel);
|
|
7
4
|
if (typeof chan === "undefined") {
|
|
8
5
|
return;
|
|
@@ -14,7 +11,7 @@ exports.default = (function (irc, network) {
|
|
|
14
11
|
newUsers.set(user.nick.toLowerCase(), newUser);
|
|
15
12
|
});
|
|
16
13
|
chan.users = newUsers;
|
|
17
|
-
|
|
14
|
+
this.emit("users", {
|
|
18
15
|
chan: chan.id,
|
|
19
16
|
});
|
|
20
17
|
});
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
8
|
-
exports.default = (function (irc, network) {
|
|
9
|
-
const client = this;
|
|
10
|
-
irc.on("nick", function (data) {
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
3
|
+
export default (function (irc, network) {
|
|
4
|
+
irc.on("nick", (data) => {
|
|
11
5
|
const self = data.nick === irc.user.nick;
|
|
12
6
|
if (self) {
|
|
13
7
|
network.setNick(data.new_nick);
|
|
14
8
|
const lobby = network.getLobby();
|
|
15
|
-
const msg = new
|
|
9
|
+
const msg = new Msg({
|
|
16
10
|
text: `You're now known as ${data.new_nick}`,
|
|
17
11
|
});
|
|
18
|
-
lobby.pushMessage(
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
lobby.pushMessage(this, msg, true);
|
|
13
|
+
this.save();
|
|
14
|
+
this.emit("nick", {
|
|
21
15
|
network: network.uuid,
|
|
22
16
|
nick: data.new_nick,
|
|
23
17
|
});
|
|
@@ -27,19 +21,28 @@ exports.default = (function (irc, network) {
|
|
|
27
21
|
if (typeof user === "undefined") {
|
|
28
22
|
return;
|
|
29
23
|
}
|
|
30
|
-
const msg = new
|
|
24
|
+
const msg = new Msg({
|
|
31
25
|
time: data.time,
|
|
32
26
|
from: user,
|
|
33
|
-
type:
|
|
27
|
+
type: MessageType.NICK,
|
|
34
28
|
new_nick: data.new_nick,
|
|
35
29
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
// User list update callback - executed regardless of buffering
|
|
31
|
+
const updateUserList = () => {
|
|
32
|
+
chan.removeUser(user);
|
|
33
|
+
user.nick = data.new_nick;
|
|
34
|
+
chan.setUser(user);
|
|
35
|
+
this.emit("users", {
|
|
36
|
+
chan: chan.id,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
// Try to process through mass event aggregator
|
|
40
|
+
const wasBuffered = this.massEventAggregator.processMessage(network, chan, msg, updateUserList);
|
|
41
|
+
if (!wasBuffered) {
|
|
42
|
+
// Not in mass event mode - process normally
|
|
43
|
+
chan.pushMessage(this, msg);
|
|
44
|
+
updateUserList();
|
|
45
|
+
}
|
|
43
46
|
});
|
|
44
47
|
});
|
|
45
48
|
});
|