mirror of
https://github.com/osmarks/ngircd.git
synced 2025-01-31 09:44:44 +00:00
New function IRC_SendWallops().
Implement new global function IRC_SendWallops() that can be called by other functions to generate WALLOPS messages to users with +w mode.
This commit is contained in:
parent
9a7499af8b
commit
eaaf0c3bd5
@ -298,8 +298,7 @@ IRC_DISCONNECT(CLIENT * Client, REQUEST * Req)
|
|||||||
GLOBAL bool
|
GLOBAL bool
|
||||||
IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
|
IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
|
||||||
{
|
{
|
||||||
CLIENT *to, *from;
|
CLIENT *from;
|
||||||
int client_type;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
@ -307,8 +306,7 @@ IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
|
|||||||
if (Req->argc != 1)
|
if (Req->argc != 1)
|
||||||
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command);
|
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command);
|
||||||
|
|
||||||
client_type = Client_Type(Client);
|
switch (Client_Type(Client)) {
|
||||||
switch (client_type) {
|
|
||||||
case CLIENT_USER:
|
case CLIENT_USER:
|
||||||
if (!Client_OperByMe(Client))
|
if (!Client_OperByMe(Client))
|
||||||
return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG, Client_ID(Client));
|
return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG, Client_ID(Client));
|
||||||
@ -324,25 +322,9 @@ IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
|
|||||||
if (!from)
|
if (!from)
|
||||||
return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix);
|
return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix);
|
||||||
|
|
||||||
for (to=Client_First(); to != NULL; to=Client_Next(to)) {
|
IRC_SendWallops(Client, from, Req->argv[0]);
|
||||||
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;
|
return CONNECTED;
|
||||||
}
|
} /* IRC_WALLOPS */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001-2005 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -405,6 +405,34 @@ va_dcl
|
|||||||
} /* IRC_WriteStrRelatedPrefix */
|
} /* IRC_WriteStrRelatedPrefix */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send WALLOPS message.
|
||||||
|
*/
|
||||||
|
GLOBAL void
|
||||||
|
IRC_SendWallops(CLIENT *Client, CLIENT *From, const char *Message)
|
||||||
|
{
|
||||||
|
CLIENT *to;
|
||||||
|
|
||||||
|
for (to=Client_First(); to != NULL; to=Client_Next(to)) {
|
||||||
|
if (Client_Conn(to) == NONE) /* no local connection */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (Client_Type(to)) {
|
||||||
|
case CLIENT_USER:
|
||||||
|
if (Client_HasMode(to, 'w'))
|
||||||
|
IRC_WriteStrClientPrefix(to, From,
|
||||||
|
"WALLOPS :%s", Message);
|
||||||
|
break;
|
||||||
|
case CLIENT_SERVER:
|
||||||
|
if (to != Client)
|
||||||
|
IRC_WriteStrClientPrefix(to, From,
|
||||||
|
"WALLOPS :%s", Message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* IRC_SendWallops */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL void
|
GLOBAL void
|
||||||
IRC_SetPenalty( CLIENT *Client, time_t Seconds )
|
IRC_SetPenalty( CLIENT *Client, time_t Seconds )
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,9 @@ GLOBAL void IRC_WriteStrServersPrefixFlag_CB PARAMS((CLIENT *ExceptOf,
|
|||||||
GLOBAL bool IRC_WriteStrRelatedPrefix PARAMS((CLIENT *Client, CLIENT *Prefix,
|
GLOBAL bool IRC_WriteStrRelatedPrefix PARAMS((CLIENT *Client, CLIENT *Prefix,
|
||||||
bool Remote, char *Format, ...));
|
bool Remote, char *Format, ...));
|
||||||
|
|
||||||
|
GLOBAL void IRC_SendWallops PARAMS((CLIENT *Client, CLIENT *From,
|
||||||
|
const char *Message));
|
||||||
|
|
||||||
GLOBAL void IRC_SetPenalty PARAMS((CLIENT *Client, time_t Seconds));
|
GLOBAL void IRC_SetPenalty PARAMS((CLIENT *Client, time_t Seconds));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user