<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_data(self, rawdata):
 """Add data to given room's state"""


        for data in rawdata:
            try:
                item = data[0]
                if item[0] == 2:
                    # Flush messages but we got nothing to flush
                    continue
                if item[0] != 0:
                    warnings.warn(f"Unknown message type '{item[0]}'", Warning)
                    continue
                item = item[1]
                # convert target to string because error codes are ints
                target = str(item[0])
                try:
                    data = item[1]
                except IndexError:
                    data = dict()
                try:
                    method = getattr(self, self.__head + target)
                    method(data)
                except AttributeError:
                    self._handle_unhandled(target, data)
            except IndexError:
                LOGGER.warning("Wrongly constructed message received: %r", data)

        self.conn.process_queues()