]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/parse.c
- Fuehrende und folgende Leerzeichen etc. in Requests werden geloescht.
[ngircd-alex.git] / src / ngircd / parse.c
index aa78357214b34f2d0613f653375d30cca29c79e0..a2adf07b4ec7054844ba50f78f5af6dc47b85024 100644 (file)
@@ -9,11 +9,22 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: parse.c,v 1.5 2001/12/26 03:23:03 alex Exp $
+ * $Id: parse.c,v 1.8 2001/12/29 03:08:19 alex Exp $
  *
  * parse.c: Parsen der Client-Anfragen
  *
  * $Log: parse.c,v $
+ * Revision 1.8  2001/12/29 03:08:19  alex
+ * - Fuehrende und folgende Leerzeichen etc. in Requests werden geloescht.
+ * - Logmeldungen (mal wieder) ein wenig angepasst.
+ *
+ * Revision 1.7  2001/12/27 19:13:21  alex
+ * - neue Befehle NOTICE und PRIVMSG.
+ * - Debug-Logging ein wenig reduziert.
+ *
+ * Revision 1.6  2001/12/26 14:45:37  alex
+ * - "Code Cleanups".
+ *
  * Revision 1.5  2001/12/26 03:23:03  alex
  * - PING/PONG-Befehle implementiert.
  *
@@ -47,6 +58,7 @@
 #include "irc.h"
 #include "log.h"
 #include "messages.h"
+#include "tool.h"
 
 #include <exp.h>
 #include "parse.h"
@@ -91,6 +103,9 @@ GLOBAL BOOLEAN Parse_Request( CONN_ID Idx, CHAR *Request )
        
        Init_Request( &req );
 
+       /* Fuehrendes und folgendes "Geraffel" verwerfen */
+       ngt_TrimStr( Request );
+
        /* gibt es ein Prefix? */
        if( Request[0] == ':' )
        {
@@ -211,10 +226,6 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req )
        assert( Req != NULL );
        assert( Req->command != NULL );
 
-#ifdef SNIFFER
-       Log( LOG_DEBUG, "    connection %d: '%s', %d %s,%s prefix.", Idx, Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
-#endif
-       
        client = Client_GetFromConn( Idx );
        assert( client != NULL );
 
@@ -225,12 +236,14 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req )
        else if( strcasecmp( Req->command, "PING" ) == 0 ) return IRC_PING( client, Req );
        else if( strcasecmp( Req->command, "PONG" ) == 0 ) return IRC_PONG( client, Req );
        else if( strcasecmp( Req->command, "MOTD" ) == 0 ) return IRC_MOTD( client, Req );
-
+       else if( strcasecmp( Req->command, "PRIVMSG" ) == 0 ) return IRC_PRIVMSG( client, Req );
+       else if( strcasecmp( Req->command, "NOTICE" ) == 0 ) return IRC_NOTICE( client, Req );
+       else if( strcasecmp( Req->command, "MODE" ) == 0 ) return IRC_MODE( client, Req );
+       
        /* Unbekannter Befehl */
-       IRC_WriteStr_Client( client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( client ), Req->command );
+       IRC_WriteStrClient( client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( client ), Req->command );
+       Log( LOG_DEBUG, "User \"%s!%s@%s\": Unknown command \"%s\", %d %s,%s prefix.", client->nick, client->user, client->host, Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
 
-       Log( LOG_DEBUG, "Connection %d: Unknown command '%s', %d %s,%s prefix.", Idx, Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
-       
        return TRUE;
 } /* Handle_Request */