summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp19
-rw-r--r--src/modules/m_spanningtree/main.h3
-rw-r--r--src/modules/m_spanningtree/netburst.cpp6
3 files changed, 10 insertions, 18 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 92d274679..4934c3d61 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -73,7 +73,7 @@ void ModuleSpanningTree::init()
Implementation eventlist[] =
{
I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostTopicChange,
- I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin,
+ I_OnWallops, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin,
I_OnChangeHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule,
I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash,
I_OnOper, I_OnAddLine, I_OnDelLine, I_OnMode, I_OnLoadModule, I_OnStats,
@@ -380,12 +380,8 @@ ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& para
*/
void ModuleSpanningTree::RemoteMessage(User* user, const char* format, ...)
{
- char text[MAXBUF];
- va_list argsPtr;
-
- va_start(argsPtr, format);
- vsnprintf(text, MAXBUF, format, argsPtr);
- va_end(argsPtr);
+ std::string text;
+ VAFORMAT(text, format, format);
if (IS_LOCAL(user))
user->WriteNotice(text);
@@ -499,14 +495,9 @@ void ModuleSpanningTree::LocalMessage(User* user, void* dest, int target_type, c
}
}
-void ModuleSpanningTree::OnUserNotice(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
-{
- LocalMessage(user, dest, target_type, text, status, exempt_list, "NOTICE");
-}
-
-void ModuleSpanningTree::OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
+void ModuleSpanningTree::OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype)
{
- LocalMessage(user, dest, target_type, text, status, exempt_list, "PRIVMSG");
+ LocalMessage(user, dest, target_type, text, status, exempt_list, (msgtype == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE"));
}
void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 9ea48aaea..947eddd37 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -148,8 +148,7 @@ class ModuleSpanningTree : public Module
void OnUserInvite(User* source,User* dest,Channel* channel, time_t) CXX11_OVERRIDE;
void OnPostTopicChange(User* user, Channel* chan, const std::string &topic) CXX11_OVERRIDE;
void OnWallops(User* user, const std::string &text) CXX11_OVERRIDE;
- void OnUserNotice(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list) CXX11_OVERRIDE;
- void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list) CXX11_OVERRIDE;
+ void OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE;
void OnBackgroundTimer(time_t curtime) CXX11_OVERRIDE;
void OnUserJoin(Membership* memb, bool sync, bool created, CUList& excepts) CXX11_OVERRIDE;
void OnChangeHost(User* user, const std::string &newhost) CXX11_OVERRIDE;
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index c22ad3acb..639a397c6 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -120,7 +120,6 @@ void TreeSocket::SendFJoins(Channel* c)
void TreeSocket::SendXLines()
{
char data[MAXBUF];
- const char* sn = ServerInstance->Config->GetSID().c_str();
std::vector<std::string> types = ServerInstance->XLines->GetAllTypes();
@@ -140,7 +139,10 @@ void TreeSocket::SendXLines()
if (!i->second->IsBurstable())
break;
- snprintf(data,MAXBUF,":%s ADDLINE %s %s %s %lu %lu :%s",sn, it->c_str(), i->second->Displayable(),
+ snprintf(data, MAXBUF, ":%s ADDLINE %s %s %s %lu %lu :%s",
+ ServerInstance->Config->GetSID().c_str(),
+ it->c_str(),
+ i->second->Displayable().c_str(),
i->second->source.c_str(),
(unsigned long)i->second->set_time,
(unsigned long)i->second->duration,