summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-05 03:40:03 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-05 03:40:03 +0000
commitf9ef4ebc9dc4fd46cdafcc76df644b4896251dac (patch)
tree69072581bc1249d279dd62f2f2625f29c01b3294 /src/modules
parente8bf6e5fdbcfa2d3c86541eb27e88ab8c1137c07 (diff)
fix some unitialised vectors and tidy up a bit.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9637 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_sqloper.cpp4
-rw-r--r--src/modules/m_antibottler.cpp8
-rw-r--r--src/modules/m_auditorium.cpp5
-rw-r--r--src/modules/m_banredirect.cpp5
-rw-r--r--src/modules/m_chanprotect.cpp4
-rw-r--r--src/modules/m_conn_umodes.cpp8
-rw-r--r--src/modules/m_delayjoin.cpp4
-rw-r--r--src/modules/m_devoice.cpp6
-rw-r--r--src/modules/m_filter.h2
-rw-r--r--src/modules/m_invisible.cpp8
-rw-r--r--src/modules/m_opermodes.cpp10
-rw-r--r--src/modules/m_services.cpp5
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp13
-rw-r--r--src/modules/m_spanningtree/fmode.cpp3
-rw-r--r--src/modules/m_spanningtree/rconnect.cpp3
-rw-r--r--src/modules/m_timedbans.cpp12
16 files changed, 45 insertions, 55 deletions
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index 09b577aed..861a2b70c 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -277,8 +277,8 @@ public:
if (oper_command)
{
std::vector<std::string> params;
- params[0] = username;
- params[1] = pass;
+ params.push_back(username);
+ params.push_back(pass);
oper_command->Handle(params, user);
}
else
diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp
index c6f6abe35..bafd422da 100644
--- a/src/modules/m_antibottler.cpp
+++ b/src/modules/m_antibottler.cpp
@@ -79,10 +79,10 @@ class ModuleAntiBottler : public Module
{
std::string strgecos = std::string(gecos) + "[Possible bottler, ident: " + std::string(ident) + "]";
std::vector<std::string> modified;
- modified[0] = "bottler";
- modified[1] = local;
- modified[2] = remote;
- modified[3] = strgecos;
+ modified.push_back("bottler");
+ modified.push_back(local);
+ modified.push_back(remote);
+ modified.push_back(strgecos);
ServerInstance->Parser->CallHandler("USER", modified, user);
return 1;
}
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index 264418c5b..75f953f43 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -160,7 +160,7 @@ class ModuleAuditorium : public Module
void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
{
Command* parthandler = ServerInstance->Parser->GetHandler("PART");
- std::vector<std::string> to_leave, parameters;
+ std::vector<std::string> to_leave;
if (parthandler)
{
for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++)
@@ -171,7 +171,8 @@ class ModuleAuditorium : public Module
/* We cant do this neatly in one loop, as we are modifying the map we are iterating */
for (std::vector<std::string>::iterator n = to_leave.begin(); n != to_leave.end(); n++)
{
- parameters[0] = *n;
+ std::vector<std::string> parameters;
+ parameters.push_back(*n);
/* This triggers our OnUserPart, above, making the PART silent */
parthandler->Handle(parameters, user);
}
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 4313039aa..e9661c727 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -223,8 +223,7 @@ class ModuleBanRedirect : public Module
irc::modestacker modestack(false);
StringDeque stackresult;
std::vector<std::string> mode_junk;
-
- mode_junk[0] = chan->name;
+ mode_junk.push_back(chan->name);
for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++)
{
@@ -241,7 +240,7 @@ class ModuleBanRedirect : public Module
{
for(StringDeque::size_type i = 0; i < stackresult.size(); i++)
{
- mode_junk[i+1] = stackresult[i];
+ mode_junk.push_back(stackresult[i]);
}
ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 07b491bb7..82c4e6940 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -67,7 +67,7 @@ class FounderProtectBase
CUList* cl = channel->GetUsers();
std::string item = extend + std::string(channel->name);
std::vector<std::string> mode_junk;
- mode_junk[0] = channel->name;
+ mode_junk.push_back(channel->name);
irc::modestacker modestack(false);
std::deque<std::string> stackresult;
@@ -89,7 +89,7 @@ class FounderProtectBase
{
for (size_t j = 0; j < stackresult.size(); j++)
{
- mode_junk[j+1] = stackresult[j];
+ mode_junk.push_back(stackresult[j]);
}
MyInstance->SendMode(mode_junk, MyInstance->FakeClient);
}
diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp
index ba3d6968d..97a8b8340 100644
--- a/src/modules/m_conn_umodes.cpp
+++ b/src/modules/m_conn_umodes.cpp
@@ -72,17 +72,15 @@ class ModuleModesOnConnect : public Module
tokens.push_back(buf);
std::vector<std::string> modes;
- modes[0] = user->nick;
- modes[1] = tokens[0];
+ modes.push_back(user->nick);
+ modes.push_back(tokens[0]);
if (tokens.size() > 1)
{
// process mode params
- int i = 2;
for (unsigned int k = 1; k < tokens.size(); k++)
{
- modes[i] = tokens[k];
- i++;
+ modes.push_back(tokens[k]);
}
}
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index 2ce31be50..abdee355a 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -146,12 +146,12 @@ class ModuleDelayJoin : public Module
void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
{
Command* parthandler = ServerInstance->Parser->GetHandler("PART");
- std::vector<std::string> parameters;
if (parthandler && user->GetExt("delayjoin"))
{
for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++)
{
- parameters[0] = f->first->name;
+ std::vector<std::string> parameters;
+ parameters.push_back(f->first->name);
/* This triggers our OnUserPart, above, making the PART silent */
parthandler->Handle(parameters, user);
}
diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp
index 75335885e..ba12d7db9 100644
--- a/src/modules/m_devoice.cpp
+++ b/src/modules/m_devoice.cpp
@@ -38,9 +38,9 @@ class CommandDevoice : public Command
if (c && c->HasUser(user))
{
std::vector<std::string> modes;
- modes[0] = parameters[0];
- modes[1] = "-v";
- modes[2] = user->nick;
+ modes.push_back(parameters[0]);
+ modes.push_back("-v");
+ modes.push_back(user->nick);
ServerInstance->SendMode(modes, ServerInstance->FakeClient);
diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h
index 288ed9310..7af2204bb 100644
--- a/src/modules/m_filter.h
+++ b/src/modules/m_filter.h
@@ -347,7 +347,7 @@ int FilterBase::OnPreCommand(const std::string &command, const std::vector<std::
{
std::vector<std::string> params;
for (int item = 0; item < (int)parameters.size(); item++)
- params[item] = parameters[item];
+ params.push_back(parameters[item]);
params[replacepoint] = "Reason filtered";
/* We're blocking, OR theyre quitting and its a KILL action
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index de573dfde..155c518c4 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -141,8 +141,8 @@ class InvisibleDeOper : public ModeWatcher
if ((!adding) && (dest->IsModeSet('Q')))
{
std::vector<std::string> newmodes;
- newmodes[0] = dest->nick;
- newmodes[1] = "-Q";
+ newmodes.push_back(dest->nick);
+ newmodes.push_back("-Q");
ServerInstance->Modes->Process(newmodes, source, true);
}
return true;
@@ -223,7 +223,6 @@ class ModuleInvisible : public Module
{
Command* parthandler = ServerInstance->Parser->GetHandler("PART");
std::vector<std::string> to_leave;
- std::vector<std::string> parameters;
if (parthandler)
{
for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++)
@@ -231,7 +230,8 @@ class ModuleInvisible : public Module
/* We cant do this neatly in one loop, as we are modifying the map we are iterating */
for (std::vector<std::string>::iterator n = to_leave.begin(); n != to_leave.end(); n++)
{
- parameters[0] = *n;
+ std::vector<std::string> parameters;
+ parameters.push_back(*n);
/* This triggers our OnUserPart, above, making the PART silent */
parthandler->Handle(parameters, user);
}
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index 8a91c3569..4184409f1 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -99,17 +99,13 @@ class ModuleModesOnOper : public Module
while (ss >> buf)
tokens.push_back(buf);
- int size = tokens.size() + 1;
- std::vector<std::string> modes(size);
- modes.resize(size);
- modes[0] = u->nick;
+ std::vector<std::string> modes;
+ modes.push_back(u->nick);
// process mode params
- int i = 1;
for (unsigned int k = 0; k < tokens.size(); k++)
{
- modes[i] = tokens[k].c_str();
- i++;
+ modes.push_back(tokens[k]);
}
std::deque<std::string> n;
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index bcac36b60..b62f432da 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -141,9 +141,8 @@ class ModuleServices : public Module
if (user->IsModeSet('r') && irc::string(user->nick) != oldnick)
{
std::vector<std::string> modechange;
- modechange.resize(2);
- modechange[0] = user->nick;
- modechange[1] = "-r";
+ modechange.push_back(user->nick);
+ modechange.push_back("-r");
kludgeme = true;
ServerInstance->SendMode(modechange,user);
kludgeme = false;
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index 070051a9c..630aab946 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -109,16 +109,15 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
if (apply_other_sides_modes)
{
unsigned int idx = 2;
- int numpara = 1;
std::vector<std::string> modelist;
// Mode parser needs to know what channel to act on.
- modelist[0] = params[0];
+ modelist.push_back(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];
+ modelist.push_back(params[idx]);
}
this->Instance->SendMode(modelist, this->Instance->FakeClient);
@@ -181,13 +180,13 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
{
std::deque<std::string> stackresult;
std::vector<std::string> mode_junk;
- mode_junk[0] = channel;
+ mode_junk.push_back(channel);
while (modestack.GetStackedLine(stackresult))
{
for (size_t j = 0; j < stackresult.size(); j++)
{
- mode_junk[j+1] = stackresult[j];
+ mode_junk.push_back(stackresult[j]);
}
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;
std::vector<std::string> mode_junk;
- mode_junk[0] = c->name;
+ mode_junk.push_back(c->name);
for (char modeletter = 'A'; modeletter <= 'z'; ++modeletter)
{
@@ -227,7 +226,7 @@ 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];
+ mode_junk.push_back(stackresult[j]);
Instance->SendMode(mode_junk, Instance->FakeClient);
}
diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp
index e7209a852..2ab370170 100644
--- a/src/modules/m_spanningtree/fmode.cpp
+++ b/src/modules/m_spanningtree/fmode.cpp
@@ -50,7 +50,6 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p
}
std::vector<std::string> modelist;
time_t TS = 0;
- int n = 0;
for (unsigned int q = 0; (q < params.size()) && (q < 64); q++)
{
if (q == 1)
@@ -64,7 +63,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];
+ modelist.push_back(params[q]);
}
}
diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp
index 1dce8e7e4..a25226828 100644
--- a/src/modules/m_spanningtree/rconnect.cpp
+++ b/src/modules/m_spanningtree/rconnect.cpp
@@ -54,8 +54,7 @@ CmdResult cmd_rconnect::Handle (const std::vector<std::string>& parameters, User
/* Yes, initiate the given connect */
ServerInstance->SNO->WriteToSnoMask('l',"Remote CONNECT from %s matching \002%s\002, connecting server \002%s\002",user->nick,parameters[0].c_str(),parameters[1].c_str());
std::vector<std::string> para;
- para.resize(1);
- para[0] = parameters[1];
+ para.push_back(parameters[1]);
std::string original_command = std::string("CONNECT ") + parameters[1];
Creator->OnPreCommand("CONNECT", para, user, true, original_command);
}
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 40c994842..ea5ade8e9 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -72,9 +72,9 @@ class CommandTban : public Command
}
std::string mask = parameters[2];
std::vector<std::string> setban;
- setban[0] = parameters[0];
- setban[1] = "+b";
- setban[2] = parameters[2];
+ setban.push_back(parameters[0]);
+ setban.push_back("+b");
+ setban.push_back(parameters[2]);
// use CallCommandHandler to make it so that the user sets the mode
// themselves
ServerInstance->CallCommandHandler("MODE",setban,user);
@@ -159,9 +159,9 @@ class ModuleTimedBans : public Module
{
std::string mask = safei->mask;
std::vector<std::string> setban;
- setban[0] = safei->channel;
- setban[1] = "-b";
- setban[2] = mask;
+ setban.push_back(safei->channel);
+ setban.push_back("-b");
+ setban.push_back(mask);
CUList empty;
cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, safei->mask.c_str());