Find java code to create persistant MUC Room

Hi,

I develop a HTTP Request plug-in, may be like User service, and I’‘m blocked by MUC creation. I don’'t see how to do that.

If someone can help…

Hi,

I wonder what you want to do. You don’'t want to write a (public) plugin like http://server:9090/muc-server-props-edit-form.jsp , do you?

LG

Not, indeed.

What I am programming is Using Service super plug-in.

In fact, it will, finally, make it possible to manage users, rosters and chat rooms by HTTP requests.

User ans Roster manage work good,but I encounter certain difficulties with chatrooms.

Wildfire API did not help me so much.

I have the impression that it misses a Java contructor to continue : MUCRoomImpl().

BA

PS : It’'s more like http://server:9090/muc-room-edit-form.jsp?&create=true but by HTTP Requests.

I make a little bit of wanted code. But it persists some bugs ans it doesn’'t work as well as I would want.

MissingParametersException is my own class to manage the lake of parameters (in HTTP Requests).

public void addChat(String name, String subject, String description)

throws MissingParametersException, ForbiddenException, ConflictException, NotAllowedException {

if (subject == null || subject.equals("")) {

throw new MissingParametersException(“Missing subject”);

}

if (description == null || description.equals("")) {

throw new MissingParametersException(“Missing description”);

}

MUCRoom room = chatManager.getChatRoom(name);

if (room != null) {

throw new ForbiddenException(“Room already exists”);

} else {

// Try to create a new room

JID address = new JID(“jabber”, server.getServerInfo().getName(), null);

room = chatManager.getChatRoom(name, address);

// Check if the room was created concurrently by another user

if (!room.getOwners().contains(address.toBareJID())) {

throw new ForbiddenException(“Room already exists”);

}

}

// Define public name

room.setNaturalLanguageName(name);

// Define room subject

room.setSubject(subject);

// Define room description

room.setDescription(description);

// Define of statics parameters like unlimited users, no password, …

room.saveToDB();

room.setSavedToDB(true);

}

public void updateChat(String name, String subject, String description)

throws MissingParametersException, ForbiddenException {

if (subject == null || subject.equals("")) {

throw new MissingParametersException(“Missing subject”);

}

if (description == null || description.equals("")) {

throw new MissingParametersException(“Missing description”);

}

MUCRoom room = chatManager.getChatRoom(name);

if (room == null) {

throw new ForbiddenException(“Room not exists”);

}

// Define room subject

room.setSubject(subject);

// Define room description

room.setDescription(description);

room.saveToDB();

room.setSavedToDB(true);

}

public void removeChat(String name) {

chatManager.getChatRoom(name).destroyRoom("", “Deleted by KeePlace Service”);

}

public void addUserToChat(String name, String jid, String username)

throws MissingParametersException, ForbiddenException, ConflictException, NotAllowedException {

if (jid == null || jid.equals("")) {

throw new MissingParametersException(“Missing jid user”);

}

MUCRoom room = chatManager.getChatRoom(name);

if (room == null) {

throw new ForbiddenException(“Room not exists”);

}

PacketRouter packet = null;

Presence presence = null;

MUCUserImpl user = new MUCUserImpl(chatManager,

PacketRouter packetRouter, new JID(jid));

MUCRoleImpl role = new MUCRoleImpl(chatManager, room, nickname,

MUCRole.Role.valueOf(“participant”),

MUCRole.Affiliation.valueOf(“member”),

user, presence, packet);

room.addMember(jid, msg, role);

}

If someone can help to correct the firsts functions and to complete the last…

Thanks,

Bak