summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-27 14:50:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-27 14:50:51 +0000
commitdeb5dd0dd3b9aeacc544080569c57dacb6cad9de (patch)
treee5b7d36ccfa654928b3d43a665ebfa8e609ddddf
parent566b2a8b00d1b0d251f72c9351998d5c300ada46 (diff)
Added m_alias module which provides command aliases.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@746 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--docs/inspircd.conf.example30
-rw-r--r--include/modules.h6
-rw-r--r--src/InspIRCd.dev12
-rw-r--r--src/InspIRCd.layout61
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/message.cpp2
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_antibottler.cpp2
8 files changed, 83 insertions, 34 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index 6a5e6c320..3c99b8f6f 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -324,6 +324,36 @@
<badhost host="*@hundredz.n.hundredz.o.1337.kiddies.com" reason="Too many 1337 kiddiots">
<badhost host="*@localhost" reason="No irc from localhost!">
+#-#-#-#-#-#-#-#-#-#-#- ALIAS DEFINITIONS -#-#-#-#-#-#-#-#-#-#-#-#-#-#
+# #
+# If you have the m_alias.so module loaded, you may also define #
+# aliases as shown below. They are commonly used to provide shortcut #
+# commands to services, however they are not limited to jsut this use.#
+# An alias tag requires the following values to be defined in it: #
+# #
+# text - The text to detect at the start of the line, #
+# must be at the start of the line to trigger the #
+# alias. May contain spaces, but case insensitive. #
+# replace - The text to replace 'text' with. Usually this #
+# will be "PRIVMSG ServiceName :" or similar. #
+# requires - If you provide a value for 'requires' this means #
+# the given nickname MUST be online for the alias #
+# to successfully trigger. If they are not, then #
+# the user receives a 'no such nick' 401 numeric. #
+# uline - Defining this value with 'yes', 'true' or '1' #
+# will ensure that the user given in 'requires' #
+# must also be on a u-lined server, as well as #
+# actually being on the network. If the user is #
+# online, but not on a u-lined server, then an #
+# oper-alert is sent out as this is possibly signs #
+# of a user trying to impersonate a service. #
+# #
+
+<alias text="NICKSERV" replace="PRIVMSG NickServ :" requires="NickServ" uline="yes">
+<alias text="CHANSERV" replace="PRIVMSG ChanServ :" requires="ChanServ" uline="yes">
+<alias text="NS ID" replace="PRIVMSG NickServ :identify" requires="NickServ" uline="yes">
+<alias text="NS" replace="PRIVMSG NickServ :" requires="NickServ" uline="yes">
+<alias text="CS" replace="PRIVMSG ChanServ :" requires="ChanServ" uline="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- YAWN -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# #
diff --git a/include/modules.h b/include/modules.h
index fd9d1765b..e6b4739d8 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -159,9 +159,11 @@ class Module : public classbase
* This method is the lowest level of handler available to a module. It will be called with raw
* data which is passing through a connected socket. If you wish, you may munge this data by changing
* the string parameter "raw". If you do this, after your function exits it will immediately be
- * cut down to 510 characters plus a carriage return and linefeed.
+ * cut down to 510 characters plus a carriage return and linefeed. For INBOUND messages only (where
+ * inbound is set to true) the value of user will be the userrec of the connection sending the
+ * data. This is not possible for outbound data because the data may be being routed to multiple targets.
*/
- virtual void OnServerRaw(std::string &raw, bool inbound);
+ virtual void OnServerRaw(std::string &raw, bool inbound, userrec* user);
/** Called whenever an extended mode is to be processed.
* The type parameter is MT_SERVER, MT_CLIENT or MT_CHANNEL, dependent on where the mode is being
diff --git a/src/InspIRCd.dev b/src/InspIRCd.dev
index bdc8a2bc2..11856196d 100644
--- a/src/InspIRCd.dev
+++ b/src/InspIRCd.dev
@@ -1,7 +1,7 @@
[Project]
FileName=InspIRCd.dev
Name=InspIRCd - The Inspire Internet Relay Chat Daemon
-UnitCount=48
+UnitCount=49
Type=1
Ver=1
ObjFiles=
@@ -525,3 +525,13 @@ Priority=1000
OverrideBuildCmd=0
BuildCmd=
+[Unit49]
+FileName=modules\m_alias.cpp
+CompileCpp=1
+Folder=Modules
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 7e3c7834a..90677110b 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -13,9 +13,9 @@ LeftChar=1
[Editor_1]
Open=1
Top=0
-CursorCol=26
-CursorRow=1457
-TopLine=1420
+CursorCol=40
+CursorRow=2594
+TopLine=2549
LeftChar=1
[Editor_2]
@@ -37,9 +37,9 @@ LeftChar=1
[Editor_4]
Open=1
Top=0
-CursorCol=1
-CursorRow=163
-TopLine=135
+CursorCol=71
+CursorRow=120
+TopLine=92
LeftChar=1
[Editor_5]
@@ -67,19 +67,19 @@ TopLine=1
LeftChar=1
[Editor_8]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=33
-TopLine=1
+CursorCol=50
+CursorRow=31
+TopLine=7
LeftChar=1
[Editor_9]
-Open=0
+Open=1
Top=0
CursorCol=1
CursorRow=113
-TopLine=58
+TopLine=26
LeftChar=1
[Editor_10]
@@ -147,7 +147,7 @@ TopLine=99
LeftChar=1
[Editor_18]
-Open=0
+Open=1
Top=0
CursorCol=69
CursorRow=31
@@ -165,9 +165,9 @@ LeftChar=1
[Editor_20]
Open=1
Top=0
-CursorCol=5
-CursorRow=506
-TopLine=470
+CursorCol=107
+CursorRow=164
+TopLine=140
LeftChar=1
[Editor_21]
@@ -216,7 +216,7 @@ CursorRow=13
TopLine=23
LeftChar=1
[Editor_27]
-Open=0
+Open=1
Top=0
CursorCol=3
CursorRow=67
@@ -288,23 +288,23 @@ LeftChar=1
[Editor_37]
Open=1
Top=0
-CursorCol=3
-CursorRow=178
-TopLine=156
+CursorCol=5
+CursorRow=90
+TopLine=63
LeftChar=1
[Editor_38]
Open=1
Top=0
-CursorCol=30
-CursorRow=57
-TopLine=10
+CursorCol=72
+CursorRow=29
+TopLine=1
LeftChar=1
[Editor_39]
Open=1
Top=0
-CursorCol=25
-CursorRow=369
-TopLine=356
+CursorCol=42
+CursorRow=165
+TopLine=139
LeftChar=1
[Editor_40]
Open=1
@@ -357,8 +357,15 @@ TopLine=128
LeftChar=1
[Editor_47]
Open=1
-Top=1
+Top=0
CursorCol=1
CursorRow=52
TopLine=4
LeftChar=1
+[Editor_48]
+Open=1
+Top=1
+CursorCol=60
+CursorRow=87
+TopLine=53
+LeftChar=1
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 864623299..c7a7964da 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -2591,7 +2591,7 @@ void process_command(userrec *user, char* cmd)
for (int i = 0; i <= MODCOUNT; i++)
{
std::string oldtmp = tmp;
- modules[i]->OnServerRaw(tmp,true);
+ modules[i]->OnServerRaw(tmp,true,user);
if (oldtmp != tmp)
{
log(DEBUG,"A Module changed the input string!");
diff --git a/src/message.cpp b/src/message.cpp
index eb25a672c..f7576fe47 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -162,7 +162,7 @@ void chop(char* str)
return;
}
string temp = str;
- FOREACH_MOD OnServerRaw(temp,false);
+ FOREACH_MOD OnServerRaw(temp,false,NULL);
const char* str2 = temp.c_str();
sprintf(str,"%s",str2);
diff --git a/src/modules.cpp b/src/modules.cpp
index 7d81a9125..d2f012977 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -117,7 +117,7 @@ void Module::OnUserPart(userrec* user, chanrec* channel) { }
void Module::OnPacketTransmit(char *p) { }
void Module::OnPacketReceive(char *p) { }
void Module::OnRehash() { }
-void Module::OnServerRaw(std::string &raw, bool inbound) { }
+void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { }
int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; }
bool Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params) { return false; }
Version Module::GetVersion() { return Version(1,0,0,0); }
diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp
index 9c6cd21c3..b8dd420cd 100644
--- a/src/modules/m_antibottler.cpp
+++ b/src/modules/m_antibottler.cpp
@@ -26,7 +26,7 @@ class ModuleAntiBottler : public Module
}
- virtual void OnServerRaw(std::string &raw, bool inbound)
+ virtual void OnServerRaw(std::string &raw, bool inbound, userrec* user)
{
if (inbound)
{