From bd4c18aa1554e4fec0913b3c5f742080cbf0eab4 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 7 Apr 2004 16:33:24 +0000 Subject: [PATCH] Added servernotice back to the user, informing them Added support for NULL as first parameter to Server::SendTo git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@418 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/InspIRCd.layout | 30 +++++++++++++++--------------- src/modules.cpp | 11 ++++++++++- src/modules/m_filter.cpp | 11 +++++++++-- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index a21245aa6..0eb47174c 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,5 +1,5 @@ [Editors] -Focused=-1 +Focused=4 Order=7,3,2,6,25,24,4,5,-1,1,0 [Editor_0] @@ -13,9 +13,9 @@ LeftChar=1 [Editor_1] Open=1 Top=0 -CursorCol=12 -CursorRow=4002 -TopLine=3971 +CursorCol=1 +CursorRow=1 +TopLine=1 LeftChar=1 [Editor_2] @@ -36,10 +36,10 @@ LeftChar=1 [Editor_4] Open=1 -Top=0 -CursorCol=1 -CursorRow=149 -TopLine=121 +Top=1 +CursorCol=25 +CursorRow=213 +TopLine=181 LeftChar=1 [Editor_5] @@ -165,9 +165,9 @@ LeftChar=1 [Editor_20] Open=1 Top=0 -CursorCol=5 -CursorRow=445 -TopLine=402 +CursorCol=68 +CursorRow=288 +TopLine=254 LeftChar=1 [Editor_21] @@ -258,8 +258,8 @@ Open=0 Top=0 [Editor_34] Open=1 -Top=1 -CursorCol=1 -CursorRow=83 -TopLine=78 +Top=0 +CursorCol=25 +CursorRow=110 +TopLine=52 LeftChar=1 diff --git a/src/modules.cpp b/src/modules.cpp index b938ebcca..d2263e352 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -207,7 +207,16 @@ void Server::SendFrom(int Socket, userrec* User, std::string s) void Server::SendTo(userrec* Source, userrec* Dest, std::string s) { - WriteTo(Source,Dest,"%s",s.c_str()); + if (!Source) + { + // if source is NULL, then the message originates from the local server + Write(Dest->fd,":%s %s",this->GetServerName().c_str(),s.c_str()); + } + else + { + // otherwise it comes from the user specified + WriteTo(Source,Dest,"%s",s.c_str()); + } } void Server::SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender) diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index d2714ee01..d208e7a5a 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -55,6 +55,7 @@ class ModuleFilter : public Module if (Srv->MatchText(text,pattern)) { std::string target = ""; + std::string reason = MyConf->ReadValue("keyword","reason",index); if (target_type == TYPE_USER) { userrec* t = (userrec*)dest; @@ -67,10 +68,13 @@ class ModuleFilter : public Module } Srv->SendOpers(std::string("FILTER: ")+std::string(user->nick)+ std::string(" had their message filtered, target was ")+ - target+": "+MyConf->ReadValue("keyword","reason",index)); + target+": "+reason); Srv->Log(DEFAULT,std::string("FILTER: ")+std::string(user->nick)+ std::string(" had their message filtered, target was ")+ - target+": "+MyConf->ReadValue("keyword","reason",index)); + target+": "+reason); + // this form of SendTo (with the source as NuLL) sends a server notice + Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+ + " :Your message has been filtered and opers notified: "+reason); return 1; } } @@ -86,6 +90,7 @@ class ModuleFilter : public Module if (Srv->MatchText(text,pattern)) { std::string target = ""; + std::string reason = MyConf->ReadValue("keyword","reason",index); if (target_type == TYPE_USER) { userrec* t = (userrec*)dest; @@ -102,6 +107,8 @@ class ModuleFilter : public Module Srv->Log(DEFAULT,std::string("FILTER: ")+std::string(user->nick)+ std::string(" had their notice filtered, target was ")+ target+": "+MyConf->ReadValue("keyword","reason",index)); + Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+ + " :Your notice has been filtered and opers notified: "+reason); return 1; } } -- 2.39.5