Ignore:
Timestamp:
Jan 8, 2012, 9:26:06 AM (9 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Expose locked state of a room on join response with room created status.

When the presence in response to a join includes the room created status code
(201), the client should configure the room before it can be used. To enable
this, the locked state of the room is now exposed through the Room.locked
attribute.

Also, update example MUC client to deal with newly created, locked rooms.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/muc.py

    r161 r162  
    11341134    @type nick: C{unicode}
    11351135
    1136     @ivar state: The status code of the room.
    1137     @type state: L{int}
    1138 
    11391136    @ivar occupantJID: The JID of the occupant in the room. Generated from
    11401137        roomJID and nick.
    11411138    @type occupantJID: L{jid.JID}
    1142     """
    1143 
    1144 
    1145     def __init__(self, roomJID, nick, state=None):
     1139
     1140    @ivar locked: Flag signalling a locked room. A locked room first needs
     1141        to be configured before it can be used. See
     1142        L{MUCClientProtocol.getConfiguration} and
     1143        L{MUCClientProtocol.configure}.
     1144    @type locked: C{bool}
     1145    """
     1146
     1147    locked = False
     1148
     1149    def __init__(self, roomJID, nick):
    11461150        """
    11471151        Initialize the room.
     
    11491153        self.roomJID = roomJID
    11501154        self.setNick(nick)
    1151         self.state = state
    1152 
    1153         self.status = 0
    1154 
    11551155        self.roster = {}
    11561156
     
    14561456            We have presence that says we joined a room.
    14571457            """
    1458             room.state = 'joined'
     1458            if STATUS_CODE.ROOM_CREATED in presence.mucStatuses:
     1459                room.locked = True
     1460
    14591461            return room
    14601462
     
    14631465            return failure
    14641466
    1465         room = Room(roomJID, nick, state='joining')
     1467        room = Room(roomJID, nick)
    14661468        self._addRoom(room)
    14671469
Note: See TracChangeset for help on using the changeset viewer.