]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_who.cpp
Merge pull request #1059 from OVERdrive-IRC/m_repeat/fix-typo
[user/henk/code/inspircd.git] / src / coremods / core_who.cpp
index dc39e296c95c9e3a996fec5d174f42b80bcffe5e..8b9258d71d374160f2bbb8a3e792a93697436ad6 100644 (file)
@@ -42,7 +42,7 @@ class CommandWho : public Command
 
        Membership* get_first_visible_channel(User* u)
        {
-               for (UCListIter i = u->chans.begin(); i != u->chans.end(); ++i)
+               for (User::ChanList::iterator i = u->chans.begin(); i != u->chans.end(); ++i)
                {
                        Membership* memb = *i;
                        if (!memb->chan->IsModeSet(secretmode))
@@ -144,7 +144,7 @@ bool CommandWho::whomatch(User* cuser, User* user, const char* matchtext)
                        long seconds = InspIRCd::Duration(matchtext);
 
                        // Okay, so time matching, we want all users connected `seconds' ago
-                       if (user->age >= ServerInstance->Time() - seconds)
+                       if (user->signon >= ServerInstance->Time() - seconds)
                                match = true;
                }
 
@@ -171,9 +171,6 @@ bool CommandWho::whomatch(User* cuser, User* user, const char* matchtext)
 
 bool CommandWho::CanView(Channel* chan, User* user)
 {
-       if (!user || !chan)
-               return false;
-
        /* Bug #383 - moved higher up the list, because if we are in the channel
         * we can see all its users
         */
@@ -220,7 +217,11 @@ void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms,
        }
 
        if (memb)
-               wholine.push_back(memb->GetPrefixChar());
+       {
+               char prefix = memb->GetPrefixChar();
+               if (prefix)
+                       wholine.push_back(prefix);
+       }
 
        wholine.append(" :0 " + u->fullname);
 
@@ -321,9 +322,8 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
                        bool inside = ch->HasUser(user);
 
                        /* who on a channel. */
-                       const UserMembList *cu = ch->GetUsers();
-
-                       for (UserMembCIter i = cu->begin(); i != cu->end(); i++)
+                       const Channel::MemberMap& cu = ch->GetUsers();
+                       for (Channel::MemberMap::const_iterator i = cu.begin(); i != cu.end(); ++i)
                        {
                                /* None of this applies if we WHO ourselves */
                                if (user != i->first)
@@ -347,7 +347,8 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
                if (opt_viewopersonly)
                {
                        /* Showing only opers */
-                       for (std::list<User*>::iterator i = ServerInstance->Users->all_opers.begin(); i != ServerInstance->Users->all_opers.end(); i++)
+                       const UserManager::OperList& opers = ServerInstance->Users->all_opers;
+                       for (UserManager::OperList::const_iterator i = opers.begin(); i != opers.end(); ++i)
                        {
                                User* oper = *i;
 
@@ -355,7 +356,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
                                {
                                        if (!user->SharesChannelWith(oper))
                                        {
-                                               if (usingwildcards && (!oper->IsModeSet(invisiblemode)) && (!user->HasPrivPermission("users/auspex")))
+                                               if (usingwildcards && (oper->IsModeSet(invisiblemode)) && (!user->HasPrivPermission("users/auspex")))
                                                        continue;
                                        }
 
@@ -365,7 +366,8 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
                }
                else
                {
-                       for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++)
+                       const user_hash& users = ServerInstance->Users->GetUsers();
+                       for (user_hash::const_iterator i = users.begin(); i != users.end(); ++i)
                        {
                                if (whomatch(user, i->second, matchtext.c_str()))
                                {