Commit c5699655 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Refactoring fixes.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@682 b35dd754-fafc-0310-a699-88a17e54d16e
parent edafdd02
......@@ -135,9 +135,9 @@ public class IQMUCRegisterHandler extends IQHandler {
if (IQ.Type.get == packet.getType()) {
reply = IQ.createResultIQ(packet);
String nickname = room.getReservedNickname(packet.getFrom().toBareJID());
Element currentRegistration = probeResult.createCopy();
if (nickname != null) {
// The user is already registered with the room so answer a completed form
Element currentRegistration = probeResult.createCopy();
ElementUtil.setProperty(currentRegistration, "query.registered", null);
XDataFormImpl form = new XDataFormImpl();
form.parse(currentRegistration);
......@@ -146,7 +146,7 @@ public class IQMUCRegisterHandler extends IQHandler {
}
else {
// The user is not registered with the room so answer an empty form
reply.getElement().add(probeResult);
reply.getElement().add(currentRegistration);
}
}
else if (IQ.Type.set == packet.getType()) {
......@@ -179,7 +179,7 @@ public class IQMUCRegisterHandler extends IQHandler {
// MUCRoom.addMember in order to receive a RegistrationInfo (new class)
// Add the new member to the members list
presences.addAll(room.addMember(packet.getTo().toBareJID(),
presences.addAll(room.addMember(packet.getFrom().toBareJID(),
nickname,
room.getRole()));
}
......
......@@ -93,11 +93,11 @@ public class MUCUserImpl implements MUCUser {
* @param packet the packet to be bounced.
*/
private void sendErrorPacket(Packet packet, PacketError.Condition error) {
packet = packet.createCopy();
packet.setError(error);
packet.setFrom(packet.getTo());
packet.setTo(packet.getFrom());
router.route(packet);
Packet reply = packet.createCopy();
reply.setError(error);
reply.setFrom(packet.getTo());
reply.setTo(packet.getFrom());
router.route(reply);
}
public JID getAddress() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment