winix/core/session.cpp

88 lines
1.2 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "session.h"
#include "misc.h"
Session::Session()
{
Clear();
plugin_data.SetSession(this);
}
Session::Session(const Session & ses)
{
operator=(ses);
}
Session & Session::operator=(const Session & ses)
{
/*
we can only copy ses.id because it is needen in SessionContainer
it have indexes to id
*/
Clear();
id = ses.id;
plugin_data.SetSession(this);
return *this;
}
void Session::SetTimesTo(time_t time)
{
start_time = time;
start_date = time;
last_time = start_time;
last_date = start_date;
// the first request can be a POST (it doesn't matter)
last_time_get = start_time;
}
// clear_plugin_data is used when clearing the temporary session
void Session::Clear(bool clear_plugin_data)
{
id = 0;
puser = 0;
rebus_item = 0;
rebus_checked = false;
remember_me = false;
new_session = true;
spam_score = 0;
remove_me = false;
start_time = 0;
last_time = 0;
last_time_get = 0;
start_date.Clear();
last_date.Clear();
tz_add = 0;
log_buffer.Clear();
last_css.clear();
if( clear_plugin_data )
plugin_data.Resize(0);
}