2 * IRC - Internet Relay Chat, ircd/map.c
3 * Copyright (C) 1994 Carlo Wood ( Run @ undernet.org )
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "ircd_reply.h"
29 #include "querycmds.h"
33 #include <stdio.h> /* sprintf */
36 void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length)
38 static char prompt[64];
40 char *p = &prompt[prompt_length];
44 if (prompt_length > 60)
45 send_reply(cptr, RPL_MAPMORE, prompt, server->name);
48 if (server->serv->lag>10000)
50 else if (server->serv->lag<0)
53 sprintf(lag,"(%is)",server->serv->lag);
54 send_reply(cptr, RPL_MAP, prompt, ((IsBurstOrBurstAck(server)) ? "*" : ""),
55 server->name, lag, (server == &me) ? UserStats.local_clients :
56 server->serv->clients);
58 if (prompt_length > 0)
64 if (prompt_length > 60)
67 for (lp = server->serv->down; lp; lp = lp->next)
68 if (match(mask, lp->value.cptr->name))
69 lp->value.cptr->flags &= ~FLAGS_MAP;
72 lp->value.cptr->flags |= FLAGS_MAP;
75 for (lp = server->serv->down; lp; lp = lp->next)
77 if ((lp->value.cptr->flags & FLAGS_MAP) == 0)
81 dump_map(cptr, lp->value.cptr, mask, prompt_length + 2);
83 if (prompt_length > 0)
91 * parv[0] = sender prefix
92 * parv[1] = server mask
94 int m_map(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
99 dump_map(sptr, &me, parv[1], 0);
100 sendto_one(sptr, rpl_str(RPL_MAPEND), me.name, parv[0]); /* XXX DEAD */