From 0f82faaef8c96ff981d63b9909a9f4047f90c2fe Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sun, 26 Jan 2014 00:13:33 -0600 Subject: [PATCH] More fixes --- lib/channel-new.js | 14 ++++++++++++++ lib/user.js | 12 ++++++++++++ www/assets/js/util.js | 10 +++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/lib/channel-new.js b/lib/channel-new.js index 70eae989..bac6e95d 100644 --- a/lib/channel-new.js +++ b/lib/channel-new.js @@ -1137,6 +1137,20 @@ Channel.prototype.sendRecentChat = function (users) { }); }; +/** + * Sends a user profile + */ +Channel.prototype.sendUserProfile = function (users, user) { + var packet = { + name: user.name, + profile: user.profile + }; + + users.forEach(function (u) { + u.socket.emit("setUserProfile", packet); + }); +}; + /** * Packs userdata for addUser or userlist */ diff --git a/lib/user.js b/lib/user.js index 856267ce..6158c801 100644 --- a/lib/user.js +++ b/lib/user.js @@ -58,6 +58,18 @@ function User(socket) { if (announcement != null) { self.socket.emit("announcement", announcement); } + + self.on("login", function () { + db.recordVisit(self.ip, self.name); + db.users.getProfile(self.name, function (err, profile) { + if (!err) { + self.profile = profile; + if (self.inChannel()) { + self.channel.sendUserProfile(self.channel.users, self); + } + } + }); + }); } /** diff --git a/www/assets/js/util.js b/www/assets/js/util.js index eae3a57f..52334df7 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -119,8 +119,10 @@ function formatUserlistItem(div) { $("").text(meta.ip).appendTo(profile); } if (meta.aliases) { - $("

").text("aliases: " + meta.aliases.join(", ")).appendTo(profile); + $("
").appendTo(profile); + $("").text("aliases: " + meta.aliases.join(", ")).appendTo(profile); } + $("


").css("margin-top", "5px").css("margin-bottom", "5px").appendTo(profile); $("

").text(data.profile.text).appendTo(profile); }); name.mousemove(function(ev) { @@ -642,7 +644,9 @@ function applyOpts() { .appendTo($("head")); } - switch(USEROPTS.layout) { + switch (USEROPTS.layout) { + case "synchtube-fluid": + fluidLayout(); case "synchtube": synchtubeLayout(); break; @@ -657,7 +661,7 @@ function applyOpts() { $("#qualitywrap").html(""); $("#videowrap").remove(); $("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-lg-12 col-md-12"); - $("#chatline").removeClass().addClass("col-lg-12 col-md-12"); + $("#chatline").removeClass().addClass("col-lg-12 col-md-12 form-control"); } $("#chatbtn").remove();