mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-30 02:02:06 +01:00
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
This commit is contained in:
parent
6023b4fa64
commit
efa6d1ddd8
1 changed files with 7 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue