Ejemplo n.º 1
0
Archivo: ui.py Proyecto: BiohZn/sbncng
    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
Ejemplo n.º 2
0
Archivo: irc.py Proyecto: BiohZn/sbncng
    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)