]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Now we know it works, remove debug
[user/henk/code/inspircd.git] / src / users.cpp
index 4854849ad4925eae5b303ad5f6257c11088237be..b76df8ac5aea938dea1fbe1618125dbe0a7a8e1c 100644 (file)
@@ -325,8 +325,7 @@ void userrec::DecrementModes()
 
 userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance)
 {
-       // the PROPER way to do it, AVOID bzero at *ALL* costs
-       *password = *nick = *ident = *host = *dhost = *fullname = *awaymsg = *oper = 0;
+       *password = *nick = *ident = *host = *dhost = *fullname = *awaymsg = *oper = *uuid = 0;
        server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName);
        reset_due = ServerInstance->Time();
        age = ServerInstance->Time(true);
@@ -436,8 +435,8 @@ char* userrec::MakeHostIP()
 
 void userrec::CloseSocket()
 {
-       shutdown(this->fd,2);
-       close(this->fd);
+       ServerInstance->SE->Shutdown(this, 2);
+       ServerInstance->SE->Close(this);
 }
 
 char* userrec::GetFullHost()
@@ -727,11 +726,8 @@ void userrec::FlushWriteBuf()
                if ((sendq.length()) && (this->fd != FD_MAGIC_NUMBER))
                {
                        int old_sendq_length = sendq.length();
-#ifndef WIN32
-               int n_sent = write(this->fd, this->sendq.data(), this->sendq.length());
-#else
-               int n_sent = send(this->fd, (const char*)this->sendq.data(), this->sendq.length(), 0);
-#endif
+                       int n_sent = ServerInstance->SE->Send(this, this->sendq.data(), this->sendq.length(), 0);
+
                        if (n_sent == -1)
                        {
                                if (errno == EAGAIN)
@@ -862,7 +858,9 @@ void userrec::AddToWhoWas()
 /* add a client connection to the sockets list */
 void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached, int socketfamily, sockaddr* ip)
 {
-       std::string tempnick = ConvToStr(socket) + "-unknown";
+       std::string tempnick = Instance->GetUID();
+
+       Instance->Log(DEBUG,"New client has UID %s ..", tempnick.c_str());
        user_hash::iterator iter = Instance->clientlist->find(tempnick);
        char ipaddr[MAXBUF];
 #ifdef IPV6
@@ -895,7 +893,8 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
        New = new userrec(Instance);
        (*(Instance->clientlist))[tempnick] = New;
        New->fd = socket;
-       strlcpy(New->nick,tempnick.c_str(),NICKMAX-1);
+       strlcpy(New->nick, tempnick.c_str(), NICKMAX - 1);
+       strlcpy(New->uuid, tempnick.c_str(), UUID_LENGTH);
 
        New->server = Instance->FindServerNamePtr(Instance->Config->ServerName);
        /* We don't need range checking here, we KNOW 'unknown\0' will fit into the ident field. */
@@ -1102,6 +1101,9 @@ void userrec::FullConnect()
 
        ServerInstance->Config->Send005(this);
 
+       this->WriteServ("042 %s %s :your unique ID", this->nick, this->uuid);
+
+
        this->ShowMOTD();
 
        /* Now registered */