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);
Element form = currentRegistration.element(QName.get("x", "jabber:x:data")); currentRegistration.addElement("username").addText(nickname);
@SuppressWarnings("unchecked")
Iterator<Element> fields = form.elementIterator("field");
Element field; Element form = currentRegistration.element(QName.get("x", "jabber:x:data"));
while (fields.hasNext()) { currentRegistration.remove(form);
field = fields.next(); // @SuppressWarnings("unchecked")
if ("muc#register_roomnick".equals(field.attributeValue("var"))) { // Iterator<Element> fields = form.elementIterator("field");
field.addElement("value").addText(nickname); //
} // Element field;
} // while (fields.hasNext()) {
// field = fields.next();
// if ("muc#register_roomnick".equals(field.attributeValue("var"))) {
// 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