Fix auto-away time strangeness when server reconnection happens.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@94 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -79,7 +79,7 @@ extern LastMsg last_sent_ctcp[2];
|
||||
void clear_array (NickTab **, char *);
|
||||
char *BX_random_str (int, int);
|
||||
int check_serverlag (void);
|
||||
void auto_away (unsigned long);
|
||||
void check_auto_away (time_t);
|
||||
ChannelList * BX_prepare_command (int *, char *, int);
|
||||
int rename_file (char *, char **);
|
||||
void putlog (int, ...);
|
||||
|
||||
@@ -328,15 +328,14 @@ char *BX_update_clock(int flag)
|
||||
do_hook(TIMER_LIST, "%02d:%02d", hour, min);
|
||||
if (min == 0 || new_hour)
|
||||
do_hook(TIMER_HOUR_LIST, "%02d:%02d", hour, min);
|
||||
idlet = (hideous - idle_time) / 60L;
|
||||
idlet = hideous - idle_time;
|
||||
if (from_server != -1)
|
||||
is_away = get_server_away(from_server) ? 1 : 0;
|
||||
if (do_hook(IDLE_LIST, "%lu", (unsigned long)idlet))
|
||||
if (do_hook(IDLE_LIST, "%lu", (unsigned long)idlet / 60))
|
||||
{
|
||||
if (is_away && new_hour && get_int_var(TIMESTAMP_AWAYLOG_HOURLY_VAR))
|
||||
logmsg(LOG_CRAP, NULL, 4, NULL);
|
||||
if (!is_away && get_int_var(AUTO_AWAY_TIME_VAR) && (idlet >= get_int_var(AUTO_AWAY_TIME_VAR)/60))
|
||||
auto_away(idlet);
|
||||
check_auto_away(idlet);
|
||||
}
|
||||
check_channel_limits();
|
||||
}
|
||||
|
||||
@@ -1184,24 +1184,26 @@ char *BX_random_str(int min, int max)
|
||||
}
|
||||
|
||||
|
||||
void auto_away(unsigned long idle_mins)
|
||||
void check_auto_away(time_t idlet)
|
||||
{
|
||||
int i;
|
||||
char *msg = NULL;
|
||||
|
||||
if (!get_int_var(AUTO_AWAY_VAR))
|
||||
int auto_away_time = get_int_var(AUTO_AWAY_TIME_VAR);
|
||||
int idle_mins = auto_away_time / 60;
|
||||
|
||||
if (!auto_away_time || !get_int_var(AUTO_AWAY_VAR) || idlet < auto_away_time)
|
||||
return;
|
||||
|
||||
if (awaymsg)
|
||||
malloc_sprintf(&msg, "%s: [%lu mins]", convert_output_format(awaymsg, NULL), idle_mins);
|
||||
malloc_sprintf(&msg, "%s: [%d mins]", convert_output_format(awaymsg, NULL), idle_mins);
|
||||
else
|
||||
malloc_sprintf(&msg, "Auto-Away after %lu mins", idle_mins);
|
||||
malloc_sprintf(&msg, "Auto-Away after %d mins", idle_mins);
|
||||
|
||||
for (i = 0; i < server_list_size(); i++)
|
||||
if (is_server_connected(i) && !get_server_away(i))
|
||||
set_server_away(i, msg, 0);
|
||||
|
||||
update_all_status(current_window, NULL, 0);
|
||||
update_all_status(current_window, NULL, 0);
|
||||
new_free(&msg);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user