for (std::vector<ucrec*>::const_iterator i = u->chans.begin(); i != u->chans.end(); i++)
{
/* Fetch the channel from the user */
- ucrec* user_channel = (ucrec*)(*i);
+ ucrec* user_channel = *i;
if (user_channel->channel)
{
fcntl(s, F_SETFL, flags | O_NONBLOCK);
}
-int CleanAndResolve (char *resolvedHost, const char *unresolvedHost, bool forward, unsigned long timeout)
-{
- bool ok;
- std::string ipaddr;
-
- DNS d(Config->DNSServer);
- if (forward)
- ok = d.ForwardLookup(unresolvedHost, false);
- else
- ok = d.ReverseLookup(unresolvedHost, false);
- if (!ok)
- return 0;
- time_t T = time(NULL)+timeout;
- while ((!d.HasResult()) && (time(NULL)<T));
- if (forward)
- ipaddr = d.GetResultIP();
- else
- ipaddr = d.GetResult();
- strlcpy(resolvedHost,ipaddr.c_str(),MAXBUF);
- return (ipaddr != "");
-}
-
int c_count(userrec* u)
{
int z = 0;
for (std::vector<ucrec*>::const_iterator i = u->chans.begin(); i != u->chans.end(); i++)
- if (((ucrec*)(*i))->channel)
+ if ((*i)->channel)
z++;
return z;
for (std::vector<ucrec*>::const_iterator i = user->chans.begin(); i != user->chans.end(); i++)
{
- if (((ucrec*)(*i))->channel == chan)
+ if ((*i)->channel == chan)
{
- if ((((ucrec*)(*i))->uc_modes & UCMODE_OP) > 0)
+ if (((*i)->uc_modes & UCMODE_OP) > 0)
{
return "@";
}
- if ((((ucrec*)(*i))->uc_modes & UCMODE_HOP) > 0)
+ if (((*i)->uc_modes & UCMODE_HOP) > 0)
{
return "%";
}
- if ((((ucrec*)(*i))->uc_modes & UCMODE_VOICE) > 0)
+ if (((*i)->uc_modes & UCMODE_VOICE) > 0)
{
return "+";
}
for (std::vector<ucrec*>::const_iterator i = user->chans.begin(); i != user->chans.end(); i++)
{
- if (((ucrec*)(*i))->channel == chan)
+ if ((*i)->channel == chan)
{
- return ((ucrec*)(*i))->uc_modes;
+ return (*i)->uc_modes;
}
}
return 0;
for (std::vector<ucrec*>::const_iterator i = user->chans.begin(); i != user->chans.end(); i++)
{
- if (((ucrec*)(*i))->channel == chan)
+ if ((*i)->channel == chan)
{
- if ((((ucrec*)(*i))->uc_modes & UCMODE_OP) > 0)
+ if (((*i)->uc_modes & UCMODE_OP) > 0)
{
return STATUS_OP;
}
- if ((((ucrec*)(*i))->uc_modes & UCMODE_HOP) > 0)
+ if (((*i)->uc_modes & UCMODE_HOP) > 0)
{
return STATUS_HOP;
}
- if ((((ucrec*)(*i))->uc_modes & UCMODE_VOICE) > 0)
+ if (((*i)->uc_modes & UCMODE_VOICE) > 0)
{
return STATUS_VOICE;
}
* If the channel is NOT private/secret OR the user shares a common channel
* If the user is an oper, and the <options:operspywhois> option is set.
*/
- if ((source == user) || (*source->oper && Config->OperSpyWhois) || (((!rec->channel->modes[CM_PRIVATE]) && (!rec->channel->modes[CM_SECRET]) && !(user->modes[UM_INVISIBLE])) || (rec->channel->HasUser(source))))
+ if ((source == user) || (*source->oper && Config->OperSpyWhois) || (((!rec->channel->modes[CM_PRIVATE]) && (!rec->channel->modes[CM_SECRET])) || (rec->channel->HasUser(source))))
{
list.append(cmode(user, rec->channel)).append(rec->channel->name).append(" ");
}