mirror of
https://github.com/calzoneman/sync.git
synced 2024-09-13 04:32:09 +00:00
Adding user socket disconnect callback for anonymous check.
This commit is contained in:
parent
18819e7553
commit
6e31e0aad3
@ -12,6 +12,12 @@ AnonymousCheck.prototype.onUserPreJoin = function (user, data, cb) {
|
||||
opts = this.channel.modules.options;
|
||||
var anonymousBanned = opts.get("block_anonymous_users");
|
||||
if(anonymousBanned && user.isAnonymous()) {
|
||||
user.socket.on("disconnect", function () {
|
||||
if (!user.is(Flags.U_IN_CHANNEL)) {
|
||||
cb("User disconnected", ChannelModule.DENY);
|
||||
}
|
||||
});
|
||||
|
||||
user.socket.emit("errorMsg", { msg : "This channel has blocked anonymous users. Please provide a user name to join."});
|
||||
user.waitFlag(Flags.U_LOGGED_IN, function () {
|
||||
cb(null, ChannelModule.PASSTHROUGH);
|
||||
|
Loading…
x
Reference in New Issue
Block a user