Ok, if you sent all parameters at core.start like this :
client.core.start({'name':''+sUsername+'', id: #userId, friends:
[#idFriend1, #idFriend2 ... ]});
You'll then be able on server side with the hook command to get those
parameteres like this :
Ape.registerHookCmd("connect",function(params, cmd) {
Ape.log(params.name);
cmd.user.setProperty('id', params.id); // params.id -> id from
client.core.start
cmd.user.friends = params.friends;
Ape.log(params.friends); // if it's displayed, it's a string.
return 1;
});
If params.friends is a string, you should get it like this :
eval("cmd.user.friends = " + params.friends + ";");
If it says that array is undefined, it's because the second parameter you're
giving to the function "in_array" is undefined. (I guess it was
cmd.user.friends or info.user.friends, depending on the name you gave to the
variable in your callback function).
2011/6/7 Pablo Tejada <[email protected]>
> Ape.log() outputs to the terminal on where you are running(starting) your
> ape server from
>
> And I think you will have to wait for julien's reply because I don't quite
> understand his solution. I'm still trying to wrap my head around what you
> want to do, is not by any means simple as it will requiere lots of
> customization but it can be done.
>
> My idea is that you could send a boolean to the server along with your
> message(via inlinepush) stating if it is for everyone in the channel or for
> your friends only. If a message is for your friends only then you would have
> a MySQL query (on the Ape server, there is a js MySQL object) to get the
> friends of the sender, loop through the channel's userlist and send the
> message through the matched user's pipe instead of the channel. All this
> would go in a custom inlinepush like command on the server. Study the
> inlinepush script in the server to get familiar
> scripts/commands/inlinepush.js
>
>
> --
> 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/
>
--
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/