]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_who.cpp
Changed m_messageflood to use PreMessage and PreNotice, because it may kick the user
[user/henk/code/inspircd.git] / src / cmd_who.cpp
index de504faf253d12a6a92144ca71732751d64c059e..b8f0684fff6a5d8389d91b8e505c6c125d44b7b2 100644 (file)
  * ---------------------------------------------------
  */
 
+#include "inspircd.h"
 #include "configreader.h"
 #include "users.h"
 #include "modules.h"
 #include "wildcard.h"
 #include "commands/cmd_who.h"
 
-/* get the last 'visible' chan of a user */
-static char *getlastchanname(userrec *u)
+static char *get_first_visible_channel(userrec *u)
 {
        UCListIter i = u->chans.begin();
        if (i != u->chans.end())
@@ -110,7 +110,7 @@ bool cmd_who::whomatch(userrec* user, const char* matchtext)
 
 
 
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
 {
        return new cmd_who(Instance);
 }
@@ -135,7 +135,7 @@ bool cmd_who::CanView(chanrec* chan, userrec* user)
 
 void cmd_who::SendWhoLine(userrec* user, const std::string &initial, chanrec* ch, userrec* u, std::vector<std::string> &whoresults)
 {
-       std::string lcn = getlastchanname(u);
+       std::string lcn = get_first_visible_channel(u);
        chanrec* chlast = ServerInstance->FindChan(lcn);
 
        /* Not visible to this user */
@@ -302,7 +302,7 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                        {
                                if (whomatch(i->second, matchtext))
                                {
-                                       if ((i->second->IsModeSet('i')) && (!IS_OPER(user)))
+                                       if ((i->second != user) && (i->second->IsModeSet('i')) && (!IS_OPER(user)))
                                                continue;
 
                                        SendWhoLine(user, initial, NULL, i->second, whoresults);
@@ -311,7 +311,7 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                }
        }
        /* Send the results out */
-       if ((whoresults.size() <= (size_t)ServerInstance->Config->MaxWhoResults) || opt_unlimit)
+       if ((ServerInstance->Config->MaxWhoResults && (whoresults.size() <= (size_t)ServerInstance->Config->MaxWhoResults)) || opt_unlimit)
        {
                for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
                        user->WriteServ(*n);