I was having some troubles with the registerHookCmd command.

I had extended the nickname.js example with some gender and age
properties. But if I want to check them if they are valid on the
server side I get an endless loop on the client side:

Server side:
Ape.registerHookCmd("connect", function(params, cmd) {
        if (!$defined(params) || !$defined(params.name) || !
$defined(params.age)|| !$defined(params.gender)) return 0;
        if (userlist.has(params.name.toLowerCase())) return ["007",
"NICK_USED"];
        if (params.name.length > 16 || params.name.test('[^a-zA-
Z0-9]', 'i')) return ["006", "BAD_NICK"];
        if (params.age.toInt() < 1) return ["008","BAD_AGE"];

        cmd.user.setProperty('name', params.name);
        cmd.user.setProperty('age',params.age);
        return 1;
});

Client-side:
If i enter a wrong age, but a valid name the login form keeps on
coming on the screen.... is this due to the fact that the name is
valid and then it tries to connect constantly?

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to