mirror of https://github.com/calzoneman/sync.git
Notify moderators when a new user joins
This commit is contained in:
parent
449d01180a
commit
6f43a7efdc
52
channel.js
52
channel.js
|
@ -367,7 +367,7 @@ Channel.prototype.tryNameBan = function(actor, name) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
this.broadcastBanlist();
|
||||
//this.broadcastBanlist();
|
||||
this.logger.log(name + " was banned by " + actor.name);
|
||||
if(!this.registered) {
|
||||
return false;
|
||||
|
@ -383,7 +383,7 @@ Channel.prototype.unbanName = function(actor, name) {
|
|||
|
||||
this.namebans[name] = null;
|
||||
delete this.namebans[name];
|
||||
this.broadcastBanlist();
|
||||
//this.broadcastBanlist();
|
||||
this.logger.log(name + " was unbanned by " + actor.name);
|
||||
|
||||
return Database.channelUnbanName(this.name, name);
|
||||
|
@ -414,7 +414,7 @@ Channel.prototype.tryIPBan = function(actor, name, range) {
|
|||
}
|
||||
}
|
||||
chan.ipbans[ip] = [name, actor.name];
|
||||
chan.broadcastBanlist();
|
||||
//chan.broadcastBanlist();
|
||||
chan.logger.log(ip + " (" + name + ") was banned by " + actor.name);
|
||||
|
||||
for(var i = 0; i < chan.users.length; i++) {
|
||||
|
@ -443,7 +443,7 @@ Channel.prototype.banIP = function(actor, receiver) {
|
|||
catch(e) {
|
||||
// Socket already disconnected
|
||||
}
|
||||
this.broadcastBanlist();
|
||||
//this.broadcastBanlist();
|
||||
this.logger.log(receiver.ip + " (" + receiver.name + ") was banned by " + actor.name);
|
||||
|
||||
if(!this.registered)
|
||||
|
@ -462,7 +462,7 @@ Channel.prototype.unbanIP = function(actor, ip) {
|
|||
if(!this.registered)
|
||||
return false;
|
||||
|
||||
this.broadcastBanlist();
|
||||
//this.broadcastBanlist();
|
||||
// Update database ban table
|
||||
return Database.channelUnbanIP(this.name, ip);
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ Channel.prototype.sendLoginHistory = function(user) {
|
|||
user.socket.emit("recentLogins", this.login_hist);
|
||||
}
|
||||
|
||||
Channel.prototype.sendRankStuff = function(user) {
|
||||
Channel.prototype.sendBanlist = function(user) {
|
||||
if(this.hasPermission(user, "ban")) {
|
||||
var ents = [];
|
||||
for(var ip in this.ipbans) {
|
||||
|
@ -670,26 +670,10 @@ Channel.prototype.sendRankStuff = function(user) {
|
|||
}
|
||||
user.socket.emit("banlist", ents);
|
||||
}
|
||||
// TODO get rid of this
|
||||
if(Rank.hasPermission(user, "seenlogins")) {
|
||||
var ents = [];
|
||||
for(var ip in this.ip_alias) {
|
||||
var disp = ip;
|
||||
if(user.rank < Rank.Siteadmin) {
|
||||
disp = "(Hidden)";
|
||||
}
|
||||
var banned = (ip in this.ipbans && this.ipbans[ip] != null);
|
||||
var range = ip.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, "$1.$2.$3");
|
||||
banned = banned || (range in this.ipbans && this.ipbans[range] != null);
|
||||
ents.push({
|
||||
ip: disp,
|
||||
id: this.hideIP(ip),
|
||||
names: this.ip_alias[ip],
|
||||
banned: banned
|
||||
});
|
||||
}
|
||||
user.socket.emit("seenlogins", {entries: ents});
|
||||
}
|
||||
}
|
||||
|
||||
Channel.prototype.sendRankStuff = function(user) {
|
||||
this.sendBanlist(user);
|
||||
if(this.hasPermission(user, "filteredit")) {
|
||||
var filts = new Array(this.filters.length);
|
||||
for(var i = 0; i < this.filters.length; i++) {
|
||||
|
@ -806,10 +790,24 @@ Channel.prototype.broadcastNewUser = function(user) {
|
|||
meta: user.meta,
|
||||
profile: user.profile
|
||||
});
|
||||
this.sendRankStuff(user);
|
||||
//this.sendRankStuff(user);
|
||||
if(user.rank > Rank.Guest) {
|
||||
this.saveRank(user);
|
||||
}
|
||||
|
||||
var msg = user.name + " joined (aliases: ";
|
||||
msg += this.ip_alias[user.ip].join(", ") + ")";
|
||||
var pkt = {
|
||||
username: "[server]",
|
||||
msg: msg,
|
||||
msgclass: "server-whisper",
|
||||
time: Date.now()
|
||||
};
|
||||
this.users.forEach(function(u) {
|
||||
if(u.rank >= 2) {
|
||||
u.socket.emit("chatMsg", pkt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Channel.prototype.broadcastUserUpdate = function(user) {
|
||||
|
|
6
user.js
6
user.js
|
@ -385,6 +385,12 @@ User.prototype.initCallbacks = function() {
|
|||
}
|
||||
}.bind(this));
|
||||
|
||||
this.socket.on("requestBanlist", function() {
|
||||
if(this.channel != null) {
|
||||
this.channel.sendBanlist(this);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
this.socket.on("requestAcl", function() {
|
||||
if(this.channel != null) {
|
||||
this.channel.sendACL(this);
|
||||
|
|
|
@ -185,6 +185,12 @@ html, body {
|
|||
color: #888888;
|
||||
}
|
||||
|
||||
.server-whisper {
|
||||
font-style: italic;
|
||||
color: #888888;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
.spoiler {
|
||||
color: #000000;
|
||||
background-color: #000000;
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
clickHandler("#show_cssedit", "#cssedit");
|
||||
clickHandler("#show_jsedit", "#jsedit");
|
||||
clickHandler("#show_banlist", "#banlist");
|
||||
$("#show_banlist").click(function() {
|
||||
socket.emit("requestBanlist");
|
||||
});
|
||||
clickHandler("#show_loginhistory", "#loginhistory");
|
||||
$("#show_loginhistory").click(function() {
|
||||
socket.emit("requestLoginHistory");
|
||||
|
|
|
@ -647,6 +647,7 @@ function handlePermissionChange() {
|
|||
}
|
||||
|
||||
if(CLIENT.rank >= 2) {
|
||||
$("#channelsettingswrap3").show();
|
||||
if($("#channelsettingswrap").html() == "")
|
||||
$("#channelsettingswrap").load("channeloptions.html");
|
||||
/* update channel controls */
|
||||
|
@ -661,11 +662,12 @@ function handlePermissionChange() {
|
|||
}
|
||||
else {
|
||||
$("#channelsettingswrap").html("");
|
||||
$("#channelsettingswrap3").hide();
|
||||
}
|
||||
|
||||
setVisible("#userpltoggle", CLIENT.rank >= 1);
|
||||
setVisible("#userpltogglewrap", CLIENT.rank >= 1);
|
||||
|
||||
setVisible("#playlisttoggle", hasPermission("playlistadd"));
|
||||
setVisible("#playlisttogglewrap", hasPermission("playlistadd"));
|
||||
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
||||
setVisible("#qlockbtn", CLIENT.rank >= 2);
|
||||
|
||||
|
@ -937,6 +939,9 @@ function formatChatMessage(data) {
|
|||
if(data.msgclass == "drink" || data.msgclass == "shout") {
|
||||
skip = false;
|
||||
}
|
||||
if(data.msgclass == "server-whisper") {
|
||||
skip = true;
|
||||
}
|
||||
LASTCHATNAME = data.username;
|
||||
LASTCHATTIME = data.time;
|
||||
var div = $("<div/>");
|
||||
|
@ -944,6 +949,8 @@ function formatChatMessage(data) {
|
|||
var time = $("<span/>").addClass("timestamp").appendTo(div);
|
||||
var timestamp = new Date(data.time).toTimeString().split(" ")[0];
|
||||
time.text("["+timestamp+"] ");
|
||||
if(data.msgclass != "greentext" && data.msgclass != "drink")
|
||||
time.addClass(data.msgclass);
|
||||
}
|
||||
var name = $("<span/>");
|
||||
if(!skip) {
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- user playlists -->
|
||||
<div class="well well-small span12 row-fluid">
|
||||
<div class="well well-small span12 row-fluid" id="userpltogglewrap">
|
||||
<div class="span12 pointer" id="userpltoggle">
|
||||
<i class="icon-plus pull-left"></i>
|
||||
<p>Show Playlist Manager</p>
|
||||
|
@ -141,7 +141,7 @@
|
|||
<!-- electric boogaloo -->
|
||||
<div class="span12" id="queue_align2"></div>
|
||||
<!-- playlist controls -->
|
||||
<div class="well well-small span12 row-fluid">
|
||||
<div class="well well-small span12 row-fluid" id="playlisttogglewrap">
|
||||
<div class="span12 pointer" id="playlisttoggle">
|
||||
<i class="icon-plus pull-left"></i>
|
||||
<p>Show Playlist Controls</p>
|
||||
|
|
Loading…
Reference in New Issue