Skip to main content
calmchessplayer
Inspiring
Oct 1, 2009 3:06 PM UTC
Question

recjectConnectionn not rejecting .

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 is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    ghost31379
    Inspiring
    Oct 3, 2009 7:03 AM UTC

    hrmmmm......try using

    this.rejectConnection(client, errorObj);

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

    thelegendaryghost

    Translate
    calmchessplayer
    Inspiring
    Oct 3, 2009 1:27 PM UTC

    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.

    Translate
    Oct 3, 2009 7:30 PM UTC

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

    Translate