Skip to main content
calmchessplayer
Inspiring
October 1, 2009
Question

recjectConnectionn not rejecting .

  • October 1, 2009
  • 1 reply
  • 933 views

The following is a code snippet that i'm trying to use to expell a banned user from my chat....everything works great except the rejectConnection part for some reason no matter how i set it will not reject the connection can you spot the trouble?

application.onConnect = function(client,userName,userType) {

var a = application.banned_so.getProperty("banned_so");
        for(i=0;i<a.length;i++){
         if (a==userName) {
             var errorObj = new Object();
             errorObj.msg = "You are banned";
             application.rejectConnection(client, errorObj);
             break;
            
         };
     };

    This topic has been closed for replies.

    1 reply

    ghost31379
    Inspiring
    October 3, 2009

    hrmmmm......try using

    this.rejectConnection(client, errorObj);

    instead of application......see if that works....then i'll wrap my brain around if not.

    thelegendaryghost

    calmchessplayer
    Inspiring
    October 3, 2009

    Yeah i've tried this and application and neither one works does it have anything to do with the fact that I accept the connection  after this bit of script runs.....I've read that you can only have one or the other........right now my work around is i use return before the connection is accepted instead of rejectConnection.

    October 3, 2009

    Syntax seems right. Are you certain that a==userName is evaluating true at some point?