From efa6d1ddd8a97e0ff80b65d9efd4d01401d47965 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Wed, 7 Apr 2004 19:52:44 +0000 Subject: [PATCH] Modifies the #create method so that the user leaves the room if the room already existed git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2286 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smackx/MultiUserChat.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/org/jivesoftware/smackx/MultiUserChat.java b/source/org/jivesoftware/smackx/MultiUserChat.java index 1ded3f7c3..d4b2a2ff9 100644 --- a/source/org/jivesoftware/smackx/MultiUserChat.java +++ b/source/org/jivesoftware/smackx/MultiUserChat.java @@ -216,16 +216,20 @@ public class MultiUserChat { else if (presence.getError() != null) { throw new XMPPException(presence.getError()); } + // Whether the room existed before or was created, the user has joined the room + this.nickname = nickname; + joined = true; + // Look for confirmation of room creation from the server MUCUser mucUser = getMUCUserExtension(presence); if (mucUser != null && mucUser.getStatus() != null) { if ("201".equals(mucUser.getStatus().getCode())) { // Room was created and the user has joined the room - this.nickname = nickname; - joined = true; return; } } + // We need to leave the room since it seems that the room already existed + leave(); throw new XMPPException("Creation failed - Missing acknowledge of room creation."); } @@ -451,7 +455,7 @@ public class MultiUserChat { MUCOwner iq = new MUCOwner(); iq.setTo(room); iq.setType(IQ.Type.SET); - iq.addExtension(form.getDataForm()); + iq.addExtension(form.getDataFormToSend()); // Send the completed configuration form to the server. connection.sendPacket(iq);