]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_who.cpp
Conversions
[user/henk/code/inspircd.git] / src / cmd_who.cpp
index ff29447fbe5c2fec278463272fd563cee17c030c..66a94cfd668bc6eec514e7dae82032624c287d76 100644 (file)
@@ -11,6 +11,7 @@
  * ---------------------------------------------------
  */
 
+#include "inspircd.h"
 #include "configreader.h"
 #include "users.h"
 #include "modules.h"
@@ -88,7 +89,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)
@@ -104,7 +111,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);
 }
@@ -117,7 +124,7 @@ bool cmd_who::CanView(chanrec* chan, userrec* user)
        /* Execute items in fastest-to-execute first order */
 
        /* Opers see all */
-       if (*user->oper)
+       if (IS_OPER(user))
                return true;
        else if (!chan->IsModeSet('s') && !chan->IsModeSet('p'))
                return true;
@@ -137,11 +144,11 @@ void cmd_who::SendWhoLine(userrec* user, const std::string &initial, chanrec* ch
                return;
 
        std::string wholine =   initial + (ch ? ch->name : lcn) + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " " +
-                               ((*ServerInstance->Config->HideWhoisServer && !*user->oper) ? ServerInstance->Config->HideWhoisServer : u->server) +
+                               ((*ServerInstance->Config->HideWhoisServer && !IS_OPER(user)) ? ServerInstance->Config->HideWhoisServer : u->server) +
                                " " + u->nick + " ";
 
        /* away? */
-       if (*u->awaymsg)
+       if (IS_AWAY(u))
        {
                wholine.append("G");
        }
@@ -151,7 +158,7 @@ void cmd_who::SendWhoLine(userrec* user, const std::string &initial, chanrec* ch
        }
 
        /* oper? */
-       if (*u->oper)
+       if (IS_OPER(u))
        {
                wholine.append("*");
        }
@@ -206,11 +213,11 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
                                        opt_viewopersonly = true;
                                break;
                                case 'h':
-                                       if (*user->oper)
+                                       if (IS_OPER(user))
                                                opt_showrealhost = true;
                                break;
                                case 'u':
-                                       if (*user->oper)
+                                       if (IS_OPER(user))
                                                opt_unlimit = true;
                                break;
                                case 'r':