Esempio n. 1
0
 def leave_room(self, presence, room_jid, nickname):
     """
     Sends 'unavailable'-type presence which leaves client from the room.
     Fails if user not in room.
     
     :param room_jid: JID of room-conference
     :param nickname: string-type client's nickname in conference
     
     """
     reciever = internJID(room_jid)
     
     assert reciever.bare() in self.roster, 'not in room'
     
     reciever.resource = nickname
     
     presence = MyElement.makeFromElement(presence)
     presence = Presence.createFromElement(presence)
     
     presence.to = reciever
     presence.from_ = self.dispatcher.myjid
     presence.type_ = 'unavailable'
     
     msg = ConnectPresence(parent=presence)
     
     self.dispatcher.send(msg.parent)
     
     del self.roster[reciever.bare()]
Esempio n. 2
0
    def leave_room(self, presence, room_jid, nickname):
        """
        Sends 'unavailable'-type presence which leaves client from the room.
        Fails if user not in room.
        
        :param room_jid: JID of room-conference
        :param nickname: string-type client's nickname in conference
        
        """
        reciever = internJID(room_jid)

        assert reciever.bare() in self.roster, 'not in room'

        reciever.resource = nickname

        presence = MyElement.makeFromElement(presence)
        presence = Presence.createFromElement(presence)

        presence.to = reciever
        presence.from_ = self.dispatcher.myjid
        presence.type_ = 'unavailable'

        msg = ConnectPresence(parent=presence)

        self.dispatcher.send(msg.parent)

        del self.roster[reciever.bare()]
Esempio n. 3
0
    def enter_room(self, presence, room_jid, nickname):
        """
        Sends 'available'-type presence which allows client to enter the room.
        Fails if user already in room.
        
        :param room_jid: JID of room-conference
        :param nickname: string-type client's nickname in conference
        :param status: string-type client's status message
        
        """
        reciever = internJID(room_jid)
        
        assert reciever.bare() not in self.roster, 'already in room'
        
        reciever.resource = nickname
 
        presence = MyElement.makeFromElement(presence)
        presence = Presence.createFromElement(presence)
 
        presence.to = reciever
        presence.from_ = self.dispatcher.myjid
        
        msg = ConnectPresence(parent=presence)
        
        self.roster[reciever.bare()] = []
        
        self.dispatcher.send(msg.parent)
Esempio n. 4
0
    def enter_room(self, presence, room_jid, nickname):
        """
        Sends 'available'-type presence which allows client to enter the room.
        Fails if user already in room.
        
        :param room_jid: JID of room-conference
        :param nickname: string-type client's nickname in conference
        :param status: string-type client's status message
        
        """
        reciever = internJID(room_jid)

        assert reciever.bare() not in self.roster, 'already in room'

        reciever.resource = nickname

        presence = MyElement.makeFromElement(presence)
        presence = Presence.createFromElement(presence)

        presence.to = reciever
        presence.from_ = self.dispatcher.myjid

        msg = ConnectPresence(parent=presence)

        self.roster[reciever.bare()] = []

        self.dispatcher.send(msg.parent)