summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:47:45 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:47:45 +0000
commit94bb5343b1464cbec9f58ee9d90a3deae3ac5308 (patch)
treeb472a590d1536d9dc23c47aa381429d00d16ed81 /src/modules
parent2455cd671f4dbc017cf7bb76fb7b29e9f95f3b40 (diff)
Remove calls to strdup() in core, it is not better than std::string
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11623 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_cban.cpp19
-rw-r--r--src/modules/m_rline.cpp8
-rw-r--r--src/modules/m_shun.cpp8
-rw-r--r--src/modules/m_spanningtree/addline.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp2
-rw-r--r--src/modules/m_spanningtree/netburst.cpp4
-rw-r--r--src/modules/m_svshold.cpp12
-rw-r--r--src/modules/m_xline_db.cpp6
8 files changed, 35 insertions, 26 deletions
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 11bd32c8a..a815cf35f 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -23,9 +23,10 @@ class CBan : public XLine
public:
irc::string matchtext;
- CBan(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char *ch) : XLine(Instance, s_time, d, src, re, "CBAN")
+ CBan(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ch)
+ : XLine(Instance, s_time, d, src, re, "CBAN")
{
- this->matchtext = ch;
+ this->matchtext = ch.c_str();
}
~CBan()
@@ -47,8 +48,9 @@ public:
void DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired CBan %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source, (long int)(ServerInstance->Time() - this->set_time));
- ServerInstance->PI->SendSNONotice("x", "Removing expired CBan " + assign(this->matchtext) + " (set by " + std::string(this->source) + " " + ConvToStr(ServerInstance->Time() - this->set_time) + " seconds ago)");
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired CBan %s (set by %s %ld seconds ago)",
+ this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->PI->SendSNONotice("x", "Removing expired CBan " + assign(this->matchtext) + " (set by " + this->source + " " + ConvToStr(ServerInstance->Time() - this->set_time) + " seconds ago)");
}
const char* Displayable()
@@ -66,7 +68,7 @@ class CBanFactory : public XLineFactory
/** Generate a shun
*/
- XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
{
return new CBan(ServerInstance, set_time, duration, source, reason, xline_specific_mask);
}
@@ -191,9 +193,10 @@ class ModuleCBan : public Module
if (rl)
{
// Channel is banned.
- user->WriteServ( "384 %s %s :Cannot join channel, CBANed (%s)", user->nick.c_str(), cname, rl->reason);
- ServerInstance->SNO->WriteToSnoMask('a', "%s tried to join %s which is CBANed (%s)", user->nick.c_str(), cname, rl->reason);
- ServerInstance->PI->SendSNONotice("A", user->nick + " tried to join " + std::string(cname) + " which is CBANed (" + std::string(rl->reason) + ")");
+ user->WriteServ( "384 %s %s :Cannot join channel, CBANed (%s)", user->nick.c_str(), cname, rl->reason.c_str());
+ ServerInstance->SNO->WriteToSnoMask('a', "%s tried to join %s which is CBANed (%s)",
+ user->nick.c_str(), cname, rl->reason.c_str());
+ ServerInstance->PI->SendSNONotice("A", user->nick + " tried to join " + std::string(cname) + " which is CBANed (" + rl->reason + ")");
return 1;
}
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 824d6229a..26c6f0ab8 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -32,7 +32,8 @@ class RLine : public XLine
* @param regex Pattern to match with
* @
*/
- RLine(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char* regexs) : XLine(Instance, s_time, d, src, re, "R")
+ RLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string regexs)
+ : XLine(Instance, s_time, d, src, re, "R")
{
matchtext = regexs;
@@ -76,7 +77,8 @@ class RLine : public XLine
void DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired R-Line %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source, (long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired R-Line %s (set by %s %ld seconds ago)",
+ this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
}
const char* Displayable()
@@ -101,7 +103,7 @@ class RLineFactory : public XLineFactory
/** Generate a RLine
*/
- XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
{
return new RLine(ServerInstance, set_time, duration, source, reason, xline_specific_mask);
}
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index f4532ecd1..8a0ca2aa3 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -21,7 +21,8 @@ class Shun : public XLine
public:
std::string matchtext;
- Shun(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char *shunmask) : XLine(Instance, s_time, d, src, re, "SHUN")
+ Shun(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string shunmask)
+ : XLine(Instance, s_time, d, src, re, "SHUN")
{
this->matchtext = shunmask;
}
@@ -56,7 +57,8 @@ public:
void DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired shun %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source, (long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired shun %s (set by %s %ld seconds ago)",
+ this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
}
const char* Displayable()
@@ -74,7 +76,7 @@ class ShunFactory : public XLineFactory
/** Generate a shun
*/
- XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
{
return new Shun(ServerInstance, set_time, duration, source, reason, xline_specific_mask);
}
diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp
index 858abe3a6..fe7ef6845 100644
--- a/src/modules/m_spanningtree/addline.cpp
+++ b/src/modules/m_spanningtree/addline.cpp
@@ -50,7 +50,7 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
XLine* xl = NULL;
try
{
- xl = xlf->Generate(ServerInstance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
+ xl = xlf->Generate(ServerInstance->Time(), atoi(params[4].c_str()), params[2], params[5], params[1]);
}
catch (ModuleException &e)
{
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 2ecbd8a88..cb9d53b32 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -788,7 +788,7 @@ void ModuleSpanningTree::OnAddLine(User* user, XLine *x)
char data[MAXBUF];
snprintf(data,MAXBUF,"%s %s %s %lu %lu :%s", x->type.c_str(), x->Displayable(),
- ServerInstance->Config->ServerName, (unsigned long)x->set_time, (unsigned long)x->duration, x->reason);
+ ServerInstance->Config->ServerName, (unsigned long)x->set_time, (unsigned long)x->duration, x->reason.c_str());
parameterlist params;
params.push_back(data);
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index eda627e3f..93e698dd4 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -193,10 +193,10 @@ void TreeSocket::SendXLines(TreeServer* Current)
continue;
snprintf(data,MAXBUF,":%s ADDLINE %s %s %s %lu %lu :%s",sn, it->c_str(), i->second->Displayable(),
- i->second->source,
+ i->second->source.c_str(),
(unsigned long)i->second->set_time,
(unsigned long)i->second->duration,
- i->second->reason);
+ i->second->reason.c_str());
this->WriteLine(data);
}
}
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index 276fef038..eae168d6b 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -23,9 +23,10 @@ class SVSHold : public XLine
public:
irc::string nickname;
- SVSHold(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char *nick) : XLine(Instance, s_time, d, src, re, "SVSHOLD")
+ SVSHold(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string nick)
+ : XLine(Instance, s_time, d, src, re, "SVSHOLD")
{
- this->nickname = nick;
+ this->nickname = nick.c_str();
}
~SVSHold()
@@ -48,7 +49,8 @@ public:
void DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired SVSHOLD %s (set by %s %ld seconds ago)", this->nickname.c_str(), this->source, (long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired SVSHOLD %s (set by %s %ld seconds ago)",
+ this->nickname.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
}
const char* Displayable()
@@ -66,7 +68,7 @@ class SVSHoldFactory : public XLineFactory
/** Generate a shun
*/
- XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
{
return new SVSHold(ServerInstance, set_time, duration, source, reason, xline_specific_mask);
}
@@ -171,7 +173,7 @@ class ModuleSVSHold : public Module
if (rl)
{
- user->WriteServ( "432 %s %s :Services reserved nickname: %s", user->nick.c_str(), newnick.c_str(), rl->reason);
+ user->WriteServ( "432 %s %s :Services reserved nickname: %s", user->nick.c_str(), newnick.c_str(), rl->reason.c_str());
return 1;
}
diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp
index d3a75a64c..bde54a110 100644
--- a/src/modules/m_xline_db.cpp
+++ b/src/modules/m_xline_db.cpp
@@ -118,7 +118,7 @@ class ModuleXLineDB : public Module
{
line = (*i);
fprintf(f, "LINE %s %s %s %lu %lu :%s\n", line->type.c_str(), line->Displayable(),
- ServerInstance->Config->ServerName, (unsigned long)line->set_time, (unsigned long)line->duration, line->reason);
+ ServerInstance->Config->ServerName, (unsigned long)line->set_time, (unsigned long)line->duration, line->reason.c_str());
}
ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Finished writing XLines. Checking for error..");
@@ -191,7 +191,7 @@ class ModuleXLineDB : public Module
while (tokens.GetToken(tmp) && (items < MAXPARAMETERS))
{
- command_p[items] = tmp.c_str();
+ command_p[items] = tmp;
items++;
}
@@ -222,7 +222,7 @@ class ModuleXLineDB : public Module
continue;
}
- XLine* xl = xlf->Generate(ServerInstance->Time(), atoi(command_p[5].c_str()), command_p[3].c_str(), command_p[6].c_str(), command_p[2].c_str());
+ XLine* xl = xlf->Generate(ServerInstance->Time(), atoi(command_p[5].c_str()), command_p[3], command_p[6], command_p[2]);
xl->SetCreateTime(atoi(command_p[4].c_str()));
if (ServerInstance->XLines->AddLine(xl, NULL))