Пример #1
0
    elif name[:1] == "+":
        channel_voices[channel].append(name[1:])

def signal_handler(signal, frame):
    irc.quit(quitmessage)
    print ''
    sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)

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)