parent
09b2cd7527
commit
dc8c10f461
@ -38,20 +38,15 @@ module.exports = function(irc, network) {
|
|||||||
|
|
||||||
function handleMessage(data) {
|
function handleMessage(data) {
|
||||||
let chan;
|
let chan;
|
||||||
const from = chan.getUser(data.nick);
|
let from;
|
||||||
const msg = new Msg({
|
let highlight = false;
|
||||||
type: data.type,
|
let showInActive = false;
|
||||||
time: data.time,
|
const self = data.nick === irc.user.nick;
|
||||||
text: data.message,
|
|
||||||
self: data.nick === irc.user.nick,
|
|
||||||
from: from,
|
|
||||||
highlight: false,
|
|
||||||
users: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
// Server messages go to server window, no questions asked
|
// Server messages go to server window, no questions asked
|
||||||
if (data.from_server) {
|
if (data.from_server) {
|
||||||
chan = network.channels[0];
|
chan = network.channels[0];
|
||||||
|
from = chan.getUser(data.nick);
|
||||||
} else {
|
} else {
|
||||||
let target = data.target;
|
let target = data.target;
|
||||||
|
|
||||||
@ -65,7 +60,7 @@ module.exports = function(irc, network) {
|
|||||||
if (typeof chan === "undefined") {
|
if (typeof chan === "undefined") {
|
||||||
// Send notices that are not targeted at us into the server window
|
// Send notices that are not targeted at us into the server window
|
||||||
if (data.type === Msg.Type.NOTICE) {
|
if (data.type === Msg.Type.NOTICE) {
|
||||||
msg.showInActive = true;
|
showInActive = true;
|
||||||
chan = network.channels[0];
|
chan = network.channels[0];
|
||||||
} else {
|
} else {
|
||||||
chan = new Chan({
|
chan = new Chan({
|
||||||
@ -80,14 +75,31 @@ module.exports = function(irc, network) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
from = chan.getUser(data.nick);
|
||||||
|
|
||||||
// Query messages (unless self) always highlight
|
// Query messages (unless self) always highlight
|
||||||
if (chan.type === Chan.Type.QUERY) {
|
if (chan.type === Chan.Type.QUERY) {
|
||||||
msg.highlight = !msg.self;
|
highlight = !self;
|
||||||
} else if (chan.type === Chan.Type.CHANNEL) {
|
} else if (chan.type === Chan.Type.CHANNEL) {
|
||||||
from.lastMessage = data.time || Date.now();
|
from.lastMessage = data.time || Date.now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// msg is constructed down here because `from` is being copied in the constructor
|
||||||
|
const msg = new Msg({
|
||||||
|
type: data.type,
|
||||||
|
time: data.time,
|
||||||
|
text: data.message,
|
||||||
|
self: self,
|
||||||
|
from: from,
|
||||||
|
highlight: highlight,
|
||||||
|
users: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (showInActive) {
|
||||||
|
msg.showInActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Self messages in channels are never highlighted
|
// Self messages in channels are never highlighted
|
||||||
// Non-self messages are highlighted as soon as the nick is detected
|
// Non-self messages are highlighted as soon as the nick is detected
|
||||||
if (!msg.highlight && !msg.self) {
|
if (!msg.highlight && !msg.self) {
|
||||||
|
Loading…
Reference in New Issue
Block a user