Merge pull request #3494 from thelounge/xpaw/remove-away-chan

Remove away messages from channels
This commit is contained in:
Pavel Djundik 2019-11-05 12:43:43 +02:00 committed by GitHub
commit 901d96c8cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 32 deletions

View File

@ -55,22 +55,6 @@ export default {
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 "chghost": case "chghost":
strings.push( strings.push(
obj[type] + obj[type] +

View File

@ -19,7 +19,7 @@ const colorCodeMap = [
["15", "Light Grey"], ["15", "Light Grey"],
]; ];
const condensedTypes = ["away", "back", "chghost", "join", "part", "quit", "nick", "kick", "mode"]; const condensedTypes = ["chghost", "join", "part", "quit", "nick", "kick", "mode"];
const condensedTypesQuery = "." + condensedTypes.join(", ."); const condensedTypesQuery = "." + condensedTypes.join(", .");
const timeFormats = { const timeFormats = {

View File

@ -29,7 +29,7 @@ module.exports = function(irc, network) {
let user; let user;
switch (chan.type) { switch (chan.type) {
case Chan.Type.QUERY: case Chan.Type.QUERY: {
if (data.nick.toLowerCase() !== chan.name.toLowerCase()) { if (data.nick.toLowerCase() !== chan.name.toLowerCase()) {
return; return;
} }
@ -44,9 +44,19 @@ module.exports = function(irc, network) {
user = chan.getUser(data.nick); user = chan.getUser(data.nick);
break; const msg = new Msg({
type: type,
text: away || "",
time: data.time,
from: user,
});
case Chan.Type.CHANNEL: chan.pushMessage(client, msg);
break;
}
case Chan.Type.CHANNEL: {
user = chan.findUser(data.nick); user = chan.findUser(data.nick);
if (!user || user.away === away) { if (!user || user.away === away) {
@ -56,19 +66,8 @@ module.exports = function(irc, network) {
user.away = away; user.away = away;
break; break;
}
default:
return;
} }
const msg = new Msg({
type: type,
text: away || "",
time: data.time,
from: user,
});
chan.pushMessage(client, msg);
}); });
} }
}; };