Use away-notify to show user away status change
This commit is contained in:
parent
3b049f174c
commit
163cfaba3c
@ -208,6 +208,8 @@ kbd {
|
|||||||
#settings .extra-help,
|
#settings .extra-help,
|
||||||
#settings #play::before,
|
#settings #play::before,
|
||||||
#form #submit::before,
|
#form #submit::before,
|
||||||
|
#chat .away .from::before,
|
||||||
|
#chat .back .from::before,
|
||||||
#chat .invite .from::before,
|
#chat .invite .from::before,
|
||||||
#chat .join .from::before,
|
#chat .join .from::before,
|
||||||
#chat .kick .from::before,
|
#chat .kick .from::before,
|
||||||
@ -258,6 +260,12 @@ kbd {
|
|||||||
|
|
||||||
#form #submit::before { content: "\f1d8"; /* http://fontawesome.io/icon/paper-plane/ */ }
|
#form #submit::before { content: "\f1d8"; /* http://fontawesome.io/icon/paper-plane/ */ }
|
||||||
|
|
||||||
|
#chat .away .from::before,
|
||||||
|
#chat .back .from::before {
|
||||||
|
content: "\f017"; /* http://fontawesome.io/icon/clock-o/ */
|
||||||
|
color: #7f8c8d;
|
||||||
|
}
|
||||||
|
|
||||||
#chat .invite .from::before {
|
#chat .invite .from::before {
|
||||||
content: "\f003"; /* http://fontawesome.io/icon/envelope-o/ */
|
content: "\f003"; /* http://fontawesome.io/icon/envelope-o/ */
|
||||||
color: #2ecc40;
|
color: #2ecc40;
|
||||||
@ -1157,6 +1165,8 @@ kbd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#chat .condensed .content,
|
#chat .condensed .content,
|
||||||
|
#chat .away .content,
|
||||||
|
#chat .back .content,
|
||||||
#chat .join .content,
|
#chat .join .content,
|
||||||
#chat .kick .content,
|
#chat .kick .content,
|
||||||
#chat .mode .content,
|
#chat .mode .content,
|
||||||
|
@ -225,8 +225,8 @@
|
|||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h2>
|
<h2>
|
||||||
Status messages
|
Status messages
|
||||||
<span class="tooltipped tooltipped-n tooltipped-no-delay" aria-label="Joins, parts, kicks, nick changes, and mode changes">
|
<span class="tooltipped tooltipped-n tooltipped-no-delay" aria-label="Joins, parts, kicks, nick changes, away changes, and mode changes">
|
||||||
<button class="extra-help" aria-label="Joins, parts, kicks, nick changes, and mode changes"></button>
|
<button class="extra-help" aria-label="Joins, parts, kicks, nick changes, away changes, and mode changes"></button>
|
||||||
</span>
|
</span>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,6 +23,12 @@ function updateText(condensed, addedTypes) {
|
|||||||
constants.condensedTypes.forEach((type) => {
|
constants.condensedTypes.forEach((type) => {
|
||||||
if (obj[type]) {
|
if (obj[type]) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case "away":
|
||||||
|
strings.push(obj[type] + (obj[type] > 1 ? " users have gone away" : " user has gone away"));
|
||||||
|
break;
|
||||||
|
case "back":
|
||||||
|
strings.push(obj[type] + (obj[type] > 1 ? " users have come back" : " user has come back"));
|
||||||
|
break;
|
||||||
case "join":
|
case "join":
|
||||||
strings.push(obj[type] + (obj[type] > 1 ? " users have joined the channel" : " user has joined the channel"));
|
strings.push(obj[type] + (obj[type] > 1 ? " users have joined the channel" : " user has joined the channel"));
|
||||||
break;
|
break;
|
||||||
|
@ -60,6 +60,8 @@ const commands = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const actionTypes = [
|
const actionTypes = [
|
||||||
|
"away",
|
||||||
|
"back",
|
||||||
"ban_list",
|
"ban_list",
|
||||||
"invite",
|
"invite",
|
||||||
"join",
|
"join",
|
||||||
@ -77,6 +79,8 @@ const actionTypes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const condensedTypes = [
|
const condensedTypes = [
|
||||||
|
"away",
|
||||||
|
"back",
|
||||||
"join",
|
"join",
|
||||||
"part",
|
"part",
|
||||||
"quit",
|
"quit",
|
||||||
|
3
client/views/actions/away.tpl
Normal file
3
client/views/actions/away.tpl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{{> ../user_name nick=from}}
|
||||||
|
is away
|
||||||
|
<i class="away-message">({{{parse text}}})</i>
|
2
client/views/actions/back.tpl
Normal file
2
client/views/actions/back.tpl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{{> ../user_name nick=from}}
|
||||||
|
is back
|
@ -3,6 +3,8 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
actions: {
|
actions: {
|
||||||
action: require("./actions/action.tpl"),
|
action: require("./actions/action.tpl"),
|
||||||
|
away: require("./actions/away.tpl"),
|
||||||
|
back: require("./actions/back.tpl"),
|
||||||
ban_list: require("./actions/ban_list.tpl"),
|
ban_list: require("./actions/ban_list.tpl"),
|
||||||
channel_list: require("./actions/channel_list.tpl"),
|
channel_list: require("./actions/channel_list.tpl"),
|
||||||
ctcp: require("./actions/ctcp.tpl"),
|
ctcp: require("./actions/ctcp.tpl"),
|
||||||
|
@ -16,6 +16,7 @@ module.exports = Client;
|
|||||||
|
|
||||||
var id = 0;
|
var id = 0;
|
||||||
var events = [
|
var events = [
|
||||||
|
"away",
|
||||||
"connection",
|
"connection",
|
||||||
"unhandled",
|
"unhandled",
|
||||||
"banlist",
|
"banlist",
|
||||||
|
@ -29,7 +29,9 @@ class Msg {
|
|||||||
|
|
||||||
Msg.Type = {
|
Msg.Type = {
|
||||||
UNHANDLED: "unhandled",
|
UNHANDLED: "unhandled",
|
||||||
|
AWAY: "away",
|
||||||
ACTION: "action",
|
ACTION: "action",
|
||||||
|
BACK: "back",
|
||||||
ERROR: "error",
|
ERROR: "error",
|
||||||
INVITE: "invite",
|
INVITE: "invite",
|
||||||
JOIN: "join",
|
JOIN: "join",
|
||||||
|
@ -7,6 +7,7 @@ module.exports = User;
|
|||||||
function User(attr, prefixLookup) {
|
function User(attr, prefixLookup) {
|
||||||
_.defaults(this, attr, {
|
_.defaults(this, attr, {
|
||||||
modes: [],
|
modes: [],
|
||||||
|
away: "",
|
||||||
mode: "",
|
mode: "",
|
||||||
nick: "",
|
nick: "",
|
||||||
lastMessage: 0,
|
lastMessage: 0,
|
||||||
|
30
src/plugins/irc-events/away.js
Normal file
30
src/plugins/irc-events/away.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const _ = require("lodash");
|
||||||
|
const Msg = require("../../models/msg");
|
||||||
|
|
||||||
|
module.exports = function(irc, network) {
|
||||||
|
const client = this;
|
||||||
|
irc.on("away", (data) => {
|
||||||
|
const away = data.message;
|
||||||
|
|
||||||
|
network.channels.forEach((chan) => {
|
||||||
|
const user = _.find(chan.users, {nick: data.nick});
|
||||||
|
|
||||||
|
if (!user || user.away === away) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const msg = new Msg({
|
||||||
|
type: away ? Msg.Type.AWAY : Msg.Type.BACK,
|
||||||
|
text: away || "",
|
||||||
|
time: data.time,
|
||||||
|
from: data.nick,
|
||||||
|
mode: user.mode
|
||||||
|
});
|
||||||
|
|
||||||
|
chan.pushMessage(client, msg);
|
||||||
|
user.away = away;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user