implement /WALLOPS as described in RFC 2812, section 4.7.
This commit is contained in:
parent
69081851ac
commit
4b9e52eb4d
|
@ -8,7 +8,7 @@
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Please read the file COPYING, README and AUTHORS for more information.
|
||||||
*
|
*
|
||||||
* $Id: defines.h,v 1.60 2007/05/17 23:34:25 alex Exp $
|
* $Id: defines.h,v 1.61 2007/08/02 10:14:26 fw Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
see RFC 2812, section 1.2.1 */
|
see RFC 2812, section 1.2.1 */
|
||||||
#define CLIENT_NAME_LEN 32 /* Max. length of "real names" */
|
#define CLIENT_NAME_LEN 32 /* Max. length of "real names" */
|
||||||
#define CLIENT_HOST_LEN 64 /* Max. host name length */
|
#define CLIENT_HOST_LEN 64 /* Max. host name length */
|
||||||
#define CLIENT_MODE_LEN 8 /* Max. lenth of all client modes */
|
#define CLIENT_MODE_LEN 9 /* Max. lenth of all client modes */
|
||||||
#define CLIENT_INFO_LEN 64 /* Max. length of server info texts */
|
#define CLIENT_INFO_LEN 64 /* Max. length of server info texts */
|
||||||
#define CLIENT_AWAY_LEN 128 /* Max. length of away messages */
|
#define CLIENT_AWAY_LEN 128 /* Max. length of away messages */
|
||||||
#define CLIENT_FLAGS_LEN 100 /* Max. length of client flags */
|
#define CLIENT_FLAGS_LEN 100 /* Max. length of client flags */
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: irc-mode.c,v 1.48 2006/12/07 17:57:20 fw Exp $";
|
static char UNUSED id[] = "$Id: irc-mode.c,v 1.49 2007/08/02 10:14:26 fw Exp $";
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -164,6 +164,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
|
||||||
{
|
{
|
||||||
case 'i': /* Invisible */
|
case 'i': /* Invisible */
|
||||||
case 's': /* Server messages */
|
case 's': /* Server messages */
|
||||||
|
case 'w': /* Wallops messages */
|
||||||
x[0] = *mode_ptr;
|
x[0] = *mode_ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: irc-oper.c,v 1.28 2007/06/28 05:15:18 fw Exp $";
|
static char UNUSED id[] = "$Id: irc-oper.c,v 1.29 2007/08/02 10:14:26 fw Exp $";
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -263,4 +263,54 @@ IRC_DISCONNECT(CLIENT *Client, REQUEST *Req )
|
||||||
} /* IRC_CONNECT */
|
} /* IRC_CONNECT */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL bool
|
||||||
|
IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CLIENT *to, *from;
|
||||||
|
int client_type;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if (Req->argc != 1)
|
||||||
|
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command);
|
||||||
|
|
||||||
|
client_type = Client_Type(Client);
|
||||||
|
switch (client_type) {
|
||||||
|
case CLIENT_USER:
|
||||||
|
if (!Client_OperByMe(Client))
|
||||||
|
return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG, Client_ID(Client));
|
||||||
|
from = Client;
|
||||||
|
break;
|
||||||
|
case CLIENT_SERVER:
|
||||||
|
from = Client_Search(Req->prefix);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!from)
|
||||||
|
return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix);
|
||||||
|
|
||||||
|
for (to=Client_First(); to != NULL; to=Client_Next(to)) {
|
||||||
|
if (Client_Conn(to) < 0) /* no local connection or WALLOPS origin */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
client_type = Client_Type(to);
|
||||||
|
switch (client_type) {
|
||||||
|
case CLIENT_USER:
|
||||||
|
if (Client_HasMode(to, 'w'))
|
||||||
|
IRC_WriteStrClientPrefix(to, from, "WALLOPS :%s", Req->argv[0]);
|
||||||
|
break;
|
||||||
|
case CLIENT_SERVER:
|
||||||
|
if (to != Client)
|
||||||
|
IRC_WriteStrClientPrefix(to, from, "WALLOPS :%s", Req->argv[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Please read the file COPYING, README and AUTHORS for more information.
|
||||||
*
|
*
|
||||||
* $Id: irc-oper.h,v 1.11 2005/03/19 18:43:48 fw Exp $
|
* $Id: irc-oper.h,v 1.12 2007/08/02 10:14:26 fw Exp $
|
||||||
*
|
*
|
||||||
* IRC operator commands (header)
|
* IRC operator commands (header)
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,7 @@ GLOBAL bool IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL bool IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req ));
|
GLOBAL bool IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL bool IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
|
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 ));
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: parse.c,v 1.67 2006/04/23 10:37:27 fw Exp $";
|
static char UNUSED id[] = "$Id: parse.c,v 1.68 2007/08/02 10:14:26 fw Exp $";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
|
@ -93,6 +93,7 @@ COMMAND My_Commands[] =
|
||||||
{ "USER", IRC_USER, 0xFFFF, 0, 0, 0 },
|
{ "USER", IRC_USER, 0xFFFF, 0, 0, 0 },
|
||||||
{ "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 },
|
{ "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 },
|
||||||
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
|
{ "WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
|
{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
|
||||||
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
|
|
Loading…
Reference in New Issue