From 17bcc37b808bcbc9b30861ce449b1bf137989662 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Wed, 16 Mar 2016 22:54:11 +0200 Subject: [PATCH] Request names on mode change as a temporary measure --- src/plugins/irc-events/error.js | 6 +++++- src/plugins/irc-events/mode.js | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugins/irc-events/error.js b/src/plugins/irc-events/error.js index f26d6836..9756c9b5 100644 --- a/src/plugins/irc-events/error.js +++ b/src/plugins/irc-events/error.js @@ -4,10 +4,14 @@ module.exports = function(irc, network) { var client = this; irc.on("irc_error", function(data) { console.log(data); + var text = data.error; + if (data.reason) { + text = data.reason + " (" + text + ")"; + } var lobby = network.channels[0]; var msg = new Msg({ type: Msg.Type.ERROR, - text: data.error, + text: text, }); client.emit("msg", { chan: lobby.id, diff --git a/src/plugins/irc-events/mode.js b/src/plugins/irc-events/mode.js index fd734439..e205c66c 100644 --- a/src/plugins/irc-events/mode.js +++ b/src/plugins/irc-events/mode.js @@ -16,11 +16,18 @@ module.exports = function(irc, network) { } } + var usersUpdated; + for (var i = 0; i < data.modes.length; i++) { var mode = data.modes[i]; var text = mode.mode; if (mode.param) { text += " " + mode.param; + + var user = _.find(targetChan.users, {name: mode.param}); + if (typeof user !== "undefined") { + usersUpdated = true; + } } var msg = new Msg({ @@ -37,5 +44,10 @@ module.exports = function(irc, network) { msg: msg, }); } + + if (usersUpdated) { + // TODO: This is horrible + irc.raw("NAMES", data.target); + } }); };