X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fparse.c;h=c92da4d2aa76b21d96bbc3dd9e2bd767c91b4190;hb=b86e33ef4945e21078b2c1f37a5d276e615450ee;hp=f3b04d0c2ee8617ceb21d32ce919859e640b55f4;hpb=c9d166747d4ea161c55c765edc23e2cd3bd7dec4;p=ngircd-alex.git diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index f3b04d0c..c92da4d2 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -41,6 +41,7 @@ #include "irc-encoding.h" #include "irc-info.h" #include "irc-login.h" +#include "irc-metadata.h" #include "irc-mode.h" #include "irc-op.h" #include "irc-oper.h" @@ -78,6 +79,7 @@ static COMMAND My_Commands[] = { "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, + { "METADATA", IRC_METADATA, CLIENT_SERVER, 0, 0, 0 }, { "MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, @@ -99,6 +101,7 @@ static COMMAND My_Commands[] = { "SQUERY", IRC_SQUERY, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "SQUIT", IRC_SQUIT, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, + { "SVSNICK", IRC_SVSNICK, CLIENT_SERVER, 0, 0, 0 }, { "SUMMON", IRC_SUMMON, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, @@ -124,7 +127,7 @@ static COMMAND My_Commands[] = { "GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, 0, 0 }, { "POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, 0, 0 }, #endif - { NULL, NULL, 0x0, 0, 0, 0 } /* Ende-Marke */ + { NULL, NULL, 0x0, 0, 0, 0 } /* End-Mark */ }; static void Init_Request PARAMS(( REQUEST *Req )); @@ -154,7 +157,7 @@ Parse_GetCommandStruct( void ) * Parse a command ("request") received from a client. * * This function is called after the connection layer received a valid CR+LF - * terminated line of text: we asume that this is a valid IRC command and + * terminated line of text: we assume that this is a valid IRC command and * try to do something useful with it :-) * * All errors are reported to the client from which the command has been @@ -166,7 +169,7 @@ Parse_GetCommandStruct( void ) * @param Idx Index of the connection from which the command has been received. * @param Request NULL terminated line of text (the "command"). * @return true on success (valid command or "regular" error), false if a - * fatal error occured and the connection has been shut down. + * fatal error occurred and the connection has been shut down. */ GLOBAL bool Parse_Request( CONN_ID Idx, char *Request ) @@ -268,8 +271,6 @@ Parse_Request( CONN_ID Idx, char *Request ) static void Init_Request( REQUEST *Req ) { - /* Neue Request-Struktur initialisieren */ - int i; assert( Req != NULL ); @@ -364,7 +365,7 @@ Validate_Command( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed ) *Closed = false; return true; -} /* Validate_Comman */ +} /* Validate_Command */ static bool @@ -511,10 +512,20 @@ Handle_Request( CONN_ID Idx, REQUEST *Req ) continue; } - if (!(client_type & cmd->type)) - return IRC_WriteStrClient(client, ERR_NOTREGISTERED_MSG, Client_ID(client)); + if (!(client_type & cmd->type)) { + if (client_type == CLIENT_USER + && cmd->type & CLIENT_SERVER) + return IRC_WriteStrClient(client, + ERR_NOTREGISTEREDSERVER_MSG, + Client_ID(client)); + else + return IRC_WriteStrClient(client, + ERR_NOTREGISTERED_MSG, + Client_ID(client)); + } - /* Command is allowed for this client: call it and count produced bytes */ + /* Command is allowed for this client: call it and count + * generated bytes in output */ Conn_ResetWCounter(); result = (cmd->function)(client, Req); cmd->bytes += Conn_WCounter();