]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
set the TS of a channel in JoinUser, not after the entire FJOIN, this is safer and...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 18 Mar 2007 16:52:56 +0000 (16:52 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 18 Mar 2007 16:52:56 +0000 (16:52 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6690 e03df62e-2008-0410-955e-edbf42e46eb7

include/channels.h
src/channels.cpp
src/cmd_join.cpp
src/modules/m_banredirect.cpp
src/modules/m_conn_join.cpp
src/modules/m_operjoin.cpp
src/modules/m_redirect.cpp
src/modules/m_sajoin.cpp
src/modules/m_spanningtree/treesocket1.cpp
src/modules/m_spanningtree/treesocket2.cpp

index 7daab2167c72509a43f18000d49186c1567bf6f0..305ff9974e8243c71f8f715e8db5c6d59f1b42e9 100644 (file)
@@ -352,7 +352,7 @@ class chanrec : public Extensible
         * been created if the channel did not exist before the user was joined to it.
         * If the user could not be joined to a channel, the return value may be NULL.
         */
-       static chanrec* JoinUser(InspIRCd* ServerInstance, userrec *user, const char* cn, bool override, const char* key = "");
+       static chanrec* JoinUser(InspIRCd* ServerInstance, userrec *user, const char* cn, bool override, const char* key, time_t TS = 0);
 
        /** Write to a channel, from a user, using va_args for text
         * @param user User whos details to prefix the line with
index 366169dd635b068e782394b2267377f2839a70b4..ce7cbb45c3d8b49a97a8f3ba01d8030e560eddf3 100644 (file)
@@ -176,7 +176,7 @@ CUList* chanrec::GetVoicedUsers()
  * add a channel to a user, creating the record for it if needed and linking
  * it to the user record 
  */
-chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bool override, const char* key)
+chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bool override, const char* key, time_t TS)
 {
        if (!user || !cn)
                return NULL;
@@ -192,6 +192,9 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
 
        if (!Ptr)
        {
+               if ((!IS_LOCAL(user)) && (!TS))
+                       Instance->Log(DEBUG,"*** BUG *** chanrec::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick, cn);
+
                privs = "@";
 
                if (IS_LOCAL(user) && override == false)
@@ -212,7 +215,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
                if (IS_LOCAL(user))
                        Ptr->modes[CM_TOPICLOCK] = Ptr->modes[CM_NOEXTERNAL] = 1;
 
-               Ptr->created = Instance->Time();
+               Ptr->created = TS ? TS : Instance->Time();
                *Ptr->topic = 0;
                *Ptr->setby = 0;
                Ptr->topicset = 0;
index aa2f537a5da9e23a3393d943bbfe7f4948226979..8c24c7bcb1dad066e031073187f33b7c69e094cc 100644 (file)
@@ -42,7 +42,7 @@ CmdResult cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
 
                if (ServerInstance->IsChannel(parameters[0]))
                {
-                       chanrec::JoinUser(ServerInstance, user, parameters[0], false);
+                       chanrec::JoinUser(ServerInstance, user, parameters[0], false, "");
                        return CMD_SUCCESS;
                }
        }
index 88d4872cef4c2102d73a99b8da5539acbfa2fbaa..1564cef5789b5095ffb7e9538197ac0dbbb3c521 100644 (file)
@@ -285,7 +285,7 @@ class ModuleBanRedirect : public Module
                                                else
                                                {
                                                        user->WriteServ("470 %s :You are banned from %s. You are being automatically redirected to %s", user->nick, chan->name, redir->targetchan.c_str());
-                                                       chanrec::JoinUser(Srv, user, redir->targetchan.c_str(), false);
+                                                       chanrec::JoinUser(Srv, user, redir->targetchan.c_str(), false, "");
                                                        return 1;
                                                }
                                        }
index 9a7fdca7a5ef044abfce5ea26cfe2558c41bde33..75415d6a5971f45328a75e65d2ed4de3349ed06a 100644 (file)
@@ -88,7 +88,7 @@ class ModuleConnJoin : public Module
 
                        for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++)
                                if (ServerInstance->IsChannel(it->c_str()))
