Problem with persistant membered chat room

Hi,

I make a plug-in to automatically create persistent chat room. They are characterized by:

changesubject => no

maxusers => unlimited

presencebroadcast => moderator, participant and visitor

publicroom => yes

persistentroom => yes

moderatedroom => no

membersonly => yes

allowinvites => no

passwordprotectedroom => no

whois => moderator

enablelogging => yes

reservednick => no

canchangenick => no

registration => no

And then, the plug-in add autorized users into such chat rooms by this function:

public void addUserToChat(String roomName, String jid, String username) throws MissingParametersException, ForbiddenException, ConflictException, NotAllowedException, UserNotFoundException {

{color:#660033}if (jid == null || jid.equals("")) {

{color:#660033}throw new MissingParametersException(“Missing jid user”);

}

MUCRoom room = chatManager.getChatRoom(roomName);

if (room == null) {

{color:#660033}throw new ForbiddenException(“Room not exists”);

}

IQ iq = new IQ(IQ.Type.set);

Element frag = iq.setChildElement(“query”, “http://jabber.org/protocol/muc#admin”);

Element item = frag.addElement(“item”);

item.addAttribute(“affiliation”, “member”);

item.addAttribute(“jid”, jid);

item.addAttribute(“nick”, username);

item.addAttribute(“role”, “participant”);

// Send the IQ packet that will modify the room’'s configuration

room.getIQAdminHandler().handleIQ(iq, room.getRole());

room.addMember(jid, username, room.getRole());

room.addParticipant(new JID(jid), null, room.getRole());

}

Note: MissingParametersException is a customized Exception.

My problem is users registered by this method can enter the room but cannot speak or cannot do anything without a “voice” agreed by moderators. Can I modify my function to do this moderator job ?

Thanks,

Bak