mirror of
https://github.com/thelounge/thelounge
synced 2024-11-22 20:13:07 +00:00
Merge pull request #845 from MaxLeiter/MaxLeiter/away-notify
Use away-notify to show updates on users away state
This commit is contained in:
commit
90cb79ac91
11 changed files with 63 additions and 2 deletions
|
@ -208,6 +208,8 @@ kbd {
|
|||
#settings .extra-help,
|
||||
#settings #play::before,
|
||||
#form #submit::before,
|
||||
#chat .away .from::before,
|
||||
#chat .back .from::before,
|
||||
#chat .invite .from::before,
|
||||
#chat .join .from::before,
|
||||
#chat .kick .from::before,
|
||||
|
@ -258,6 +260,12 @@ kbd {
|
|||
|
||||
#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 {
|
||||
content: "\f003"; /* http://fontawesome.io/icon/envelope-o/ */
|
||||
color: #2ecc40;
|
||||
|
@ -1157,6 +1165,8 @@ kbd {
|
|||
}
|
||||
|
||||
#chat .condensed .content,
|
||||
#chat .away .content,
|
||||
#chat .back .content,
|
||||
#chat .join .content,
|
||||
#chat .kick .content,
|
||||
#chat .mode .content,
|
||||
|
|
|
@ -225,8 +225,8 @@
|
|||
<div class="col-sm-12">
|
||||
<h2>
|
||||
Status messages
|
||||
<span class="tooltipped tooltipped-n tooltipped-no-delay" aria-label="Joins, parts, kicks, nick changes, and mode changes">
|
||||
<button class="extra-help" aria-label="Joins, parts, kicks, nick changes, and mode changes"></button>
|
||||
<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, away changes, and mode changes"></button>
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
|
|
|
@ -23,6 +23,12 @@ function updateText(condensed, addedTypes) {
|
|||
constants.condensedTypes.forEach((type) => {
|
||||
if (obj[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":
|
||||
strings.push(obj[type] + (obj[type] > 1 ? " users have joined the channel" : " user has joined the channel"));
|
||||
break;
|
||||
|
|
|
@ -60,6 +60,8 @@ const commands = [
|
|||
];
|
||||
|
||||
const actionTypes = [
|
||||
"away",
|
||||
"back",
|
||||
"ban_list",
|
||||
"invite",
|
||||
"join",
|
||||
|
@ -77,6 +79,8 @@ const actionTypes = [
|
|||
];
|
||||
|
||||
const condensedTypes = [
|
||||
"away",
|
||||
"back",
|
||||
"join",
|
||||
"part",
|
||||
"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 = {
|
||||
actions: {
|
||||
action: require("./actions/action.tpl"),
|
||||
away: require("./actions/away.tpl"),
|
||||
back: require("./actions/back.tpl"),
|
||||
ban_list: require("./actions/ban_list.tpl"),
|
||||
channel_list: require("./actions/channel_list.tpl"),
|
||||
ctcp: require("./actions/ctcp.tpl"),
|
||||
|
|
|
@ -15,6 +15,7 @@ module.exports = Client;
|
|||
|
||||
var id = 0;
|
||||
var events = [
|
||||
"away",
|
||||
"connection",
|
||||
"unhandled",
|
||||
"banlist",
|
||||
|
|
|
@ -29,7 +29,9 @@ class Msg {
|
|||
|
||||
Msg.Type = {
|
||||
UNHANDLED: "unhandled",
|
||||
AWAY: "away",
|
||||
ACTION: "action",
|
||||
BACK: "back",
|
||||
ERROR: "error",
|
||||
INVITE: "invite",
|
||||
JOIN: "join",
|
||||
|
|
|
@ -7,6 +7,7 @@ module.exports = User;
|
|||
function User(attr, prefixLookup) {
|
||||
_.defaults(this, attr, {
|
||||
modes: [],
|
||||
away: "",
|
||||
mode: "",
|
||||
nick: "",
|
||||
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 a new issue