X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Firc-info.c;h=26306949ed865ecc014d0299770c73e5ee4ab790;hp=2f1112e87be2ec86dd2e0fe35477fd0db61fab85;hb=7281b8dd4d917f8b7f7c36460b78b686427ce973;hpb=e17976a17287a9266740ebcdd22a4e2ececd72e1 diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c index 2f1112e8..26306949 100644 --- a/src/ngircd/irc-info.c +++ b/src/ngircd/irc-info.c @@ -14,15 +14,17 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-info.c,v 1.14 2003/01/01 13:30:35 alex Exp $"; +static char UNUSED id[] = "$Id: irc-info.c,v 1.22 2004/05/07 11:19:21 alex Exp $"; #include "imp.h" #include #include #include #include +#include #include "ngircd.h" +#include "cvs-version.h" #include "conn-func.h" #include "conn-zip.h" #include "client.h" @@ -76,6 +78,7 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req ) if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC2_MSG, Client_ID( prefix ), Conf_ServerAdmin2 )) return DISCONNECTED; if( ! IRC_WriteStrClient( Client, RPL_ADMINEMAIL_MSG, Client_ID( prefix ), Conf_ServerAdminMail )) return DISCONNECTED; + IRC_SetPenalty( Client, 1 ); return CONNECTED; } /* IRC_ADMIN */ @@ -160,7 +163,8 @@ IRC_LINKS( CLIENT *Client, REQUEST *Req ) } c = Client_Next( c ); } - + + IRC_SetPenalty( target, 1 ); return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask ); } /* IRC_LINKS */ @@ -196,6 +200,7 @@ IRC_LUSERS( CLIENT *Client, REQUEST *Req ) IRC_Send_LUSERS( target ); + IRC_SetPenalty( target, 1 ); return CONNECTED; } /* IRC_LUSERS */ @@ -229,6 +234,7 @@ IRC_MOTD( CLIENT *Client, REQUEST *Req ) } } + IRC_SetPenalty( from, 3 ); return IRC_Show_MOTD( from ); } /* IRC_MOTD */ @@ -323,6 +329,7 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req ) if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED; } + IRC_SetPenalty( from, 1 ); return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" ); } /* IRC_NAMES */ @@ -373,7 +380,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req ) if( cl && (( Client_Type( cl ) == CLIENT_SERVER ) || ( cl == Client ))) { /* Server link or our own connection */ -#ifdef USE_ZLIB +#ifdef ZLIB if( Conn_Options( con ) & CONN_ZIP ) { if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFOZIP_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Zip_SendBytes( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Zip_RecvBytes( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED; @@ -401,6 +408,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req ) break; } + IRC_SetPenalty( from, 2 ); return IRC_WriteStrClient( from, RPL_ENDOFSTATS_MSG, Client_ID( from ), query ); } /* IRC_STATS */ @@ -437,7 +445,7 @@ IRC_TIME( CLIENT *Client, REQUEST *Req ) } t = time( NULL ); - (VOID)strftime( t_str, 60, "%A %B %d %Y -- %H:%M %z", localtime( &t )); + (VOID)strftime( t_str, 60, "%A %B %d %Y -- %H:%M %Z", localtime( &t )); return IRC_WriteStrClient( from, RPL_TIME_MSG, Client_ID( from ), Client_ID( Client_ThisServer( )), t_str ); } /* IRC_TIME */ @@ -486,6 +494,9 @@ GLOBAL BOOLEAN IRC_VERSION( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *prefix; +#ifdef CVSDATE + CHAR ver[12], vertxt[30]; +#endif assert( Client != NULL ); assert( Req != NULL ); @@ -513,7 +524,16 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req ) } /* mit Versionsinfo antworten */ - return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE, VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( )); + IRC_SetPenalty( Client, 1 ); +#ifdef CVSDATE + strlcpy( ver, CVSDATE, sizeof( ver )); + strncpy( ver + 4, ver + 5, 2 ); + strncpy( ver + 6, ver + 8, 3 ); + snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver ); + return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, vertxt, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( )); +#else + return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( )); +#endif } /* IRC_VERSION */ @@ -753,6 +773,13 @@ IRC_Show_MOTD( CLIENT *Client ) assert( Client != NULL ); + if( Conf_MotdPhrase[0] ) + { + if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED; + if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), Conf_MotdPhrase )) return DISCONNECTED; + return IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client )); + } + fd = fopen( Conf_MotdFile, "r" ); if( ! fd ) { @@ -760,7 +787,7 @@ IRC_Show_MOTD( CLIENT *Client ) return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) ); } - IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( ))); + if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED; while( TRUE ) { if( ! fgets( line, 126, fd )) break;