Commit e3f7496d authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(leave_conf): Use current_time instead of calling time().

(login_old): Likewise.
(login): Likewise.
(logout): Likewise.
(who_is_on_dynamic): Likewise.
(get_session_info): Likewise.
(get_session_info_ident): Likewise.
(get_time): Likewise.
(user_active): Likewise.
parent 573cc962
/*
* $Id: session.c,v 0.45 1999/05/12 13:25:33 byers Exp $
* $Id: session.c,v 0.46 1999/05/16 21:46:57 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -34,7 +34,7 @@
#endif
static const char *
rcsid = "$Id: session.c,v 0.45 1999/05/12 13:25:33 byers Exp $";
rcsid = "$Id: session.c,v 0.46 1999/05/16 21:46:57 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -65,6 +65,7 @@ USE(rcsid);
#include "param.h"
#include "kom-memory.h"
#include "string-malloc.h"
#include "server-time.h"
/*
* Create an oldstyle username, user%host.domain@host.domain.
......@@ -100,7 +101,7 @@ leave_conf(void)
if ((mship = locate_membership( active_connection->cwc, ACT_P ))
!= NULL )
{
time(&mship->last_time_read);
mship->last_time_read = current_time;
mark_person_as_changed (active_connection->pers_no);
}
else
......@@ -153,7 +154,7 @@ login_old (Pers_no pers_no,
cached_lock_person(pers_no);
pers_p->last_login = time(&active_connection->session_start);
pers_p->last_login = active_connection->session_start = current_time;
++pers_p->sessions;
s_strcpy(&pers_p->username, active_connection->username);
......@@ -249,7 +250,7 @@ login (Pers_no pers_no,
cached_lock_person(pers_no);
pers_p->last_login = time(&active_connection->session_start);
pers_p->last_login = active_connection->session_start = current_time;
s_strcpy(&pers_p->username, active_connection->username);
......@@ -309,9 +310,9 @@ logout( void )
}
leave_conf();
ACT_P->last_login = current_time;
ACT_P->total_time_present +=
ldifftime(time(&ACT_P->last_login),
active_connection->session_start);
ldifftime(current_time, active_connection->session_start);
cached_unlock_person( ACTPERS );
mark_person_as_changed( ACTPERS );
......@@ -561,9 +562,7 @@ who_is_on_dynamic(int want_visible,
long i;
Session_no session;
int include_it = 0;
time_t tn;
tn = time(NULL);
cptr = active_connection;
......@@ -577,7 +576,8 @@ who_is_on_dynamic(int want_visible,
else
include_it = want_visible;
if (active_last != 0 && ldifftime(tn, cptr->active_time) > active_last
if (active_last != 0
&& ldifftime(current_time, cptr->active_time) > active_last
&& cptr->flags.user_active_used)
include_it = 0;
......@@ -601,7 +601,8 @@ who_is_on_dynamic(int want_visible,
else
include_it = want_visible;
if (active_last != 0 && ldifftime(tn, cptr->active_time) > active_last
if (active_last != 0
&& ldifftime(current_time, cptr->active_time) > active_last
&& cptr->flags.user_active_used)
include_it = 0;
......@@ -611,7 +612,8 @@ who_is_on_dynamic(int want_visible,
result->sessions[i].session = cptr->session_no;
result->sessions[i].person = cptr->pers_no;
result->sessions[i].working_conference = cptr->cwc;
result->sessions[i].idle_time = ldifftime(tn, cptr->active_time);
result->sessions[i].idle_time = ldifftime(current_time,
cptr->active_time);
result->sessions[i].flags = cptr->flags;
......@@ -653,7 +655,7 @@ get_session_info (Session_no session_no,
result->working_conference = cptr->cwc;
result->session = cptr->session_no;
result->connection_time = cptr->session_start;
result->idle_time = ldifftime(time(NULL), cptr->active_time);
result->idle_time = ldifftime(current_time, cptr->active_time);
/* Backward compatibility. result->username is free()d in
prot_a_reply() prot-a.c. */
......@@ -716,7 +718,7 @@ get_session_info_ident (Session_no session_no,
result->working_conference = cptr->cwc;
result->session = cptr->session_no;
result->connection_time = cptr->session_start;
result->idle_time = ldifftime(time(NULL), cptr->active_time);
result->idle_time = ldifftime(current_time, cptr->active_time);
result->username = cptr->username;
result->hostname = cptr->hostname;
result->ident_user = cptr->ident_user;
......@@ -831,7 +833,7 @@ who_is_on_old( Who_info_list_old *result )
extern Success
get_time( time_t *clk )
{
time(clk);
*clk = current_time;
return OK;
}
......@@ -1026,7 +1028,7 @@ query_async(Number_list *result)
extern Success
user_active(void)
{
time(&active_connection->active_time);
active_connection->active_time = current_time;
active_connection->flags.user_active_used = TRUE;
return OK;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment