Add support for IRCv3 server-time

This commit is contained in:
Pavel Djundik 2016-03-12 11:36:55 +02:00 committed by Maxime Poulin
parent 7baf5f0f81
commit 516ccd965f
9 changed files with 14 additions and 1 deletions

View File

@ -28,8 +28,13 @@ function Msg(attr) {
from: "", from: "",
id: id++, id: id++,
text: "", text: "",
time: new Date(),
type: Msg.Type.MESSAGE, type: Msg.Type.MESSAGE,
self: false self: false
}, attr)); }, attr));
if (attr.time > 0) {
attr.time = new Date(attr.time);
} else {
attr.time = new Date();
}
} }

View File

@ -24,6 +24,7 @@ module.exports = function(irc, network) {
chan: chan.id chan: chan.id
}); });
var msg = new Msg({ var msg = new Msg({
time: data.time,
from: data.nick, from: data.nick,
hostmask: data.ident + "@" + data.hostname, hostmask: data.ident + "@" + data.hostname,
type: Msg.Type.JOIN, type: Msg.Type.JOIN,

View File

@ -21,6 +21,7 @@ module.exports = function(irc, network) {
var msg = new Msg({ var msg = new Msg({
type: Msg.Type.KICK, type: Msg.Type.KICK,
time: data.time,
mode: chan.getMode(data.nick), mode: chan.getMode(data.nick),
from: data.nick, from: data.nick,
target: data.kicked, target: data.kicked,

View File

@ -65,6 +65,7 @@ module.exports = function(irc, network) {
var msg = new Msg({ var msg = new Msg({
type: data.type, type: data.type,
time: data.time,
mode: chan.getMode(data.nick), mode: chan.getMode(data.nick),
from: data.nick, from: data.nick,
text: data.msg, text: data.msg,

View File

@ -24,6 +24,7 @@ module.exports = function(irc, network) {
} }
var msg = new Msg({ var msg = new Msg({
time: data.time,
type: Msg.Type.MODE, type: Msg.Type.MODE,
mode: (targetChan.type !== Chan.Type.LOBBY && targetChan.getMode(data.nick)) || "", mode: (targetChan.type !== Chan.Type.LOBBY && targetChan.getMode(data.nick)) || "",
from: data.nick, from: data.nick,

View File

@ -34,6 +34,7 @@ module.exports = function(irc, network) {
chan: chan.id chan: chan.id
}); });
var msg = new Msg({ var msg = new Msg({
time: data.time,
type: Msg.Type.NICK, type: Msg.Type.NICK,
mode: chan.getMode(data.newnick), mode: chan.getMode(data.newnick),
nick: data.nick, nick: data.nick,

View File

@ -23,6 +23,7 @@ module.exports = function(irc, network) {
}); });
var msg = new Msg({ var msg = new Msg({
type: Msg.Type.PART, type: Msg.Type.PART,
time: data.time,
mode: (user && user.mode) || "", mode: (user && user.mode) || "",
text: data.message || "", text: data.message || "",
hostmask: data.ident + "@" + data.hostname, hostmask: data.ident + "@" + data.hostname,

View File

@ -15,6 +15,7 @@ module.exports = function(irc, network) {
chan: chan.id chan: chan.id
}); });
var msg = new Msg({ var msg = new Msg({
time: data.time,
type: Msg.Type.QUIT, type: Msg.Type.QUIT,
mode: user.mode || "", mode: user.mode || "",
text: data.message || "", text: data.message || "",

View File

@ -10,6 +10,7 @@ module.exports = function(irc, network) {
} }
var msg = new Msg({ var msg = new Msg({
time: data.time,
type: Msg.Type.TOPIC, type: Msg.Type.TOPIC,
mode: (data.nick && chan.getMode(data.nick)) || "", mode: (data.nick && chan.getMode(data.nick)) || "",
from: data.nick, from: data.nick,