Handle nick
This commit is contained in:
parent
4d986537bc
commit
9ab71b2588
@ -1,3 +1,3 @@
|
||||
<a href="#" class="user" data-name="{{from}}">{{mode}}{{from}}</a>
|
||||
<a href="#" class="user" data-name="{{from}}">{{mode}}{{nick}}</a>
|
||||
is now known as
|
||||
<a href="#" class="user" data-name="{{text}}">{{mode}}{{text}}</a>
|
||||
<a href="#" class="user" data-name="{{text}}">{{mode}}{{newnick}}</a>
|
||||
|
@ -5,11 +5,10 @@ module.exports = function(irc, network) {
|
||||
var client = this;
|
||||
irc.on("nick", function(data) {
|
||||
var self = false;
|
||||
var nick = data["new"];
|
||||
if (nick === irc.user.nick) {
|
||||
if (data.nick === irc.user.nick) {
|
||||
var lobby = network.channels[0];
|
||||
var msg = new Msg({
|
||||
text: "You're now known as " + nick,
|
||||
text: "You're now known as " + data.newnick,
|
||||
});
|
||||
lobby.messages.push(msg);
|
||||
client.emit("msg", {
|
||||
@ -20,23 +19,25 @@ module.exports = function(irc, network) {
|
||||
client.save();
|
||||
client.emit("nick", {
|
||||
network: network.id,
|
||||
nick: nick
|
||||
nick: data.newnick
|
||||
});
|
||||
}
|
||||
|
||||
network.channels.forEach(function(chan) {
|
||||
var user = _.find(chan.users, {name: data.nick});
|
||||
if (typeof user === "undefined") {
|
||||
return;
|
||||
}
|
||||
user.name = nick;
|
||||
user.name = data.newnick;
|
||||
chan.sortUsers();
|
||||
client.emit("users", {
|
||||
chan: chan.id
|
||||
});
|
||||
var msg = new Msg({
|
||||
type: Msg.Type.NICK,
|
||||
from: data.nick,
|
||||
text: nick,
|
||||
mode: chan.getMode(data.newnick),
|
||||
nick: data.nick,
|
||||
newnick: data.newnick,
|
||||
self: self
|
||||
});
|
||||
chan.messages.push(msg);
|
||||
|
Loading…
Reference in New Issue
Block a user