diff --git a/client/css/style.css b/client/css/style.css index 3815cfe4..580366ba 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -304,6 +304,8 @@ p { #chat .msg[data-type="invite"] .from::before, #chat .msg[data-type="join"] .from::before, #chat .msg[data-type="kick"] .from::before, +#chat .msg[data-type="login"] .from::before, +#chat .msg[data-type="logout"] .from::before, #chat .msg[data-type="part"] .from::before, #chat .msg[data-type="quit"] .from::before, #chat .msg[data-type="topic"] .from::before, @@ -425,6 +427,16 @@ p { color: #2ecc40; } +#chat .msg[data-type="login"] .from::before { + content: "\f007"; /* https://fontawesome.com/icons/user?style=solid */ + color: #2ecc40; +} + +#chat .msg[data-type="logout"] .from::before { + content: "\f007"; /* https://fontawesome.com/icons/user?style=solid */ + color: #ff4136; +} + #chat .msg[data-type="part"] .from::before, #chat .msg[data-type="quit"] .from::before { content: "\f2f5"; /* https://fontawesome.com/icons/sign-out-alt?style=solid */ diff --git a/src/client.js b/src/client.js index 418b0e38..ca7f0f2a 100644 --- a/src/client.js +++ b/src/client.js @@ -33,6 +33,7 @@ const events = [ "invite", "join", "kick", + "list", "mode", "modelist", "motd", @@ -41,9 +42,9 @@ const events = [ "nick", "part", "quit", + "sasl", "topic", "welcome", - "list", "whois", ]; diff --git a/src/models/msg.js b/src/models/msg.js index ed2ce6e5..0d61dace 100644 --- a/src/models/msg.js +++ b/src/models/msg.js @@ -60,13 +60,15 @@ class Msg { Msg.Type = { UNHANDLED: "unhandled", - AWAY: "away", ACTION: "action", + AWAY: "away", BACK: "back", ERROR: "error", INVITE: "invite", JOIN: "join", KICK: "kick", + LOGIN: "login", + LOGOUT: "logout", MESSAGE: "message", MODE: "mode", MODE_CHANNEL: "mode_channel", diff --git a/src/plugins/irc-events/sasl.js b/src/plugins/irc-events/sasl.js new file mode 100644 index 00000000..2b429880 --- /dev/null +++ b/src/plugins/irc-events/sasl.js @@ -0,0 +1,27 @@ +"use strict"; + +const Msg = require("../../models/msg"); + +module.exports = function (irc, network) { + const client = this; + + irc.on("loggedin", (data) => { + const lobby = network.channels[0]; + + const msg = new Msg({ + type: Msg.Type.LOGIN, + text: "Logged in as: " + data.account, + }); + lobby.pushMessage(client, msg, true); + }); + + irc.on("loggedout", () => { + const lobby = network.channels[0]; + + const msg = new Msg({ + type: Msg.Type.LOGOUT, + text: "Logged out", + }); + lobby.pushMessage(client, msg, true); + }); +};