From 7700bbc64f270407a84d15cc43f115e2199c7d72 Mon Sep 17 00:00:00 2001 From: special Date: Thu, 28 Sep 2006 19:18:47 +0000 Subject: [PATCH] Cleaned up FJOIN a bit, fixing another segfault in the process. Brain should take a look at this and see if there are any subtle bugs in how it works, since its trackrecord isn't great :P git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5355 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 33b3e2bdb..fc98ad701 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1534,18 +1534,17 @@ class TreeSocket : public InspSocket chanrec* chan = this->Instance->FindChan(channel); if (chan) - { key = chan->key; - } + strlcpy(mode_users[0],channel.c_str(),MAXBUF); /* default is a high value, which if we dont have this * channel will let the other side apply their modes. */ time_t ourTS = time(NULL)+600; - chanrec* us = this->Instance->FindChan(channel); - if (us) - ourTS = us->age; + + if (chan) + ourTS = chan->age; /* XXX: PAY ATTENTION: * In 1.1, if they have the newer channel, we immediately clear @@ -1558,10 +1557,10 @@ class TreeSocket : public InspSocket { Instance->Log(DEBUG,"FJOIN detected, our TS=%lu, their TS=%lu",ourTS,TS); std::deque param_list; - if (us) - us->age = TS; + if (chan) + chan->age = TS; ourTS = TS; - param_list.push_back(chan->name); + param_list.push_back(channel); Instance->Log(DEBUG,"REMOVE ALL STATUS MODES FROM OUR USERS *NOW*"); this->RemoveStatus(Instance->Config->ServerName, param_list); } @@ -1624,8 +1623,8 @@ class TreeSocket : public InspSocket this->Instance->SendMode((const char**)mode_users,modectr,who); if (ourTS != TS) { - Instance->Log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS); - us->age = TS; + Instance->Log(DEFAULT,"Channel TS for %s changed from %lu to %lu",chan->name,ourTS,TS); + chan->age = TS; ourTS = TS; } } @@ -1645,7 +1644,7 @@ class TreeSocket : public InspSocket /* there werent enough modes built up to flush it during FJOIN, * or, there are a number left over. flush them out. */ - if ((modectr > 2) && (who) && (us)) + if ((modectr > 2) && (who) && (chan)) { if (ourTS >= TS) { @@ -1653,8 +1652,8 @@ class TreeSocket : public InspSocket this->Instance->SendMode((const char**)mode_users,modectr,who); if (ourTS != TS) { - Instance->Log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS); - us->age = TS; + Instance->Log(DEFAULT,"Channel TS for %s changed from %lu to %lu",chan->name,ourTS,TS); + chan->age = TS; ourTS = TS; } } -- 2.39.5