def process_member_event(room, event)
      membership = (@memberships[room] ||= {})
      type = event['content']['membership'].to_sym

      # Only update the membership status if we are currently not in the room
      # or if the new state is that we have left.
      if membership[:type] != :join || type == :leave
        membership[:type] = type
        broadcast(:membership, self, room, membership)
      end

      update(event['content'])

      Events.processed event
    end
def process_member_event(room, event)
      membership = (@memberships[room] ||= {})
      type = event['content']['membership'].to_sym

      # Only update the membership status if we are currently not in the room
      # or if the new state is that we have left.
      if membership[:type] != :join || type == :leave
        membership[:type] = type
        broadcast(:membership, self, room, membership)
      end

      update(event['content'])

      Events.processed event
    end
Process a member event.

 @param room [Room] The room that sent the event.
 @param event [Hash] Event data.