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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.broadcastBanlist();
|
//this.broadcastBanlist();
|
||||||
this.logger.log(name + " was banned by " + actor.name);
|
this.logger.log(name + " was banned by " + actor.name);
|
||||||
if(!this.registered) {
|
if(!this.registered) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -383,7 +383,7 @@ Channel.prototype.unbanName = function(actor, name) {
|
||||||
|
|
||||||
this.namebans[name] = null;
|
this.namebans[name] = null;
|
||||||
delete this.namebans[name];
|
delete this.namebans[name];
|
||||||
this.broadcastBanlist();
|
//this.broadcastBanlist();
|
||||||
this.logger.log(name + " was unbanned by " + actor.name);
|
this.logger.log(name + " was unbanned by " + actor.name);
|
||||||
|
|
||||||
return Database.channelUnbanName(this.name, 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.ipbans[ip] = [name, actor.name];
|
||||||
chan.broadcastBanlist();
|
//chan.broadcastBanlist();
|
||||||
chan.logger.log(ip + " (" + name + ") was banned by " + actor.name);
|
chan.logger.log(ip + " (" + name + ") was banned by " + actor.name);
|
||||||
|
|
||||||
for(var i = 0; i < chan.users.length; i++) {
|
for(var i = 0; i < chan.users.length; i++) {
|
||||||
|
@ -443,7 +443,7 @@ Channel.prototype.banIP = function(actor, receiver) {
|
||||||
catch(e) {
|
catch(e) {
|
||||||
// Socket already disconnected
|
// Socket already disconnected
|
||||||
}
|
}
|
||||||
this.broadcastBanlist();
|
//this.broadcastBanlist();
|
||||||
this.logger.log(receiver.ip + " (" + receiver.name + ") was banned by " + actor.name);
|
this.logger.log(receiver.ip + " (" + receiver.name + ") was banned by " + actor.name);
|
||||||
|
|
||||||
if(!this.registered)
|
if(!this.registered)
|
||||||
|
@ -462,7 +462,7 @@ Channel.prototype.unbanIP = function(actor, ip) {
|
||||||
if(!this.registered)
|
if(!this.registered)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this.broadcastBanlist();
|
//this.broadcastBanlist();
|
||||||
// Update database ban table
|
// Update database ban table
|
||||||
return Database.channelUnbanIP(this.name, ip);
|
return Database.channelUnbanIP(this.name, ip);
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ Channel.prototype.sendLoginHistory = function(user) {
|
||||||
user.socket.emit("recentLogins", this.login_hist);
|
user.socket.emit("recentLogins", this.login_hist);
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel.prototype.sendRankStuff = function(user) {
|
Channel.prototype.sendBanlist = function(user) {
|
||||||
if(this.hasPermission(user, "ban")) {
|
if(this.hasPermission(user, "ban")) {
|
||||||
var ents = [];
|
var ents = [];
|
||||||
for(var ip in this.ipbans) {
|
for(var ip in this.ipbans) {
|
||||||
|
@ -670,26 +670,10 @@ Channel.prototype.sendRankStuff = function(user) {
|
||||||
}
|
}
|
||||||
user.socket.emit("banlist", ents);
|
user.socket.emit("banlist", ents);
|
||||||
}
|
}
|
||||||
// TODO get rid of this
|
}
|
||||||
if(Rank.hasPermission(user, "seenlogins")) {
|
|
||||||
var ents = [];
|
Channel.prototype.sendRankStuff = function(user) {
|
||||||
for(var ip in this.ip_alias) {
|
this.sendBanlist(user);
|
||||||
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});
|
|
||||||
}
|
|
||||||
if(this.hasPermission(user, "filteredit")) {
|
if(this.hasPermission(user, "filteredit")) {
|
||||||
var filts = new Array(this.filters.length);
|
var filts = new Array(this.filters.length);
|
||||||
for(var i = 0; i < this.filters.length; i++) {
|
for(var i = 0; i < this.filters.length; i++) {
|
||||||
|
@ -806,10 +790,24 @@ Channel.prototype.broadcastNewUser = function(user) {
|
||||||
meta: user.meta,
|
meta: user.meta,
|
||||||
profile: user.profile
|
profile: user.profile
|
||||||
});
|
});
|
||||||
this.sendRankStuff(user);
|
//this.sendRankStuff(user);
|
||||||
if(user.rank > Rank.Guest) {
|
if(user.rank > Rank.Guest) {
|
||||||
this.saveRank(user);
|
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) {
|
Channel.prototype.broadcastUserUpdate = function(user) {
|
||||||
|
|
6
user.js
6
user.js
|
@ -385,6 +385,12 @@ User.prototype.initCallbacks = function() {
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
this.socket.on("requestBanlist", function() {
|
||||||
|
if(this.channel != null) {
|
||||||
|
this.channel.sendBanlist(this);
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
this.socket.on("requestAcl", function() {
|
this.socket.on("requestAcl", function() {
|
||||||
if(this.channel != null) {
|
if(this.channel != null) {
|
||||||
this.channel.sendACL(this);
|
this.channel.sendACL(this);
|
||||||
|
|
|
@ -185,6 +185,12 @@ html, body {
|
||||||
color: #888888;
|
color: #888888;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.server-whisper {
|
||||||
|
font-style: italic;
|
||||||
|
color: #888888;
|
||||||
|
font-size: 8pt;
|
||||||
|
}
|
||||||
|
|
||||||
.spoiler {
|
.spoiler {
|
||||||
color: #000000;
|
color: #000000;
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
clickHandler("#show_cssedit", "#cssedit");
|
clickHandler("#show_cssedit", "#cssedit");
|
||||||
clickHandler("#show_jsedit", "#jsedit");
|
clickHandler("#show_jsedit", "#jsedit");
|
||||||
clickHandler("#show_banlist", "#banlist");
|
clickHandler("#show_banlist", "#banlist");
|
||||||
|
$("#show_banlist").click(function() {
|
||||||
|
socket.emit("requestBanlist");
|
||||||
|
});
|
||||||
clickHandler("#show_loginhistory", "#loginhistory");
|
clickHandler("#show_loginhistory", "#loginhistory");
|
||||||
$("#show_loginhistory").click(function() {
|
$("#show_loginhistory").click(function() {
|
||||||
socket.emit("requestLoginHistory");
|
socket.emit("requestLoginHistory");
|
||||||
|
|
|
@ -647,6 +647,7 @@ function handlePermissionChange() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CLIENT.rank >= 2) {
|
if(CLIENT.rank >= 2) {
|
||||||
|
$("#channelsettingswrap3").show();
|
||||||
if($("#channelsettingswrap").html() == "")
|
if($("#channelsettingswrap").html() == "")
|
||||||
$("#channelsettingswrap").load("channeloptions.html");
|
$("#channelsettingswrap").load("channeloptions.html");
|
||||||
/* update channel controls */
|
/* update channel controls */
|
||||||
|
@ -661,11 +662,12 @@ function handlePermissionChange() {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#channelsettingswrap").html("");
|
$("#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"));
|
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
||||||
setVisible("#qlockbtn", CLIENT.rank >= 2);
|
setVisible("#qlockbtn", CLIENT.rank >= 2);
|
||||||
|
|
||||||
|
@ -937,6 +939,9 @@ function formatChatMessage(data) {
|
||||||
if(data.msgclass == "drink" || data.msgclass == "shout") {
|
if(data.msgclass == "drink" || data.msgclass == "shout") {
|
||||||
skip = false;
|
skip = false;
|
||||||
}
|
}
|
||||||
|
if(data.msgclass == "server-whisper") {
|
||||||
|
skip = true;
|
||||||
|
}
|
||||||
LASTCHATNAME = data.username;
|
LASTCHATNAME = data.username;
|
||||||
LASTCHATTIME = data.time;
|
LASTCHATTIME = data.time;
|
||||||
var div = $("<div/>");
|
var div = $("<div/>");
|
||||||
|
@ -944,6 +949,8 @@ function formatChatMessage(data) {
|
||||||
var time = $("<span/>").addClass("timestamp").appendTo(div);
|
var time = $("<span/>").addClass("timestamp").appendTo(div);
|
||||||
var timestamp = new Date(data.time).toTimeString().split(" ")[0];
|
var timestamp = new Date(data.time).toTimeString().split(" ")[0];
|
||||||
time.text("["+timestamp+"] ");
|
time.text("["+timestamp+"] ");
|
||||||
|
if(data.msgclass != "greentext" && data.msgclass != "drink")
|
||||||
|
time.addClass(data.msgclass);
|
||||||
}
|
}
|
||||||
var name = $("<span/>");
|
var name = $("<span/>");
|
||||||
if(!skip) {
|
if(!skip) {
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- user playlists -->
|
<!-- 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">
|
<div class="span12 pointer" id="userpltoggle">
|
||||||
<i class="icon-plus pull-left"></i>
|
<i class="icon-plus pull-left"></i>
|
||||||
<p>Show Playlist Manager</p>
|
<p>Show Playlist Manager</p>
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
<!-- electric boogaloo -->
|
<!-- electric boogaloo -->
|
||||||
<div class="span12" id="queue_align2"></div>
|
<div class="span12" id="queue_align2"></div>
|
||||||
<!-- playlist controls -->
|
<!-- 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">
|
<div class="span12 pointer" id="playlisttoggle">
|
||||||
<i class="icon-plus pull-left"></i>
|
<i class="icon-plus pull-left"></i>
|
||||||
<p>Show Playlist Controls</p>
|
<p>Show Playlist Controls</p>
|
||||||
|
|
Loading…
Reference in New Issue