]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
A few tidyups, and comment how the new constructors work (so that w00t doesnt wonder...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 27 Aug 2007 11:34:16 +0000 (11:34 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 27 Aug 2007 11:34:16 +0000 (11:34 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7875 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_spanningtree/treesocket1.cpp
src/users.cpp

index a0eb6ad7fd211dfe08f772d67afb50c68d6758a4..21882eda85bc5fca308ac22a2d91ff3145848286 100644 (file)
@@ -976,6 +976,10 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
                tempnick = params[0].c_str();
        }
 
+       /* IMPORTANT NOTE: For remote users, we pass the UUID in the constructor. This automatically
+        * sets it up in the UUID hash for us.
+        * TODO: Make this throw an exception maybe, on UUID collision?
+        */
        userrec* _new = new userrec(this->Instance, params[0]);
        (*(this->Instance->clientlist))[tempnick] = _new;
        _new->SetFd(FD_MAGIC_NUMBER);
index 5e7828d5b1a0d732b05ada328905a0c771b34c85..476a4f1cd28179e5c69793a0c21222ef0986fe51 100644 (file)
@@ -860,12 +860,14 @@ 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)
 {
+       /* NOTE: Calling this one parameter constructor for userrec automatically
+        * allocates a new UUID and places it in the hash_map.
+        */
        userrec* New = new userrec(Instance);
        int j = 0;
 
        Instance->unregistered_count++;
 
-       user_hash::iterator iter = Instance->clientlist->find(New->uuid);
        char ipaddr[MAXBUF];
 #ifdef IPV6
        if (socketfamily == AF_INET6)
@@ -875,7 +877,9 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
        inet_ntop(AF_INET, &((const sockaddr_in*)ip)->sin_addr, ipaddr, sizeof(ipaddr));
 
        (*(Instance->clientlist))[New->uuid] = New;
-       New->fd = socket;
+       New->SetFd(socket);
+
+       /* The users default nick is their UUID */
        strlcpy(New->nick, New->uuid, NICKMAX - 1);
 
        New->server = Instance->FindServerNamePtr(Instance->Config->ServerName);