Simplify addidle() a little
This commit is contained in:
@@ -318,7 +318,6 @@ char *channel = NULL, *p;
|
||||
time_t seconds = 0;
|
||||
ChannelList *tmp, *new = NULL;
|
||||
|
||||
|
||||
if ((p = next_arg(args, &args)))
|
||||
{
|
||||
malloc_strcpy(&channel, make_channel(p));
|
||||
@@ -339,24 +338,22 @@ ChannelList *tmp, *new = NULL;
|
||||
new->max_idle = seconds;
|
||||
new->check_idle = (my_strnicmp(command, "UN", 2) == 0) ? 0: 1;
|
||||
|
||||
tmp = lookup_channel(channel, from_server, CHAN_NOUNLINK);
|
||||
if (!new->check_idle)
|
||||
{
|
||||
bitchsay("Idle checking turned %s for %s", on_off(new->check_idle), channel);
|
||||
if ((tmp = lookup_channel(channel, from_server, CHAN_NOUNLINK)))
|
||||
if (tmp)
|
||||
tmp->check_idle = tmp->max_idle = 0;
|
||||
new->max_idle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((tmp = lookup_channel(channel, from_server, CHAN_NOUNLINK)))
|
||||
{
|
||||
if (new && new->check_idle)
|
||||
bitchsay("Idle checking turned %s for %s %d mins", on_off(tmp->check_idle), channel, (int)(tmp->max_idle/60));
|
||||
if (tmp)
|
||||
{
|
||||
tmp->max_idle = new->max_idle;
|
||||
tmp->check_idle = new->check_idle;
|
||||
add_timer(0, empty_string, get_int_var(IDLE_CHECK_VAR) * 1000, 1, timer_idlekick, channel, NULL, current_window->refnum, "idle-check");
|
||||
bitchsay("Idle checking turned %s for %s %d mins",on_off(tmp->check_idle), channel, (int)(tmp->max_idle/60));
|
||||
}
|
||||
}
|
||||
}
|
||||
new_free(&channel);
|
||||
|
||||
Reference in New Issue
Block a user