summaryrefslogtreecommitdiff
path: root/src/channels.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-03 01:52:59 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-03 01:52:59 +0000
commitde25d946733f774e3a5b53a58438a9c92af0acbe (patch)
tree459ccc3b0c2423f1592afec4b458615968a1176d /src/channels.cpp
parente57ed15735a3f23d6451845c7cf96758e6909d8c (diff)
Get rid of a bunch of memory-wasting C-style strings
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11796 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index b250368b3..22ec6e4d9 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -158,7 +158,8 @@ const UserMembList* Channel::GetUsers()
void Channel::SetDefaultModes()
{
- ServerInstance->Logs->Log("CHANNELS", DEBUG, "SetDefaultModes %s", ServerInstance->Config->DefaultModes);
+ ServerInstance->Logs->Log("CHANNELS", DEBUG, "SetDefaultModes %s",
+ ServerInstance->Config->DefaultModes.c_str());
irc::spacesepstream list(ServerInstance->Config->DefaultModes);
std::string modeseq;
std::string parameter;
@@ -484,12 +485,13 @@ long Channel::PartUser(User *user, std::string &reason)
return this->GetUserCounter();
}
-long Channel::ServerKickUser(User* user, const char* reason, const char* servername)
+long Channel::ServerKickUser(User* user, const char* reason, const std::string& servername)
{
- if (servername == NULL || *ServerInstance->Config->HideWhoisServer)
- servername = ServerInstance->Config->ServerName;
+ if (servername.empty() || !ServerInstance->Config->HideWhoisServer.empty())
+ ServerInstance->FakeClient->server = ServerInstance->Config->ServerName;
+ else
+ ServerInstance->FakeClient->server = servername;
- ServerInstance->FakeClient->server = servername;
return this->KickUser(ServerInstance->FakeClient, user, reason);
}
@@ -597,7 +599,7 @@ void Channel::WriteChannel(User* user, const std::string &text)
}
}
-void Channel::WriteChannelWithServ(const char* ServName, const char* text, ...)
+void Channel::WriteChannelWithServ(const std::string& ServName, const char* text, ...)
{
char textbuffer[MAXBUF];
va_list argsPtr;
@@ -612,11 +614,11 @@ void Channel::WriteChannelWithServ(const char* ServName, const char* text, ...)
this->WriteChannelWithServ(ServName, std::string(textbuffer));
}
-void Channel::WriteChannelWithServ(const char* ServName, const std::string &text)
+void Channel::WriteChannelWithServ(const std::string& ServName, const std::string &text)
{
char tb[MAXBUF];
- snprintf(tb,MAXBUF,":%s %s", ServName ? ServName : ServerInstance->Config->ServerName, text.c_str());
+ snprintf(tb,MAXBUF,":%s %s", ServName.empty() ? ServerInstance->Config->ServerName.c_str() : ServName.c_str(), text.c_str());
std::string out = tb;
for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
@@ -664,7 +666,7 @@ void Channel::WriteAllExcept(User* user, bool serversource, char status, CUList
{
char tb[MAXBUF];
- snprintf(tb,MAXBUF,":%s %s", serversource ? ServerInstance->Config->ServerName : user->GetFullHost().c_str(), text.c_str());
+ snprintf(tb,MAXBUF,":%s %s", serversource ? ServerInstance->Config->ServerName.c_str() : user->GetFullHost().c_str(), text.c_str());
std::string out = tb;
this->RawWriteAllExcept(user, serversource, status, except_list, std::string(tb));