/[svn]/ircd-hybrid/trunk/modules/m_help.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/modules/m_help.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1673 by michael, Sat Oct 27 21:02:32 2012 UTC revision 1674 by michael, Fri Nov 23 21:00:02 2012 UTC
# Line 91  dohelp(struct Client *source_p, const ch Line 91  dohelp(struct Client *source_p, const ch
91    char h_index[] = "index";    char h_index[] = "index";
92    char path[PATH_MAX + 1];    char path[PATH_MAX + 1];
93    struct stat sb;    struct stat sb;
94    int i;    unsigned int i;
95    
96    if (topic != NULL)    if (EmptyString(topic))
97    {      topic = h_index;
     if (*topic == '\0')  
       topic = h_index;  
     else  
     {  
       /* convert to lower case */  
       for (i = 0; topic[i] != '\0'; ++i)  
         topic[i] = ToLower(topic[i]);  
     }  
   }  
98    else    else
99      topic = h_index;    /* list available help topics */      for (i = 0; topic[i] != '\0'; ++i)
100          topic[i] = ToLower(topic[i]);
101    
102    if (strpbrk(topic, "/\\"))    if (strpbrk(topic, "/\\"))
103    {    {
# Line 145  sendhelpfile(struct Client *source_p, co Line 137  sendhelpfile(struct Client *source_p, co
137  {  {
138    FILE *file;    FILE *file;
139    char line[HELPLEN];    char line[HELPLEN];
   char started = 0;  
   int type;  
140    
141    if ((file = fopen(path, "r")) == NULL)    if ((file = fopen(path, "r")) == NULL)
142    {    {
# Line 162  sendhelpfile(struct Client *source_p, co Line 152  sendhelpfile(struct Client *source_p, co
152      return;      return;
153    }    }
154    
155    else if (line[0] != '#')    line[strlen(line) - 1] = '\0';
156    {    sendto_one(source_p, form_str(RPL_HELPSTART),
     line[strlen(line) - 1] = '\0';          
     sendto_one(source_p, form_str(RPL_HELPSTART),  
157               me.name, source_p->name, topic, line);               me.name, source_p->name, topic, line);
     started = 1;  
   }  
158    
159    while (fgets(line, sizeof(line), file))    while (fgets(line, sizeof(line), file))
160    {    {
161      line[strlen(line) - 1] = '\0';      line[strlen(line) - 1] = '\0';
162      if (line[0] != '#')  
163      {      sendto_one(source_p, form_str(RPL_HELPTXT),
164        if (!started)                 me.name, source_p->name, topic, line);
       {  
         type = RPL_HELPSTART;  
         started = 1;  
       }  
       else  
         type = RPL_HELPTXT;  
         
       sendto_one(source_p, form_str(RPL_HELPTXT),  
                  me.name, source_p->name, topic, line);  
     }  
165    }    }
166    
167    fclose(file);    fclose(file);
   sendto_one(source_p, form_str(RPL_HELPTXT),  
              me.name, source_p->name, topic, "");  
168    sendto_one(source_p, form_str(RPL_ENDOFHELP),    sendto_one(source_p, form_str(RPL_ENDOFHELP),
169               me.name, source_p->name, topic);               me.name, source_p->name, topic);
170  }  }

Legend:
Removed from v.1673  
changed lines
  Added in v.1674

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28