]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_who.cpp
Check the ident when checking against IP in ldapoper (#1823)
[user/henk/code/inspircd.git] / src / coremods / core_who.cpp
index b5f9163e14fafb7edcfd65dcb4cebc49b392a956..fdf8919a22e33a6c2af29001d535546b52d2f5c9 100644 (file)
@@ -1,10 +1,16 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2018 Peter Powell <petpow@saberuk.com>
- *   Copyright (C) 2014 Adam <Adam@anope.org>
+ *   Copyright (C) 2019 linuxdaemon <linuxdaemon.irc@gmail.com>
+ *   Copyright (C) 2017-2019 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2017-2018 Adam <Adam@anope.org>
+ *   Copyright (C) 2013-2014, 2016 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
- *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2009 John Brooks <special@inspircd.org>
+ *   Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2007-2008, 2010 Craig Edwards <brain@inspircd.org>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -34,8 +40,36 @@ enum
        RPL_WHOSPCRPL = 354
 };
 
+static const char whox_field_order[] = "tcuihsnfdlaor";
+static const char who_field_order[] = "cuhsnf";
+
 struct WhoData : public Who::Request
 {
+       bool GetFieldIndex(char flag, size_t& out) const CXX11_OVERRIDE
+       {
+               if (!whox)
+               {
+                       const char* pos = strchr(who_field_order, flag);
+                       if (pos == NULL)
+                               return false;
+
+                       out = pos - who_field_order;
+                       return true;
+               }
+
+               if (!whox_fields[flag])
+                       return false;
+
+               out = 0;
+               for (const char* c = whox_field_order; *c && *c != flag; ++c)
+               {
+                       if (whox_fields[*c])
+                               ++out;
+               }
+
+               return whox_field_order[out];
+       }
+
        WhoData(const CommandBase::Params& parameters)
        {
                // Find the matchtext and swap the 0 for a * so we can use InspIRCd::Match on it.
@@ -143,7 +177,7 @@ class CommandWho : public SplitCommand
                , whoevprov(parent, "event/who")
        {
                allow_empty_last_param = false;
-               syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [[Aafhilmnoprstux][%acdfhilnorstu] <server>|<nickname>|<channel>|<realname>|<host>|0]";
+               syntax = "<server>|<nick>|<channel>|<realname>|<host>|0 [[Aafhilmnoprstux][%acdfhilnorstu] <server>|<nick>|<channel>|<realname>|<host>|0]";
        }
 
        /** Sends a WHO reply to a user. */