X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fparse.c;h=13a92ac250bf06962c9b2984eba70c679d9a9401;hb=98e9467c85b1a81fbbcebf2be21b3a0d83fb60c4;hp=fdb957c3efe0c52d881ff3cdffd6bf345e98de02;hpb=344185b1bd6254ac4a198b3caeaf08db285016c8;p=ngircd-alex.git diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index fdb957c3..13a92ac2 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,29 +16,26 @@ * IRC command parser and validator. */ -#include "imp.h" #include #include -#include #include #include #include "ngircd.h" -#include "defines.h" #include "conn-func.h" +#include "conf.h" #include "channel.h" #include "log.h" #include "messages.h" -#include "tool.h" -#include "exp.h" #include "parse.h" -#include "imp.h" #include "irc.h" #include "irc-cap.h" #include "irc-channel.h" -#include "irc-encoding.h" +#ifdef ICONV +# include "irc-encoding.h" +#endif #include "irc-info.h" #include "irc-login.h" #include "irc-metadata.h" @@ -49,9 +46,6 @@ #include "irc-write.h" #include "numeric.h" -#include "exp.h" -#include "conf.h" - struct _NUMERIC { int numeric; bool (*function) PARAMS(( CLIENT *Client, REQUEST *Request )); @@ -76,7 +70,7 @@ static COMMAND My_Commands[] = _CMD("GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0), _CMD("HELP", IRC_HELP, CLIENT_USER, 0, 1, 2), _CMD("INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 1, 2), - _CMD("INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 2, 2, 0), + _CMD("INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 2, 2, 1), _CMD("ISON", IRC_ISON, CLIENT_USER, 1, -1, 0), _CMD("JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 1, 2, 0), _CMD("KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 2, 3, 0), @@ -162,7 +156,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 assume that this is a valid IRC command and * try to do something useful with it :-) @@ -348,7 +342,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed ) /* check if the client named in the prefix is expected * to come from that direction */ if (Client_NextHop(c) != client) { - if (Client_Type(c) != CLIENT_SERVER) { + if (Client_Type(client) != CLIENT_SERVER) { Log(LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\"), closing connection!", Req->prefix, Client_ID(client), Idx, Req->command); @@ -467,10 +461,10 @@ Handle_Numeric(CLIENT *client, REQUEST *Req) } /* Determine source */ - if (! Req->prefix[0]) { - /* Oops, no prefix!? */ - Log(LOG_WARNING, "Got status code %s from \"%s\" without prefix!?", - Req->command, Client_ID(client)); + if (!Req->prefix) { + Log(LOG_WARNING, + "Got status code %s from \"%s\" without prefix!?", + Req->command, Client_ID(client)); return true; }