]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_userhost.cpp
In the grand tradition of huge fucking commits:
[user/henk/code/inspircd.git] / src / cmd_userhost.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "commands/cmd_userhost.h"
16
17 extern "C" DllExport Command* init_command(InspIRCd* Instance)
18 {
19         return new cmd_userhost(Instance);
20 }
21
22 CmdResult cmd_userhost::Handle (const char** parameters, int pcnt, User *user)
23 {
24         std::string retbuf = std::string("302 ") + user->nick + " :";
25
26         
27         for (int i = 0; i < pcnt; i++)
28         {
29                 User *u = ServerInstance->FindNick(parameters[i]);
30
31                 if ((u) && (u->registered == REG_ALL))
32                 {
33                         retbuf = retbuf + u->nick;
34
35                         if (IS_OPER(u))
36                         {
37                                 retbuf = retbuf + "*=+";
38                         }
39                         else
40                         {
41                                 retbuf = retbuf + "=+";
42                         }
43
44                         retbuf = retbuf + u->ident + "@";
45
46                         if (IS_OPER(user))
47                         {
48                                 retbuf = retbuf + u->host;
49                         }
50                         else
51                         {
52                                 retbuf = retbuf + u->dhost;
53                         }
54
55                         retbuf = retbuf + " ";
56                 }
57         }
58
59         user->WriteServ(retbuf);
60
61         return CMD_SUCCESS;
62 }