summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/hashcomp.h2
-rw-r--r--src/cmd_oper.cpp8
-rw-r--r--src/cmd_whois.cpp13
-rw-r--r--src/hashcomp.cpp11
4 files changed, 18 insertions, 16 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
index 056bba6e5..0a39deb1f 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -212,6 +212,8 @@ namespace irc
/** This typedef declares irc::string based upon irc_char_traits
*/
typedef basic_string<char, irc_char_traits, allocator<char> > string;
+
+ const char* Spacify(char* n);
}
/* Define operators for using >> and << with irc::string to an ostream on an istream. */
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index 4f4c0d284..f7975a2e4 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -20,7 +20,7 @@
#include "modules.h"
#include "wildcard.h"
#include "commands/cmd_oper.h"
-#include "commands/cmd_whois.h"
+#include "hashcomp.h"
bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
{
@@ -36,8 +36,6 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
return false;
}
-
-
extern "C" command_t* init_command(InspIRCd* Instance)
{
return new cmd_oper(Instance);
@@ -106,8 +104,8 @@ CmdResult cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
if (found)
{
/* correct oper credentials */
- ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,Spacify(OperType),parameters[0]);
- user->WriteServ("381 %s :You are now an IRC operator of type %s",user->nick,Spacify(OperType));
+ ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0]);
+ user->WriteServ("381 %s :You are now an IRC operator of type %s",user->nick,irc::Spacify(OperType));
if (!user->modes[UM_OPERATOR])
user->Oper(OperType);
}
diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp
index d48d1a10c..c0c5b97a3 100644
--- a/src/cmd_whois.cpp
+++ b/src/cmd_whois.cpp
@@ -19,16 +19,7 @@
#include "users.h"
#include "modules.h"
#include "commands/cmd_whois.h"
-
-const char* Spacify(char* n)
-{
- static char x[MAXBUF];
- strlcpy(x,n,MAXBUF);
- for (char* y = x; *y; y++)
- if (*y == '_')
- *y = ' ';
- return x;
-}
+#include "hashcomp.h"
void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick)
{
@@ -66,7 +57,7 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo
}
if (*dest->oper)
{
- user->WriteServ("313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),Spacify(dest->oper), ServerInstance->Config->Network);
+ user->WriteServ("313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),irc::Spacify(dest->oper), ServerInstance->Config->Network);
}
if ((!signon) && (!idle))
{
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 682501f23..8d19d059a 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -298,3 +298,14 @@ std::string irc::hex(const unsigned char *raw, size_t rawsz)
return buf;
}
+const char* irc::Spacify(char* n)
+{
+ static char x[MAXBUF];
+ strlcpy(x,n,MAXBUF);
+ for (char* y = x; *y; y++)
+ if (*y == '_')
+ *y = ' ';
+ return x;
+}
+
+