mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-17 15:36:50 +00:00
use mkhash for aliases too
This commit is contained in:
parent
3280df62f5
commit
8229117911
@ -270,13 +270,14 @@ void do_alias(COMMAND_ARGS)
|
||||
set_mallocdoer(do_alias);
|
||||
alias = (Alias*)Calloc(sizeof(Alias)+strlen(cmd));
|
||||
stringcpy(alias->alias,cmd);
|
||||
alias->hash = mkhash(cmd);
|
||||
set_mallocdoer(do_alias);
|
||||
alias->format = stringdup(rest);
|
||||
alias->next = aliaslist;
|
||||
aliaslist = alias;
|
||||
to_user(from,"Added alias: %s --> %s",cmd,rest);
|
||||
#ifdef DEBUG
|
||||
debug("(do_alias) Added alias: %s --> %s\n",cmd,rest);
|
||||
debug("(do_alias) Added alias: %s [#%i] --> %s\n",cmd,alias->hash,rest);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
14
src/ons.c
14
src/ons.c
@ -394,7 +394,7 @@ void on_msg(char *from, char *to, char *rest)
|
||||
uchar *p1,*p2;
|
||||
int has_cc,has_bang;
|
||||
int uaccess;
|
||||
int i,j,h;
|
||||
int i,j,command_hash;
|
||||
|
||||
/*
|
||||
* No line sent to this routine should be longer than MSGLEN
|
||||
@ -475,15 +475,15 @@ void on_msg(char *from, char *to, char *rest)
|
||||
command++;
|
||||
}
|
||||
|
||||
command_hash = mkhash(command);
|
||||
|
||||
#ifdef ALIAS
|
||||
arec = 0;
|
||||
recheck_alias:
|
||||
#endif /* ALIAS */
|
||||
|
||||
#ifdef ALIAS
|
||||
for(alias=aliaslist;alias;alias=alias->next)
|
||||
{
|
||||
if (!stringcasecmp(alias->alias,command))
|
||||
if (command_hash == alias->hash && stringcasecmp(alias->alias,command) == 0)
|
||||
{
|
||||
unchop(command,rest);
|
||||
afmt(amem,alias->format,command);
|
||||
@ -527,10 +527,10 @@ recheck_alias:
|
||||
if (i) return;
|
||||
#endif /* SCRIPTING */
|
||||
|
||||
h = mkhash(command);
|
||||
i = hashmap[h];
|
||||
command_hash = mkhash(command);
|
||||
i = hashmap[command_hash];
|
||||
#ifdef DEBUG
|
||||
debug("(on_msg) %s = hash %i, mapped to %i %s\n",command,h,i,(i==255)?"(no match)":mcmd[i].name);
|
||||
debug("(on_msg) %s = hash %i, mapped to %i %s\n",command,command_hash,i,(i==255)?"(no match)":mcmd[i].name);
|
||||
#endif /* DEBUG */
|
||||
if (i == 255)
|
||||
goto public_msg;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user