Esempio n. 1
0
static void ban_fizzer(aClient *cptr)
{
	int i;
	aClient *acptr;
	char hostip[128], mo[100], mo2[100];
	char *tkllayer[9] = {
		me.name,	/*0  server.name */
		"+",		/*1  +|- */
		"z",		/*2  G   */
		"*",		/*3  user */
		NULL,		/*4  host */
		NULL,
		NULL,		/*6  expire_at */
		NULL,		/*7  set_at */
		NULL		/*8  reason */
	};

	strlcpy(hostip, Inet_ia2p(&cptr->ip), sizeof(hostip));

	tkllayer[4] = hostip;
	tkllayer[5] = me.name;
	ircsprintf(mo, "%li", 86400 + TStime());
	ircsprintf(mo2, "%li", TStime());
	tkllayer[6] = mo;
	tkllayer[7] = mo2;
	tkllayer[8] = "Fizzer";
	m_tkl(&me, &me, 9, tkllayer);
	return;
}
Esempio n. 2
0
/*    m_sqline
**	parv[0] = sender
**	parv[1] = nickmask
**	parv[2] = reason
*/
DLLFUNC int m_sqline(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	char    mo[1024];
	char *comment = (parc == 3) ? parv[2] : NULL;
	char *tkllayer[9] = {
                me.name,        /*0  server.name */
                "+",            /*1  +|- */
                "Q",            /*2  G   */
                "*" ,           /*3  user */
                parv[1],           /*4  host */
                sptr->name,           /*5  setby */
                "0",            /*6  expire_at */
                NULL,           /*7  set_at */
                "no reason"     /*8  reason */
        };

	if (!IsServer(cptr))
		return 0;

	if (parc < 2)
		return 0;

	ircsprintf(mo, "%li", TStime());
	tkllayer[7] = mo;
        tkllayer[8] = comment ? comment : "no reason";
        return m_tkl(&me, &me, 9, tkllayer);
}
Esempio n. 3
0
/*
** m_rakill;
**      parv[0] = sender prefix
**      parv[1] = hostmask
**      parv[2] = username
**      parv[3] = comment
*/
DLLFUNC int m_rakill(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	char *tkllayer[6] = {
		me.name,	/*0  server.name */
		"-",		/*1  - */
		"G",		/*2  G   */
		NULL,		/*3  user */
		NULL,		/*4  host */
		NULL		/*5  whoremoved */
	};

	if (parc < 2 && IsPerson(sptr))
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "RAKILL");
		return 0;
	}

	if (IsServer(sptr) && parc < 3)
		return 0;

	if (!IsServer(cptr))
	{
		if (!IsOper(sptr))
		{
			sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
			    sptr->name);
		}
		else
		{
			sendto_one(sptr, ":%s NOTICE %s :*** RAKILL is depreciated and should not be used. Please use /gline -user@host instead", 
				me.name, sptr->name);
		}
		return 0;
	}
	
	tkllayer[3] = parv[2];
	tkllayer[4] = parv[1];	
	tkllayer[5] = sptr->name;
	m_tkl(&me, &me, 6, tkllayer);
	loop.do_bancheck = 1;
	return 0;
}
Esempio n. 4
0
/*    m_unsqline
**	parv[0] = sender
**	parv[1] = nickmask
*/
DLLFUNC int m_unsqline(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
       char *tkllayer[6] = {
                me.name,        /*0  server.name */
                "-",            /*1  - */
                "Q",            /*2  Q   */
                "*",            /*3  unused */
                parv[1],        /*4  host */
                sptr->name      /*5  whoremoved */
        };

	if (parc < 2)
		return 0;
        if (!IsServer(cptr))
                return 0;

        m_tkl(&me, &me, 6, tkllayer);
        return 0;
}
Esempio n. 5
0
/*	m_gqline - Global Q:Line
**	parv[0] = sender
**	parv[1] = nickname mask
**	parv[2] = Optional expiration time
**	parv[3] = reason
*/
static int m_gqline(aClient *cptr, aClient *sptr, int parc, char* parv[])
{
    TS secs;
    int whattodo = 0;
    int i;
    aClient *acptr = NULL;
    char *mask = NULL;
    char mo[1024], mo2[1024];
    char *p;
    char *tkllayer[9] = {
        me.name,	/* 0 = Server Name */
        NULL,		/* 1 = + / - */
        "Q",		/* 2 = Q - Global Q:Line */
        "*",		/* 3 = * = normal qline, H = hold */
        NULL,		/* 4 = Nickname mask */
        NULL,		/* 5 = setby */
        "0",		/* 6 = expire ts */
        NULL,		/* 7 = set ts */
        "no reason"	/* 8 = reason */
    };
    struct tm *t = NULL;
    if (IsServer(sptr)) return 0;
    if (!OPCanTKL(sptr) || !IsOper(sptr))
    {
        sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
        return 0;
    }
    if (parc == 1)
    {
        tkl_stats(sptr, TKL_NICK|TKL_GLOBAL, NULL);
        sendto_one(sptr, rpl_str(RPL_ENDOFSTATS), me.name, sptr->name, 'Q');
        return 0;
    }
    mask = parv[1];
    if (*mask == '-') {
        whattodo = 1;
        mask++;
    }
    else if (*mask == '+') {
        whattodo = 0;
        mask++;
    }
    if (!whattodo) {
        char c;
        i = 0;
        for (p = mask; *p; p++) if (*p != '*' && *p != '?') i++;
        if (i < 4) {
            sendto_one(sptr, ":%s NOTICE %s :*** [error] Too broad mask", me.name, sptr->name);
            return 0;
        }
    }
    tkl_check_expire(NULL);
    secs = 0;
    if (whattodo == 0 && (parc > 3))
    {
        secs = atime(parv[2]);
        if (secs < 0) {
            sendto_one(sptr, ":%s NOTICE %s :*** [error] Specified time out of range", me.name, sptr->name);
            return 0;
        }
    }
    tkllayer[1] = whattodo == 0 ? "+" : "-";
    tkllayer[4] = mask;
    tkllayer[5] = make_nick_user_host(sptr->name, sptr->user->username, GetHost(sptr));
    if (whattodo == 0)
    {
        if (secs == 0)
        {
            if (DEFAULT_BANTIME && (parc <= 3))
                ircsprintf(mo, "%li", DEFAULT_BANTIME + TStime());
            else
                ircsprintf(mo, "%li", secs);
        }
        else
            ircsprintf(mo, "%li", secs + TStime());
        ircsprintf(mo2, "%li", TStime());
        tkllayer[6] = mo;
        tkllayer[7] = mo2;
        if (parc > 3) {
            tkllayer[8] = parv[3];
        } else if (parc > 2) {
            tkllayer[8] = parv[2];
        }
        i = atol(mo);
        t = gmtime((TS*)&i);
        if (!t)
        {
            sendto_one(sptr, ":%s NOTICE %s :*** [error] Specified time is out of range", me.name, sptr->name);
            return 0;
        }
        m_tkl(&me, &me, 9, tkllayer);
    }
    else {
        m_tkl(&me, &me, 6, tkllayer);
    }
    return 0;
}