-                                       chanrec::JoinUser(ServerInstance, user, it->c_str(), false);
+                                       chanrec::JoinUser(ServerInstance, user, it->c_str(), false, "");
                }
 
 };
index 09ddb47b938e2577c89902ea3ef1e46225ec45a1..4308068e3e83aaa57b2a36744282d183fbfc9bc4 100644 (file)
@@ -89,7 +89,7 @@ class ModuleOperjoin : public Module
 
                        for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++)
                                if (ServerInstance->IsChannel(it->c_str()))
-                                       chanrec::JoinUser(ServerInstance, user, it->c_str(), false);
+                                       chanrec::JoinUser(ServerInstance, user, it->c_str(), false, "");
                }
 
 };
index cf0174cc600e1e49148fbd74ed9c27bae0c3d281..9cba183fe7d5f28275a1ac40fd7e7c75805b394e 100644 (file)
@@ -137,7 +137,7 @@ class ModuleRedirect : public Module
                                        }
 
                                        user->WriteServ("470 %s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str());
-                                       chanrec::JoinUser(ServerInstance, user, channel.c_str(), false);
+                                       chanrec::JoinUser(ServerInstance, user, channel.c_str(), false, "");
                                        return 1;
                                }
                        }
index caf3dc6d2336668583d5fd11e8cde08f2baa104d..a2c710ec3d38f2ece7f598ade2a7201b4f3715a4 100644 (file)
@@ -49,7 +49,7 @@ class cmd_sajoin : public command_t
                                return CMD_FAILURE;
                        }
 
-                       chanrec::JoinUser(ServerInstance, dest, parameters[1], true);
+                       chanrec::JoinUser(ServerInstance, dest, parameters[1], true, "");
 
                        /* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propogate */
                        chanrec* n = ServerInstance->FindChan(parameters[1]);
index f0fd0e1ef283852fb2e35d1e6ddc4509414ab37e..008f0c98a9ab53acb7842d8f1b370a5346edfb1b 100644 (file)
@@ -756,7 +756,10 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
                                /* Finally, we can actually place the user into the channel.
                                 * We're sure its right. Final answer, phone a friend.
                                 */
-                               chanrec::JoinUser(this->Instance, who, channel.c_str(), true, "");
+                               if (created)
+                                       chanrec::JoinUser(this->Instance, who, channel.c_str(), true, "", TS);
+                               else
+                                       chanrec::JoinUser(this->Instance, who, channel.c_str(), true, "");
                                /* Have we already queued up MAXMODES modes with parameters
                                 * (+qaohv) ready to be sent to the server?
                                 */
@@ -838,19 +841,6 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
                for (unsigned int f = 2; f < modectr; f++)
                        free(mode_users[f]);
        }
-       /* if we newly created the channel, set it's TS properly. */
-       if (created)
-       {
-               /* find created channel .. */
-               chan = this->Instance->FindChan(channel);
-               if (chan)
-                       /* w00t said this shouldnt be needed but it is.
-                        * This isnt strictly true, as chan can be NULL
-                        * if a nick collision has occured and therefore
-                        * the channel was never created.
-                        */
-                       chan->age = TS;
-       }
        /* All done. That wasnt so bad was it, you can wipe
         * the sweat from your forehead now. :-)
         */
index e4d53c8ef499308ba370d7cba28fa857c2d07925..72c439ebef2386e39c3d7a32af817c2ca5f61e09 100644 (file)
@@ -335,7 +335,7 @@ bool TreeSocket::ServiceJoin(const std::string &prefix, std::deque<std::string>
        {
                /* only join if it's local, otherwise just pass it on! */
                if (IS_LOCAL(u))
-                       chanrec::JoinUser(this->Instance, u, params[1].c_str(), false);
+                       chanrec::JoinUser(this->Instance, u, params[1].c_str(), false, "", Instance->Time());
                Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix);
        }
        return true;