1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-26 18:36:38 +02:00
Files
unrealircd/src/help.c
T
binki 06e807130c - Added error message for unknown directives in the "files" block
- Remote MOTD support. Not adequately tested. Required restructuring of the asynchronous download callback and handler.
- Added some consts throughout url.c, etc.
- Fix segfault where the an include directive specifies a URL and cURL follows redirects, resulting in a different resultant URL. The remote includes code would look for the an include block using the resultant URL and assume that it would be found. The new code searches differently, has new checks, and ignores the resultant URL.
- Removed duplicated m_motd() and friends that were both in modules and s_serv.c. The copies in s_serv.c (core) were overriding the in-module functions.
2010-06-16 05:44:15 +00:00

92 lines
2.5 KiB
C

/************************************************************************
* Unreal Internet Relay Chat Daemon, src/help.c
* Copyright (C) 2001 codemastr (Dominick Meglio) <codemastr@unrealircd.com>
*
* 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
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "h.h"
#include "proto.h"
#define HDR(str) sendto_one(sptr, ":%s 290 %s :%s", me.name, sptr->name, str);
#define SND(str) sendto_one(sptr, ":%s 292 %s :%s", me.name, sptr->name, str);
ConfigItem_help *Find_Help(char *command) {
ConfigItem_help *help;
if (!command) {
for (help = conf_help; help; help = (ConfigItem_help *)help->next) {
if (help->command == NULL)
return help;
}
return NULL;
}
for (help = conf_help; help; help = (ConfigItem_help *)help->next) {
if (help->command == NULL)
continue;
else if (!stricmp(command,help->command))
return help;
}
return NULL;
}
int parse_help(aClient *sptr, char *name, char *help)
{
ConfigItem_help *helpitem;
aMotdLine *text;
if (BadPtr(help))
{
helpitem = Find_Help(NULL);
if (!helpitem)
return 1;
SND(" -");
HDR(" ***** UnrealIRCd Help System *****");
SND(" -");
text = helpitem->text;
while (text) {
SND(text->line);
text = text->next;
}
SND(" -");
return 1;
}
helpitem = Find_Help(help);
if (!helpitem) {
SND(" -");
HDR(" ***** No Help Available *****");
SND(" -");
SND(" We're sorry, we don't have help available for the command you requested.");
SND(" -");
sendto_one(sptr,":%s 292 %s : ***** Go to %s if you have any further questions *****",
me.name, sptr->name, helpchan);
SND(" -");
return 0;
}
text = helpitem->text;
SND(" -");
sendto_one(sptr,":%s 290 %s :***** %s *****",
me.name, sptr->name, helpitem->command);
SND(" -");
while (text) {
SND(text->line);
text = text->next;
}
SND(" -");
return 1;
}