Beispiel #1
0
    def _client_privmsg_handler(self, evt, clientobj, command, nickobj, params):
        """
        PRIVMSG handler. Checks whether the target is '-sBNC' and passes the command
        to _handle_command.
        """

        if not clientobj.registered or len(params) < 1:
            return Event.Continue

        target = params[0]
        targetobj = clientobj.get_nick(target)

        # TODO: use the nick from _identity
        if targetobj.nick.upper() != '-SBNC':
            return Event.Continue

        if len(params) < 2:
            clientobj.send_message('ERR_NOTEXTTOSEND', prefix=clientobj.server)
            return Event.Handled

        text = params[1]
        
        tokens = parse_irc_message(text, can_have_prefix=False)
                
        if not self._handle_command(clientobj, tokens[1], tokens[2], False):
            # TODO: use the nick from _identity
            self.send_sbnc_reply(clientobj, 'Unknown command. Try /msg -sBNC help', notice=False)
    
        return Event.Handled
Beispiel #2
0
    def process_line(self, line):
        prefix, command, params = utils.parse_irc_message(line.rstrip('\r\n'))
        nickobj = self.get_nick(prefix)

        print nickobj, command, params

        command = command.upper()

        if self.__class__.command_received_event.invoke(self, command=command, nickobj=nickobj, params=params):
            return

        self.handle_unknown_command(nickobj, command, params)