]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_who.cpp
Fix passing wrong instance to resolver
[user/henk/code/inspircd.git] / src / cmd_who.cpp
index aab1688baf5144ebba532dc461acdc5134d61fc2..de3f30196fae2fc5fb9a5aaa02f250d3ff4681ce 100644 (file)
@@ -23,8 +23,7 @@
 #include "wildcard.h"
 #include "commands/cmd_who.h"
 
-extern ServerConfig* Config;
-extern user_hash clientlist;
+extern InspIRCd* ServerInstance;
 extern chan_hash chanlist;
 extern std::vector<userrec*> all_opers;
 
@@ -132,7 +131,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                        /* XXX - code duplication; this could be more efficient -- w00t */
                        std::string wholine = initial;
 
-                       wholine = wholine + getlastchanname(i->second) + " " + i->second->ident + " " + (opt_showrealhost ? i->second->host : i->second->dhost) + " " + 
+                       wholine = wholine + ch->name + " " + i->second->ident + " " + (opt_showrealhost ? i->second->host : i->second->dhost) + " " + 
                                        i->second->server + " " + i->second->nick + " ";
 
                        /* away? */
@@ -196,7 +195,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                }
                else
                {
-                       for (user_hash::iterator i = clientlist.begin(); i != clientlist.end(); i++)
+                       for (user_hash::iterator i = ServerInstance->clientlist.begin(); i != ServerInstance->clientlist.end(); i++)
                        {
                                if (whomatch(i->second, matchtext, opt_realname, opt_showrealhost))
                                {
@@ -228,15 +227,15 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                }
        }
        /* Send the results out */
-       if ((whoresults.size() < (size_t)Config->MaxWhoResults) && (!opt_unlimit))
+       if ((whoresults.size() < (size_t)ServerInstance->Config->MaxWhoResults) && (!opt_unlimit))
        {
                for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
-                       WriteServ_NoFormat(user->fd,n->c_str());
-               WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, parameters[0]);
+                       user->WriteServ(*n);
+               user->WriteServ("315 %s %s :End of /WHO list.",user->nick, parameters[0]);
        }
        else
        {
                /* BZZT! Too many results. */
-               WriteServ(user->fd,"315 %s %s :Too many results",user->nick, parameters[0]);
+               user->WriteServ("315 %s %s :Too many results",user->nick, parameters[0]);
        }
 }