]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/commands/cmd_userhost.cpp
Update copyrights for 2009.
[user/henk/code/inspircd.git] / src / commands / cmd_userhost.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 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 CommandUserhost(Instance);
20 }
21
22 CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, User *user)
23 {
24         std::string retbuf = std::string("302 ") + user->nick + " :";
25
26         
27         for (unsigned int i = 0; i < parameters.size(); 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                         if (IS_AWAY(u))
45                                 retbuf += "-";
46                         else
47                                 retbuf += "+";
48
49                         retbuf = retbuf + u->ident + "@";
50
51                         if (user->HasPrivPermission("users/auspex"))
52                         {
53                                 retbuf = retbuf + u->host;
54                         }
55                         else
56                         {
57                                 retbuf = retbuf + u->dhost;
58                         }
59
60                         retbuf = retbuf + " ";
61                 }
62         }
63
64         user->WriteServ(retbuf);
65
66         return CMD_SUCCESS;
67 }