def __processLine(self, line):
        # If a message comes from another user, it will have an @ symbol
        if "@" in line:
            # Location of the @ symbol in the line (proceeds sender's domain)
            at = line.find("@")
            # Location of the first gap, this immediately follows the sender's domain
            gap = line[at:].find(" ") + at + 1
            lastColon = line[gap+1:].find(":") + 2 + gap
        else:
            lastColon = line[1:].find(":") + 1

        # Does most of the parsing of the line received from the IRC network.
        # if there is no message to the line. ie. only one colon at the start of line
        if ":" not in line[1:]:
            headers = line[1:].strip().split(" ")
            message = ""
        else:
            # Split everything up to the lastColon (ie. the headers)
            headers = line[1:lastColon-1].strip().split(" ")
            message = line[lastColon:]
            
        sender = headers[0]
        if len(headers) < 2:
            self.__debugPrint("Unhelpful number of messages in message: \"" + line + "\"")
        else:
            if "!" in sender:
                cut = headers[0].find('!')
                if cut != -1:
                    sender = sender[:cut]
                msgtype = headers[1]
                if msgtype == "PRIVMSG" and message.startswith("ACTION ") and message.endswith(""):
                    msgtype = "ACTION"
                    message = message[8:-1]
                self.__callBind(msgtype, sender, headers[2:], message)
            else:
                self.__debugPrint("[" + headers[1] + "] " + message)
                if (headers[1] == "307" or headers[1] == "330") and len(headers) >= 4:
                    self.__identAccept(headers[3])
                if headers[1] == "318" and len(headers) >= 4:
                    self.__identReject(headers[3])
                    #identifies the next user in the nick commands list
                    if len(self.identifyNickCommands) == 0:
                        self.identifyLock = False
                    else:
                        self.outBuf.sendBuffered("WHOIS " + self.identifyNickCommands[0][0])
                self.__callBind(headers[1], sender, headers[2:], message)
dataset/ETHPy150Open LukeusMaximus/Python-IRC-Bot-Framework/ircbotframe.py/ircBot.__processLine/original