aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_check.cpp
diff options
context:
space:
mode:
authorGravatar w00t2006-06-17 10:24:50 +0000
committerGravatar w00t2006-06-17 10:24:50 +0000
commitbf3c73e9c42cfbd5dc1849547fcd5d626f78fc1d (patch)
treef73619df93e37cd434e41bdcd3d8e2b1fcae6a5a /src/modules/m_check.cpp
parentSync m_check with trunk (diff)
m_check now does IP addresses, hosts are next.
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@4019 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_check.cpp')
-rw-r--r--src/modules/m_check.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 68c677d09..d386bb3c9 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -26,6 +26,8 @@ using namespace std;
/* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */
+extern user_hash clientlist;
+
static Server *Srv;
class cmd_check : public command_t
@@ -154,6 +156,27 @@ class cmd_check : public command_t
else
{
/* /check on an IP address, or something that doesn't exist */
+ struct sockaddr_in addr;
+ long x = 0;
+
+ if (inet_aton(parameters[0], &addr.sin_addr) == 0)
+ {
+ /* hostname or other */
+ }
+ else
+ {
+ /* IP address */
+ for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++)
+ {
+ if (addr.sin_addr.s_addr == user->ip4.s_addr)
+ {
+ /* same IP. */
+ Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + user->GetFullRealHost());
+ }
+ }
+ }
+
+ Srv->SendTo(NULL, user, checkstr + " matches " + ConvToStr(x));
}
Srv->SendTo(NULL, user, checkstr + " END " + std::string(parameters[0]));