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.
28 #include "querycmds.h"
33 void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length)
35 static char prompt[64];
37 char *p = &prompt[prompt_length];
41 if (prompt_length > 60)
42 sendto_one(cptr, rpl_str(RPL_MAPMORE), me.name, cptr->name,
43 prompt, server->name);
45 sendto_one(cptr, rpl_str(RPL_MAP), me.name, cptr->name,
46 prompt, NumServ(server), server->name,
47 server->serv->lag>0 ? server->serv->lag : 0,
48 (server == &me) ? UserStats.local_clients : server->serv->clients);
49 if (prompt_length > 0)
55 if (prompt_length > 60)
58 for (lp = server->serv->down; lp; lp = lp->next)
59 if (match(mask, lp->value.cptr->name))
60 lp->value.cptr->flags &= ~FLAGS_MAP;
63 lp->value.cptr->flags |= FLAGS_MAP;
66 for (lp = server->serv->down; lp; lp = lp->next)
68 if ((lp->value.cptr->flags & FLAGS_MAP) == 0)
72 dump_map(cptr, lp->value.cptr, mask, prompt_length + 2);
74 if (prompt_length > 0)
82 * parv[0] = sender prefix
83 * parv[1] = server mask
85 int m_map(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
90 dump_map(sptr, &me, parv[1], 0);
91 sendto_one(sptr, rpl_str(RPL_MAPEND), me.name, parv[0]);