mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-02 13:53:13 +02:00
+- Made del_Command().
This commit is contained in:
@@ -292,3 +292,4 @@
|
||||
- You can now specify oper flags using the old method:
|
||||
(new method) flags { flags here }; (old method) flags flags_here;
|
||||
- Removed a lot of vars and stuff from the old config, also made some cleanups to reduce source size
|
||||
- Made del_Command().
|
||||
+2
-1
@@ -130,6 +130,7 @@ extern int R_do_socks, R_good_socks, R_no_socks;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
extern inline aCommand *find_Command(char *cmd, int token);
|
||||
extern aChannel *find_channel PROTO((char *, aChannel *));
|
||||
extern Member *find_member_link PROTO((Member *, aClient *));
|
||||
extern void remove_user_from_channel PROTO((aClient *, aChannel *));
|
||||
@@ -403,7 +404,7 @@ void add_Command_backend(char *cmd, int (*func)(), unsigned char parameters, uns
|
||||
void add_Command(char *cmd, char *token, int (*func)(), unsigned char parameters);
|
||||
void add_Command_to_list(aCommand *item, aCommand **list);
|
||||
aCommand *del_Command_from_list(aCommand *item, aCommand **list);
|
||||
|
||||
int del_Command(char *cmd, char *token, int (*func)());
|
||||
|
||||
/* CRULE */
|
||||
char *crule_parse PROTO((char *));
|
||||
|
||||
@@ -339,3 +339,64 @@ aCommand *del_Command_from_list(aCommand *item, aCommand **list)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline aCommand *find_CommandEx(char *cmd, int (*func)(), int token)
|
||||
{
|
||||
aCommand *p;
|
||||
|
||||
for (p = CommandHash[toupper(*cmd)]; p; p = p->next)
|
||||
if (p->token && token)
|
||||
{
|
||||
if (!strcmp(p->cmd, cmd))
|
||||
if (p->func == func)
|
||||
return (p);
|
||||
}
|
||||
else
|
||||
if (!match(p->cmd, cmd))
|
||||
if (p->func == func)
|
||||
return (p);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
int del_Command(char *cmd, char *token, int (*func)())
|
||||
{
|
||||
aCommand *p;
|
||||
int i = 0;
|
||||
p = find_CommandEx(cmd, func, 0);
|
||||
if (!p)
|
||||
i--;
|
||||
else
|
||||
{
|
||||
del_Command_from_list(p, &CommandHash[toupper(*cmd)]);
|
||||
if (p->cmd)
|
||||
MyFree(p->cmd);
|
||||
MyFree(p);
|
||||
}
|
||||
p = find_CommandEx(token, func, 1);
|
||||
if (!p)
|
||||
i--;
|
||||
else
|
||||
{
|
||||
del_Command_from_list(p, &CommandHash[toupper(*token)]);
|
||||
if (p->cmd)
|
||||
MyFree(p->cmd);
|
||||
MyFree(p);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
inline aCommand *find_Command(char *cmd, int token)
|
||||
{
|
||||
aCommand *p;
|
||||
|
||||
for (p = CommandHash[toupper(*cmd)]; p; p = p->next)
|
||||
if (p->token && token)
|
||||
{
|
||||
if (!strcmp(p->cmd, cmd))
|
||||
return (p);
|
||||
}
|
||||
else
|
||||
if (!match(p->cmd, cmd))
|
||||
return (p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-16
@@ -184,22 +184,6 @@ void ban_flooder(aClient *cptr)
|
||||
return;
|
||||
}
|
||||
|
||||
inline aCommand *find_Command(char *cmd, int token)
|
||||
{
|
||||
aCommand *p;
|
||||
|
||||
for (p = CommandHash[toupper(*cmd)]; p; p = p->next)
|
||||
if (p->token && token)
|
||||
{
|
||||
if (!strcmp(p->cmd, cmd))
|
||||
return (p);
|
||||
}
|
||||
else
|
||||
if (!match(p->cmd, cmd))
|
||||
return (p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* parse a buffer.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user