Exemple #1
0
/**
 * Handler for the IRC "HELP" command.
 *
 * @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_HELP(CLIENT *Client, REQUEST *Req)
{
	COMMAND *cmd;

	assert(Client != NULL);
	assert(Req != NULL);

	if ((Req->argc == 0 && array_bytes(&Conf_Helptext) > 0)
	    || (Req->argc >= 1 && strcasecmp(Req->argv[0], "Commands") != 0)) {
		/* Help text available and requested */
		if (Req->argc >= 1)
			return Help(Client, Req->argv[0]);

		if (!Help(Client, "Intro"))
			return DISCONNECTED;
		return CONNECTED;
	}

	cmd = Parse_GetCommandStruct();
	while(cmd->name) {
		if (!IRC_WriteStrClient(Client, "NOTICE %s :%s",
					Client_ID(Client), cmd->name))
			return DISCONNECTED;
		cmd++;
	}
	return CONNECTED;
} /* IRC_HELP */
Exemple #2
0
GLOBAL bool
IRC_HELP( CLIENT *Client, REQUEST *Req )
{
	COMMAND *cmd;

	assert( Client != NULL );
	assert( Req != NULL );

	/* Bad number of arguments? */
	if( Req->argc > 0 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );

	cmd = Parse_GetCommandStruct( );
	while( cmd->name )
	{
		if( ! IRC_WriteStrClient( Client, "NOTICE %s :%s", Client_ID( Client ), cmd->name )) return DISCONNECTED;
		cmd++;
	}
	
	IRC_SetPenalty( Client, 2 );
	return CONNECTED;
} /* IRC_HELP */