Projects tigase _server tigase-muc Commits 6c190154
ctrl k
  • src/main/groovy/tigase/admin/RoomAddPersistentOccupant.groovy
    ■ ■ ■ ■ ■ ■
    skipped 18 lines
    19 19   
    20 20  import groovy.transform.CompileStatic
    21 21  import tigase.kernel.core.Kernel
     22 +import tigase.muc.Affiliation
    22 23  import tigase.muc.MUCComponent
    23 24  import tigase.muc.Room
    24 25  import tigase.muc.RoomAffiliation
    skipped 2 lines
    27 28  import tigase.server.Iq
    28 29  import tigase.server.Packet
    29 30  import tigase.xmpp.jid.BareJID
     31 + 
    30 32  // AS:Description: Add persistent room occupant
    31 33  // AS:CommandId: room-occupant-persistent-add
    32 34  // AS:Component: muc
    skipped 40 lines
    73 75   
    74 76   BareJID occupant = BareJID.bareJIDInstance(occupantStr);
    75 77   RoomAffiliation oldAffiliation = room.getAffiliation(occupant);
    76  - if (oldAffiliation == RoomAffiliation.none || oldAffiliation == RoomAffiliation.outcast || oldAffiliation ==
    77  - RoomAffiliation.member) {
    78  - room.addAffiliationByJid(occupant, RoomAffiliation.memberPersistent);
    79  - } else if (oldAffiliation == RoomAffiliation.admin) {
    80  - room.addAffiliationByJid(occupant, RoomAffiliation.memberPersistent);
    81  - } else if (oldAffiliation == RoomAffiliation.owner) {
    82  - room.addAffiliationByJid(occupant, RoomAffiliation.ownerPersistent);
     78 + switch (oldAffiliation.getAffiliation()) {
     79 + case Affiliation.none:
     80 + case Affiliation.outcast:
     81 + room.addAffiliationByJid(occupant, RoomAffiliation.memberPersistent);
     82 + break;
     83 + default:
     84 + room.addAffiliationByJid(occupant,
     85 + RoomAffiliation.from(oldAffiliation.getAffiliation(), true, null));
     86 + break;
    83 87   }
    84 88   
    85 89   Command.addTextField(result, "Note", "Operation successful");
    skipped 14 lines
  • src/main/java/tigase/muc/modules/PresenceModuleImpl.java
    ■ ■ ■ ■ ■
    skipped 739 lines
    740 740   }
    741 741   }
    742 742   
    743  - protected void sendPresenceToAllOccupants(Room room, JID senderJID, boolean newRoomCreated, String newNickName)
     743 + protected Element sendPresenceToAllOccupants(Room room, JID senderJID, boolean newRoomCreated, String newNickName)
    744 744   throws TigaseStringprepException {
    745 745   Element presence;
    746 746   
    skipped 9 lines
    756 756   if (presence != null) {
    757 757   sendPresenceToAllOccupants(presence, room, senderJID, newRoomCreated, newNickName);
    758 758   }
     759 + return presence;
    759 760   }
    760 761   
    761 762   private Integer toInteger(String v, Integer defaultValue) throws NumberFormatException {
    skipped 99 lines
Please wait...
Page is in error, reload to recover