Hi,
I stuck with channel left problem, I've made registerCmd left all channel
for each user, after join channel I keep the channel list array in user
object, than after trigger left channel all command (registerCmd "leftall")
will loop channel list and left the channel one by one.
But when doing loop, I just get first channel left, than after that aped
died, something wrong with my code?
please help, appreciate it, thank you. here my code :
Ape.addEvent("afterJoin", function(user, channel) {
channel.userslist.set(user.getProperty('pubid'),user);
chanlist = new Array();
if(user.getProperty('channel')==null){
chanlist.push(channel.getProperty('name'));
}else{
chanlist = user.getProperty('channel');
chanlist.push(channel.getProperty('name'));
}
user.setProperty('channel',chanlist);
Ape.log('UserGetProperty: '+
user.getProperty('channel').toString());
Ape.log("JOIN CHANNEL " + user.getProperty('name') + " " +
channel.getProperty('name'));
switch(channel.getProperty('name'))
{
case ChlAdmin.ListUser :
i = 0;
userlist.each(function(v,k)
{
v.each(function(pubid)
{
jsonObj['user'+i] = k;
jsonObj['ip'+i] =
Ape.getUserByPubid(pubid).getProperty('ip');
i++;
});
});
jsonObj.count = i;
info.user.pipe.sendRaw(Package.ListUser, jsonObj);
break;
}
});
Ape.registerCmd("leftall", false, function(params,info){
user = info.user;
if(user == null)
{
Ape.log("leftall - user is null");
}
else
{
chanlist = user.getProperty('channel');
Ape.log("channel found : " +chanlist.length);
if(chanlist != null){
for(i = 0; i < chanlist.length; i++){
Ape.log("loop chanlist : " + i);
Ape.log("user left all channel : "
+chanlist[i]);
user.left(chanlist[i]);
};
user.setProperty('channel', null);
}
}
});
--
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.