irc = IrcClient() joined = False def on_command_sent(line): print "> " + line irc.set_on_command_sent_callback(on_command_sent) irc.connect(server, port, nick, realname) while True: s = select.select([irc.socket, sys.stdin], [], [])[0] if sys.stdin in s: irc.socket.send(sys.stdin.readline().strip() + "\r\n") if irc.socket in s: line = irc.readline() if line is "" or line is None: continue print line sender = re.match(r':([^\s]+)\s', line) if sender: sender = sender.group(1) ignore = False for ignore_pattern in ignore_patterns: if re.match(ignore_pattern, sender): ignore = True tmp = irc.is_ping(line) if tmp: irc.send_pong(tmp)