diff --git a/lib/plugins/join.js b/lib/plugins/join.js index b4f46fb7..15cd80ee 100644 --- a/lib/plugins/join.js +++ b/lib/plugins/join.js @@ -1,6 +1,7 @@ var _ = require("lodash"); var Chan = require("../models/chan"); var Msg = require("../models/msg"); +var User = require("../models/user"); module.exports = function(client, sockets) { var network = this; @@ -16,6 +17,13 @@ module.exports = function(client, sockets) { chan: chan, }); } + var users = chan.users; + users.push(new User({name: data.nick})); + chan.sortUsers(); + sockets.in("chat").emit("users", { + id: chan.id, + users: users, + }); var msg = new Msg({ from: data.nick, type: "join",