Handle invites

Requires irc-fw update
This commit is contained in:
Pavel Djundik 2016-03-26 01:26:53 +02:00 committed by Maxime Poulin
parent 3fc7036d32
commit 142aa85548
2 changed files with 7 additions and 8 deletions

View File

@ -3,7 +3,7 @@ invited
{{#if invitedYou}} {{#if invitedYou}}
you you
{{else}} {{else}}
<a href="#" class="user" data-name="{{target}}">{{target}}</a> <a href="#" class="user" data-name="{{invited}}">{{invited}}</a>
{{/if}} {{/if}}
to to
{{{parse text}}} {{{parse channel}}}

View File

@ -3,8 +3,6 @@ var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {
var client = this; var client = this;
irc.on("invite", function(data) { irc.on("invite", function(data) {
var target = data.to;
var chan = network.getChannel(data.channel); var chan = network.getChannel(data.channel);
if (typeof chan === "undefined") { if (typeof chan === "undefined") {
chan = network.channels[0]; chan = network.channels[0];
@ -12,10 +10,11 @@ module.exports = function(irc, network) {
var msg = new Msg({ var msg = new Msg({
type: Msg.Type.INVITE, type: Msg.Type.INVITE,
from: data.from, time: data.time,
target: target, from: data.nick,
text: data.channel, invited: data.invited,
invitedYou: target === irc.user.nick channel: data.channel,
invitedYou: data.invited === irc.user.nick
}); });
chan.messages.push(msg); chan.messages.push(msg);
client.emit("msg", { client.emit("msg", {