mirror of
https://github.com/osmarks/ngircd.git
synced 2025-01-19 03:52:52 +00:00
Implement IRC_xLINE(): handler for "GLINE" and "KLINE" commands
This commit is contained in:
parent
e23f025dd6
commit
e9e6224aae
@ -27,6 +27,7 @@
|
|||||||
#include "conn-func.h"
|
#include "conn-func.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
|
#include "class.h"
|
||||||
#include "irc-write.h"
|
#include "irc-write.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
@ -414,5 +415,75 @@ IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
|
|||||||
return CONNECTED;
|
return CONNECTED;
|
||||||
} /* IRC_WALLOPS */
|
} /* IRC_WALLOPS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle <?>LINE commands (GLINE, KLINE).
|
||||||
|
*
|
||||||
|
* @param Client The client from which this command has been received.
|
||||||
|
* @param Req Request structure with prefix and all parameters.
|
||||||
|
* @return CONNECTED or DISCONNECTED.
|
||||||
|
*/
|
||||||
|
GLOBAL bool
|
||||||
|
IRC_xLINE(CLIENT *Client, REQUEST *Req)
|
||||||
|
{
|
||||||
|
CLIENT *from;
|
||||||
|
int class;
|
||||||
|
char class_c;
|
||||||
|
|
||||||
|
assert(Client != NULL);
|
||||||
|
assert(Req != NULL);
|
||||||
|
|
||||||
|
from = Op_Check(Client, Req);
|
||||||
|
if (!from)
|
||||||
|
return Op_NoPrivileges(Client, Req);
|
||||||
|
|
||||||
|
/* Bad number of parameters? */
|
||||||
|
if (Req->argc != 1 && Req->argc != 3)
|
||||||
|
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||||
|
Client_ID(Client), Req->command);
|
||||||
|
|
||||||
|
switch(Req->command[0]) {
|
||||||
|
case 'g':
|
||||||
|
case 'G':
|
||||||
|
class = CLASS_GLINE; class_c = 'G';
|
||||||
|
break;
|
||||||
|
case 'k':
|
||||||
|
case 'K':
|
||||||
|
class = CLASS_KLINE; class_c = 'K';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Req->argc == 1) {
|
||||||
|
/* Delete mask from list */
|
||||||
|
Class_DeleteMask(class, Req->argv[0]);
|
||||||
|
Log(LOG_NOTICE|LOG_snotice,
|
||||||
|
"\"%s\" deleted \"%s\" from %c-Line list.",
|
||||||
|
Client_Mask(from), Req->argv[0], class_c);
|
||||||
|
if (class == CLASS_GLINE) {
|
||||||
|
/* Inform other servers */
|
||||||
|
IRC_WriteStrServersPrefix(Client, from, "%s %s",
|
||||||
|
Req->command, Req->argv[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Add new mask to list */
|
||||||
|
if (Class_AddMask(class, Req->argv[0],
|
||||||
|
time(NULL) + atol(Req->argv[1]),
|
||||||
|
Req->argv[2])) {
|
||||||
|
Log(LOG_NOTICE|LOG_snotice,
|
||||||
|
"\"%s\" added \"%s\" to %c-Line list: \"%s\" (%ld seconds).",
|
||||||
|
Client_Mask(from), Req->argv[0], class_c,
|
||||||
|
Req->argv[2], atol(Req->argv[1]));
|
||||||
|
if (class == CLASS_GLINE) {
|
||||||
|
/* Inform other servers */
|
||||||
|
IRC_WriteStrServersPrefix(Client, from,
|
||||||
|
"%s %s %s :%s", Req->command,
|
||||||
|
Req->argv[0], Req->argv[1],
|
||||||
|
Req->argv[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,6 +25,8 @@ GLOBAL bool IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
|
|||||||
GLOBAL bool IRC_DISCONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
|
GLOBAL bool IRC_DISCONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL bool IRC_WALLOPS PARAMS(( CLIENT *Client, REQUEST *Req ));
|
GLOBAL bool IRC_WALLOPS PARAMS(( CLIENT *Client, REQUEST *Req ));
|
||||||
|
|
||||||
|
GLOBAL bool IRC_xLINE PARAMS((CLIENT *Client, REQUEST *Req));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
@ -63,6 +63,7 @@ static COMMAND My_Commands[] =
|
|||||||
{ "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 },
|
{ "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 },
|
||||||
{ "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 0, 0, 0 },
|
{ "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 0, 0, 0 },
|
||||||
{ "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 },
|
{ "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 },
|
||||||
|
{ "GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "HELP", IRC_HELP, CLIENT_USER, 0, 0, 0 },
|
{ "HELP", IRC_HELP, CLIENT_USER, 0, 0, 0 },
|
||||||
{ "INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
@ -70,6 +71,7 @@ static COMMAND My_Commands[] =
|
|||||||
{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
|
{ "KLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
|
Loading…
Reference in New Issue
Block a user