Fix the $timer() scripting function.
This function never worked - function_timer() was creating a string but then never throwing it away and returning a part of the argument instead, which then caused a crash because it couldn't be freed later in the expression parsing. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@472 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2c01]
|
[Changes 1.2c01]
|
||||||
|
|
||||||
|
* Fix the $timer() scripting function. (caf)
|
||||||
|
|
||||||
* Fix the /TKB (timed kickban) command. (caf)
|
* Fix the /TKB (timed kickban) command. (caf)
|
||||||
|
|
||||||
* Rewrite termcap/terminfo detection logic in configure and include term.h
|
* Rewrite termcap/terminfo detection logic in configure and include term.h
|
||||||
|
|||||||
@@ -454,24 +454,26 @@ static TimerList *get_timer (char *ref)
|
|||||||
|
|
||||||
char *function_timer(char *n, char *args)
|
char *function_timer(char *n, char *args)
|
||||||
{
|
{
|
||||||
char *ref;
|
char *ref = next_arg(args, &args);
|
||||||
char *out = NULL;
|
TimerList *t = NULL;
|
||||||
TimerList *tmp;
|
double time_left;
|
||||||
ref = next_arg(args, &args);
|
struct timeval current;
|
||||||
if (ref && *ref && (tmp = get_timer(ref)))
|
|
||||||
{
|
if (ref && *ref)
|
||||||
double time_left;
|
t = get_timer(ref);
|
||||||
struct timeval current;
|
|
||||||
char buf[40];
|
if (!t)
|
||||||
get_time(¤t);
|
return m_strdup(empty_string);
|
||||||
time_left = BX_time_diff(current, tmp->time);
|
|
||||||
if (time_left < 0)
|
get_time(¤t);
|
||||||
time_left = 0.0;
|
time_left = BX_time_diff(current, t->time);
|
||||||
snprintf(buf, sizeof buf, "%0.3f", time_left);
|
if (time_left < 0)
|
||||||
malloc_sprintf(&out, "%s %d %d %d %d %s %s %s", tmp->ref, tmp->server, tmp->window, tmp->interval, tmp->events, buf, tmp->callback? "(internal callback)" : (tmp->command? tmp->command : ""), tmp->whom ? tmp->whom : empty_string );
|
time_left = 0.0;
|
||||||
return ref;
|
|
||||||
}
|
return m_sprintf("%s %d %d %ld %d %0.3f %s%s", t->ref, t->server,
|
||||||
return m_strdup(empty_string);
|
t->window, (long)t->interval, t->events, time_left,
|
||||||
|
t->callback ? "(internal callback) " : t->command,
|
||||||
|
t->whom ? t->whom : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user