1 11 12 package org.jivesoftware.messenger.muc.spi; 13 14 import org.jivesoftware.messenger.forms.DataForm; 15 import org.jivesoftware.messenger.forms.FormField; 16 import org.jivesoftware.messenger.forms.spi.XDataFormImpl; 17 import org.jivesoftware.messenger.forms.spi.XFormFieldImpl; 18 import org.jivesoftware.messenger.muc.ConflictException; 19 import org.jivesoftware.messenger.muc.ForbiddenException; 20 import org.jivesoftware.messenger.muc.MUCRole; 21 import org.jivesoftware.util.LocaleUtils; 22 import org.jivesoftware.messenger.*; 23 import org.jivesoftware.messenger.user.UserNotFoundException; 24 import java.util.*; 25 26 import org.dom4j.DocumentHelper; 27 import org.dom4j.Element; 28 import org.dom4j.QName; 29 import org.xmpp.packet.Presence; 30 import org.xmpp.packet.JID; 31 import org.xmpp.packet.IQ; 32 import org.xmpp.packet.PacketError; 33 34 41 public class IQOwnerHandler { 42 private MUCRoomImpl room; 43 44 private PacketRouter router; 45 46 private XDataFormImpl configurationForm; 47 48 private Element probeResult; 49 50 public IQOwnerHandler(MUCRoomImpl chatroom, PacketRouter packetRouter) { 51 this.room = chatroom; 52 this.router = packetRouter; 53 init(); 54 } 55 56 75 public void handleIQ(IQ packet, MUCRole role) throws ForbiddenException, ConflictException { 76 if (MUCRole.Affiliation.owner != role.getAffiliation()) { 78 throw new ForbiddenException(); 79 } 80 81 IQ reply = IQ.createResultIQ(packet); 82 Element element = packet.getChildElement(); 83 84 Element formElement = element.element(QName.get("x", "jabber:x:data")); 86 if (formElement != null) { 87 handleDataFormElement(role, formElement); 88 } 89 else { 90 Element destroyElement = element.element("destroy"); 91 if (destroyElement != null) { 92 room.destroyRoom(destroyElement.attributeValue("jid"), destroyElement 93 .elementTextTrim("reason")); 94 } 95 else { 96 List itemsList = element.elements("item"); 97 if (!itemsList.isEmpty()) { 98 handleItemsElement(itemsList, role, reply); 99 } 100 else { 101 if (!element.elementIterator().hasNext()) { 104 refreshConfigurationFormValues(); 105 reply.setChildElement(probeResult.createCopy()); 106 } 107 else { 110 reply.setChildElement(packet.getChildElement().createCopy()); 111 reply.setError(PacketError.Condition.bad_request); 112 } 113 } 114 } 115 } 116 if (reply.getTo() != null) { 117 router.route(reply); 120 } 121 } 122 123 136 private void handleItemsElement(List itemsList, MUCRole senderRole, IQ reply) 137 throws ForbiddenException, ConflictException { 138 Element item; 139 String affiliation = null; 140 boolean hasJID = ((Element)itemsList.get(0)).attributeValue("jid") != null; 141 boolean hasNick = ((Element)itemsList.get(0)).attributeValue("nick") != null; 142 if (!hasJID && !hasNick) { 144 for (Iterator items = itemsList.iterator(); items.hasNext();) { 146 item = (Element)items.next(); 147 affiliation = item.attributeValue("affiliation"); 148 Element result = reply.setChildElement("query", "http://jabber.org/protocol/muc#owner"); 150 151 if ("owner".equals(affiliation)) { 152 Element ownerMetaData; 154 MUCRole role; 155 for (String jid : room.getOwners()) { 156 ownerMetaData = result.addElement("item", "http://jabber.org/protocol/muc#owner"); 157 ownerMetaData.addAttribute("affiliation", "owner"); 158 ownerMetaData.addAttribute("jid", jid); 159 try { 161 List<MUCRole> roles = room.getOccupantsByBareJID(jid); 162 role = roles.get(0); 163 ownerMetaData.addAttribute("role", role.getRole().toString()); 164 ownerMetaData.addAttribute("nick", role.getNickname()); 165 } 166 catch (UserNotFoundException e) { 167 } 169 } 170 } 171 else if ("admin".equals(affiliation)) { 172 Element adminMetaData; 174 MUCRole role; 175 for (String jid : room.getAdmins()) { 176 adminMetaData = result.addElement("item", "http://jabber.org/protocol/muc#owner"); 177 adminMetaData.addAttribute("affiliation", "admin"); 178 adminMetaData.addAttribute("jid", jid); 179 try { 181 List<MUCRole> roles = room.getOccupantsByBareJID(jid); 182 role = roles.get(0); 183 adminMetaData.addAttribute("role", role.getRole().toString()); 184 adminMetaData.addAttribute("nick", role.getNickname()); 185 } 186 catch (UserNotFoundException e) { 187 } 189 } 190 } 191 else { 192 reply.setError(PacketError.Condition.bad_request); 193 } 194 } 195 } 196 else { 197 Map<String ,String > jids = new HashMap<String ,String >(); 199 String bareJID = null; 200 String nick; 201 for (Iterator items = itemsList.iterator(); items.hasNext();) { 203 try { 204 item = (Element)items.next(); 205 affiliation = item.attributeValue("affiliation"); 206 if (hasJID) { 207 bareJID = new JID(item.attributeValue("jid")).toBareJID(); 208 } 209 else { 210 nick = item.attributeValue("nick"); 212 bareJID = room.getOccupant(nick).getChatUser().getAddress().toBareJID(); 213 } 214 jids.put(bareJID, affiliation); 215 } 216 catch (UserNotFoundException e) { 217 } 219 } 220 221 List<Presence> presences = new ArrayList<Presence>(jids.size()); 223 224 room.lock.readLock().lock(); 225 try { 226 if (jids.keySet().containsAll(room.owners)) { 228 if (!jids.containsValue("owner")) { 230 throw new ConflictException(); 231 } 232 } 233 234 room.lock.readLock().unlock(); 235 room.lock.writeLock().lock(); 236 try { 237 String targetAffiliation = null; 238 for (Iterator<String > it = jids.keySet().iterator(); it.hasNext();) { 239 bareJID = it.next(); 240 targetAffiliation = jids.get(bareJID); 241 if ("owner".equals(targetAffiliation)) { 242 presences.addAll(room.addOwner(bareJID, senderRole)); 244 } 245 else if ("admin".equals(targetAffiliation)) { 246 presences.addAll(room.addAdmin(bareJID, senderRole)); 248 } 249 else if ("member".equals(targetAffiliation)) { 250 boolean hadAffiliation = room.getAffiliation(bareJID) != MUCRole.Affiliation.none; 252 presences.addAll(room.addMember(bareJID, null, senderRole)); 253 if (!hadAffiliation && room.isMembersOnly()) { 256 room.sendInvitation(new JID(bareJID), null, senderRole, null); 257 } 258 } 259 else if ("none".equals(targetAffiliation)) { 260 presences.addAll(room.addNone(bareJID, senderRole)); 262 } 263 } 264 } 265 finally { 266 room.lock.writeLock().unlock(); 267 room.lock.readLock().lock(); 268 } 269 } 270 finally { 271 room.lock.readLock().unlock(); 272 } 273 274 for (Presence presence : presences) { 276 room.send(presence); 277 } 278 } 279 } 280 281 290 private void handleDataFormElement(MUCRole senderRole, Element formElement) 291 throws ForbiddenException, ConflictException { 292 XDataFormImpl completedForm = new XDataFormImpl(); 293 completedForm.parse(formElement); 294 295 if (DataForm.TYPE_CANCEL.equals(completedForm.getType())) { 296 if (room.isLocked()) { 299 room.destroyRoom(null, null); 300 } 301 } 302 else if (DataForm.TYPE_SUBMIT.equals(completedForm.getType())) { 303 if (completedForm.getFieldsSize() == 0) { 305 } 307 else { 309 processConfigurationForm(completedForm, senderRole); 310 } 311 if (room.isLocked() && !room.isManuallyLocked()) { 314 room.unlock(senderRole); 315 } 316 } 317 } 318 319 328 private void processConfigurationForm(XDataFormImpl completedForm, MUCRole senderRole) 329 throws ForbiddenException, ConflictException { 330 Iterator<String > values; 331 String booleanValue; 332 List<String > list; 333 FormField field; 334 335 field = completedForm.getField("muc#roomconfig_roomadmins"); 337 boolean adminsSent = field != null; 338 List<String > admins = new ArrayList<String >(); 339 if (field != null) { 340 values = field.getValues(); 341 while (values.hasNext()) { 342 admins.add(values.next()); 343 } 344 } 345 346 field = completedForm.getField("muc#roomconfig_roomowners"); 348 boolean ownersSent = field != null; 349 List<String > owners = new ArrayList<String >(); 350 if (field != null) { 351 values = field.getValues(); 352 while (values.hasNext()) { 353 owners.add(values.next()); 354 } 355 } 356 357 if (ownersSent && owners.isEmpty()) { 359 throw new ConflictException(); 360 } 361 362 List presences = new ArrayList(admins.size() + owners.size()); 364 365 room.lock.writeLock().lock(); 366 try { 367 field = completedForm.getField("muc#roomconfig_roomname"); 368 if (field != null) { 369 values = field.getValues(); 370 room.setNaturalLanguageName((values.hasNext() ? values.next() : " ")); 371 } 372 373 field = completedForm.getField("muc#roomconfig_roomdesc"); 374 if (field != null) { 375 values = field.getValues(); 376 room.setDescription((values.hasNext() ? values.next() : " ")); 377 } 378 379 field = completedForm.getField("muc#roomconfig_changesubject"); 380 if (field != null) { 381 values = field.getValues(); 382 booleanValue = (values.hasNext() ? values.next() : "1"); 383 room.setCanOccupantsChangeSubject(("1".equals(booleanValue) ? true : false)); 384 } 385 386 field = completedForm.getField("muc#roomconfig_maxusers"); 387 if (field != null) { 388 values = field.getValues(); 389 room.setMaxUsers((values.hasNext() ? Integer.parseInt(values.next()) : 30)); 390 } 391 392 field = completedForm.getField("muc#roomconfig_presencebroadcast"); 393 if (field != null) { 394 values = field.getValues(); 395 list = new ArrayList<String >(); 396 while (values.hasNext()) { 397 list.add(values.next()); 398 } 399 room.setRolesToBroadcastPresence(list); 400 } 401 402 field = completedForm.getField("muc#roomconfig_publicroom"); 403 if (field != null) { 404 values = field.getValues(); 405 booleanValue = (values.hasNext() ? values.next() : "1"); 406 room.setPublicRoom(("1".equals(booleanValue) ? true : false)); 407 } 408 409 field = completedForm.getField("muc#roomconfig_persistentroom"); 410 if (field != null) { 411 values = field.getValues(); 412 booleanValue = (values.hasNext() ? values.next() : "1"); 413 boolean isPersistent = ("1".equals(booleanValue) ? true : false); 414 if (room.isPersistent() && !isPersistent) { 416 MUCPersistenceManager.deleteFromDB(room); 417 } 418 room.setPersistent(isPersistent); 419 } 420 421 field = completedForm.getField("muc#roomconfig_moderatedroom"); 422 if (field != null) { 423 values = field.getValues(); 424 booleanValue = (values.hasNext() ? values.next() : "1"); 425 room.setModerated(("1".equals(booleanValue) ? true : false)); 426 } 427 428 field = completedForm.getField("muc#roomconfig_membersonly"); 429 if (field != null) { 430 values = field.getValues(); 431 booleanValue = (values.hasNext() ? values.next() : "1"); 432 presences.addAll(room.setMembersOnly(("1".equals(booleanValue) ? 433 true : false))); 434 } 435 436 field = completedForm.getField("muc#roomconfig_allowinvites"); 437 if (field != null) { 438 values = field.getValues(); 439 booleanValue = (values.hasNext() ? values.next() : "1"); 440 room.setCanOccupantsInvite(("1".equals(booleanValue) ? true : false)); 441 } 442 443 field = completedForm.getField("muc#roomconfig_passwordprotectedroom"); 444 if (field != null) { 445 values = field.getValues(); 446 booleanValue = (values.hasNext() ? values.next() : "1"); 447 boolean isPasswordProtected = "1".equals(booleanValue); 448 if (isPasswordProtected) { 449 field = completedForm.getField("muc#roomconfig_roomsecret"); 451 if (field != null) { 452 values = completedForm.getField("muc#roomconfig_roomsecret").getValues(); 453 room.setPassword((values.hasNext() ? values.next() : null)); 454 } 455 } 456 else { 457 room.setPassword(null); 459 } 460 } 461 462 field = completedForm.getField("muc#roomconfig_whois"); 463 if (field != null) { 464 values = field.getValues(); 465 booleanValue = (values.hasNext() ? values.next() : "1"); 466 room.setCanAnyoneDiscoverJID(("anyone".equals(booleanValue) ? true : false)); 467 } 468 469 field = completedForm.getField("muc#roomconfig_enablelogging"); 470 if (field != null) { 471 values = field.getValues(); 472 booleanValue = (values.hasNext() ? values.next() : "1"); 473 room.setLogEnabled(("1".equals(booleanValue) ? true : false)); 474 } 475 476 field = completedForm.getField("x-muc#roomconfig_reservednick"); 477 if (field != null) { 478 values = field.getValues(); 479 booleanValue = (values.hasNext() ? values.next() : "1"); 480 room.setLoginRestrictedToNickname(("1".equals(booleanValue) ? true : false)); 481 } 482 483 field = completedForm.getField("x-muc#roomconfig_canchangenick"); 484 if (field != null) { 485 values = field.getValues(); 486 booleanValue = (values.hasNext() ? values.next() : "1"); 487 room.setChangeNickname(("1".equals(booleanValue) ? true : false)); 488 } 489 490 field = completedForm.getField("x-muc#roomconfig_registration"); 491 if (field != null) { 492 values = field.getValues(); 493 booleanValue = (values.hasNext() ? values.next() : "1"); 494 room.setRegistrationEnabled(("1".equals(booleanValue) ? true : false)); 495 } 496 497 room.setModificationDate(new Date()); 500 501 if (room.isPersistent()) { 502 room.saveToDB(); 503 } 504 505 presences.addAll(room.addOwners(owners, senderRole)); 507 presences.addAll(room.addAdmins(admins, senderRole)); 508 509 if (ownersSent) { 510 List<String > ownersToRemove = new ArrayList<String >(room.owners); 513 ownersToRemove.removeAll(admins); 514 ownersToRemove.removeAll(owners); 515 for (String jid : ownersToRemove) { 516 presences.addAll(room.addMember(jid, null, senderRole)); 517 } 518 } 519 520 if (adminsSent) { 521 List<String > adminsToRemove = new ArrayList<String >(room.admins); 524 adminsToRemove.removeAll(admins); 525 adminsToRemove.removeAll(owners); 526 for (String jid : adminsToRemove) { 527 presences.addAll(room.addMember(jid, null, senderRole)); 528 } 529 } 530 531 if (!room.isPersistent() && room.getOccupantsCount() == 0) { 534 room.destroyRoom(null, null); 535 } 536 537 } 538 finally { 539 room.lock.writeLock().unlock(); 540 } 541 542 for (Iterator it = presences.iterator(); it.hasNext();) { 544 room.send((Presence)it.next()); 545 } 546 } 547 548 private void refreshConfigurationFormValues() { 549 room.lock.readLock().lock(); 550 try { 551 FormField field = configurationForm.getField("muc#roomconfig_roomname"); 552 field.clearValues(); 553 field.addValue(room.getNaturalLanguageName()); 554 555 field = configurationForm.getField("muc#roomconfig_roomdesc"); 556 field.clearValues(); 557 field.addValue(room.getDescription()); 558 559 field = configurationForm.getField("muc#roomconfig_changesubject"); 560 field.clearValues(); 561 field.addValue((room.canOccupantsChangeSubject() ? "1" : "0")); 562 563 field = configurationForm.getField("muc#roomconfig_maxusers"); 564 field.clearValues(); 565 field.addValue(Integer.toString(room.getMaxUsers())); 566 567 field = configurationForm.getField("muc#roomconfig_presencebroadcast"); 568 field.clearValues(); 569 for (String roleToBroadcast : room.getRolesToBroadcastPresence()) { 570 field.addValue(roleToBroadcast); 571 } 572 573 field = configurationForm.getField("muc#roomconfig_publicroom"); 574 field.clearValues(); 575 field.addValue((room.isPublicRoom() ? "1" : "0")); 576 577 field = configurationForm.getField("muc#roomconfig_persistentroom"); 578 field.clearValues(); 579 field.addValue((room.isPersistent() ? "1" : "0")); 580 581 field = configurationForm.getField("muc#roomconfig_moderatedroom"); 582 field.clearValues(); 583 field.addValue((room.isModerated() ? "1" : "0")); 584 585 field = configurationForm.getField("muc#roomconfig_membersonly"); 586 field.clearValues(); 587 field.addValue((room.isMembersOnly() ? "1" : "0")); 588 589 field = configurationForm.getField("muc#roomconfig_allowinvites"); 590 field.clearValues(); 591 field.addValue((room.canOccupantsInvite() ? "1" : "0")); 592 593 field = configurationForm.getField("muc#roomconfig_passwordprotectedroom"); 594 field.clearValues(); 595 field.addValue((room.isPasswordProtected() ? "1" : "0")); 596 597 field = configurationForm.getField("muc#roomconfig_roomsecret"); 598 field.clearValues(); 599 field.addValue(room.getPassword()); 600 601 field = configurationForm.getField("muc#roomconfig_whois"); 602 field.clearValues(); 603 field.addValue((room.canAnyoneDiscoverJID() ? "anyone" : "moderators")); 604 605 field = configurationForm.getField("muc#roomconfig_enablelogging"); 606 field.clearValues(); 607 field.addValue((room.isLogEnabled() ? "1" : "0")); 608 609 field = configurationForm.getField("x-muc#roomconfig_reservednick"); 610 field.clearValues(); 611 field.addValue((room.isLoginRestrictedToNickname() ? "1" : "0")); 612 613 field = configurationForm.getField("x-muc#roomconfig_canchangenick"); 614 field.clearValues(); 615 field.addValue((room.canChangeNickname() ? "1" : "0")); 616 617 field = configurationForm.getField("x-muc#roomconfig_registration"); 618 field.clearValues(); 619 field.addValue((room.isRegistrationEnabled() ? "1" : "0")); 620 621 field = configurationForm.getField("muc#roomconfig_roomadmins"); 622 field.clearValues(); 623 for (String jid : room.getAdmins()) { 624 field.addValue(jid); 625 } 626 627 field = configurationForm.getField("muc#roomconfig_roomowners"); 628 field.clearValues(); 629 for (String jid : room.getOwners()) { 630 field.addValue(jid); 631 } 632 633 probeResult.remove(probeResult.element(QName.get("x", "jabber:x:data"))); 635 probeResult.add(configurationForm.asXMLElement()); 637 638 } 639 finally { 640 room.lock.readLock().unlock(); 641 } 642 } 643 644 private void init() { 645 Element element = DocumentHelper.createElement(QName.get("query", 646 "http://jabber.org/protocol/muc#owner")); 647 648 configurationForm = new XDataFormImpl(DataForm.TYPE_FORM); 649 configurationForm.setTitle(LocaleUtils.getLocalizedString("muc.form.conf.title")); 650 List params = new ArrayList(); 651 params.add(room.getName()); 652 configurationForm.addInstruction(LocaleUtils.getLocalizedString("muc.form.conf.instruction", params)); 653 654 XFormFieldImpl field = new XFormFieldImpl("FORM_TYPE"); 655 field.setType(FormField.TYPE_HIDDEN); 656 field.addValue("http://jabber.org/protocol/muc#roomconfig"); 657 configurationForm.addField(field); 658 659 field = new XFormFieldImpl("muc#roomconfig_roomname"); 660 field.setType(FormField.TYPE_TEXT_SINGLE); 661 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_roomname")); 662 configurationForm.addField(field); 663 664 field = new XFormFieldImpl("muc#roomconfig_roomdesc"); 665 field.setType(FormField.TYPE_TEXT_SINGLE); 666 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_roomdesc")); 667 configurationForm.addField(field); 668 669 field = new XFormFieldImpl("muc#roomconfig_changesubject"); 670 field.setType(FormField.TYPE_BOOLEAN); 671 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_changesubject")); 672 configurationForm.addField(field); 673 674 field = new XFormFieldImpl("muc#roomconfig_maxusers"); 675 field.setType(FormField.TYPE_LIST_SINGLE); 676 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_maxusers")); 677 field.addOption("10", "10"); 678 field.addOption("20", "20"); 679 field.addOption("30", "30"); 680 field.addOption("40", "40"); 681 field.addOption("50", "50"); 682 field.addOption(LocaleUtils.getLocalizedString("muc.form.conf.none"), "0"); 683 configurationForm.addField(field); 684 685 field = new XFormFieldImpl("muc#roomconfig_presencebroadcast"); 686 field.setType(FormField.TYPE_LIST_MULTI); 687 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_presencebroadcast")); 688 field.addOption(LocaleUtils.getLocalizedString("muc.form.conf.moderator"), "moderator"); 689 field.addOption(LocaleUtils.getLocalizedString("muc.form.conf.participant"), "participant"); 690 field.addOption(LocaleUtils.getLocalizedString("muc.form.conf.visitor"), "visitor"); 691 configurationForm.addField(field); 692 693 field = new XFormFieldImpl("muc#roomconfig_publicroom"); 694 field.setType(FormField.TYPE_BOOLEAN); 695 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_publicroom")); 696 configurationForm.addField(field); 697 698 field = new XFormFieldImpl("muc#roomconfig_persistentroom"); 699 field.setType(FormField.TYPE_BOOLEAN); 700 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_persistentroom")); 701 configurationForm.addField(field); 702 703 field = new XFormFieldImpl("muc#roomconfig_moderatedroom"); 704 field.setType(FormField.TYPE_BOOLEAN); 705 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_moderatedroom")); 706 configurationForm.addField(field); 707 708 field = new XFormFieldImpl("muc#roomconfig_membersonly"); 709 field.setType(FormField.TYPE_BOOLEAN); 710 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_membersonly")); 711 configurationForm.addField(field); 712 713 field = new XFormFieldImpl(); 714 field.setType(FormField.TYPE_FIXED); 715 field.addValue(LocaleUtils.getLocalizedString("muc.form.conf.allowinvitesfixed")); 716 configurationForm.addField(field); 717 718 field = new XFormFieldImpl("muc#roomconfig_allowinvites"); 719 field.setType(FormField.TYPE_BOOLEAN); 720 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_allowinvites")); 721 configurationForm.addField(field); 722 723 field = new XFormFieldImpl("muc#roomconfig_passwordprotectedroom"); 724 field.setType(FormField.TYPE_BOOLEAN); 725 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_passwordprotectedroom")); 726 configurationForm.addField(field); 727 728 field = new XFormFieldImpl(); 729 field.setType(FormField.TYPE_FIXED); 730 field.addValue(LocaleUtils.getLocalizedString("muc.form.conf.roomsecretfixed")); 731 configurationForm.addField(field); 732 733 field = new XFormFieldImpl("muc#roomconfig_roomsecret"); 734 field.setType(FormField.TYPE_TEXT_PRIVATE); 735 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_roomsecret")); 736 configurationForm.addField(field); 737 738 field = new XFormFieldImpl("muc#roomconfig_whois"); 739 field.setType(FormField.TYPE_LIST_SINGLE); 740 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_whois")); 741 field.addOption(LocaleUtils.getLocalizedString("muc.form.conf.moderator"), "moderators"); 742 field.addOption(LocaleUtils.getLocalizedString("muc.form.conf.anyone"), "anyone"); 743 configurationForm.addField(field); 744 745 field = new XFormFieldImpl("muc#roomconfig_enablelogging"); 746 field.setType(FormField.TYPE_BOOLEAN); 747 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_enablelogging")); 748 configurationForm.addField(field); 749 750 field = new XFormFieldImpl("x-muc#roomconfig_reservednick"); 751 field.setType(FormField.TYPE_BOOLEAN); 752 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_reservednick")); 753 configurationForm.addField(field); 754 755 field = new XFormFieldImpl("x-muc#roomconfig_canchangenick"); 756 field.setType(FormField.TYPE_BOOLEAN); 757 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_canchangenick")); 758 configurationForm.addField(field); 759 760 field = new XFormFieldImpl("x-muc#roomconfig_registration"); 761 field.setType(FormField.TYPE_BOOLEAN); 762 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_registration")); 763 configurationForm.addField(field); 764 765 field = new XFormFieldImpl(); 766 field.setType(FormField.TYPE_FIXED); 767 field.addValue(LocaleUtils.getLocalizedString("muc.form.conf.roomadminsfixed")); 768 configurationForm.addField(field); 769 770 field = new XFormFieldImpl("muc#roomconfig_roomadmins"); 771 field.setType(FormField.TYPE_JID_MULTI); 772 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_roomadmins")); 773 configurationForm.addField(field); 774 775 field = new XFormFieldImpl(); 776 field.setType(FormField.TYPE_FIXED); 777 field.addValue(LocaleUtils.getLocalizedString("muc.form.conf.roomownersfixed")); 778 configurationForm.addField(field); 779 780 field = new XFormFieldImpl("muc#roomconfig_roomowners"); 781 field.setType(FormField.TYPE_JID_MULTI); 782 field.setLabel(LocaleUtils.getLocalizedString("muc.form.conf.owner_roomowners")); 783 configurationForm.addField(field); 784 785 probeResult = element; 787 probeResult.add(configurationForm.asXMLElement()); 788 } 789 } | Popular Tags |