]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-info.c
Fixed abort() when inviting users to nonexistent channels.
[ngircd-alex.git] / src / ngircd / irc-info.c
index a11f9dadcc11a7406360710dcc1af6d18461f011..28ac7e9854311541d6cbfe7cfc4cae4091b54608 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-info.c,v 1.16 2003/04/21 10:54:30 alex Exp $";
+static char UNUSED id[] = "$Id: irc-info.c,v 1.19 2003/12/04 14:05:16 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -23,6 +23,7 @@ static char UNUSED id[] = "$Id: irc-info.c,v 1.16 2003/04/21 10:54:30 alex Exp $
 #include <string.h>
 
 #include "ngircd.h"
+#include "cvs-version.h"
 #include "conn-func.h"
 #include "conn-zip.h"
 #include "client.h"
@@ -76,6 +77,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 +162,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 +199,7 @@ IRC_LUSERS( CLIENT *Client, REQUEST *Req )
 
        IRC_Send_LUSERS( target );
 
+       IRC_SetPenalty( target, 1 );
        return CONNECTED;
 } /* IRC_LUSERS */
 
@@ -229,6 +233,7 @@ IRC_MOTD( CLIENT *Client, REQUEST *Req )
                }
        }
 
+       IRC_SetPenalty( from, 3 );
        return IRC_Show_MOTD( from );
 } /* IRC_MOTD */
 
@@ -323,6 +328,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 */
 
@@ -401,6 +407,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 */
 
@@ -486,6 +493,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 +523,16 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
        }
 
        /* mit Versionsinfo antworten */
+       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 */