#include "client.h"
#include "ircd.h"
-#include "ircd_policy.h"
+#include "ircd_defs.h"
+#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_snprintf.h"
#include "ircd_string.h"
#include "send.h"
#include "querycmds.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
+#include <string.h>
static void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length)
{
+ const char *chr;
static char prompt[64];
struct DLink *lp;
- char *p = &prompt[prompt_length];
+ char *p = prompt + prompt_length;
int cnt = 0;
-
+
*p = '\0';
if (prompt_length > 60)
send_reply(cptr, RPL_MAPMORE, prompt, cli_name(server));
- else {
+ else
+ {
char lag[512];
if (cli_serv(server)->lag>10000)
- lag[0]=0;
+ lag[0]=0;
else if (cli_serv(server)->lag<0)
- strcpy(lag,"(0s)");
+ strcpy(lag,"(0s)");
+ else
+ sprintf(lag,"(%is)",cli_serv(server)->lag);
+ if (IsBurst(server))
+ chr = "*";
+ else if (IsBurstAck(server))
+ chr = "!";
else
- sprintf(lag,"(%is)",cli_serv(server)->lag);
- send_reply(cptr, RPL_MAP, prompt, (
- (IsBurst(server)) ? "*" : (IsBurstAck(server) ? "!" : "")),
- cli_name(server), lag, (server == &me) ? UserStats.local_clients :
- cli_serv(server)->clients);
+ chr = "";
+ send_reply(cptr, RPL_MAP, prompt, chr, cli_name(server),
+ lag, (server == &me) ? UserStats.local_clients :
+ cli_serv(server)->clients);
}
if (prompt_length > 0)
{
strcpy(p, "|-");
for (lp = cli_serv(server)->down; lp; lp = lp->next)
if (match(mask, cli_name(lp->value.cptr)))
- cli_flags(lp->value.cptr) &= ~FLAGS_MAP;
+ ClrFlag(lp->value.cptr, FLAG_MAP);
else
{
- cli_flags(lp->value.cptr) |= FLAGS_MAP;
+ SetFlag(lp->value.cptr, FLAG_MAP);
cnt++;
}
for (lp = cli_serv(server)->down; lp; lp = lp->next)
{
- if ((cli_flags(lp->value.cptr) & FLAGS_MAP) == 0)
+ if (!HasFlag(lp->value.cptr, FLAG_MAP))
continue;
if (--cnt == 0)
*p = '`';
*/
int m_map(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
+ if (feature_bool(FEAT_HIS_MAP) && !IsAnOper(sptr))
+ {
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s %s", sptr,
+ "/MAP has been disabled, from CFV-165. "
+ "Visit ", feature_str(FEAT_HIS_URLSERVERS));
+ return 0;
+ }
if (parc < 2)
parv[1] = "*";
-
dump_map(sptr, &me, parv[1], 0);
send_reply(sptr, RPL_MAPEND);
return 0;
}
-#ifdef HEAD_IN_SAND_MAP
-int m_map_redirect(struct Client* cptr, struct Client* sptr, int parc,
- char* parv[])
+int mo_map(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
- sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s", sptr,
- "/MAP has been disabled, from CFV-165. "
- "Visit http://www.undernet.org/servers.php");
+ if (parc < 2)
+ parv[1] = "*";
+
+ dump_map(sptr, &me, parv[1], 0);
+ send_reply(sptr, RPL_MAPEND);
+
return 0;
}
-#endif