ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_help.c
(Generate patch)

Comparing:
ircd-hybrid-7.2/modules/m_help.c (file contents), Revision 897 by db, Sat Nov 3 17:13:32 2007 UTC vs.
ircd-hybrid-8/modules/m_help.c (file contents), Revision 1325 by michael, Sat Mar 31 10:29:02 2012 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 – #include "handlers.h"
26   #include "client.h"
27   #include "ircd.h"
29 – #include "ircd_handler.h"
30 – #include "msg.h"
28   #include "numeric.h"
29   #include "send.h"
30 < #include "s_conf.h"
34 < #include "s_log.h"
30 > #include "conf.h"
31   #include "parse.h"
32   #include "modules.h"
33   #include "irc_string.h"
34  
35   #define HELPLEN 400
36  
41 – static void m_help(struct Client *, struct Client *, int, char *[]);
42 – static void mo_help(struct Client *, struct Client *, int, char *[]);
43 – static void mo_uhelp(struct Client *, struct Client *, int, char *[]);
37   static void dohelp(struct Client *, const char *, char *);
38   static void sendhelpfile(struct Client *, const char *, const char *);
39  
47 – struct Message help_msgtab = {
48 –  "HELP", 0, 0, 0, 0, MFLG_SLOW, 0,
49 –  {m_unregistered, m_help, m_ignore, m_ignore, mo_help, m_ignore}
50 – };
51 –
52 – struct Message uhelp_msgtab = {
53 –  "UHELP", 0, 0, 0, 0, MFLG_SLOW, 0,
54 –  {m_unregistered, m_help, m_ignore, m_ignore, mo_uhelp, m_ignore}
55 – };
56 –
57 – #ifndef STATIC_MODULES
58 – void
59 – _modinit(void)
60 – {
61 –  mod_add_cmd(&help_msgtab);
62 –  mod_add_cmd(&uhelp_msgtab);
63 – }
64 –
65 – void
66 – _moddeinit(void)
67 – {
68 –  mod_del_cmd(&help_msgtab);
69 –  mod_del_cmd(&uhelp_msgtab);
70 – }
71 –
72 – const char *_version = "$Revision$";
73 – #endif
40  
41   /*
42   * m_help - HELP message handler
# Line 159 | Line 125 | dohelp(struct Client *source_p, const ch
125  
126    if (stat(path, &sb) < 0)
127    {
162 –    ilog(L_NOTICE, "help file %s not found", path);
128      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
129                 me.name, source_p->name, topic);
130      return;
131    }
132  
168 – #ifndef _WIN32
133    if (!S_ISREG(sb.st_mode))
134    {
171 –    ilog(L_NOTICE, "help file %s not found", path);
135      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
136                 me.name, source_p->name, topic);
137      return;
138    }
176 – #endif
139  
140    sendhelpfile(source_p, path, topic);
141   }
# Line 181 | Line 143 | dohelp(struct Client *source_p, const ch
143   static void
144   sendhelpfile(struct Client *source_p, const char *path, const char *topic)
145   {
146 <  FBFILE *file;
146 >  FILE *file;
147    char line[HELPLEN];
148    char started = 0;
149    int type;
150  
151 <  if ((file = fbopen(path, "r")) == NULL)
151 >  if ((file = fopen(path, "r")) == NULL)
152    {
153      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
154                 me.name, source_p->name, topic);
155      return;
156    }
157  
158 <  if (fbgets(line, sizeof(line), file) == NULL)
158 >  if (fgets(line, sizeof(line), file) == NULL)
159    {
160      sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
161                 me.name, source_p->name, topic);
# Line 208 | Line 170 | sendhelpfile(struct Client *source_p, co
170      started = 1;
171    }
172  
173 <  while (fbgets(line, sizeof(line), file))
173 >  while (fgets(line, sizeof(line), file))
174    {
175      line[strlen(line) - 1] = '\0';
176 <    if(line[0] != '#')
176 >    if (line[0] != '#')
177      {
178        if (!started)
179        {
180          type = RPL_HELPSTART;
181 <        started = 1;
181 >        started = 1;
182        }
183        else
184          type = RPL_HELPTXT;
# Line 226 | Line 188 | sendhelpfile(struct Client *source_p, co
188      }
189    }
190  
191 <  fbclose(file);
191 >  fclose(file);
192    sendto_one(source_p, form_str(RPL_HELPTXT),
193               me.name, source_p->name, topic, "");
194    sendto_one(source_p, form_str(RPL_ENDOFHELP),
195               me.name, source_p->name, topic);
196   }
197 +
198 + static struct Message help_msgtab = {
199 +  "HELP", 0, 0, 0, 0, MFLG_SLOW, 0,
200 +  {m_unregistered, m_help, m_ignore, m_ignore, mo_help, m_ignore}
201 + };
202 +
203 + static struct Message uhelp_msgtab = {
204 +  "UHELP", 0, 0, 0, 0, MFLG_SLOW, 0,
205 +  {m_unregistered, m_help, m_ignore, m_ignore, mo_uhelp, m_ignore}
206 + };
207 +
208 + static void
209 + module_init(void)
210 + {
211 +  mod_add_cmd(&help_msgtab);
212 +  mod_add_cmd(&uhelp_msgtab);
213 + }
214 +
215 + static void
216 + module_exit(void)
217 + {
218 +  mod_del_cmd(&help_msgtab);
219 +  mod_del_cmd(&uhelp_msgtab);
220 + }
221 +
222 + struct module module_entry = {
223 +  .node    = { NULL, NULL, NULL },
224 +  .name    = NULL,
225 +  .version = "$Revision$",
226 +  .handle  = NULL,
227 +  .modinit = module_init,
228 +  .modexit = module_exit,
229 +  .flags   = 0
230 + };

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)