36 |
|
#include "modules.h" |
37 |
|
#include "irc_string.h" |
38 |
|
|
39 |
– |
#define HPATH IRCD_PREFIX "/help/opers" |
40 |
– |
#define UHPATH IRCD_PREFIX "/help/users" |
39 |
|
#define HELPLEN 400 |
40 |
|
|
41 |
|
static void m_help(struct Client *, struct Client *, int, char *[]); |
54 |
|
{m_unregistered, m_help, m_ignore, m_ignore, mo_uhelp, m_ignore} |
55 |
|
}; |
56 |
|
|
59 |
– |
#ifndef STATIC_MODULES |
57 |
|
void |
58 |
|
_modinit(void) |
59 |
|
{ |
69 |
|
} |
70 |
|
|
71 |
|
const char *_version = "$Revision$"; |
75 |
– |
#endif |
72 |
|
|
73 |
|
/* |
74 |
|
* m_help - HELP message handler |
120 |
|
static void |
121 |
|
dohelp(struct Client *source_p, const char *hpath, char *topic) |
122 |
|
{ |
123 |
+ |
char h_index[] = "index"; |
124 |
|
char path[PATH_MAX + 1]; |
125 |
|
struct stat sb; |
126 |
|
int i; |
128 |
|
if (topic != NULL) |
129 |
|
{ |
130 |
|
if (*topic == '\0') |
131 |
< |
topic = "index"; |
131 |
> |
topic = h_index; |
132 |
|
else |
133 |
|
{ |
134 |
|
/* convert to lower case */ |
135 |
< |
for (i = 0; topic[i] != '\0'; i++) |
135 |
> |
for (i = 0; topic[i] != '\0'; ++i) |
136 |
|
topic[i] = ToLower(topic[i]); |
137 |
|
} |
138 |
|
} |
139 |
|
else |
140 |
< |
topic = "index"; /* list available help topics */ |
140 |
> |
topic = h_index; /* list available help topics */ |
141 |
|
|
142 |
|
if (strpbrk(topic, "/\\")) |
143 |
|
{ |
157 |
|
|
158 |
|
if (stat(path, &sb) < 0) |
159 |
|
{ |
163 |
– |
ilog(L_NOTICE, "help file %s not found", path); |
160 |
|
sendto_one(source_p, form_str(ERR_HELPNOTFOUND), |
161 |
|
me.name, source_p->name, topic); |
162 |
|
return; |
163 |
|
} |
164 |
|
|
169 |
– |
#ifndef _WIN32 |
165 |
|
if (!S_ISREG(sb.st_mode)) |
166 |
|
{ |
172 |
– |
ilog(L_NOTICE, "help file %s not found", path); |
167 |
|
sendto_one(source_p, form_str(ERR_HELPNOTFOUND), |
168 |
|
me.name, source_p->name, topic); |
169 |
|
return; |
170 |
|
} |
177 |
– |
#endif |
171 |
|
|
172 |
|
sendhelpfile(source_p, path, topic); |
173 |
|
} |
205 |
|
while (fbgets(line, sizeof(line), file)) |
206 |
|
{ |
207 |
|
line[strlen(line) - 1] = '\0'; |
208 |
< |
if(line[0] != '#') |
208 |
> |
if (line[0] != '#') |
209 |
|
{ |
210 |
|
if (!started) |
211 |
|
{ |
212 |
|
type = RPL_HELPSTART; |
213 |
< |
started = 1; |
213 |
> |
started = 1; |
214 |
|
} |
215 |
|
else |
216 |
|
type = RPL_HELPTXT; |