From 87dbe508d5d897d73321c0e26efcddd36505e3ad Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 4 Apr 2008 14:48:34 +0000 Subject: Add safety check for nonexistent server in receiving server origin privmsg (shouldnt happen as we vet the uid higher up the chain, but check anyway!) Also add trigger for OnText to remove privmsg/notice git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9311 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_delayjoin.cpp | 4 ++++ src/modules/m_spanningtree/privmsg.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 88a654cc7..bb96b4617 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -160,6 +160,10 @@ class ModuleDelayJoin : public Module void OnText(User* user, void* dest, int target_type, const std::string &text, char status, CUList &exempt_list) { + /* Server origin */ + if (!user) + return; + if (target_type != TYPE_CHANNEL) return; diff --git a/src/modules/m_spanningtree/privmsg.cpp b/src/modules/m_spanningtree/privmsg.cpp index 6c4c8935e..0aa175c70 100644 --- a/src/modules/m_spanningtree/privmsg.cpp +++ b/src/modules/m_spanningtree/privmsg.cpp @@ -51,7 +51,11 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string FOREACH_MOD_I(Instance, I_OnUserNotice, OnUserNotice(NULL, channel, TYPE_SERVER, text, status, except_list)); } TreeServer* s = Utils->FindServer(prefix); - channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name, text.c_str()); + if (s) + { + FOREACH_MOD_I(Instance, I_OnText, OnText(NULL, channel, TYPE_SERVER, text, status, except_list)); + channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name, text.c_str()); + } } /* Propogate as channel privmsg */ -- cgit v1.2.3