IRCu fix for private messages to bots
This commit is contained in:
parent
d35dd51208
commit
cc83e08dba
1 changed files with 16 additions and 3 deletions
19
dl.c
19
dl.c
|
@ -849,6 +849,9 @@ bot_message (char *origin, char **av, int ac)
|
||||||
User *u;
|
User *u;
|
||||||
User *bot_user;
|
User *bot_user;
|
||||||
ModUser *mod_usr;
|
ModUser *mod_usr;
|
||||||
|
char** argv;
|
||||||
|
int argc = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Check command length */
|
/* Check command length */
|
||||||
if (strnlen (av[1], MAX_CMD_LINE_LENGTH) >= MAX_CMD_LINE_LENGTH) {
|
if (strnlen (av[1], MAX_CMD_LINE_LENGTH) >= MAX_CMD_LINE_LENGTH) {
|
||||||
|
@ -884,7 +887,12 @@ bot_message (char *origin, char **av, int ac)
|
||||||
if (setjmp (sigvbuf) == 0) {
|
if (setjmp (sigvbuf) == 0) {
|
||||||
SET_SEGV_INMODULE(mod_usr->modname);
|
SET_SEGV_INMODULE(mod_usr->modname);
|
||||||
if(mod_usr->function) {
|
if(mod_usr->function) {
|
||||||
mod_usr->function (origin, av, ac);
|
AddStringToList (&argv, bot_user->nick, &argc);
|
||||||
|
for(i = 1; i < ac; i++) {
|
||||||
|
AddStringToList (&argv, av[i], &argc);
|
||||||
|
}
|
||||||
|
mod_usr->function (u->nick, av, ac);
|
||||||
|
free(argv);
|
||||||
} else {
|
} else {
|
||||||
/* Trap CTCP commands and silently drop them to avoid unknown command errors
|
/* Trap CTCP commands and silently drop them to avoid unknown command errors
|
||||||
* Why bother? Well we might be able to use some of them in the future
|
* Why bother? Well we might be able to use some of them in the future
|
||||||
|
@ -895,14 +903,19 @@ bot_message (char *origin, char **av, int ac)
|
||||||
if (av[1][0] == '\1') {
|
if (av[1][0] == '\1') {
|
||||||
char* buf;
|
char* buf;
|
||||||
buf = joinbuf(av, ac, 1);
|
buf = joinbuf(av, ac, 1);
|
||||||
nlog (LOG_NORMAL, LOG_MOD, "%s requested CTCP %s", origin, buf);
|
nlog (LOG_NORMAL, LOG_MOD, "%s requested CTCP %s", u->nick, buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!u) {
|
if (!u) {
|
||||||
nlog (LOG_WARNING, LOG_CORE, "Unable to finduser %s (%s)", origin, mod_usr->nick);
|
nlog (LOG_WARNING, LOG_CORE, "Unable to finduser %s (%s)", u->nick, mod_usr->nick);
|
||||||
} else {
|
} else {
|
||||||
|
AddStringToList (&argv, bot_user->nick, &argc);
|
||||||
|
for(i = 1; i < ac; i++) {
|
||||||
|
AddStringToList (&argv, av[i], &argc);
|
||||||
|
}
|
||||||
run_bot_cmd(mod_usr, u, av, ac);
|
run_bot_cmd(mod_usr, u, av, ac);
|
||||||
|
free(argv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CLEAR_SEGV_INMODULE();
|
CLEAR_SEGV_INMODULE();
|
||||||
|
|
Reference in a new issue