summaryrefslogtreecommitdiff
path: root/src/commands
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/commands
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/commands')
-rw-r--r--src/commands/cmd_admin.cpp10
-rw-r--r--src/commands/cmd_kill.cpp12
-rw-r--r--src/commands/cmd_links.cpp2
-rw-r--r--src/commands/cmd_map.cpp4
-rw-r--r--src/commands/cmd_modules.cpp6
-rw-r--r--src/commands/cmd_part.cpp4
-rw-r--r--src/commands/cmd_ping.cpp2
-rw-r--r--src/commands/cmd_quit.cpp2
-rw-r--r--src/commands/cmd_time.cpp2
-rw-r--r--src/commands/cmd_who.cpp11
-rw-r--r--src/commands/cmd_whois.cpp2
-rw-r--r--src/commands/cmd_whowas.cpp4
12 files changed, 29 insertions, 32 deletions
diff --git a/src/commands/cmd_admin.cpp b/src/commands/cmd_admin.cpp
index 1f2641e67..01017f69c 100644
--- a/src/commands/cmd_admin.cpp
+++ b/src/commands/cmd_admin.cpp
@@ -47,11 +47,11 @@ class CommandAdmin : public Command
*/
CmdResult CommandAdmin::Handle (const std::vector<std::string>& parameters, User *user)
{
- user->WriteNumeric(RPL_ADMINME, "%s :Administrative info for %s",user->nick.c_str(),ServerInstance->Config->ServerName);
- if (*ServerInstance->Config->AdminName)
- user->WriteNumeric(RPL_ADMINLOC1, "%s :Name - %s",user->nick.c_str(),ServerInstance->Config->AdminName);
- user->WriteNumeric(RPL_ADMINLOC2, "%s :Nickname - %s",user->nick.c_str(),ServerInstance->Config->AdminNick);
- user->WriteNumeric(RPL_ADMINEMAIL, "%s :E-Mail - %s",user->nick.c_str(),ServerInstance->Config->AdminEmail);
+ user->WriteNumeric(RPL_ADMINME, "%s :Administrative info for %s",user->nick.c_str(),ServerInstance->Config->ServerName.c_str());
+ if (!ServerInstance->Config->AdminName.empty())
+ user->WriteNumeric(RPL_ADMINLOC1, "%s :Name - %s",user->nick.c_str(),ServerInstance->Config->AdminName.c_str());
+ user->WriteNumeric(RPL_ADMINLOC2, "%s :Nickname - %s",user->nick.c_str(),ServerInstance->Config->AdminNick.c_str());
+ user->WriteNumeric(RPL_ADMINEMAIL, "%s :E-Mail - %s",user->nick.c_str(),ServerInstance->Config->AdminEmail.c_str());
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp
index 88db2764d..8bbc7ad0b 100644
--- a/src/commands/cmd_kill.cpp
+++ b/src/commands/cmd_kill.cpp
@@ -65,10 +65,10 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
- if (*ServerInstance->Config->HideKillsServer)
+ if (!ServerInstance->Config->HideKillsServer.empty())
{
// hidekills is on, use it
- snprintf(killreason, ServerInstance->Config->Limits.MaxQuit, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1].c_str());
+ snprintf(killreason, ServerInstance->Config->Limits.MaxQuit, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer.c_str(), parameters[1].c_str());
}
else
{
@@ -100,17 +100,17 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
* snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t
*/
ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick.c_str(), u->nick.c_str(), u->ident.c_str(), u->host.c_str(), parameters[1].c_str());
- ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName, user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str());
+ ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str());
/* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show
* hidekillsserver as source if possible
*/
if (!u->quitting)
{
- u->Write(":%s KILL %s :%s!%s!%s (%s)", *ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->GetFullHost().c_str(),
+ u->Write(":%s KILL %s :%s!%s!%s (%s)", ServerInstance->Config->HideKillsServer.empty() ? user->GetFullHost().c_str() : ServerInstance->Config->HideKillsServer.c_str(),
u->nick.c_str(),
- ServerInstance->Config->ServerName,
+ ServerInstance->Config->ServerName.c_str(),
user->dhost.c_str(),
- *ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->nick.c_str(),
+ ServerInstance->Config->HideKillsServer.empty() ? user->nick.c_str() : ServerInstance->Config->HideKillsServer.c_str(),
parameters[1].c_str());
}
}
diff --git a/src/commands/cmd_links.cpp b/src/commands/cmd_links.cpp
index d722fa65d..3fcaf1e4d 100644
--- a/src/commands/cmd_links.cpp
+++ b/src/commands/cmd_links.cpp
@@ -48,7 +48,7 @@ class CommandLinks : public Command
*/
CmdResult CommandLinks::Handle (const std::vector<std::string>&, User *user)
{
- user->WriteNumeric(364, "%s %s %s :0 %s",user->nick.c_str(),ServerInstance->Config->ServerName,ServerInstance->Config->ServerName,ServerInstance->Config->ServerDesc);
+ user->WriteNumeric(364, "%s %s %s :0 %s",user->nick.c_str(),ServerInstance->Config->ServerName.c_str(),ServerInstance->Config->ServerName.c_str(),ServerInstance->Config->ServerDesc.c_str());
user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick.c_str());
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_map.cpp b/src/commands/cmd_map.cpp
index b6846954a..074ca9248 100644
--- a/src/commands/cmd_map.cpp
+++ b/src/commands/cmd_map.cpp
@@ -38,11 +38,11 @@ CmdResult CommandMap::Handle (const std::vector<std::string>&, User *user)
if (IS_OPER(user))
{
- user->WriteNumeric(006, "%s :%s [%s]", user->nick.c_str(), ServerInstance->Config->ServerName, ServerInstance->Config->GetSID().c_str());
+ user->WriteNumeric(006, "%s :%s [%s]", user->nick.c_str(), ServerInstance->Config->ServerName.c_str(), ServerInstance->Config->GetSID().c_str());
user->WriteNumeric(007, "%s :End of /MAP", user->nick.c_str());
return CMD_SUCCESS;
}
- user->WriteNumeric(006, "%s :%s",user->nick.c_str(),ServerInstance->Config->ServerName);
+ user->WriteNumeric(006, "%s :%s",user->nick.c_str(),ServerInstance->Config->ServerName.c_str());
user->WriteNumeric(007, "%s :End of /MAP",user->nick.c_str());
return CMD_SUCCESS;
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 76cc29ac6..1b0f1da13 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -58,16 +58,16 @@ CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
if (!(V.Flags & mult))
flags[pos] = '-';
- ServerInstance->DumpText(user, ":%s 702 %s :%p %s %s :%s - %s", ServerInstance->Config->ServerName,
+ ServerInstance->DumpText(user, ":%s 702 %s :%p %s %s :%s - %s", ServerInstance->Config->ServerName.c_str(),
user->nick.c_str(), (void*)m, module_names[i].c_str(), flags.c_str(), V.description.c_str(), V.version.c_str());
}
else
{
- ServerInstance->DumpText(user, ":%s 702 %s :%s %s", ServerInstance->Config->ServerName,
+ ServerInstance->DumpText(user, ":%s 702 %s :%s %s", ServerInstance->Config->ServerName.c_str(),
user->nick.c_str(), module_names[i].c_str(), V.description.c_str());
}
}
- ServerInstance->DumpText(user, ":%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName, user->nick.c_str());
+ ServerInstance->DumpText(user, ":%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName.c_str(), user->nick.c_str());
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp
index e2e4e59a0..a7a407ac8 100644
--- a/src/commands/cmd_part.cpp
+++ b/src/commands/cmd_part.cpp
@@ -39,12 +39,12 @@ CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User
if (IS_LOCAL(user))
{
- if (*ServerInstance->Config->FixedPart)
+ if (!ServerInstance->Config->FixedPart.empty())
reason = ServerInstance->Config->FixedPart;
else
{
if (parameters.size() > 1)
- reason = ServerInstance->Config->PrefixPart + std::string(parameters[1]) + ServerInstance->Config->SuffixPart;
+ reason = ServerInstance->Config->PrefixPart + parameters[1] + ServerInstance->Config->SuffixPart;
else
reason = "";
}
diff --git a/src/commands/cmd_ping.cpp b/src/commands/cmd_ping.cpp
index e7898921a..b009bda84 100644
--- a/src/commands/cmd_ping.cpp
+++ b/src/commands/cmd_ping.cpp
@@ -35,7 +35,7 @@ class CommandPing : public Command
CmdResult CommandPing::Handle (const std::vector<std::string>& parameters, User *user)
{
- user->WriteServ("PONG %s :%s", ServerInstance->Config->ServerName, parameters[0].c_str());
+ user->WriteServ("PONG %s :%s", ServerInstance->Config->ServerName.c_str(), parameters[0].c_str());
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_quit.cpp b/src/commands/cmd_quit.cpp
index d041fc031..5db7ada40 100644
--- a/src/commands/cmd_quit.cpp
+++ b/src/commands/cmd_quit.cpp
@@ -41,7 +41,7 @@ CmdResult CommandQuit::Handle (const std::vector<std::string>& parameters, User
if (IS_LOCAL(user))
{
- if (*ServerInstance->Config->FixedQuit)
+ if (!ServerInstance->Config->FixedQuit.empty())
quitmsg = ServerInstance->Config->FixedQuit;
else
quitmsg = parameters.size() ?
diff --git a/src/commands/cmd_time.cpp b/src/commands/cmd_time.cpp
index 8ff588c2d..16cb76c7d 100644
--- a/src/commands/cmd_time.cpp
+++ b/src/commands/cmd_time.cpp
@@ -57,7 +57,7 @@ CmdResult CommandTime::Handle (const std::vector<std::string>&, User *user)
snprintf(tms,26,"%s",asctime(timeinfo));
tms[24] = 0;
- user->WriteNumeric(RPL_TIME, "%s %s :%s",user->nick.c_str(),ServerInstance->Config->ServerName,tms);
+ user->WriteNumeric(RPL_TIME, "%s %s :%s",user->nick.c_str(),ServerInstance->Config->ServerName.c_str(),tms);
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp
index 89ca60d02..49fb26a2f 100644
--- a/src/commands/cmd_who.cpp
+++ b/src/commands/cmd_who.cpp
@@ -148,7 +148,7 @@ bool CommandWho::whomatch(User* cuser, User* user, const char* matchtext)
match = InspIRCd::Match(user->nick, matchtext);
/* Don't allow server name matches if HideWhoisServer is enabled, unless the command user has the priv */
- if (!match && (!*ServerInstance->Config->HideWhoisServer || cuser->HasPrivPermission("users/auspex")))
+ if (!match && (ServerInstance->Config->HideWhoisServer.empty() || cuser->HasPrivPermission("users/auspex")))
match = InspIRCd::Match(user->server, matchtext);
return match;
@@ -183,7 +183,7 @@ void CommandWho::SendWhoLine(User* user, const std::string &initial, Channel* ch
Channel* chlast = ServerInstance->FindChan(lcn);
std::string wholine = initial + (ch ? ch->name : lcn) + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " " +
- ((*ServerInstance->Config->HideWhoisServer && !user->HasPrivPermission("servers/auspex")) ? ServerInstance->Config->HideWhoisServer : u->server) +
+ ((!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex")) ? ServerInstance->Config->HideWhoisServer : u->server) +
" " + u->nick + " ";
/* away? */
@@ -255,9 +255,6 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
}
}
- if (ServerInstance->FindServerName(matchtext))
- usingwildcards = true;
-
if (parameters.size() > 1)
{
/* Fix for bug #444, WHO flags count as a wildcard */
@@ -300,11 +297,11 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
opt_away = true;
break;
case 'l':
- if (user->HasPrivPermission("users/auspex") || !*ServerInstance->Config->HideWhoisServer)
+ if (user->HasPrivPermission("users/auspex") || ServerInstance->Config->HideWhoisServer.empty())
opt_local = true;
break;
case 'f':
- if (user->HasPrivPermission("users/auspex") || !*ServerInstance->Config->HideWhoisServer)
+ if (user->HasPrivPermission("users/auspex") || ServerInstance->Config->HideWhoisServer.empty())
opt_far = true;
break;
case 't':
diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp
index 972b0439e..37806df07 100644
--- a/src/commands/cmd_whois.cpp
+++ b/src/commands/cmd_whois.cpp
@@ -66,7 +66,7 @@ CmdResult CommandWhois::Handle (const std::vector<std::string>& parameters, User
* For remote users (/w remoteuser remoteuser), spanningtree will handle calling do_whois, so we can ignore this case.
* Thanks to djGrrr for not being impatient while I have a crap day coding. :p -- w00t
*/
- if (IS_LOCAL(dest) && (!*ServerInstance->Config->HideWhoisServer || parameters.size() > 1))
+ if (IS_LOCAL(dest) && (ServerInstance->Config->HideWhoisServer.empty() || parameters.size() > 1))
{
idle = abs((long)((dest->idle_lastmsg)-ServerInstance->Time()));
signon = dest->signon;
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp
index 6cd50f8b8..837e5d016 100644
--- a/src/commands/cmd_whowas.cpp
+++ b/src/commands/cmd_whowas.cpp
@@ -65,8 +65,8 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use
user->WriteNumeric(379, "%s %s :was connecting from *@%s",
user->nick.c_str(), parameters[0].c_str(), u->host.c_str());
- if (*ServerInstance->Config->HideWhoisServer && !user->HasPrivPermission("servers/auspex"))
- user->WriteNumeric(312, "%s %s %s :%s",user->nick.c_str(),parameters[0].c_str(), ServerInstance->Config->HideWhoisServer, b);
+ if (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"))
+ user->WriteNumeric(312, "%s %s %s :%s",user->nick.c_str(),parameters[0].c_str(), ServerInstance->Config->HideWhoisServer.c_str(), b);
else
user->WriteNumeric(312, "%s %s %s :%s",user->nick.c_str(),parameters[0].c_str(), u->server.c_str(), b);
}