]> jfr.im git - solanum.git/blobdiff - modules/m_map.c
More cleanup
[solanum.git] / modules / m_map.c
index 9ceae0e6042c5da28fb599cadc7a2671d39accb3..6ba05e1fa5df20c905bab9311007d635c021f776 100644 (file)
@@ -18,8 +18,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_map.c 3368 2007-04-03 10:11:06Z nenolod $
  */
 
 #include "stdinc.h"
 
 #define USER_COL       50      /* display | Users: %d at col 50 */
 
-static int m_map(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
-static int mo_map(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
+static const char map_desc[] = "Provides the MAP command to view network topology information";
+
+static void m_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
+static void mo_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
 
 struct Message map_msgtab = {
-       "MAP", 0, 0, 0, MFLG_SLOW,
+       "MAP", 0, 0, 0, 0,
        {mg_unreg, {m_map, 0}, mg_ignore, mg_ignore, mg_ignore, {mo_map, 0}}
 };
 
 mapi_clist_av1 map_clist[] = { &map_msgtab, NULL };
-DECLARE_MODULE_AV1(map, NULL, NULL, map_clist, NULL, NULL, "$Revision: 3368 $");
+
+DECLARE_MODULE_AV2(map, NULL, NULL, map_clist, NULL, NULL, NULL, NULL, map_desc);
 
 static void dump_map(struct Client *client_p, struct Client *root, char *pbuf);
 static void flattened_map(struct Client *client_p);
@@ -50,33 +51,30 @@ static char buf[BUFSIZE];
 
 /* m_map
 */
-static int
-m_map(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+m_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        if((!IsExemptShide(source_p) && ConfigServerHide.flatten_links) ||
           ConfigFileEntry.map_oper_only)
        {
                flattened_map(client_p);
                sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND));
-               return 0;
+               return;
        }
 
        dump_map(client_p, &me, buf);
        sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND));
-       return 0;
 }
 
 /*
 ** mo_map
 */
-static int
-mo_map(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+mo_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        dump_map(client_p, &me, buf);
        scache_send_missing(client_p);
        sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND));
-
-       return 0;
 }
 
 /*
@@ -110,7 +108,7 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
        }
 
        frac = (1000 * rb_dlink_list_length(&root_p->serv->users) + Count.total / 2) / Count.total;
-       rb_snprintf(buf + USER_COL, BUFSIZE - USER_COL,
+       snprintf(buf + USER_COL, BUFSIZE - USER_COL,
                 " | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users),
                 frac / 10, frac % 10);
 
@@ -159,7 +157,7 @@ flattened_map(struct Client *client_p)
        rb_dlink_node *ptr;
        struct Client *target_p;
        int i, len;
-       int cnt = 0;
+       unsigned long cnt = 0;
 
        /* First display me as the root */
        rb_strlcpy(buf, me.name, BUFSIZE);
@@ -200,7 +198,7 @@ flattened_map(struct Client *client_p)
                else
                        rb_strlcpy(buf, " |- ", BUFSIZE);
 
-               strlcat(buf, target_p->name, BUFSIZE);
+               rb_strlcat(buf, target_p->name, BUFSIZE);
                len = strlen(buf);
                buf[len] = ' ';