*[SOLVED] !!*
Here's a server-side script to manage user's name and pubid and a command to
get connected user's pubid!
var userlist = new $H;
var usertable = new $H;
Ape.registerHookCmd("connect", function(params, cmd) {
if (!$defined(params) || !$defined(params.name)) 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"];
cmd.user.setProperty('name', params.name);
return 1;
});
Ape.addEvent('adduser', function(user) {
usertable.set(user.getProperty('name').toLowerCase(),user.getProperty('pubid'));
userlist.set(user.getProperty('name').toLowerCase(), true);
});
Ape.addEvent('deluser', function(user) {
userlist.erase(user.getProperty('name').toLowerCase());
usertable.erase(user.getProperty('name').toLowerCase());
});
Ape.registerCmd('getUserPubid',true,function(params,infos){
infos.user.pipe.sendRaw('userpubid',{'userlist':userlist,
'usertable':usertable});
infos.user.pipe.sendRaw('userpubid',{'pubid':usertable.get(params.name.toLowerCase())});
});
I hope you find it useful.
Salut!
carles.
--
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/