mirror of
https://github.com/osmarks/ngircd.git
synced 2025-02-15 08:40:02 +00:00
New function IRC_WriteStrServersPrefixFlag_CB() using a callback function.
This commit is contained in:
parent
4f759d8113
commit
f199d63724
@ -39,7 +39,9 @@ static char UNUSED id[] = "$Id: irc-write.c,v 1.21 2006/08/12 11:56:24 fw Exp $"
|
|||||||
#define SEND_TO_SERVER 2
|
#define SEND_TO_SERVER 2
|
||||||
|
|
||||||
|
|
||||||
static char *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client ));
|
static char *Get_Prefix PARAMS((CLIENT *Target, CLIENT *Client));
|
||||||
|
static void cb_writeStrServersPrefixFlag PARAMS((CLIENT *Client,
|
||||||
|
CLIENT *Prefix, void *Buffer));
|
||||||
|
|
||||||
|
|
||||||
#ifdef PROTOTYPES
|
#ifdef PROTOTYPES
|
||||||
@ -288,7 +290,6 @@ va_dcl
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
char buffer[1000];
|
char buffer[1000];
|
||||||
CLIENT *c;
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
assert( Format != NULL );
|
assert( Format != NULL );
|
||||||
@ -302,15 +303,26 @@ va_dcl
|
|||||||
vsnprintf( buffer, 1000, Format, ap );
|
vsnprintf( buffer, 1000, Format, ap );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
c = Client_First( );
|
IRC_WriteStrServersPrefixFlag_CB(ExceptOf, Prefix, Flag,
|
||||||
while( c )
|
cb_writeStrServersPrefixFlag, buffer);
|
||||||
{
|
} /* IRC_WriteStrServersPrefixFlag */
|
||||||
if(( Client_Type( c ) == CLIENT_SERVER ) && ( Client_Conn( c ) > NONE ) && ( c != Client_ThisServer( )) && ( c != ExceptOf ))
|
|
||||||
{
|
|
||||||
/* Ziel-Server gefunden. Nun noch pruefen, ob Flags stimmen */
|
GLOBAL void
|
||||||
if(( Flag == '\0' ) || ( strchr( Client_Flags( c ), Flag ) != NULL )) IRC_WriteStrClientPrefix( c, Prefix, "%s", buffer );
|
IRC_WriteStrServersPrefixFlag_CB(CLIENT *ExceptOf, CLIENT *Prefix, char Flag,
|
||||||
|
void (*callback)(CLIENT *, CLIENT *, void *), void *cb_data)
|
||||||
|
{
|
||||||
|
CLIENT *c;
|
||||||
|
|
||||||
|
c = Client_First();
|
||||||
|
while(c) {
|
||||||
|
if (Client_Type(c) == CLIENT_SERVER && Client_Conn(c) > NONE &&
|
||||||
|
c != Client_ThisServer() && c != ExceptOf) {
|
||||||
|
/* Found a target server, do the flags match? */
|
||||||
|
if (Flag == '\0' || strchr(Client_Flags(c), Flag))
|
||||||
|
callback(c, Prefix, cb_data);
|
||||||
}
|
}
|
||||||
c = Client_Next( c );
|
c = Client_Next(c);
|
||||||
}
|
}
|
||||||
} /* IRC_WriteStrServersPrefixFlag */
|
} /* IRC_WriteStrServersPrefixFlag */
|
||||||
|
|
||||||
@ -426,4 +438,11 @@ Get_Prefix( CLIENT *Target, CLIENT *Client )
|
|||||||
} /* Get_Prefix */
|
} /* Get_Prefix */
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
cb_writeStrServersPrefixFlag(CLIENT *Client, CLIENT *Prefix, void *Buffer)
|
||||||
|
{
|
||||||
|
IRC_WriteStrClientPrefix(Client, Prefix, "%s", Buffer);
|
||||||
|
} /* cb_writeStrServersPrefixFlag */
|
||||||
|
|
||||||
|
|
||||||
/* -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-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
|
||||||
@ -8,32 +8,35 @@
|
|||||||
* (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-write.h,v 1.8 2006/05/10 21:24:01 alex Exp $
|
|
||||||
*
|
|
||||||
* Sending IRC commands over the network (header)
|
* Sending IRC commands over the network (header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __irc_write_h__
|
#ifndef __irc_write_h__
|
||||||
#define __irc_write_h__
|
#define __irc_write_h__
|
||||||
|
|
||||||
|
GLOBAL bool IRC_WriteStrClient PARAMS((CLIENT *Client, char *Format, ...));
|
||||||
|
GLOBAL bool IRC_WriteStrClientPrefix PARAMS((CLIENT *Client, CLIENT *Prefix,
|
||||||
|
char *Format, ...));
|
||||||
|
|
||||||
GLOBAL bool IRC_WriteStrClient PARAMS(( CLIENT *Client, char *Format, ... ));
|
GLOBAL bool IRC_WriteStrChannel PARAMS((CLIENT *Client, CHANNEL *Chan,
|
||||||
GLOBAL bool IRC_WriteStrClientPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, char *Format, ... ));
|
bool Remote, char *Format, ...));
|
||||||
|
GLOBAL bool IRC_WriteStrChannelPrefix PARAMS((CLIENT *Client, CHANNEL *Chan,
|
||||||
|
CLIENT *Prefix, bool Remote, char *Format, ...));
|
||||||
|
|
||||||
GLOBAL bool IRC_WriteStrChannel PARAMS(( CLIENT *Client, CHANNEL *Chan, bool Remote, char *Format, ... ));
|
GLOBAL void IRC_WriteStrServers PARAMS((CLIENT *ExceptOf, char *Format, ...));
|
||||||
GLOBAL bool IRC_WriteStrChannelPrefix PARAMS(( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, bool Remote, char *Format, ... ));
|
GLOBAL void IRC_WriteStrServersPrefix PARAMS((CLIENT *ExceptOf, CLIENT *Prefix,
|
||||||
|
char *Format, ...));
|
||||||
|
GLOBAL void IRC_WriteStrServersPrefixFlag PARAMS((CLIENT *ExceptOf,
|
||||||
|
CLIENT *Prefix, char Flag, char *Format, ...));
|
||||||
|
GLOBAL void IRC_WriteStrServersPrefixFlag_CB PARAMS((CLIENT *ExceptOf,
|
||||||
|
CLIENT *Prefix, char Flag,
|
||||||
|
void (*callback)(CLIENT *, CLIENT *, void *), void *cb_data));
|
||||||
|
|
||||||
GLOBAL void IRC_WriteStrServers PARAMS(( CLIENT *ExceptOf, char *Format, ... ));
|
GLOBAL bool IRC_WriteStrRelatedPrefix PARAMS((CLIENT *Client, CLIENT *Prefix,
|
||||||
GLOBAL void IRC_WriteStrServersPrefix PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, char *Format, ... ));
|
bool Remote, char *Format, ...));
|
||||||
GLOBAL void IRC_WriteStrServersPrefixFlag PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, char Flag, char *Format, ... ));
|
|
||||||
|
|
||||||
GLOBAL bool IRC_WriteStrRelatedPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, bool Remote, char *Format, ... ));
|
|
||||||
|
|
||||||
GLOBAL void IRC_SetPenalty PARAMS(( CLIENT *Client, time_t Seconds ));
|
|
||||||
|
|
||||||
|
GLOBAL void IRC_SetPenalty PARAMS((CLIENT *Client, time_t Seconds));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user