Commit ea81dc86 authored by Roman S's avatar Roman S

Merge pull request #145 from sco0ter/of474

OF-474 OpenFire still provides entry forms for already-registered room users
parents 746a195a 3df71ba3
...@@ -141,18 +141,20 @@ class IQMUCRegisterHandler { ...@@ -141,18 +141,20 @@ class IQMUCRegisterHandler {
if (nickname != null) { if (nickname != null) {
// The user is already registered with the room so answer a completed form // The user is already registered with the room so answer a completed form
ElementUtil.setProperty(currentRegistration, "query.registered", null); ElementUtil.setProperty(currentRegistration, "query.registered", null);
currentRegistration.addElement("username").addText(nickname);
Element form = currentRegistration.element(QName.get("x", "jabber:x:data")); Element form = currentRegistration.element(QName.get("x", "jabber:x:data"));
currentRegistration.remove(form);
@SuppressWarnings("unchecked") // @SuppressWarnings("unchecked")
Iterator<Element> fields = form.elementIterator("field"); // Iterator<Element> fields = form.elementIterator("field");
//
Element field; // Element field;
while (fields.hasNext()) { // while (fields.hasNext()) {
field = fields.next(); // field = fields.next();
if ("muc#register_roomnick".equals(field.attributeValue("var"))) { // if ("muc#register_roomnick".equals(field.attributeValue("var"))) {
field.addElement("value").addText(nickname); // field.addElement("value").addText(nickname);
} // }
} // }
reply.setChildElement(currentRegistration); reply.setChildElement(currentRegistration);
} }
else { else {
......
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