summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/globals.h1
-rw-r--r--include/helperfuncs.h1
-rw-r--r--include/modules.h6
-rw-r--r--include/users.h8
-rw-r--r--src/cmd_wallops.cpp2
-rw-r--r--src/helperfuncs.cpp29
-rw-r--r--src/modules.cpp5
-rw-r--r--src/users.cpp33
8 files changed, 38 insertions, 47 deletions
diff --git a/include/globals.h b/include/globals.h
index 299a1f438..d3aac6571 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -34,7 +34,6 @@ typedef std::multimap< std::string, KeyValList > ConfigDataHash;
void WriteOpers(char* text, ...);
void do_log(int level, char *text, ...);
int common_channels(userrec *u, userrec *u2);
-void WriteWallOps(userrec *source, bool local_only, char* text, ...);
int isnick(const char *n);
chanrec* FindChan(const char* chan);
void readfile(file_cache &F, const char* fname);
diff --git a/include/helperfuncs.h b/include/helperfuncs.h
index d35f0ae6e..e094b1a0e 100644
--- a/include/helperfuncs.h
+++ b/include/helperfuncs.h
@@ -56,7 +56,6 @@ void WriteMode(const char* modes, int flags, const char* text, ...);
void NoticeAll(userrec *source, bool local_only, char* text, ...);
void ServerNoticeAll(char* text, ...);
void ServerPrivmsgAll(char* text, ...);
-void WriteWallOps(userrec *source, bool local_only, char* text, ...);
void strlower(char *n);
userrec* Find(const std::string &nick);
userrec* Find(const char* nick);
diff --git a/include/modules.h b/include/modules.h
index 88fe81adc..f086188d0 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1333,12 +1333,6 @@ class Server : public Extensible
*/
virtual bool CommonChannels(userrec* u1, userrec* u2);
- /** Sends a WALLOPS message.
- * This method writes a WALLOPS message to all users with the +w flag, originating from the
- * specified user.
- */
- virtual void SendWallops(userrec* User, const std::string &text);
-
/** Returns true if a nick is valid.
* Nicks for unregistered connections will return false.
*/
diff --git a/include/users.h b/include/users.h
index a66062383..5e6225dfb 100644
--- a/include/users.h
+++ b/include/users.h
@@ -614,19 +614,23 @@ class userrec : public connection
* @param text The format string for text to send to the users
* @param ... POD-type format arguments
*/
- void WriteCommon(char* text, ...);
+ void WriteCommon(const char* text, ...);
/** Write to all users that can see this user (not including this user in the list), appending CR/LF
* @param text The format string for text to send to the users
* @param ... POD-type format arguments
*/
- void WriteCommonExcept(char* text, ...);
+ void WriteCommonExcept(const char* text, ...);
/** Write to all users that can see this user (not including this user in the list), appending CR/LF
* @param text A std::string to send to the users
*/
void WriteCommonExcept(const std::string &text);
+ void userrec::WriteWallOps(const char* text, ...);
+
+ void userrec::WriteWallOps(const std::string &text);
+
/** Default destructor
*/
virtual ~userrec();
diff --git a/src/cmd_wallops.cpp b/src/cmd_wallops.cpp
index 453ce911d..a30ab0762 100644
--- a/src/cmd_wallops.cpp
+++ b/src/cmd_wallops.cpp
@@ -27,6 +27,6 @@ extern ServerConfig* Config;
void cmd_wallops::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteWallOps(user,false,"%s",parameters[0]);
+ user->WriteWallOps(std::string(parameters[0]));
FOREACH_MOD(I_OnWallops,OnWallops(user,parameters[0]));
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 6cf969a82..e9d4e774f 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -335,35 +335,6 @@ void NoticeAll(userrec *source, bool local_only, char* text, ...)
}
-void WriteWallOps(userrec *source, bool local_only, char* text, ...)
-{
- char textbuffer[MAXBUF];
- char formatbuffer[MAXBUF];
- va_list argsPtr;
-
- if ((!text) || (!source))
- {
- log(DEFAULT,"*** BUG *** WriteOpers was given an invalid parameter");
- return;
- }
-
- va_start(argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
- va_end(argsPtr);
-
- snprintf(formatbuffer,MAXBUF,"WALLOPS :%s",textbuffer);
-
- for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
- {
- userrec* t = (userrec*)(*i);
-
- if ((IS_LOCAL(t)) && (t->modes[UM_WALLOPS]))
- {
- source->WriteTo(t,std::string(formatbuffer));
- }
- }
-}
-
/* convert a string to lowercase. Note following special circumstances
* taken from RFC 1459. Many "official" server branches still hold to this
* rule so i will too;
diff --git a/src/modules.cpp b/src/modules.cpp
index ea45c5d9e..84502d374 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -465,11 +465,6 @@ void Server::DumpText(userrec* User, const std::string &LinePrefix, stringstream
User->WriteServ(CompleteLine);
}
-void Server::SendWallops(userrec* User, const std::string &text)
-{
- WriteWallOps(User,false,"%s",text.c_str());
-}
-
void Server::ChangeHost(userrec* user, const std::string &host)
{
ChangeDisplayedHost(user,host.c_str());
diff --git a/src/users.cpp b/src/users.cpp
index ec197fd60..31320581d 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1390,7 +1390,7 @@ void userrec::WriteTo(userrec *dest, const std::string &data)
}
-void userrec::WriteCommon(char* text, ...)
+void userrec::WriteCommon(const char* text, ...)
{
char textbuffer[MAXBUF];
va_list argsPtr;
@@ -1448,7 +1448,7 @@ void userrec::WriteCommon(const std::string &text)
* channel, NOT including the source user e.g. for use in QUIT
*/
-void userrec::WriteCommonExcept(char* text, ...)
+void userrec::WriteCommonExcept(const char* text, ...)
{
char textbuffer[MAXBUF];
va_list argsPtr;
@@ -1537,3 +1537,32 @@ void userrec::WriteCommonExcept(const std::string &text)
}
+void userrec::WriteWallOps(const std::string &text)
+{
+ /* Does nothing if theyre not opered */
+ if ((!*this->oper) && (IS_LOCAL(this)))
+ return;
+
+ std::string wallop = "WALLOPS :";
+ wallop.append(text);
+
+ for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
+ {
+ userrec* t = *i;
+ if ((IS_LOCAL(t)) && (t->modes[UM_WALLOPS]))
+ this->WriteTo(t,wallop);
+ }
+}
+
+void userrec::WriteWallOps(const char* text, ...)
+{
+ char textbuffer[MAXBUF];
+ va_list argsPtr;
+
+ va_start(argsPtr, text);
+ vsnprintf(textbuffer, MAXBUF, text, argsPtr);
+ va_end(argsPtr);
+
+ this->WriteWallOps(std::string(textbuffer));
+}
+