]> jfr.im git - solanum.git/blobdiff - modules/m_help.c
m_oper: receive ircd-seven-style opernames
[solanum.git] / modules / m_help.c
index 24c562f341b6bee8b807f2a32fc35f93734f9964..9e56c861362838b4ee155f1c8e03364f5e08d780 100644 (file)
@@ -20,8 +20,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
- *
- *  $Id: m_help.c 254 2005-09-21 23:35:12Z nenolod $
  */
 
 #include "stdinc.h"
 #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"
+#include "rb_dictionary.h"
+
+static const char help_desc[] =
+       "Provides the help facility for commands, modes, and server concepts";
 
-static int m_help(struct Client *, struct Client *, int, const char **);
-static int mo_help(struct Client *, struct Client *, int, const char **);
-static int mo_uhelp(struct Client *, struct Client *, int, const char **);
+static void m_help(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void mo_help(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void mo_uhelp(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 static void dohelp(struct Client *, int, const char *);
 
 struct Message help_msgtab = {
-       "HELP", 0, 0, 0, MFLG_SLOW,
+       "HELP", 0, 0, 0, 0,
        {mg_unreg, {m_help, 0}, mg_ignore, mg_ignore, mg_ignore, {mo_help, 0}}
 };
 struct Message uhelp_msgtab = {
-       "UHELP", 0, 0, 0, MFLG_SLOW,
+       "UHELP", 0, 0, 0, 0,
        {mg_unreg, {m_help, 0}, mg_ignore, mg_ignore, mg_ignore, {mo_uhelp, 0}}
 };
 
 mapi_clist_av1 help_clist[] = { &help_msgtab, &uhelp_msgtab, NULL };
-DECLARE_MODULE_AV1(help, NULL, NULL, help_clist, NULL, NULL, "$Revision: 254 $");
+
+DECLARE_MODULE_AV2(help, NULL, NULL, help_clist, NULL, NULL, NULL, NULL, help_desc);
 
 /*
  * 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 void
+m_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL);
-
-       return 0;
 }
 
 /*
  * 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[])
+static void
+mo_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        dohelp(source_p, HELP_OPER, parc > 1 ? parv[1] : NULL);
-       return 0;
 }
 
 /*
  * 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[])
+static void
+mo_uhelp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL);
-       return 0;
 }
 
 static void
@@ -96,13 +91,13 @@ 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;
 
-       hptr = irc_dictionary_retrieve(help_dict, topic);
+       hptr = rb_dictionary_retrieve((flags & HELP_OPER) ? help_dict_oper : help_dict_user, topic);
 
        if(hptr == NULL || !(hptr->flags & flags))
        {
@@ -118,7 +113,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;
 
@@ -128,5 +123,4 @@ dohelp(struct Client *source_p, int flags, const char *topic)
 
        sendto_one(source_p, form_str(RPL_ENDOFHELP),
                   me.name, source_p->name, topic);
-       return;
 }