commit 4b9e52eb4d5b1bd417ab10f7bdbd14b856921706 from: Florian Westphal date: Thu Aug 02 10:14:26 2007 UTC implement /WALLOPS as described in RFC 2812, section 4.7. commit - 69081851aca7191dfa56860ddf02b97aed4b72ba commit + 4b9e52eb4d5b1bd417ab10f7bdbd14b856921706 blob - b686f883a12d4577b9828641e7ca599f7254bbe7 blob + 251a6997dd3c1e084525cc29ede57c8219735cc2 --- src/ngircd/defines.h +++ src/ngircd/defines.h @@ -8,7 +8,7 @@ * (at your option) any later version. * 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 */ #define CLIENT_NAME_LEN 32 /* Max. length of "real names" */ #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_AWAY_LEN 128 /* Max. length of away messages */ #define CLIENT_FLAGS_LEN 100 /* Max. length of client flags */ blob - 75f99d9eb7b465a2a8ca907823500e563be658b1 blob + 4a6127ad95a0baa9e374fa3b36c3d764eb2fbeb1 --- src/ngircd/irc-mode.c +++ src/ngircd/irc-mode.c @@ -14,7 +14,7 @@ #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 @@ -164,6 +164,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Ori { case 'i': /* Invisible */ case 's': /* Server messages */ + case 'w': /* Wallops messages */ x[0] = *mode_ptr; break; blob - c80b8b051aecc89b78848254bf99d6f58ccab6f4 blob + c9286d7015e4598d1d0c09ef7694160cb39bc22d --- src/ngircd/irc-oper.c +++ src/ngircd/irc-oper.c @@ -14,7 +14,7 @@ #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 @@ -261,6 +261,56 @@ IRC_DISCONNECT(CLIENT *Client, REQUEST *Req ) if( Conn_GetClient( my_conn )) return CONNECTED; else return DISCONNECTED; } /* 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- */ blob - dd2faa24ef7a7df3e86beac762d750836c763d12 blob + 8b867c45ae486e9079bda580032a25f2e81735f3 --- src/ngircd/irc-oper.h +++ src/ngircd/irc-oper.h @@ -8,7 +8,7 @@ * (at your option) any later version. * 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) */ @@ -24,6 +24,7 @@ GLOBAL bool IRC_REHASH PARAMS((CLIENT *Client, REQUEST GLOBAL bool IRC_RESTART 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_WALLOPS PARAMS(( CLIENT *Client, REQUEST *Req )); #endif blob - 548c3729543aa9838ffccc2e85c9500e88436735 blob + b5e64a331ffd0a2c57b503e0d0ca2097d84747ec --- src/ngircd/parse.c +++ src/ngircd/parse.c @@ -12,7 +12,7 @@ #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 @@ -93,6 +93,7 @@ COMMAND My_Commands[] = { "USER", IRC_USER, 0xFFFF, 0, 0, 0 }, { "USERHOST", IRC_USERHOST, CLIENT_USER, 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 }, { "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },