Emit a message for SASL loggedin/loggedout events

Closes GH-3921
This commit is contained in:
Val Lorentz 2022-02-08 20:55:39 +01:00 committed by Reto Brunner
parent 3fb18717a7
commit 1e3a7b1250
4 changed files with 44 additions and 2 deletions

View File

@ -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 */

View File

@ -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",
];

View File

@ -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",

View File

@ -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);
});
};