From 3f5f84c92c1a424843b430c60a50efa600ae1236 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 5 May 2013 21:18:47 -0400 Subject: The const char* specialization of this no longer works --- src/config.cpp | 11 +++-------- src/init.cpp | 4 ++-- src/messages.cpp | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/config.cpp b/src/config.cpp index eac2be8c6..17d15a0d9 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -94,11 +94,6 @@ template<> time_t Block::Get(const Anope::string &tag, const Anope::string &def) return Anope::DoTime(Get(tag, def)); } -template<> const char* Block::Get(const Anope::string &tag, const Anope::string &def) const -{ - return this->Get(tag, def).c_str(); -} - template<> bool Block::Get(const Anope::string &tag, const Anope::string &def) const { const Anope::string &str = Get(tag, def); @@ -507,7 +502,7 @@ Conf::Conf() : Block("") { try { - Anope::casemap = std::locale(options->Get("casemap")); + Anope::casemap = std::locale(options->Get("casemap").c_str()); } catch (const std::runtime_error &) { @@ -524,7 +519,7 @@ Conf::Conf() : Block("") if (!options->Get("user").empty()) { errno = 0; - struct passwd *u = getpwnam(options->Get("user")); + struct passwd *u = getpwnam(options->Get("user").c_str()); if (u == NULL) Log() << "Unable to setuid to " << options->Get("user") << ": " << Anope::LastError(); else if (setuid(u->pw_uid) == -1) @@ -535,7 +530,7 @@ Conf::Conf() : Block("") if (!options->Get("group").empty()) { errno = 0; - struct group *g = getgrnam(options->Get("group")); + struct group *g = getgrnam(options->Get("group").c_str()); if (g == NULL) Log() << "Unable to setgid to " << options->Get("group") << ": " << Anope::LastError(); else if (setuid(g->gr_gid) == -1) diff --git a/src/init.cpp b/src/init.cpp index faa57c18b..205fb2501 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -197,14 +197,14 @@ static void InitSignals() static void remove_pidfile() { - remove(Config->GetBlock("serverinfo")->Get("pid")); + remove(Config->GetBlock("serverinfo")->Get("pid").c_str()); } /* Create our PID file and write the PID to it. */ static void write_pidfile() { - FILE *pidfile = fopen(Config->GetBlock("serverinfo")->Get("pid"), "w"); + FILE *pidfile = fopen(Config->GetBlock("serverinfo")->Get("pid").c_str(), "w"); if (pidfile) { #ifdef _WIN32 diff --git a/src/messages.cpp b/src/messages.cpp index 9bbfb42c0..ed601a206 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -225,7 +225,7 @@ void MOTD::Run(MessageSource &source, const std::vector ¶ms) if (s != Me) return; - FILE *f = fopen(Config->GetBlock("serverinfo")->Get("motd"), "r"); + FILE *f = fopen(Config->GetBlock("serverinfo")->Get("motd").c_str(), "r"); if (f) { IRCD->SendNumeric(375, source.GetSource(), ":- %s Message of the Day", s->GetName().c_str()); @@ -454,7 +454,7 @@ void Whois::Run(MessageSource &source, const std::vector ¶ms) IRCD->SendNumeric(311, source.GetSource(), "%s %s %s * :%s", u->nick.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->realname.c_str()); if (bi) IRCD->SendNumeric(307, source.GetSource(), "%s :is a registered nick", bi->nick.c_str()); - IRCD->SendNumeric(312, source.GetSource(), "%s %s :%s", u->nick.c_str(), Me->GetName().c_str(), Config->GetBlock("serverinfo")->Get("description")); + IRCD->SendNumeric(312, source.GetSource(), "%s %s :%s", u->nick.c_str(), Me->GetName().c_str(), Config->GetBlock("serverinfo")->Get("description").c_str()); if (bi) IRCD->SendNumeric(317, source.GetSource(), "%s %ld %ld :seconds idle, signon time", bi->nick.c_str(), static_cast(Anope::CurTime - bi->lastmsg), static_cast(bi->signon)); IRCD->SendNumeric(318, source.GetSource(), "%s :End of /WHOIS list.", params[0].c_str()); -- cgit