def METHOD_NAME(self, buf):
    """Extract into a list irc messages of a tcp streams.
    @buf: tcp stream data
    """
    try:
        with BytesIO(buf) as f:
            lines = f.readlines()
    except Exception:
        log.error("Failed reading tcp stream buffer")
        return False
    logirc = False
    for element in lines:
        if re.match(b"^:", element) is not None:
            command = "([a-zA-Z]+|[0-9]{3})"
            params = "(\x20.+)"
            irc_server_msg = re.findall(r"(^:[\w+.{}!@|()]+\x20)" + command + params, element)
            if irc_server_msg:
                self._sc["prefix"] = convert_to_printable(irc_server_msg[0][0].strip())
                self._sc["command"] = convert_to_printable(irc_server_msg[0][1].strip())
                self._sc["params"] = convert_to_printable(irc_server_msg[0][2].strip())
                self._sc["type"] = "server"
                if logirc:
                    self._messages.append(dict(self._sc))
        else:
            irc_client_msg = re.findall(b"([a-zA-Z]+\x20)(.+[\x0a\0x0d])", element)
            if irc_client_msg and irc_client_msg[0][0].strip() in self.__methods_client:
                self._cc["command"] = convert_to_printable(irc_client_msg[0][0].strip())
                if self._cc["command"] in ("NICK", "USER"):
                    logirc = True
                self._cc["params"] = convert_to_printable(irc_client_msg[0][1].strip())
                self._cc["type"] = "client"
                if logirc:
                    self._messages.append(dict(self._cc))