X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Firc-write.c;h=9c0c39871500648ec95c18c6b8af05bd49a00fe0;hp=526e2fb694bdf948ccf957f6fafb9a8ca5571d25;hb=b130b35f48d19450240748425e12d21f2c38350f;hpb=904c8a4375cb9deed64007b06c6a7ba42313d93d diff --git a/src/ngircd/irc-write.c b/src/ngircd/irc-write.c index 526e2fb6..9c0c3987 100644 --- a/src/ngircd/irc-write.c +++ b/src/ngircd/irc-write.c @@ -16,7 +16,6 @@ * Sending IRC commands over the network */ -#include "imp.h" #include #ifdef PROTOTYPES # include @@ -24,13 +23,10 @@ # include #endif #include -#include -#include "defines.h" #include "conn-func.h" #include "channel.h" -#include "exp.h" #include "irc-write.h" #define SEND_TO_USER 1 @@ -70,7 +66,7 @@ va_dcl #else va_start(ap); #endif - vsnprintf(buffer, 1000, Format, ap); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end(ap); IRC_SetPenalty(Client, 2); @@ -107,7 +103,7 @@ va_dcl #else va_start(ap); #endif - vsnprintf(buffer, 1000, Format, ap); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end(ap); return IRC_WriteStrClientPrefix(Client, Client_ThisServer(), @@ -148,7 +144,7 @@ va_dcl #else va_start( ap ); #endif - vsnprintf( buffer, 1000, Format, ap ); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end( ap ); return Conn_WriteStr(Client_Conn(Client_NextHop(Client)), ":%s %s", @@ -190,7 +186,7 @@ va_dcl #else va_start( ap ); #endif - vsnprintf( buffer, 1000, Format, ap ); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end( ap ); IRC_WriteStrChannelPrefix(Client, Chan, Client_ThisServer(), @@ -239,7 +235,7 @@ va_dcl #else va_start( ap ); #endif - vsnprintf( buffer, 1000, Format, ap ); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end( ap ); Conn_ClearFlags( ); @@ -296,7 +292,7 @@ va_dcl #else va_start( ap ); #endif - vsnprintf( buffer, 1000, Format, ap ); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end( ap ); IRC_WriteStrServersPrefix(ExceptOf, Client_ThisServer(), "%s", buffer); @@ -333,7 +329,7 @@ va_dcl #else va_start( ap ); #endif - vsnprintf( buffer, 1000, Format, ap ); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end( ap ); IRC_WriteStrServersPrefixFlag( ExceptOf, Prefix, '\0', "%s", buffer ); @@ -373,7 +369,7 @@ va_dcl #else va_start( ap ); #endif - vsnprintf( buffer, 1000, Format, ap ); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end( ap ); IRC_WriteStrServersPrefixFlag_CB(ExceptOf, Prefix, Flag, @@ -451,7 +447,7 @@ va_dcl #else va_start( ap ); #endif - vsnprintf( buffer, 1000, Format, ap ); + vsnprintf(buffer, sizeof(buffer), Format, ap); va_end( ap ); Conn_ClearFlags( ); @@ -513,7 +509,7 @@ va_dcl #else va_start(ap); #endif - vsnprintf(msg, 1000, Format, ap); + vsnprintf(msg, sizeof(msg), Format, ap); va_end(ap); for (to=Client_First(); to != NULL; to=Client_Next(to)) { @@ -538,24 +534,27 @@ va_dcl /** * Set a "penalty time" for an IRC client. * - * Note: penalty times are never set for server links! + * Note: penalty times are never set for server links or remote clients! * * @param Client The client. * @param Seconds The additional "penalty time" to enforce. */ GLOBAL void -IRC_SetPenalty( CLIENT *Client, time_t Seconds ) +IRC_SetPenalty(CLIENT *Client, time_t Seconds) { CONN_ID c; - assert( Client != NULL ); - assert( Seconds > 0 ); + assert(Client != NULL); + assert(Seconds > 0); + + if (Client_Type(Client) == CLIENT_SERVER) + return; - if( Client_Type( Client ) == CLIENT_SERVER ) return; + c = Client_Conn(Client); + if (c <= NONE) + return; - c = Client_Conn( Client ); - if (c > NONE) - Conn_SetPenalty(c, Seconds); + Conn_SetPenalty(c, Seconds); } /* IRC_SetPenalty */ static const char *