]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added m_alias module which provides command aliases.
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 27 Apr 2004 14:50:51 +0000 (14:50 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 27 Apr 2004 14:50:51 +0000 (14:50 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@746 e03df62e-2008-0410-955e-edbf42e46eb7

docs/inspircd.conf.example
include/modules.h
src/InspIRCd.dev
src/InspIRCd.layout
src/inspircd.cpp
src/message.cpp
src/modules.cpp
src/modules/m_antibottler.cpp

index 6a5e6c320c56ff9db29ce42e81cf3bd652006a6c..3c99b8f6fc2f93cb4c952004cfe6117b8408d241 100644 (file)
 <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  -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 #                                                                     #
index fd9d1765b5bed030c5d99f4df422853527a71d7a..e6b4739d8c7a34c63414e0ec5b19434a63d5383d 100644 (file)
@@ -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
index bdc8a2bc2ac4dc42edaec8e0559500d3a0b09446..11856196d8420901cfda3a391f3edcffe4a5251d 100644 (file)
@@ -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=
+
index 7e3c7834a9ec13aead5389c8f382c56186263d43..90677110b1a9d91fc417dcaf8ef3c459d4dbc9a5 100644 (file)
@@ -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
index 86462329919d21edcc33527e59b7179263c0af9c..c7a7964daddca0cd2b092f3d15ee230d67332c35 100644 (file)
@@ -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!");
index eb25a672cd7429a6ab32226d94229b73dbb07a89..f7576fe4789fe2ba7a0bcbcfd9ba13bfa6c3cc3d 100644 (file)
@@ -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);
   
index 7d81a9125ceb80ad67890637661faaf730c467b6..d2f01297781c3ef270e9262ece46abd3e7dff679 100644 (file)
@@ -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); }
index 9c6cd21c370dc9a038c98267312a0cc4ed366699..b8dd420cdfda9a37fd4e2b5a1d4ba66298040b54 100644 (file)
@@ -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)
                {