#include "portab.h"
-static char UNUSED id[] = "$Id: irc-write.c,v 1.19 2005/07/31 20:13:08 alex Exp $";
+static char UNUSED id[] = "$Id: irc-write.c,v 1.21 2006/08/12 11:56:24 fw Exp $";
#include "imp.h"
#include <assert.h>
#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
else if( Client_Type( c ) == CLIENT_SERVER ) c = NULL;
}
if( c ) c = Client_NextHop( c );
-
+
if( c && ( c != Client ))
{
/* Ok, anderer Client */
IRC_WriteStrServersPrefixFlag( ExceptOf, Prefix, '\0', "%s", buffer );
} /* IRC_WriteStrServersPrefix */
-
+
#ifdef PROTOTYPES
GLOBAL void
#endif
{
char buffer[1000];
- CLIENT *c;
va_list ap;
-
+
assert( Format != NULL );
assert( Prefix != NULL );
#endif
vsnprintf( buffer, 1000, Format, ap );
va_end( ap );
-
- c = Client_First( );
- while( c )
- {
- if(( Client_Type( c ) == CLIENT_SERVER ) && ( Client_Conn( c ) > NONE ) && ( c != Client_ThisServer( )) && ( c != ExceptOf ))
- {
- /* Ziel-Server gefunden. Nun noch pruefen, ob Flags stimmen */
- if(( Flag == '\0' ) || ( strchr( Client_Flags( c ), Flag ) != NULL )) IRC_WriteStrClientPrefix( c, Prefix, "%s", buffer );
+
+ IRC_WriteStrServersPrefixFlag_CB(ExceptOf, Prefix, Flag,
+ cb_writeStrServersPrefixFlag, buffer);
+} /* IRC_WriteStrServersPrefixFlag */
+
+
+GLOBAL void
+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 */
}
cl2chan = Channel_NextMember( chan, cl2chan );
}
-
+
/* naechsten Channel */
chan_cl2chan = Channel_NextChannelOf( Client, chan_cl2chan );
}
GLOBAL void
-IRC_SetPenalty( CLIENT *Client, int Seconds )
+IRC_SetPenalty( CLIENT *Client, time_t Seconds )
{
CONN_ID c;
-
+
assert( Client != NULL );
assert( Seconds > 0 );
-
+
if( Client_Type( Client ) == CLIENT_SERVER ) return;
-
+
c = Client_Conn( Client );
- if( c > NONE ) Conn_SetPenalty( c, Seconds );
+ if (c > NONE)
+ Conn_SetPenalty(c, Seconds);
} /* IRC_SetPenalty */
} /* Get_Prefix */
+static void
+cb_writeStrServersPrefixFlag(CLIENT *Client, CLIENT *Prefix, void *Buffer)
+{
+ IRC_WriteStrClientPrefix(Client, Prefix, "%s", Buffer);
+} /* cb_writeStrServersPrefixFlag */
+
+
/* -eof- */