Пример #1
0
    def process(self, server, nick, user, host, target, msg):
        if not msg == self.start_tag: return
        code = ''
        flag = hold(server, 'CMSG')

        while True:
            event, args = yield flag 
            if args[4] == target and args[3] == host:
                if args[5] == self.end_tag:
                    break
                code = code + args[5] + '\n'
            
        url, output = libpad.sandbox(code, self.lang)
        if len(output) <= self.max_width:
            send_msg(server, target, output)
        else:
            send_msg(server, target, url)
Пример #2
0
    def process(self, server, nick, user, host, target, msg):
        if not msg == self.start_tag: return
        code = ''
        flag = hold(server, 'CMSG')

        while True:
            event, args = yield flag
            if args[4] == target and args[3] == host:
                if args[5] == self.end_tag:
                    break
                code = code + args[5] + '\n'

        url, output = libpad.sandbox(code, self.lang)
        if len(output) <= self.max_width:
            send_msg(server, target, output)
        else:
            send_msg(server, target, url)
Пример #3
0
    def get_nick(self, spin, nick, user, host, target, msg):
        # We aim to receive a '431' reply from the server.
        # Consequently we can obtain the nick.
        send_cmd(spin, 'NICK')

        # It waits for the event to happen once it happens
        # the untwisted system of events chains this iterator
        # and starts where it stopped.
        event, args = yield hold(spin, '431')

        # Unpacks the arguments.
        source, prefix, mynick, cmd_msg = args

        # Tells which nick it uses.
        send_msg(spin, target, '%s My nick is %s' % (nick, mynick))

        # This prints all what '431' carries.
        print source, prefix, mynick, cmd_msg
Пример #4
0
    def get_nick(self, spin, nick, user, host, target, msg):
        # We aim to receive a '431' reply from the server.
        # Consequently we can obtain the nick.
        send_cmd(spin, 'NICK')

        # It waits for the event to happen once it happens
        # the untwisted system of events chains this iterator
        # and starts where it stopped.
        event, args = yield hold(spin, '431')

        # Unpacks the arguments.
        source, prefix, mynick, cmd_msg = args

        # Tells which nick it uses.
        send_msg(spin, target, '%s My nick is %s' % (nick, mynick)) 

        # This prints all what '431' carries.
        print source, prefix, mynick, cmd_msg