powered by Jive Software

In Multi User Chat notification about kick event

i have joined room in openfire. .But some reasons admin kicked me out of room .There are multiple occupants in room .All occupant are notified about my kick event . But i dont get any notification of admin was kicked me from room ?

'How to i get notification about kick event ?

I am using aSmack (Android) library.

Thanks in advance.

Hi, the follwing docs may help you

http://xmpp.org/extensions/xep-0045.html

8.2 Kicking an Occupant

After informing the moderator, the service MUST then inform all of the remaining occupants that the kicked occupant is no longer in the room by sending presence stanzas of type “unavailable” from the individual’s roomnick (<room@service/nick>) to all the remaining occupants (just as it does when occupants exit the room of their own volition), including the status code and optionally the reason and actor.

here is my code

1:banUser

2:send presence to other members in this MultiUserChat

public boolean banUser(IMMUCBean mucBean , MultiUserChat muc , String memberJid){

boolean result = true;

try {

muc.banUser(memberJid, null);

MUCUser.Status status = new MUCUser.Status(“301”);

String from = mucBean.getId()+"/"+sConnection.getUser();

MUCUser mucUser = new MUCUser();

MUCUser.Item item = new MUCUser.Item(“outcast”, “none”);

item.setJid(memberJid);

item.setActor(StringUtils.parseBareAddress(sConnection.getUser() ));

mucUser.setItem(item);

mucUser.setStatus(status);

List members = mucBean.getEntities();

for(IMFriendBean member:members){

if(member.getId().equals(memberJid))//不再对被踢者发送了

continue;

Presence presence = new Presence(Presence.Type.unavailable);

presence.addExtension(mucUser);

presence.setFrom(from);

presence.setTo(member.getId());

LogUtils.e(tag, “踢人 对外presence:”+presence.toXML());

sConnection.sendPacket(presence);

}

} catch (XMPPException e) {

LogUtils.e(tag, “ban user failed…”);

result = false;

}

return result;

}