]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Replaced sprintf's with some char* voodoo
[user/henk/code/inspircd.git] / src / users.cpp
index 28e96308a1d266f0c194ea784d22b8dc61666b8c..256b04780a2ae333aa3b61b5a73392a3f64c1478 100644 (file)
@@ -80,6 +80,18 @@ userrec::~userrec()
 {
 }
 
+void userrec::MakeHost(char* nhost)
+{
+       /* This is much faster than snprintf */
+       char* t = nhost;
+       for(char* n = ident; n; n++)
+               *t++ = *n;
+       *t++ = '@';
+       for(char* n = host; n; n++)
+               *t++ = *n;
+       *t = 0;
+}
+
 void userrec::CloseSocket()
 {
        shutdown(this->fd,2);
@@ -89,7 +101,16 @@ void userrec::CloseSocket()
 char* userrec::GetFullHost()
 {
        static char result[MAXBUF];
-       snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,dhost);
+       char* t = result;
+       for(char* n = nick; n; n++)
+               *t++ = *n;
+       *t++ = '!';
+       for(char* n = ident; n; n++)
+               *t++ = *n;
+       *t++ = '@';
+       for(char* n = dhost; n; n++)
+               *t++ = *n;
+       *t = 0;
        return result;
 }
 
@@ -106,7 +127,16 @@ int userrec::ReadData(void* buffer, size_t size)
 char* userrec::GetFullRealHost()
 {
        static char fresult[MAXBUF];
-       snprintf(fresult,MAXBUF,"%s!%s@%s",nick,ident,host);
+       char* t = fresult;
+       for(char* n = nick; n; n++)
+               *t++ = *n;
+       *t++ = '!';
+       for(char* n = ident; n; n++)
+               *t++ = *n;
+       *t++ = '@';
+       for(char* n = host; n; n++)
+               *t++ = *n;
+       *t = 0;
        return fresult;
 }
 
@@ -684,7 +714,7 @@ void FullConnectUser(userrec* user, CullList* Goners)
         WriteServ(user->fd,"001 %s :Welcome to the %s IRC Network %s!%s@%s",user->nick,Config->Network,user->nick,user->ident,user->host);
         WriteServ(user->fd,"002 %s :Your host is %s, running version %s",user->nick,Config->ServerName,VERSION);
         WriteServ(user->fd,"003 %s :This server was created %s %s",user->nick,__TIME__,__DATE__);
-        WriteServ(user->fd,"004 %s %s %s :iowghrasxRVSCWBG lvhopsmntikrcaqbegOLQRSKVHGCNT",user->nick,Config->ServerName,VERSION);
+        WriteServ(user->fd,"004 %s %s %s iowghrasxRVSCWBG lvhopsmntikrcaqbegIOLQRSKVHGCNT vhobeIaqglk",user->nick,Config->ServerName,VERSION);
         // anfl @ #ratbox, efnet reminded me that according to the RFC this cant contain more than 13 tokens per line...
         // so i'd better split it :)
         std::stringstream out(Config->data005);