]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_who.cpp
Odd bits and bobs to keep the numeric sane if the user is insane (like stskeeps for...
[user/henk/code/inspircd.git] / src / cmd_who.cpp
index 140fa92e2906b2c29dbf3b0dcb8719064756cc89..745e5db15f2c28aa71293e7322818244e817c9e4 100644 (file)
 
 #include "configreader.h"
 #include "users.h"
-#include "message.h"
 #include "modules.h"
 #include "commands.h"
-#include "helperfuncs.h"
+
 #include "wildcard.h"
 #include "commands/cmd_who.h"
 
-extern InspIRCd* ServerInstance;
-extern chan_hash chanlist;
-extern std::vector<userrec*> all_opers;
+
 
 /* get the last 'visible' chan of a user */
 static char *getlastchanname(userrec *u)
@@ -49,6 +46,9 @@ bool whomatch(userrec* user, const char* matchtext, bool opt_realname, bool opt_
        bool realhost = false;
        bool realname = false;
 
+       if (user->registered != REG_ALL)
+               return false;
+
        if (opt_realname)
                realname = match(user->fullname, matchtext);
 
@@ -150,7 +150,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                                wholine.append("*");
                        }
 
-                       wholine = wholine + cmode(i->second, ch) + " :0 " + i->second->fullname;
+                       wholine = wholine + ch->GetStatusChar(i->second) + " :0 " + i->second->fullname;
                        whoresults.push_back(wholine);
                }
        }
@@ -161,7 +161,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                if (opt_viewopersonly)
                {
                        /* Showing only opers */
-                       for (std::vector<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++)
+                       for (std::vector<userrec*>::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++)
                        {
                                userrec* oper = *i;
 
@@ -188,7 +188,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                                                wholine.append("*");
                                        }
        
-                                       wholine = wholine + cmode(oper, ch) + " :0 " + oper->fullname;
+                                       wholine = wholine + ch->GetStatusChar(oper) + " :0 " + oper->fullname;
                                        whoresults.push_back(wholine);
                                }
                        }
@@ -220,7 +220,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                                                wholine.append("*");
                                        }
 
-                                       wholine = wholine + cmode(i->second, ch) + " :0 " + i->second->fullname;
+                                       wholine = wholine + ch->GetStatusChar(i->second) + " :0 " + i->second->fullname;
                                        whoresults.push_back(wholine);
                                }
                        }
@@ -231,7 +231,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
        {
                for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
                        user->WriteServ(*n);
-               user->WriteServ("315 %s %s :End of /WHO list.",user->nick, parameters[0]);
+               user->WriteServ("315 %s %s :End of /WHO list.",user->nick, *parameters[0] ? parameters[0] : "*");
        }
        else
        {