]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_help.c
Allow /ojoin !#channel/%#channel, if admin/halfop are enabled.
[irc/rqf/shadowircd.git] / modules / m_help.c
index 85f9de35b601d23234bb62451002fe587185162c..ab94ed0bbf1b0a5e35c4afd08515f828cd14ffa5 100644 (file)
 #include "numeric.h"
 #include "send.h"
 #include "s_conf.h"
-#include "s_log.h"
+#include "logger.h"
 #include "parse.h"
 #include "modules.h"
 #include "hash.h"
 #include "cache.h"
+#include "irc_dictionary.h"
 
 static int m_help(struct Client *, struct Client *, int, const char **);
 static int mo_help(struct Client *, struct Client *, int, const char **);
@@ -56,29 +57,10 @@ DECLARE_MODULE_AV1(help, NULL, NULL, help_clist, NULL, NULL, "$Revision: 254 $")
 
 /*
  * m_help - HELP message handler
- *      parv[0] = sender prefix
  */
 static int
 m_help(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
-       static time_t last_used = 0;
-
-       /* HELP is always local */
-       if((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
-       {
-               /* safe enough to give this on a local connect only */
-               sendto_one(source_p, form_str(RPL_LOAD2HI), 
-                          me.name, source_p->name, "HELP");
-               sendto_one(source_p, form_str(RPL_ENDOFHELP),
-                          me.name, source_p->name,
-                          (parc > 1 && !EmptyString(parv[1])) ? parv[1] : "index");
-               return 0;
-       }
-       else
-       {
-               last_used = CurrentTime;
-       }
-
        dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL);
 
        return 0;
@@ -86,7 +68,6 @@ m_help(struct Client *client_p, struct Client *source_p, int parc, const char *p
 
 /*
  * mo_help - HELP message handler
- *      parv[0] = sender prefix
  */
 static int
 mo_help(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
@@ -98,7 +79,6 @@ mo_help(struct Client *client_p, struct Client *source_p, int parc, const char *
 /*
  * mo_uhelp - HELP message handler
  * This is used so that opers can view the user help file without deopering
- *      parv[0] = sender prefix
  */
 static int
 mo_uhelp(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
@@ -113,15 +93,23 @@ dohelp(struct Client *source_p, int flags, const char *topic)
        static const char ntopic[] = "index";
        struct cachefile *hptr;
        struct cacheline *lineptr;
-       dlink_node *ptr;
-       dlink_node *fptr;
+       rb_dlink_node *ptr;
+       rb_dlink_node *fptr;
 
        if(EmptyString(topic))
+       {
                topic = ntopic;
+               if(!EmptyString(ServerInfo.helpchan))
+                       sendto_one(source_p, ":%s 525 %s :Official Help Channel: %s",
+                                       me.name, source_p->name, ServerInfo.helpchan);
+               if(!EmptyString(ServerInfo.helpurl))
+                       sendto_one(source_p, ":%s 526 %s :Official Help URL: %s",
+                                       me.name, source_p->name, ServerInfo.helpurl);
+       }
 
-       hptr = hash_find_help(topic, flags);
+       hptr = irc_dictionary_retrieve(flags & HELP_OPER ? help_dict_oper : help_dict_user, topic);
 
-       if(hptr == NULL)
+       if(hptr == NULL || !(hptr->flags & flags))
        {
                sendto_one(source_p, form_str(ERR_HELPNOTFOUND),
                           me.name, source_p->name, topic);
@@ -135,7 +123,7 @@ dohelp(struct Client *source_p, int flags, const char *topic)
        sendto_one(source_p, form_str(RPL_HELPSTART),
                   me.name, source_p->name, topic, lineptr->data);
 
-       DLINK_FOREACH(ptr, fptr->next)
+       RB_DLINK_FOREACH(ptr, fptr->next)
        {
                lineptr = ptr->data;