Added m_alias module which provides command aliases.

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@746 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2004-04-27 14:50:51 +00:00
parent 566b2a8b00
commit deb5dd0dd3
8 changed files with 83 additions and 34 deletions

View File

@ -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 -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# #

View 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

View 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=

View 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

View 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!");

View 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);

View 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); }

View 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)
{