rewritten: sessions management
(Session, SessionContainer, SessionManager) now a Session object don't copy all fields in its copy constructor (only id) the rest fields are set after the object is inserted in SessionContainer added: after successfully login a session id is changed added: plugin.Call() methods with a first argument a pointer to a Session object git-svn-id: svn://ttmath.org/publicrep/winix/trunk@823 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -17,9 +17,34 @@ Session::Session()
|
||||
{
|
||||
SetTimeToNow();
|
||||
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::SetTimeToNow()
|
||||
{
|
||||
time = std::time(0);
|
||||
@@ -34,10 +59,9 @@ void Session::SetTimeToNow()
|
||||
|
||||
|
||||
// this doesn't clear times
|
||||
void Session::Clear()
|
||||
void Session::Clear(bool clear_plugin_data)
|
||||
{
|
||||
id = 0;
|
||||
time = 0;
|
||||
puser = 0;
|
||||
rebus_item = 0;
|
||||
rebus_checked = false;
|
||||
@@ -45,7 +69,9 @@ void Session::Clear()
|
||||
new_session = true;
|
||||
spam_score = 0;
|
||||
remove_me = false;
|
||||
plugin_data.Resize(0);
|
||||
|
||||
if( clear_plugin_data )
|
||||
plugin_data.Resize(0);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user