Ejemplo n.º 1
0
    def handle_line(self, line):
        match_dict = IRCMessage.parse(line)

        logging.debug("(FROM SERVER) Prefix: \"{prefix}\", Command: \"{command}\", Params: \"{params}\", Trailing: \"{trailing}\"".format(**match_dict))

        if match_dict["command"] in replay_commands:
            self.all_replay.append(match_dict)

        if match_dict["command"] in server_handlers:
            for handler in server_handlers[match_dict["command"]]:
                handler.handle(self, match_dict)
                self.send_line("JOIN #bbeggs")
        else:
            self.client_send(line)
Ejemplo n.º 2
0
 def handle_line(self, line):
     match_dict = IRCMessage.parse(line)
     
     logging.debug("(CLIENT) {line}".format(line=line))
     if self.registered:
         if match_dict["command"] in client_handlers:
             for handler in client_handlers[match_dict["command"]]:
                 handler.handle(self.exchanger, line)
         else:
             self.exchanger.send_line(line)
     else:
         if match_dict["command"] == "PASS":
             pass_split = match_dict["params"].split(":", 2)
             if len(pass_split) != 2:
                 return
             self.login(*pass_split)