summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-05-22 20:41:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-05-22 20:41:16 +0000
commitda8fe330c2b3445b370cb80ecae93c7fb34d441d (patch)
tree4b6ef238c206d3440b36827b847fd3895dc300f8 /src
parent38c9d65253a67dbe13c77792027a9db601735813 (diff)
Added support for changing of text within OnUserPreNotice and OnUserPreMessage (required for modes +G and +S etc)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@821 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/InspIRCd.layout102
-rw-r--r--src/commands.cpp18
-rw-r--r--src/modules.cpp4
-rw-r--r--src/modules/m_blockcolor.cpp4
-rw-r--r--src/modules/m_filter.cpp12
-rw-r--r--src/modules/m_noctcp.cpp4
-rw-r--r--src/modules/m_nonotice.cpp2
-rw-r--r--src/modules/m_services.cpp4
8 files changed, 79 insertions, 71 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index ed04817c7..fa44b4a6e 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -1,5 +1,5 @@
[Editors]
-Focused=-1
+Focused=43
Order=2,4,6,3,7,25,5,24,39,42,43,1,46,0,49,-1
[Editor_0]
@@ -13,9 +13,9 @@ LeftChar=1
[Editor_1]
Open=1
Top=0
-CursorCol=17
-CursorRow=11
-TopLine=1
+CursorCol=26
+CursorRow=2974
+TopLine=2920
LeftChar=1
[Editor_2]
@@ -37,9 +37,9 @@ LeftChar=1
[Editor_4]
Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=13
+CursorRow=315
+TopLine=276
LeftChar=1
[Editor_5]
@@ -55,7 +55,7 @@ Open=1
Top=0
CursorCol=1
CursorRow=16
-TopLine=1
+TopLine=59
LeftChar=1
[Editor_7]
@@ -139,11 +139,11 @@ TopLine=1
LeftChar=1
[Editor_17]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=44
+CursorRow=78
+TopLine=23
LeftChar=1
[Editor_18]
@@ -163,11 +163,11 @@ TopLine=1
LeftChar=1
[Editor_20]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=14
+CursorRow=276
+TopLine=245
LeftChar=1
[Editor_21]
@@ -179,7 +179,7 @@ TopLine=1
LeftChar=1
[Editor_22]
-Open=0
+Open=1
Top=0
CursorCol=1
CursorRow=16
@@ -251,11 +251,11 @@ CursorRow=16
TopLine=1
LeftChar=1
[Editor_32]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=86
+CursorRow=65
+TopLine=18
LeftChar=1
[Editor_33]
Open=0
@@ -323,16 +323,16 @@ LeftChar=1
[Editor_42]
Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=42
+CursorRow=287
+TopLine=256
LeftChar=1
[Editor_43]
Open=1
-Top=0
-CursorCol=4
-CursorRow=435
-TopLine=387
+Top=1
+CursorCol=32
+CursorRow=601
+TopLine=552
LeftChar=1
[Editor_44]
Open=0
@@ -356,11 +356,11 @@ CursorRow=16
TopLine=1
LeftChar=1
[Editor_47]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=86
+CursorRow=88
+TopLine=69
LeftChar=1
[Editor_48]
Open=0
@@ -384,11 +384,11 @@ CursorRow=16
TopLine=1
LeftChar=1
[Editor_51]
-Open=0
+Open=1
Top=0
CursorCol=1
-CursorRow=16
-TopLine=1
+CursorRow=89
+TopLine=35
LeftChar=1
[Editor_52]
Open=0
@@ -412,11 +412,11 @@ CursorRow=16
TopLine=1
LeftChar=1
[Editor_55]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=85
+CursorRow=35
+TopLine=19
LeftChar=1
[Editor_56]
Open=0
@@ -426,18 +426,18 @@ CursorRow=16
TopLine=1
LeftChar=1
[Editor_57]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=85
+CursorRow=56
+TopLine=11
LeftChar=1
[Editor_58]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=16
-TopLine=1
+CursorCol=85
+CursorRow=54
+TopLine=10
LeftChar=1
[Editor_59]
Open=0
@@ -448,8 +448,8 @@ TopLine=1
LeftChar=1
[Editor_60]
Open=1
-Top=1
-CursorCol=1
-CursorRow=1
-TopLine=33
+Top=0
+CursorCol=22
+CursorRow=50
+TopLine=12
LeftChar=1
diff --git a/src/commands.cpp b/src/commands.cpp
index 5b3c14f98..5144d7ae5 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -560,10 +560,12 @@ void handle_privmsg(char **parameters, int pcnt, userrec *user)
int MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreMessage(user,chan,TYPE_CHANNEL,std::string(parameters[1])));
+ std::string temp = parameters[1];
+ FOREACH_RESULT(OnUserPreMessage(user,chan,TYPE_CHANNEL,temp));
if (MOD_RESULT) {
return;
}
+ parameters[1] = (char*)temp.c_str();
ChanExceptSender(chan, user, "PRIVMSG %s :%s", chan->name, parameters[1]);
@@ -591,10 +593,12 @@ void handle_privmsg(char **parameters, int pcnt, userrec *user)
int MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreMessage(user,dest,TYPE_USER,std::string(parameters[1])));
+ std::string temp = parameters[1];
+ FOREACH_RESULT(OnUserPreMessage(user,dest,TYPE_USER,temp));
if (MOD_RESULT) {
return;
}
+ parameters[1] = (char*)temp.c_str();
@@ -643,11 +647,13 @@ void handle_notice(char **parameters, int pcnt, userrec *user)
}
int MOD_RESULT = 0;
-
- FOREACH_RESULT(OnUserPreNotice(user,chan,TYPE_CHANNEL,std::string(parameters[1])));
+
+ std::string temp = parameters[1];
+ FOREACH_RESULT(OnUserPreNotice(user,chan,TYPE_CHANNEL,temp));
if (MOD_RESULT) {
return;
}
+ parameters[1] = (char*)temp.c_str();
ChanExceptSender(chan, user, "NOTICE %s :%s", chan->name, parameters[1]);
@@ -669,10 +675,12 @@ void handle_notice(char **parameters, int pcnt, userrec *user)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreNotice(user,dest,TYPE_USER,std::string(parameters[1])));
+ std::string temp = parameters[1];
+ FOREACH_RESULT(OnUserPreNotice(user,dest,TYPE_USER,temp));
if (MOD_RESULT) {
return;
}
+ parameters[1] = (char*)temp.c_str();
if (!strcmp(dest->server,user->server))
{
diff --git a/src/modules.cpp b/src/modules.cpp
index 7477fe518..56a1d2621 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -311,8 +311,8 @@ void Module::OnOper(userrec* user) { };
void Module::OnInfo(userrec* user) { };
void Module::OnWhois(userrec* source, userrec* dest) { };
int Module::OnUserPreInvite(userrec* source,userrec* dest,chanrec* channel) { return 0; };
-int Module::OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text) { return 0; };
-int Module::OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text) { return 0; };
+int Module::OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text) { return 0; };
+int Module::OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text) { return 0; };
int Module::OnUserPreNick(userrec* user, std::string newnick) { return 0; };
int Module::OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type) { return ACR_DEFAULT; };
string_list Module::OnUserSync(userrec* user) { string_list empty; return empty; }
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index a4e5acc1d..7f9d8716d 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -32,7 +32,7 @@ class ModuleBlockColor : public Module
Srv->AddExtendedMode('c',MT_CHANNEL,false,0,0);
}
- virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
{
if (target_type == TYPE_CHANNEL)
{
@@ -51,7 +51,7 @@ class ModuleBlockColor : public Module
return 0;
}
- virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text)
{
if (target_type == TYPE_CHANNEL)
{
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 8d121ac0e..679df66bc 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -62,13 +62,13 @@ class ModuleFilter : public Module
// format of a config entry is <keyword pattern="*glob*" reason="Some reason here" action="kill/block">
- virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
{
- text = text + " ";
+ std::string text2 = text + " ";
for (int index = 0; index < MyConf->Enumerate("keyword"); index++)
{
std::string pattern = MyConf->ReadValue("keyword","pattern",index);
- if (Srv->MatchText(text,pattern))
+ if (Srv->MatchText(text2,pattern))
{
std::string target = "";
std::string reason = MyConf->ReadValue("keyword","reason",index);
@@ -111,13 +111,13 @@ class ModuleFilter : public Module
return 0;
}
- virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text)
{
- text = text + " ";
+ std::string text2 = text + " ";
for (int index = 0; index < MyConf->Enumerate("keyword"); index++)
{
std::string pattern = MyConf->ReadValue("keyword","pattern",index);
- if (Srv->MatchText(text,pattern))
+ if (Srv->MatchText(text2,pattern))
{
std::string target = "";
std::string reason = MyConf->ReadValue("keyword","reason",index);
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 8d597d1b8..4d58151f0 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -33,7 +33,7 @@ class ModuleNoCTCP : public Module
Srv->AddExtendedMode('C',MT_CHANNEL,false,0,0);
}
- virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
{
if (target_type == TYPE_CHANNEL)
{
@@ -53,7 +53,7 @@ class ModuleNoCTCP : public Module
return 0;
}
- virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text)
{
if (target_type == TYPE_CHANNEL)
{
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index a5fa2b61c..89a619590 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -32,7 +32,7 @@ class ModuleNoNotice : public Module
Srv->AddExtendedMode('T',MT_CHANNEL,false,0,0);
}
- virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text)
{
if (target_type == TYPE_CHANNEL)
{
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index 74c2bf2dc..95d0436e1 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -85,7 +85,7 @@ class ModuleServices : public Module
return 0;
}
- virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
{
if (target_type == TYPE_CHANNEL)
{
@@ -120,7 +120,7 @@ class ModuleServices : public Module
return 0;
}
- virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text)
+ virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text)
{
if (target_type == TYPE_CHANNEL)
{