]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/message.cpp
(1) remove CleanAndResolve.
[user/henk/code/inspircd.git] / src / message.cpp
index c1c4faa3ee8e20689761ea6a2f1976ba12b70258..268cc65540617635467ffc534503a82fa837ae0a 100644 (file)
@@ -95,33 +95,11 @@ void NonBlocking(int s)
        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;
 
@@ -217,17 +195,17 @@ const char* cmode(userrec *user, chanrec *chan)
 
        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 "+";
                        }
@@ -244,9 +222,9 @@ int cflags(userrec *user, chanrec *chan)
 
        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;
@@ -269,17 +247,17 @@ int cstatus(userrec *user, chanrec *chan)
 
        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;
                        }
@@ -306,7 +284,7 @@ std::string chlist(userrec *user,userrec* source)
                         * 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(" ");
                        }