@lordbex/thelounge 4.4.3-blowfish

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.
Files changed (148) hide show
  1. package/.thelounge_home +1 -0
  2. package/LICENSE +22 -0
  3. package/README.md +95 -0
  4. package/client/index.html.tpl +69 -0
  5. package/dist/defaults/config.js +465 -0
  6. package/dist/package.json +174 -0
  7. package/dist/server/client.js +678 -0
  8. package/dist/server/clientManager.js +220 -0
  9. package/dist/server/command-line/index.js +85 -0
  10. package/dist/server/command-line/install.js +123 -0
  11. package/dist/server/command-line/outdated.js +30 -0
  12. package/dist/server/command-line/start.js +34 -0
  13. package/dist/server/command-line/storage.js +103 -0
  14. package/dist/server/command-line/uninstall.js +40 -0
  15. package/dist/server/command-line/upgrade.js +64 -0
  16. package/dist/server/command-line/users/add.js +67 -0
  17. package/dist/server/command-line/users/edit.js +39 -0
  18. package/dist/server/command-line/users/index.js +17 -0
  19. package/dist/server/command-line/users/list.js +53 -0
  20. package/dist/server/command-line/users/remove.js +37 -0
  21. package/dist/server/command-line/users/reset.js +64 -0
  22. package/dist/server/command-line/utils.js +177 -0
  23. package/dist/server/config.js +138 -0
  24. package/dist/server/helper.js +161 -0
  25. package/dist/server/identification.js +139 -0
  26. package/dist/server/index.js +3 -0
  27. package/dist/server/log.js +35 -0
  28. package/dist/server/models/chan.js +275 -0
  29. package/dist/server/models/msg.js +92 -0
  30. package/dist/server/models/network.js +546 -0
  31. package/dist/server/models/prefix.js +31 -0
  32. package/dist/server/models/user.js +42 -0
  33. package/dist/server/plugins/auth/ldap.js +188 -0
  34. package/dist/server/plugins/auth/local.js +41 -0
  35. package/dist/server/plugins/auth.js +70 -0
  36. package/dist/server/plugins/changelog.js +103 -0
  37. package/dist/server/plugins/clientCertificate.js +115 -0
  38. package/dist/server/plugins/dev-server.js +33 -0
  39. package/dist/server/plugins/inputs/action.js +54 -0
  40. package/dist/server/plugins/inputs/away.js +20 -0
  41. package/dist/server/plugins/inputs/ban.js +45 -0
  42. package/dist/server/plugins/inputs/blow.js +44 -0
  43. package/dist/server/plugins/inputs/connect.js +41 -0
  44. package/dist/server/plugins/inputs/ctcp.js +29 -0
  45. package/dist/server/plugins/inputs/disconnect.js +15 -0
  46. package/dist/server/plugins/inputs/ignore.js +74 -0
  47. package/dist/server/plugins/inputs/ignorelist.js +50 -0
  48. package/dist/server/plugins/inputs/index.js +105 -0
  49. package/dist/server/plugins/inputs/invite.js +31 -0
  50. package/dist/server/plugins/inputs/kick.js +26 -0
  51. package/dist/server/plugins/inputs/kill.js +13 -0
  52. package/dist/server/plugins/inputs/list.js +12 -0
  53. package/dist/server/plugins/inputs/mode.js +55 -0
  54. package/dist/server/plugins/inputs/msg.js +106 -0
  55. package/dist/server/plugins/inputs/mute.js +56 -0
  56. package/dist/server/plugins/inputs/nick.js +55 -0
  57. package/dist/server/plugins/inputs/notice.js +42 -0
  58. package/dist/server/plugins/inputs/part.js +46 -0
  59. package/dist/server/plugins/inputs/quit.js +27 -0
  60. package/dist/server/plugins/inputs/raw.js +13 -0
  61. package/dist/server/plugins/inputs/rejoin.js +25 -0
  62. package/dist/server/plugins/inputs/topic.js +24 -0
  63. package/dist/server/plugins/inputs/whois.js +19 -0
  64. package/dist/server/plugins/irc-events/away.js +59 -0
  65. package/dist/server/plugins/irc-events/cap.js +62 -0
  66. package/dist/server/plugins/irc-events/chghost.js +29 -0
  67. package/dist/server/plugins/irc-events/connection.js +152 -0
  68. package/dist/server/plugins/irc-events/ctcp.js +72 -0
  69. package/dist/server/plugins/irc-events/error.js +80 -0
  70. package/dist/server/plugins/irc-events/help.js +21 -0
  71. package/dist/server/plugins/irc-events/info.js +21 -0
  72. package/dist/server/plugins/irc-events/invite.js +27 -0
  73. package/dist/server/plugins/irc-events/join.js +53 -0
  74. package/dist/server/plugins/irc-events/kick.js +39 -0
  75. package/dist/server/plugins/irc-events/link.js +442 -0
  76. package/dist/server/plugins/irc-events/list.js +47 -0
  77. package/dist/server/plugins/irc-events/message.js +187 -0
  78. package/dist/server/plugins/irc-events/mode.js +124 -0
  79. package/dist/server/plugins/irc-events/modelist.js +67 -0
  80. package/dist/server/plugins/irc-events/motd.js +29 -0
  81. package/dist/server/plugins/irc-events/names.js +21 -0
  82. package/dist/server/plugins/irc-events/nick.js +45 -0
  83. package/dist/server/plugins/irc-events/part.js +35 -0
  84. package/dist/server/plugins/irc-events/quit.js +32 -0
  85. package/dist/server/plugins/irc-events/sasl.js +26 -0
  86. package/dist/server/plugins/irc-events/topic.js +42 -0
  87. package/dist/server/plugins/irc-events/unhandled.js +31 -0
  88. package/dist/server/plugins/irc-events/welcome.js +22 -0
  89. package/dist/server/plugins/irc-events/whois.js +57 -0
  90. package/dist/server/plugins/messageStorage/sqlite.js +454 -0
  91. package/dist/server/plugins/messageStorage/text.js +124 -0
  92. package/dist/server/plugins/packages/index.js +200 -0
  93. package/dist/server/plugins/packages/publicClient.js +66 -0
  94. package/dist/server/plugins/packages/themes.js +61 -0
  95. package/dist/server/plugins/storage.js +88 -0
  96. package/dist/server/plugins/sts.js +85 -0
  97. package/dist/server/plugins/uploader.js +267 -0
  98. package/dist/server/plugins/webpush.js +99 -0
  99. package/dist/server/server.js +857 -0
  100. package/dist/server/storageCleaner.js +131 -0
  101. package/dist/server/utils/fish.js +432 -0
  102. package/dist/shared/irc.js +19 -0
  103. package/dist/shared/linkify.js +81 -0
  104. package/dist/shared/types/chan.js +22 -0
  105. package/dist/shared/types/changelog.js +2 -0
  106. package/dist/shared/types/config.js +2 -0
  107. package/dist/shared/types/mention.js +2 -0
  108. package/dist/shared/types/msg.js +34 -0
  109. package/dist/shared/types/network.js +2 -0
  110. package/dist/shared/types/storage.js +2 -0
  111. package/dist/shared/types/user.js +2 -0
  112. package/dist/webpack.config.js +224 -0
  113. package/index.js +38 -0
  114. package/package.json +174 -0
  115. package/public/audio/pop.wav +0 -0
  116. package/public/css/style.css +12 -0
  117. package/public/css/style.css.map +1 -0
  118. package/public/favicon.ico +0 -0
  119. package/public/fonts/fa-solid-900.woff +0 -0
  120. package/public/fonts/fa-solid-900.woff2 +0 -0
  121. package/public/img/favicon-alerted.ico +0 -0
  122. package/public/img/icon-alerted-black-transparent-bg-72x72px.png +0 -0
  123. package/public/img/icon-alerted-grey-bg-192x192px.png +0 -0
  124. package/public/img/icon-black-transparent-bg.svg +1 -0
  125. package/public/img/logo-grey-bg-120x120px.png +0 -0
  126. package/public/img/logo-grey-bg-152x152px.png +0 -0
  127. package/public/img/logo-grey-bg-167x167px.png +0 -0
  128. package/public/img/logo-grey-bg-180x180px.png +0 -0
  129. package/public/img/logo-grey-bg-192x192px.png +0 -0
  130. package/public/img/logo-grey-bg-512x512px.png +0 -0
  131. package/public/img/logo-grey-bg.svg +1 -0
  132. package/public/img/logo-horizontal-transparent-bg-inverted.svg +1 -0
  133. package/public/img/logo-horizontal-transparent-bg.svg +1 -0
  134. package/public/img/logo-transparent-bg-inverted.svg +1 -0
  135. package/public/img/logo-transparent-bg.svg +1 -0
  136. package/public/img/logo-vertical-transparent-bg-inverted.svg +1 -0
  137. package/public/img/logo-vertical-transparent-bg.svg +1 -0
  138. package/public/js/bundle.js +2 -0
  139. package/public/js/bundle.js.map +1 -0
  140. package/public/js/bundle.vendor.js +3 -0
  141. package/public/js/bundle.vendor.js.LICENSE.txt +18 -0
  142. package/public/js/bundle.vendor.js.map +1 -0
  143. package/public/js/loading-error-handlers.js +1 -0
  144. package/public/robots.txt +2 -0
  145. package/public/service-worker.js +1 -0
  146. package/public/thelounge.webmanifest +53 -0
  147. package/public/themes/default.css +35 -0
  148. package/public/themes/morning.css +183 -0
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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;
11
+ // The following saves the channel key based on channel mode instead of
12
+ // extracting it from `/join #channel key`. This lets us not have to
13
+ // temporarily store the key until successful join, but also saves the key
14
+ // if a key is set or changed while being on the channel.
15
+ irc.on("channel info", function (data) {
16
+ if (!data.modes) {
17
+ return;
18
+ }
19
+ const targetChan = network.getChannel(data.channel);
20
+ if (typeof targetChan === "undefined") {
21
+ return;
22
+ }
23
+ data.modes.forEach((mode) => {
24
+ const text = mode.mode;
25
+ const add = text[0] === "+";
26
+ const char = text[1];
27
+ if (char === "k") {
28
+ targetChan.key = add ? mode.param : "";
29
+ client.save();
30
+ }
31
+ });
32
+ const msg = new msg_1.default({
33
+ type: msg_2.MessageType.MODE_CHANNEL,
34
+ text: `${data.raw_modes} ${data.raw_params.join(" ")}`,
35
+ });
36
+ targetChan.pushMessage(client, msg);
37
+ });
38
+ irc.on("user info", function (data) {
39
+ const serverChan = network.getLobby();
40
+ const msg = new msg_1.default({
41
+ type: msg_2.MessageType.MODE_USER,
42
+ raw_modes: data.raw_modes,
43
+ self: false,
44
+ showInActive: true,
45
+ });
46
+ serverChan.pushMessage(client, msg);
47
+ });
48
+ irc.on("mode", function (data) {
49
+ let targetChan;
50
+ if (data.target === irc.user.nick) {
51
+ targetChan = network.getLobby();
52
+ }
53
+ else {
54
+ targetChan = network.getChannel(data.target);
55
+ if (typeof targetChan === "undefined") {
56
+ return;
57
+ }
58
+ }
59
+ const msg = new msg_1.default({
60
+ time: data.time,
61
+ type: msg_2.MessageType.MODE,
62
+ from: targetChan.getUser(data.nick),
63
+ text: `${data.raw_modes} ${data.raw_params.join(" ")}`,
64
+ self: data.nick === irc.user.nick,
65
+ });
66
+ const users = [];
67
+ for (const param of data.raw_params) {
68
+ if (targetChan.findUser(param)) {
69
+ users.push(param);
70
+ }
71
+ }
72
+ if (users.length > 0) {
73
+ msg.users = users;
74
+ }
75
+ targetChan.pushMessage(client, msg);
76
+ let usersUpdated = false;
77
+ const userModeSortPriority = {};
78
+ const supportsMultiPrefix = network.irc.network.cap.isEnabled("multi-prefix");
79
+ irc.network.options.PREFIX.forEach((prefix, index) => {
80
+ userModeSortPriority[prefix.symbol] = index;
81
+ });
82
+ data.modes.forEach((mode) => {
83
+ const add = mode.mode[0] === "+";
84
+ const char = mode.mode[1];
85
+ if (char === "k") {
86
+ targetChan.key = add ? mode.param : "";
87
+ client.save();
88
+ }
89
+ if (!mode.param) {
90
+ return;
91
+ }
92
+ const user = targetChan.findUser(mode.param);
93
+ if (!user) {
94
+ return;
95
+ }
96
+ usersUpdated = true;
97
+ if (!supportsMultiPrefix) {
98
+ return;
99
+ }
100
+ const changedMode = network.serverOptions.PREFIX.modeToSymbol[char];
101
+ if (!add) {
102
+ lodash_1.default.pull(user.modes, changedMode);
103
+ }
104
+ else if (!user.modes.includes(changedMode)) {
105
+ user.modes.push(changedMode);
106
+ user.modes.sort(function (a, b) {
107
+ return userModeSortPriority[a] - userModeSortPriority[b];
108
+ });
109
+ }
110
+ });
111
+ if (!usersUpdated) {
112
+ return;
113
+ }
114
+ if (!supportsMultiPrefix) {
115
+ // TODO: This is horrible
116
+ irc.raw("NAMES", data.target);
117
+ }
118
+ else {
119
+ client.emit("users", {
120
+ chan: targetChan.id,
121
+ });
122
+ }
123
+ });
124
+ });
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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
+ 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) {
28
+ if (data.length === 0) {
29
+ const msg = new msg_1.default({
30
+ time: new Date(),
31
+ type: msg_2.MessageType.ERROR,
32
+ text: `${name} is empty`,
33
+ });
34
+ let chan = network.getChannel(channel);
35
+ // Send error to lobby if we receive empty list for a channel we're not in
36
+ if (typeof chan === "undefined") {
37
+ msg.showInActive = true;
38
+ chan = network.getLobby();
39
+ }
40
+ chan.pushMessage(client, msg, true);
41
+ return;
42
+ }
43
+ const chanName = `${name} for ${channel}`;
44
+ let chan = network.getChannel(chanName);
45
+ if (typeof chan === "undefined") {
46
+ chan = client.createChannel({
47
+ type: chan_1.ChanType.SPECIAL,
48
+ special: type,
49
+ name: chanName,
50
+ data: data,
51
+ });
52
+ client.emit("join", {
53
+ network: network.uuid,
54
+ chan: chan.getFilteredClone(true),
55
+ shouldOpen: false,
56
+ index: network.addChannel(chan),
57
+ });
58
+ }
59
+ else {
60
+ chan.data = data;
61
+ client.emit("msg:special", {
62
+ chan: chan.id,
63
+ data: data,
64
+ });
65
+ }
66
+ }
67
+ });
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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) {
11
+ const lobby = network.getLobby();
12
+ if (data.motd) {
13
+ const msg = new msg_1.default({
14
+ type: msg_2.MessageType.MONOSPACE_BLOCK,
15
+ command: "motd",
16
+ text: data.motd,
17
+ });
18
+ lobby.pushMessage(client, msg);
19
+ }
20
+ if (data.error) {
21
+ const msg = new msg_1.default({
22
+ type: msg_2.MessageType.MONOSPACE_BLOCK,
23
+ command: "motd",
24
+ text: data.error,
25
+ });
26
+ lobby.pushMessage(client, msg);
27
+ }
28
+ });
29
+ });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (function (irc, network) {
4
+ const client = this;
5
+ irc.on("userlist", function (data) {
6
+ const chan = network.getChannel(data.channel);
7
+ if (typeof chan === "undefined") {
8
+ return;
9
+ }
10
+ const newUsers = new Map();
11
+ data.users.forEach((user) => {
12
+ const newUser = chan.getUser(user.nick);
13
+ newUser.setModes(user.modes, network.serverOptions.PREFIX);
14
+ newUsers.set(user.nick.toLowerCase(), newUser);
15
+ });
16
+ chan.users = newUsers;
17
+ client.emit("users", {
18
+ chan: chan.id,
19
+ });
20
+ });
21
+ });
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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) {
11
+ const self = data.nick === irc.user.nick;
12
+ if (self) {
13
+ network.setNick(data.new_nick);
14
+ const lobby = network.getLobby();
15
+ const msg = new msg_1.default({
16
+ text: `You're now known as ${data.new_nick}`,
17
+ });
18
+ lobby.pushMessage(client, msg, true);
19
+ client.save();
20
+ client.emit("nick", {
21
+ network: network.uuid,
22
+ nick: data.new_nick,
23
+ });
24
+ }
25
+ network.channels.forEach((chan) => {
26
+ const user = chan.findUser(data.nick);
27
+ if (typeof user === "undefined") {
28
+ return;
29
+ }
30
+ const msg = new msg_1.default({
31
+ time: data.time,
32
+ from: user,
33
+ type: msg_2.MessageType.NICK,
34
+ new_nick: data.new_nick,
35
+ });
36
+ chan.pushMessage(client, msg);
37
+ chan.removeUser(user);
38
+ user.nick = data.new_nick;
39
+ chan.setUser(user);
40
+ client.emit("users", {
41
+ chan: chan.id,
42
+ });
43
+ });
44
+ });
45
+ });
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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("part", function (data) {
11
+ if (!data.channel) {
12
+ return;
13
+ }
14
+ const chan = network.getChannel(data.channel);
15
+ if (typeof chan === "undefined") {
16
+ return;
17
+ }
18
+ const user = chan.getUser(data.nick);
19
+ const msg = new msg_1.default({
20
+ type: msg_2.MessageType.PART,
21
+ time: data.time,
22
+ text: data.message || "",
23
+ hostmask: data.ident + "@" + data.hostname,
24
+ from: user,
25
+ self: data.nick === irc.user.nick,
26
+ });
27
+ chan.pushMessage(client, msg);
28
+ if (data.nick === irc.user.nick) {
29
+ client.part(network, chan);
30
+ }
31
+ else {
32
+ chan.removeUser(user);
33
+ }
34
+ });
35
+ });
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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("quit", function (data) {
11
+ network.channels.forEach((chan) => {
12
+ const user = chan.findUser(data.nick);
13
+ if (typeof user === "undefined") {
14
+ return;
15
+ }
16
+ const msg = new msg_1.default({
17
+ time: data.time,
18
+ type: msg_2.MessageType.QUIT,
19
+ text: data.message || "",
20
+ hostmask: data.ident + "@" + data.hostname,
21
+ from: user,
22
+ });
23
+ chan.pushMessage(client, msg);
24
+ chan.removeUser(user);
25
+ });
26
+ // If user with the nick we are trying to keep has quit, try to get this nick
27
+ if (network.keepNick === data.nick) {
28
+ irc.changeNick(network.keepNick);
29
+ network.keepNick = null;
30
+ }
31
+ });
32
+ });
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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("loggedin", (data) => {
11
+ const lobby = network.getLobby();
12
+ const msg = new msg_1.default({
13
+ type: msg_2.MessageType.LOGIN,
14
+ text: "Logged in as: " + data.account,
15
+ });
16
+ lobby.pushMessage(client, msg, true);
17
+ });
18
+ irc.on("loggedout", () => {
19
+ const lobby = network.getLobby();
20
+ const msg = new msg_1.default({
21
+ type: msg_2.MessageType.LOGOUT,
22
+ text: "Logged out",
23
+ });
24
+ lobby.pushMessage(client, msg, true);
25
+ });
26
+ });
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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("topic", function (data) {
11
+ const chan = network.getChannel(data.channel);
12
+ if (typeof chan === "undefined") {
13
+ return;
14
+ }
15
+ const msg = new msg_1.default({
16
+ time: data.time,
17
+ type: msg_2.MessageType.TOPIC,
18
+ from: data.nick && chan.getUser(data.nick),
19
+ text: data.topic,
20
+ self: data.nick === irc.user.nick,
21
+ });
22
+ chan.pushMessage(client, msg);
23
+ chan.topic = data.topic;
24
+ client.emit("topic", {
25
+ chan: chan.id,
26
+ topic: chan.topic,
27
+ });
28
+ });
29
+ irc.on("topicsetby", function (data) {
30
+ const chan = network.getChannel(data.channel);
31
+ if (typeof chan === "undefined") {
32
+ return;
33
+ }
34
+ const msg = new msg_1.default({
35
+ type: msg_2.MessageType.TOPIC_SET_BY,
36
+ from: chan.getUser(data.nick),
37
+ when: new Date(data.when * 1000),
38
+ self: data.nick === irc.user.nick,
39
+ });
40
+ chan.pushMessage(client, msg);
41
+ });
42
+ });
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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("unknown command", function (command) {
11
+ let target = network.getLobby();
12
+ // Do not display users own name
13
+ if (command.params.length > 0 && command.params[0] === network.irc.user.nick) {
14
+ command.params.shift();
15
+ }
16
+ // Check the length again because we may shift the nick above
17
+ if (command.params.length > 0) {
18
+ // If this numeric starts with a channel name that exists
19
+ // put this message in that channel
20
+ const channel = network.getChannel(command.params[0]);
21
+ if (typeof channel !== "undefined") {
22
+ target = channel;
23
+ }
24
+ }
25
+ target.pushMessage(client, new msg_1.default({
26
+ type: msg_2.MessageType.UNHANDLED,
27
+ command: command.command,
28
+ params: command.params,
29
+ }), true);
30
+ });
31
+ });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const msg_1 = __importDefault(require("../../models/msg"));
7
+ exports.default = (function (irc, network) {
8
+ const client = this;
9
+ irc.on("registered", function (data) {
10
+ network.setNick(data.nick);
11
+ const lobby = network.getLobby();
12
+ const msg = new msg_1.default({
13
+ text: "You're now known as " + data.nick,
14
+ });
15
+ lobby.pushMessage(client, msg);
16
+ client.save();
17
+ client.emit("nick", {
18
+ network: network.uuid,
19
+ nick: data.nick,
20
+ });
21
+ });
22
+ });
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
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
+ const chan_1 = require("../../../shared/types/chan");
9
+ exports.default = (function (irc, network) {
10
+ const client = this;
11
+ irc.on("whois", handleWhois);
12
+ irc.on("whowas", (data) => {
13
+ data.whowas = true;
14
+ handleWhois(data);
15
+ });
16
+ function handleWhois(data) {
17
+ let chan = network.getChannel(data.nick);
18
+ if (typeof chan === "undefined") {
19
+ // Do not create new windows for errors as they may contain illegal characters
20
+ if (data.error) {
21
+ chan = network.getLobby();
22
+ }
23
+ else {
24
+ chan = client.createChannel({
25
+ type: chan_1.ChanType.QUERY,
26
+ name: data.nick,
27
+ });
28
+ client.emit("join", {
29
+ network: network.uuid,
30
+ chan: chan.getFilteredClone(true),
31
+ shouldOpen: true,
32
+ index: network.addChannel(chan),
33
+ });
34
+ chan.loadMessages(client, network);
35
+ client.save();
36
+ }
37
+ }
38
+ let msg;
39
+ if (data.error) {
40
+ msg = new msg_1.default({
41
+ type: msg_2.MessageType.ERROR,
42
+ text: "No such nick: " + data.nick,
43
+ });
44
+ }
45
+ else {
46
+ // Absolute datetime in milliseconds since nick is idle
47
+ data.idleTime = Date.now() - data.idle * 1000;
48
+ // Absolute datetime in milliseconds when nick logged on.
49
+ data.logonTime = data.logon * 1000;
50
+ msg = new msg_1.default({
51
+ type: msg_2.MessageType.WHOIS,
52
+ whois: data,
53
+ });
54
+ }
55
+ chan.pushMessage(client, msg);
56
+ }
57
+ });