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 */
35 void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length)
37 static char prompt[64];
39 char *p = &prompt[prompt_length];
43 if (prompt_length > 60)
44 send_reply(cptr, RPL_MAPMORE, prompt, server->name);
47 if (server->serv->lag>10000)
49 else if (server->serv->lag<0)
52 sprintf(lag,"(%is)",server->serv->lag);
53 send_reply(cptr, RPL_MAP, prompt, ((IsBurstOrBurstAck(server)) ? "*" : ""),
54 server->name, lag, (server == &me) ? UserStats.local_clients :
55 server->serv->clients);
57 if (prompt_length > 0)
63 if (prompt_length > 60)
66 for (lp = server->serv->down; lp; lp = lp->next)
67 if (match(mask, lp->value.cptr->name))
68 lp->value.cptr->flags &= ~FLAGS_MAP;
71 lp->value.cptr->flags |= FLAGS_MAP;
74 for (lp = server->serv->down; lp; lp = lp->next)
76 if ((lp->value.cptr->flags & FLAGS_MAP) == 0)
80 dump_map(cptr, lp->value.cptr, mask, prompt_length + 2);
82 if (prompt_length > 0)
90 * parv[0] = sender prefix
91 * parv[1] = server mask
93 int m_map(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
98 dump_map(sptr, &me, parv[1], 0);
99 sendto_one(sptr, rpl_str(RPL_MAPEND), me.name, parv[0]); /* XXX DEAD */