]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Collision tweaks
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 23 May 2008 05:13:57 +0000 (05:13 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 23 May 2008 05:13:57 +0000 (05:13 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9790 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_spanningtree/nickcollide.cpp
src/modules/m_spanningtree/treesocket.h
src/modules/m_spanningtree/treesocket2.cpp
src/modules/m_spanningtree/uid.cpp

index d2adbc766d406cb7f4aae786d5f0505675cdd95a..9ef5b48f4620c4bc800b4f8c6d4e76319cbebc57 100644 (file)
@@ -27,7 +27,7 @@
  * Returns 1 if colliding local client, 2 if colliding remote, 3 if colliding both.
  * Sends SVSNICKs as appropriate and forces nickchanges too.
  */
-int TreeSocket::DoCollision(User *u, time_t remotets, const char *remoteident, const char *remoteip, const char *remoteuid)
+int TreeSocket::DoCollision(User *u, time_t remotets, const std::string &remoteident, const std::string &remoteip, const std::string &remoteuid)
 {
        /*
         *  Under old protocol rules, we would have had to kill both clients.
@@ -51,8 +51,8 @@ int TreeSocket::DoCollision(User *u, time_t remotets, const char *remoteident, c
 
        /* for brevity, don't use the User */
        time_t localts = u->age;
-       const char *localident = u->ident.c_str();
-       const char *localip = u->GetIPString();
+       const std::string localident = u->ident;
+       const std::string localip = u->GetIPString();
 
        /* mmk. let's do this again. */
        if (remotets == localts)
@@ -64,8 +64,8 @@ int TreeSocket::DoCollision(User *u, time_t remotets, const char *remoteident, c
                /* fuck. now it gets complex. */
 
                /* first, let's see if ident@host matches. */
-               bool SamePerson = !strcmp(localident, remoteident)
-                               && !strcmp(localip, remoteip);
+               bool SamePerson = (localident == remoteident)
+                               && (localip == remoteip);
 
                /*
                 * if ident@ip is equal, and theirs is newer, or
index 324203f115811db6315bc391944c4521fb673d4d..fef7b107bf1c8a42701276920e771c2b9aa4c11e 100644 (file)
@@ -227,7 +227,7 @@ class TreeSocket : public BufferedSocket
        bool ForceJoin(const std::string &source, std::deque<std::string> &params);
 
        /* Used on nick collision ... XXX ugly function HACK */
-       int DoCollision(User *u, time_t remotets, const char *remoteident, const char *remoteip, const char *remoteuid);
+       int DoCollision(User *u, time_t remotets, const std::string &remoteident, const std::string &remoteip, const std::string &remoteuid);
 
        /** UID command */
        bool ParseUID(const std::string &source, std::deque<std::string> &params);
index 93d99c2bad1fb58c1854934aa103e0ca40f822f0..5d2471b2cd1b8333d6243c0f4bbf6e2cb525a668 100644 (file)
@@ -575,7 +575,7 @@ bool TreeSocket::ProcessLine(std::string &line)
                                        {
                                                int collideret = 0;
                                                /* x is local, who is remote */
-                                               collideret = this->DoCollision(x, who->age, who->ident.c_str(), who->GetIPString(), who->uuid.c_str());
+                                               collideret = this->DoCollision(x, who->age, who->ident, who->GetIPString(), who->uuid);
                                                if (collideret != 1)
                                                {
                                                        /*
index e539e0b18d1b4898702e2c1bf7e94f8a74f94155..d5caedd8e28c923af20a2e094c33df5695621150 100644 (file)
@@ -86,7 +86,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
                 * Nick collision.
                 */
                Instance->Logs->Log("m_spanningtree",DEBUG,"*** Collision on %s", tempnick);
-               int collide = this->DoCollision(iter->second, age_t, params[5].c_str(), params[7].c_str(), params[0].c_str());
+               int collide = this->DoCollision(iter->second, age_t, params[5], params[7], params[0]);
 
                if (collide == 2)
                {