diff --git a/client/css/style.css b/client/css/style.css
index 37e5b08b..3b9bcf67 100644
--- a/client/css/style.css
+++ b/client/css/style.css
@@ -827,6 +827,11 @@ button,
color: #2ecc40;
}
+#chat .ctcp .from:before {
+ font-family: FontAwesome;
+ content: "\f0f6";
+}
+
#chat .whois .from:before {
font-family: FontAwesome;
content: "\f007";
diff --git a/client/js/lounge.js b/client/js/lounge.js
index 9335e557..8ecfa8fd 100644
--- a/client/js/lounge.js
+++ b/client/js/lounge.js
@@ -225,6 +225,7 @@ $(function() {
"topic_set_by",
"action",
"whois",
+ "ctcp",
].indexOf(type) !== -1) {
data.msg.template = "actions/" + type;
msg = $(render("msg_action", data.msg));
diff --git a/client/views/actions/ctcp.tpl b/client/views/actions/ctcp.tpl
new file mode 100644
index 00000000..30334536
--- /dev/null
+++ b/client/views/actions/ctcp.tpl
@@ -0,0 +1,2 @@
+{{from}}
+{{ctcpType}} {{ctcpMessage}}
diff --git a/src/client.js b/src/client.js
index 3d7a1416..0349e5dd 100644
--- a/src/client.js
+++ b/src/client.js
@@ -30,6 +30,7 @@ var events = [
"whois"
];
var inputs = [
+ "ctcp",
"msg",
"part",
"action",
diff --git a/src/models/msg.js b/src/models/msg.js
index 00fbf04b..0f29d5ab 100644
--- a/src/models/msg.js
+++ b/src/models/msg.js
@@ -14,6 +14,7 @@ Msg.Type = {
PART: "part",
QUIT: "quit",
TOGGLE: "toggle",
+ CTCP: "ctcp",
TOPIC: "topic",
TOPIC_SET_BY: "topic_set_by",
WHOIS: "whois"
diff --git a/src/plugins/inputs/ctcp.js b/src/plugins/inputs/ctcp.js
new file mode 100644
index 00000000..75906b79
--- /dev/null
+++ b/src/plugins/inputs/ctcp.js
@@ -0,0 +1,8 @@
+exports.commands = ["ctcp"];
+
+exports.input = function(network, chan, cmd, args) {
+ if (args.length > 1) {
+ var irc = network.irc;
+ irc.ctcpRequest(args[0], args.slice(1).join(" "));
+ }
+};
diff --git a/src/plugins/irc-events/ctcp.js b/src/plugins/irc-events/ctcp.js
index b2db7973..d6cbd1a7 100644
--- a/src/plugins/irc-events/ctcp.js
+++ b/src/plugins/irc-events/ctcp.js
@@ -1,15 +1,38 @@
var pkg = require(process.cwd() + "/package.json");
+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.messages.push(msg);
+ client.emit("msg", {
+ chan: chan.id,
+ msg: msg
+ });
+ });
-module.exports = function(irc/* , network */) {
irc.on("ctcp request", function(data) {
switch (data.type) {
case "VERSION":
- irc.ctcpResponse(data.nick, "VERSION " + pkg.name + " " + pkg.version);
+ irc.ctcpResponse(data.nick, "VERSION", pkg.name + " " + pkg.version);
break;
case "PING":
var split = data.message.split(" ");
if (split.length === 2) {
- irc.ctcpResponse(data.nick, "PING " + split[1]);
+ irc.ctcpResponse(data.nick, "PING", split[1]);
}
break;
}