diff options
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 23 | ||||
-rw-r--r-- | src/modules/m_spanningtree/fmode.cpp | 9 |
2 files changed, 15 insertions, 17 deletions
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 34dff7019..070051a9c 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -110,19 +110,18 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p { unsigned int idx = 2; int numpara = 1; - const char* modelist[64]; - memset(&modelist,0,sizeof(modelist)); + std::vector<std::string> modelist; // Mode parser needs to know what channel to act on. - modelist[0] = params[0].c_str(); + modelist[0] = params[0]; /* Remember, params[params.size() - 1] is nicklist, and we don't want to apply *that* */ for (idx = 2; idx != (params.size() - 1); idx++) { - modelist[numpara++] = params[idx].c_str(); + modelist[numpara++] = params[idx]; } - this->Instance->SendMode(modelist, numpara, this->Instance->FakeClient); + this->Instance->SendMode(modelist, this->Instance->FakeClient); } /* Now, process every 'modes,nick' pair */ @@ -181,16 +180,16 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p if (apply_other_sides_modes) { std::deque<std::string> stackresult; - const char* mode_junk[MAXMODES+2]; - mode_junk[0] = channel.c_str(); + std::vector<std::string> mode_junk; + mode_junk[0] = channel; while (modestack.GetStackedLine(stackresult)) { for (size_t j = 0; j < stackresult.size(); j++) { - mode_junk[j+1] = stackresult[j].c_str(); + mode_junk[j+1] = stackresult[j]; } - Instance->SendMode(mode_junk, stackresult.size() + 1, Instance->FakeClient); + Instance->SendMode(mode_junk, Instance->FakeClient); } } @@ -210,7 +209,7 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque<std::string> { irc::modestacker stack(false); std::deque<std::string> stackresult; - const char* mode_junk[MAXMODES+2]; + std::vector<std::string> mode_junk; mode_junk[0] = c->name; for (char modeletter = 'A'; modeletter <= 'z'; ++modeletter) @@ -228,9 +227,9 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque<std::string> while (stack.GetStackedLine(stackresult)) { for (size_t j = 0; j < stackresult.size(); j++) - mode_junk[j+1] = stackresult[j].c_str(); + mode_junk[j+1] = stackresult[j]; - Instance->SendMode(mode_junk, stackresult.size() + 1, Instance->FakeClient); + Instance->SendMode(mode_junk, Instance->FakeClient); } } return true; diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index 6fa269584..e7209a852 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -48,10 +48,9 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p smode = true; /* Setting this flag tells us it is a server mode*/ sourceserv = source; /* Set sourceserv to the actual source string */ } - const char* modelist[64]; + std::vector<std::string> modelist; time_t TS = 0; int n = 0; - memset(&modelist,0,sizeof(modelist)); for (unsigned int q = 0; (q < params.size()) && (q < 64); q++) { if (q == 1) @@ -65,7 +64,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p else { /* Everything else is fine to append to the modelist */ - modelist[n++] = params[q].c_str(); + modelist[n++] = params[q]; } } @@ -103,11 +102,11 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p { if (smode) { - this->Instance->SendMode(modelist, n, who); + this->Instance->SendMode(modelist, who); } else { - this->Instance->CallCommandHandler("MODE", modelist, n, who); + this->Instance->CallCommandHandler("MODE", modelist, who); } /* HOT POTATO! PASS IT ON! */ Utils->DoOneToAllButSender(source,"FMODE",params,sourceserv); |