]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/message.cpp
Adjust m_mysql to match the assumed behaviour of m_pgsql exactly, e.g. when there...
[user/henk/code/inspircd.git] / src / message.cpp
index 03bd5fd4115b357ceefb2148a8768d9eac5e74d0..e4dc380cd2af87c701273cf40626c79e7cf8a0db 100644 (file)
@@ -25,11 +25,7 @@ using namespace std;
 #include <sys/utsname.h>
 #include <time.h>
 #include <string>
-#ifdef GCC3
 #include <ext/hash_map>
-#else
-#include <hash_map>
-#endif
 #include <map>
 #include <sstream>
 #include <vector>
@@ -80,80 +76,6 @@ int common_channels(userrec *u, userrec *u2)
        return 0;
 }
 
-void tidystring(char* str)
-{
-       // strips out double spaces before a : parameter
-
-       char temp[MAXBUF];
-       bool go_again = true;
-
-       if (!str)
-               return;
-
-       // pointer voodoo++ --w00t
-       while ((*str) && (*str == ' '))
-               str++;
-
-       while (go_again)
-       {
-               bool noparse = false;
-               int t = 0, a = 0;
-               go_again = false;
-               const int lenofstr = strlen(str);
-
-               /*
-                * by caching strlen() of str, we theoretically avoid 3 expensive calls each time this loop
-                * rolls around.. should speed things up a nanosecond or two. ;)
-                */
-
-               while (a < lenofstr)
-               {
-                       if ((a < lenofstr - 1) && (noparse == false))
-                       {
-                               if ((str[a] == ' ') && (str[a+1] == ' '))
-                               {
-                                       log(DEBUG,"Tidied extra space out of string: %s",str);
-                                       go_again = true;
-                                       a++;
-                               }
-                       }
-
-                       if (a < lenofstr - 1)
-                       {
-                               if ((str[a] == ' ') && (str[a+1] == ':'))
-                               {
-                                       noparse = true;
-                               }
-                       }
-
-                       temp[t++] = str[a++];
-               }
-
-               temp[t] = '\0';
-               strlcpy(str,temp,MAXBUF);
-       }
-}
-
-/* chop a string down to 512 characters and preserve linefeed (irc max
- * line length) */
-
-void chop(char* str)
-{
-       if (!str)
-       {
-               log(DEBUG,"ERROR! Null string passed to chop()!");
-               return;
-       }
-       if (strlen(str) >= 511)
-       {
-               str[510] = '\r';
-               str[511] = '\n';
-               str[512] = '\0';
-               log(DEBUG,"Excess line chopped.");
-       }
-}
-
-
 void Blocking(int s)
 {
        int flags = fcntl(s, F_GETFL, 0);
@@ -168,15 +90,15 @@ void NonBlocking(int s)
 
 int CleanAndResolve (char *resolvedHost, const char *unresolvedHost, bool forward)
 {
-       int fd;
+       bool ok;
        std::string ipaddr;
 
        DNS d(Config->DNSServer);
        if (forward)
-               fd = d.ForwardLookup(unresolvedHost);
+               ok = d.ForwardLookup(unresolvedHost, false);
        else
-               fd = d.ReverseLookup(unresolvedHost);
-       if (fd < 0)
+               ok = d.ReverseLookup(unresolvedHost, false);
+       if (!ok)
                return 0;
        time_t T = time(NULL)+1;
        while ((!d.HasResult()) && (time(NULL)<T));