summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2016-05-30 16:22:26 +0100
committerJoe Robinson <joe@lc8n.com>2016-05-30 16:22:26 +0100
commitd48d14f88cc6cc339af189666f8287532fb7a309 (patch)
tree0e23d23dbd01b5f78c10d02aa81dd99bba1141af
parentcfe99ec801c0c2cf5b9d484332183a952a421da1 (diff)
Add /topic function
-rw-r--r--index.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/index.js b/index.js
index 223fd94..96ce9dd 100644
--- a/index.js
+++ b/index.js
@@ -114,6 +114,10 @@ $("#send-message").keypress(function(e) {
nick = message.split(" ")[1];
message = message.substring(6+nick.length, message.length);
sendPm(message, nick);
+ } else if (message.indexOf("/topic") == 0) {
+ var channel = $(".tab.active").attr("data-tab").replace("chan-", "#")
+ topic = message.substring(7, message.length);
+ setTopic(channel, topic);
} else if (message.indexOf("/") == 0) {
command = message.split(" ")[0].replace("/","");
commandArgs = message.replace(command + " ", "");
@@ -159,6 +163,10 @@ function sendPm(message, nick) {
chatTab.scrollTop(chanTab.prop("scrollHeight"));
}
+function setTopic(channel, topic) {
+ client.send("TOPIC", channel, topic);
+}
+
function joinChannel(channel, sendJoin) {
if (sendJoin) {
client.join(channel);