Esempio n. 1
0
    def createRoomWithIds(self, ids=[]):
        """Create a chat room with contact ids"""
        try:
            room = LineRoom(self, self._createRoom(ids))
            self.rooms.append(room)

            return room
        except Exception as e:
            self.raise_error(e)

            return None
Esempio n. 2
0
    def createRoomWithContacts(self, contacts=[]):
        """Create a chat room with contacts"""
        try:
            contact_ids = []
            for contact in contacts:
                contact_ids.append(contact.id)

            room = LineRoom(self, self._createRoom(contact_ids))
            self.rooms.append(room)

            return room
        except Exception as e:
            self.raise_error(e)

            return None
Esempio n. 3
0
    def refreshActiveRooms(self):
        """Refresh active chat rooms"""
        start = 1
        count = 50

        self.rooms = []

        while True:
            channel = self._getMessageBoxCompactWrapUpList(start, count)

            for box in channel.messageBoxWrapUpList:
                if box.messageBox.midType == ToType.ROOM:
                    room = LineRoom(self, self._getRoom(box.messageBox.id))
                    self.rooms.append(room)

            if len(channel.messageBoxWrapUpList) == count:
                start += count
            else:
                break