cmd_check() : command_t("CHECK", 'o', 1)
{
this->source = "m_check.so";
+ syntax = "<nickname>|<ip>|<hostmask>|<channel>";
}
void Handle (const char** parameters, int pcnt, userrec *user)
if (IS_LOCAL(targuser))
{
/* port information is only held for a local user! */
- Srv->SendTo(NULL, user, checkstr + " onport " + ConvToStr(targuser->port));
+ Srv->SendTo(NULL, user, checkstr + " onport " + ConvToStr(targuser->GetPort()));
}
chliststr = chlist(targuser, targuser);
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 */
+ for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++)
{
- /* hostname or other */
- for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++)
+ if (match(a->second->host, parameters[0]) || match(a->second->dhost, parameters[0]))
{
- if (match(a->second->host, parameters[0]) || match(a->second->dhost, parameters[0]))
- {
- /* host or vhost matches mask */
- Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
- }
+ /* host or vhost matches mask */
+ Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
}
- }
- else
- {
/* IP address */
- for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++)
+ else if (match(a->second->GetIPString(), parameters[0]))
{
- if (addr.sin_addr.s_addr == a->second->ip4.s_addr)
- {
- /* same IP. */
- Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
- }
+ /* same IP. */
+ Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
}
}