Exemplo n.º 1
0
    def watcher(self, server, nick, user, host, target, msg):
        count, start       = self.data.setdefault(host, [0,  time.time()])
        count              = count + 1
        self.data[host][0] = count

        if time.time() - start > self.n_secs:
            self.data[host][0], self.data[host][1] = 0, time.time()
            if self.n_lines/float(self.n_secs) < count/(time.time() - start):
                send_cmd(server, self.cmd.format(nick=nick, 
                         chan=target, host=host, user=user))
Exemplo n.º 2
0
    def set_common_irc_handles(self, area, con):
        l1 = lambda con, chan: self.create_channel(area, con, chan)
        l2 = lambda con, prefix, servaddr: send_cmd(con, 'PONG :%s' % servaddr)
        l3 = lambda con, data: area.insee('end', '%s\n' % data)

        xmap(con, '001', on_001)
        xmap(con, 'PRIVMSG', on_privmsg)
        xmap(con, 'JOIN', on_join)
        xmap(con, 'PART', on_part)
        xmap(con, '353', on_353)
        xmap(con, '332', on_332)
        xmap(con, 'NICK', on_nick)

        xmap(con, 'MEJOIN', l1)
        xmap(con, 'PING', l2)
        xmap(con, FOUND, l3)
Exemplo n.º 3
0
 def send_cmd(self, area, con):
     ask = Ask(area)
     send_cmd(con, ask.data)
Exemplo n.º 4
0
def irc_cmd(server, nick, user, host, target, msg, data):
    if is_adm(host): send_cmd(server, data)
Exemplo n.º 5
0
def irc_cmd(server, nick, user, host, target, msg, data):
    # is_adm(host) checks whether the user is authenticated
    # in order to send back to the server the irc command.
    if is_adm(host): send_cmd(server, data)