]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/commands/cmd_userhost.cpp
Change OnHookUserIO to OnHookIO, making it usable for more than User* and less picky...
[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://wiki.inspircd.org/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         for (unsigned int i = 0; i < parameters.size(); i++)
27         {
28                 User *u = ServerInstance->FindNick(parameters[i]);
29
30                 if ((u) && (u->registered == REG_ALL))
31                 {
32                         retbuf = retbuf + u->nick;
33
34                         if (IS_OPER(u))
35                         {
36                                 retbuf = retbuf + "*=";
37                         }
38                         else
39                         {
40                                 retbuf = retbuf + "=";
41                         }
42
43                         if (IS_AWAY(u))
44                                 retbuf += "-";
45                         else
46                                 retbuf += "+";
47
48                         retbuf = retbuf + u->ident + "@";
49
50                         if (user->HasPrivPermission("users/auspex"))
51                         {
52                                 retbuf = retbuf + u->host;
53                         }
54                         else
55                         {
56                                 retbuf = retbuf + u->dhost;
57                         }
58
59                         retbuf = retbuf + " ";
60                 }
61         }
62
63         user->WriteServ(retbuf);
64
65         return CMD_SUCCESS;
66 }