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=46e342711387269a1cc47d19ecf1e1dee870c388;hp=905799eb52fc21886bec08a44e4c88553d2ef7b0;hb=2a7dd06ebd9cc72d45a6a4becdbef5213d7b7800;hpb=32188d821b24198e4f6b5283fec1060b6700b66b diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c index 905799eb..46e34271 100644 --- a/src/ngircd/irc-info.c +++ b/src/ngircd/irc-info.c @@ -7,13 +7,15 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. - * - * IRC info commands */ - #include "portab.h" +/** + * @file + * IRC info commands + */ + #include "imp.h" #include #include @@ -914,6 +916,15 @@ IRC_WHO( CLIENT *Client, REQUEST *Req ) } /* IRC_WHO */ +/** + * Handler for the IRC "WHOIS" command. + * + * See RFC 2812, 3.6.2 "Whois query". + * + * @param Client The client from which this command has been received. + * @param Req Request structure with prefix and all parameters. + * @return CONNECTED or DISCONNECTED. + */ GLOBAL bool IRC_WHOIS( CLIENT *Client, REQUEST *Req ) { @@ -926,11 +937,17 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req ) assert( Req != NULL ); /* Bad number of parameters? */ - if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); + if (Req->argc < 1 || Req->argc > 2) + return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, + Client_ID(Client), Req->command); /* Search client */ - c = Client_Search( Req->argv[Req->argc - 1] ); - if(( ! c ) || ( Client_Type( c ) != CLIENT_USER )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[Req->argc - 1] ); + c = Client_Search(Req->argv[Req->argc - 1]); + if (!c || (Client_Type(c) != CLIENT_USER + && Client_Type(c) != CLIENT_SERVICE)) + return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, + Client_ID(Client), + Req->argv[Req->argc - 1]); /* Search sender of the WHOIS */ if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix ); @@ -1239,7 +1256,9 @@ static bool Show_MOTD_SSLInfo(CLIENT *Client) return ret; } #else -static inline bool Show_MOTD_SSLInfo(UNUSED CLIENT *c) { return true; } +static inline bool +Show_MOTD_SSLInfo(UNUSED CLIENT *c) +{ return true; } #endif GLOBAL bool @@ -1337,7 +1356,7 @@ IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan ) * See for details. */ GLOBAL bool -IRC_Send_ISUPPORT PARAMS((CLIENT * Client)) +IRC_Send_ISUPPORT(CLIENT * Client) { if (!IRC_WriteStrClient(Client, RPL_ISUPPORT1_MSG, Client_ID(Client), Conf_MaxJoins))