From 5c336d3789d9228758fde9ce1936d2263de3d4ca Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Sun, 16 Apr 2017 12:31:32 +0300 Subject: [PATCH] Add slug with command to unhandled messages --- client/js/libs/handlebars/slugify.js | 5 +++++ client/views/chan.tpl | 2 +- client/views/msg_unhandled.tpl | 2 +- client/views/network.tpl | 2 +- src/models/network.js | 1 + src/plugins/irc-events/connection.js | 3 ++- 6 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 client/js/libs/handlebars/slugify.js diff --git a/client/js/libs/handlebars/slugify.js b/client/js/libs/handlebars/slugify.js new file mode 100644 index 00000000..a8b385e8 --- /dev/null +++ b/client/js/libs/handlebars/slugify.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = function(orig) { + return orig.toLowerCase().replace(/[^a-z0-9]/, "-"); +}; diff --git a/client/views/chan.tpl b/client/views/chan.tpl index 626eb228..d9e9d005 100644 --- a/client/views/chan.tpl +++ b/client/views/chan.tpl @@ -1,5 +1,5 @@ {{#each channels}} -
+
{{#if unread}}{{roundBadgeNumber unread}}{{/if}} {{name}} diff --git a/client/views/msg_unhandled.tpl b/client/views/msg_unhandled.tpl index 1a6fcfd7..69ad3fe5 100644 --- a/client/views/msg_unhandled.tpl +++ b/client/views/msg_unhandled.tpl @@ -1,4 +1,4 @@ -
+
{{tz time}} diff --git a/client/views/network.tpl b/client/views/network.tpl index 9da98019..d525dff2 100644 --- a/client/views/network.tpl +++ b/client/views/network.tpl @@ -1,5 +1,5 @@ {{#each networks}} -
+
{{> chan}}
{{/each}} diff --git a/src/models/network.js b/src/models/network.js index f5576133..4a63d355 100644 --- a/src/models/network.js +++ b/src/models/network.js @@ -25,6 +25,7 @@ function Network(attr) { irc: null, serverOptions: { PREFIX: [], + NETWORK: "", }, chanCache: [], }); diff --git a/src/plugins/irc-events/connection.js b/src/plugins/irc-events/connection.js index 47cb331c..e44b7676 100644 --- a/src/plugins/irc-events/connection.js +++ b/src/plugins/irc-events/connection.js @@ -120,7 +120,7 @@ module.exports = function(irc, network) { }); irc.on("server options", function(data) { - if (network.serverOptions.PREFIX === data.options.PREFIX) { + if (network.serverOptions.PREFIX === data.options.PREFIX && network.serverOptions.NETWORK === data.options.NETWORK) { return; } @@ -131,6 +131,7 @@ module.exports = function(irc, network) { }); network.serverOptions.PREFIX = data.options.PREFIX; + network.serverOptions.NETWORK = data.options.NETWORK; client.emit("network_changed", { network: network.id,