]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_who.cpp
Slightly modify WHO <port> p to allow a port range, e.g. "WHO 6660-6669,7000,7001...
[user/henk/code/inspircd.git] / src / cmd_who.cpp
index 5992d7aa0ff687455db7c1ba141efb883f376f2a..df209991a24948c67fc2dcf49cba1c8d0ce801f4 100644 (file)
@@ -88,7 +88,13 @@ bool cmd_who::whomatch(userrec* user, const char* matchtext)
                                        else
                                        {
                                                if (opt_port)
-                                                       port = (user->GetPort() == ConvToInt(matchtext));
+                                               {
+                                                       irc::portparser portrange(matchtext, false);
+                                                       long portno = -1;
+                                                       while ((portno = portrange.GetToken()))
+                                                               if (portno == user->GetPort())
+                                                                       port = true;
+                                               }
                                                else
                                                {
                                                        if (opt_away)
@@ -259,14 +265,14 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                        for (CUList::iterator i = cu->begin(); i != cu->end(); i++)
                        {
                                /* opers only, please */
-                               if (opt_viewopersonly && !IS_OPER(i->second))
+                               if (opt_viewopersonly && !IS_OPER(i->first))
                                        continue;
        
                                /* If we're not inside the channel, hide +i users */
-                               if (i->second->IsModeSet('i') && !inside)
+                               if (i->first->IsModeSet('i') && !inside)
                                        continue;
        
-                               SendWhoLine(user, initial, ch, i->second, whoresults);
+                               SendWhoLine(user, initial, ch, i->first, whoresults);
                        }
                }
        }