Exemple #1
0
def voice(irc, result, group, other):
    lang = base[irc.base.name][1][other['rpl_whois']['is logged']]['lang']
    target = result('target')
    channel = other['channel']

    if not target:
        target = [group('nick')]
    else:
        target = target.split()

    print target
    for masktar in target:
        if util.val_mask(masktar):
            # Esto se activa sí... es una mascara
            for nick in util.make_nick_ls(irc, channel, masktar)[0]:
                irc.mode(channel, '+v ' + nick)
                continue
            else:
                irc.err(channel, _('nadie en el canal: ', lang) + masktar)

        else:
            # Esto se activa sí... es un nick, o no coincide con nada
            nick_ls = util.make_nick_ls(irc, channel, '*!*@*', lower=True)[0]
            if masktar.lower() in nick_ls:
                irc.mode(channel, '+v ' + masktar)
                continue
            else:
                irc.err(channel, _('nadie en el canal: ', lang) + masktar)
Exemple #2
0
def kick(irc, result, group, other):
    lang = base[irc.base.name][1][other['rpl_whois']['is logged']]['lang']
    target = result('target')
    channel = other['channel']

    # Mensaje de expulsion!
    message = result('reason')
    p = True
    if not message:
        message = ''
        p = False
    if not message.endswith('.') and p:
        message = message + '.'
    if not message.endswith(' ') and p:
        message = message + ' '
    message = message + _('expulsado por', lang) + ' ' + group('nick')

    if util.val_mask(target):
        # Esto se activa sí... es una mascara
        for nick in util.make_nick_ls(irc, channel, target)[0]:
            if nick.lower() != irc.base.nick.lower():
                irc.kick(channel, nick, message)
        else:
            irc.err(channel, _('nadie en el canal: ', lang) + target)
    else:
        # Esto se activa sí... es un nick, o no coincide con nada
        nick_ls = util.make_nick_ls(irc, channel, '*!*@*', lower=True)[0]
        if target.lower() in nick_ls:
            if target.lower() != irc.base.nick.lower():
                irc.kick(channel, target, message)
        else:
            irc.err(channel, _('nadie en el canal: ', lang) + target)
Exemple #3
0
def ban(irc, result, group, other):
    lang = base[irc.base.name][1][other['rpl_whois']['is logged']]['lang']
    time = result('time')
    target = result('target')
    channel = other['channel']

    # Mensaje de expulsion!
    message = result('message')
    p = True
    if not message:
        message = ''
        p = False
    if not message.endswith('.') and p:
        message = message + '.'
    if not message.endswith(' ') and p:
        message = message + ' '
    message = message + _('expulsado por', lang) + ' ' + group('nick')

    banned = False
    if util.val_mask(target):
        # Esto se activa sí... es una mascara
        banned = True
        irc.mode(channel, '+b ' + target)
        for nick in util.make_nick_ls(irc, channel, target)[0]:
            irc.kick(channel, nick, message)

    elif irc.features.network == 'freenode' and util.val_extban(target):
        # Esto se activa sí...
        #        La red es freenode y el ban es extendido
        banned = True
        irc.mode(channel, '+b ' + target)
    else:
        # Esto se activa sí... es un nick, o no coincide con nada
        rpl_whois = whois(irc, target)
        if rpl_whois['error']:
            irc.err(channel, rpl_whois['error'])
            return
        else:
            target = '*!*@' + rpl_whois['mask']['host']
            banned = True
            irc.mode(channel, '+b ' + target)
            for nick in util.make_nick_ls(irc, channel, target)[0]:
                irc.kick(channel, nick, message)

    if time and banned:
        try:
            time = center.mode.conv_parse_txt(time)
            center.mode.add(irc.base.name, channel, '-b ' + target)
        except ValueError:
            irc.err(other['target'], _('tiempo invalido', lang))
            return