mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-10 01:32:17 +02:00
caa46042bf
Several ES6 additions are only available in strict mode. Example: > SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode Strict mode was also enabled in a few of our files already, and it is a good thing to have anyway.
35 lines
687 B
JavaScript
35 lines
687 B
JavaScript
"use strict";
|
|
|
|
var Msg = require("../../models/msg");
|
|
|
|
module.exports = function(irc, network) {
|
|
var client = this;
|
|
|
|
irc.on("ctcp response", function(data) {
|
|
var chan = network.getChannel(data.nick);
|
|
if (typeof chan === "undefined") {
|
|
chan = network.channels[0];
|
|
}
|
|
|
|
var msg = new Msg({
|
|
type: Msg.Type.CTCP,
|
|
time: data.time,
|
|
from: data.nick,
|
|
ctcpType: data.type,
|
|
ctcpMessage: data.message
|
|
});
|
|
chan.pushMessage(client, msg);
|
|
});
|
|
|
|
irc.on("ctcp request", function(data) {
|
|
switch (data.type) {
|
|
case "PING":
|
|
var split = data.message.split(" ");
|
|
if (split.length === 2) {
|
|
irc.ctcpResponse(data.nick, "PING", split[1]);
|
|
}
|
|
break;
|
|
}
|
|
});
|
|
};
|