start working on 0.7.x branch
- added FileLog which stores content to the file log - now Log is only a wrapper - it puts messages to the local buffer and when logsave is used then the buffer is put to FileLog - new base classes: WinixBase (Log, Config*, Synchro*) WinixModel : public WinixBase (morm::ModelConnector*, Plugin*) WinixSystem : public WinixModel (System*) WinixRequest : public WinixSystem (SLog, Cur*) - singletons: log, slog, plugin are depracated - now references to them are in base classses (WinixBase, WinixModel) - DbBase, DbConn and Db are depracated - now we are using Morm project (in WinixModel there is a model_connector pointer) each thread will have its own ModelConnector git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1146 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
#include "log.h"
|
||||
#include "session.h"
|
||||
#include "sessionparser.h"
|
||||
#include "plugin.h"
|
||||
#include "functions/functionbase.h"
|
||||
|
||||
|
||||
|
||||
@@ -96,6 +96,14 @@ void SessionManager::SetLastContainer(LastContainer * plast_container)
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::set_dependency(WinixModel * winix_model)
|
||||
{
|
||||
WinixModel::set_dependency(winix_model);
|
||||
session_tab.set_dependency(winix_model);
|
||||
session_id_manager.set_dependency(winix_model);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SessionManager::InitBanList()
|
||||
{
|
||||
@@ -554,7 +562,7 @@ void SessionManager::DeleteSessions()
|
||||
{
|
||||
if( i->puser && !i->remember_me )
|
||||
{
|
||||
plugin.Call(&(*i), WINIX_PREPARE_USER_TO_LOGOUT, i->puser);
|
||||
plugin->Call(&(*i), WINIX_PREPARE_USER_TO_LOGOUT, i->puser);
|
||||
last_container->UserLogout(i->puser->id, i->id);
|
||||
}
|
||||
}
|
||||
@@ -586,7 +594,7 @@ SessionContainer::Iterator i = session_tab.FindById(old_id);
|
||||
}
|
||||
|
||||
if( changed )
|
||||
plugin.Call(&(*i), WINIX_SESSION_CHANGED_ID, old_id, new_id);
|
||||
plugin->Call(&(*i), WINIX_SESSION_CHANGED_ID, old_id, new_id);
|
||||
else
|
||||
log << log1 << "SM: I cannot create a new session id (still uses old one)" << logend;
|
||||
}
|
||||
@@ -605,7 +613,7 @@ void SessionManager::InitTmpSession()
|
||||
|
||||
log << log4 << "SM: initializing temporary session" << logend;
|
||||
cur->session = &temporary_session;
|
||||
plugin.Call(WINIX_SESSION_CREATED);
|
||||
plugin->Call(WINIX_SESSION_CREATED);
|
||||
|
||||
cur->session = old_session;
|
||||
}
|
||||
@@ -618,7 +626,15 @@ void SessionManager::UninitTmpSession()
|
||||
|
||||
log << log4 << "SM: uninitializing temporary session" << logend;
|
||||
cur->session = &temporary_session;
|
||||
cur->session->plugin_data.DeleteAll(); // this will call plugin.Call(WINIX_PLUGIN_SESSION_DATA_REMOVE);
|
||||
|
||||
|
||||
if( cur->session->plugin_data.HasAllocatedData() )
|
||||
{
|
||||
plugin->Call(cur->session, WINIX_PLUGIN_SESSION_DATA_REMOVE);
|
||||
}
|
||||
|
||||
//cur->session->plugin_data.DeleteAll(); // this will call plugin.Call(WINIX_PLUGIN_SESSION_DATA_REMOVE);
|
||||
|
||||
cur->session->plugin_data.Resize(0);
|
||||
|
||||
cur->session = old_session;
|
||||
@@ -631,6 +647,8 @@ void SessionManager::LoadSessions()
|
||||
SessionParser sp;
|
||||
SessionContainer::Iterator i;
|
||||
|
||||
sp.set_dependency(this);
|
||||
|
||||
// sessions will be overwritten (pointers are invalidated)
|
||||
cur->session = &temporary_session;
|
||||
|
||||
@@ -639,8 +657,8 @@ SessionContainer::Iterator i;
|
||||
|
||||
for(i=session_tab.Begin() ; i != session_tab.End() ; ++i)
|
||||
{
|
||||
i->plugin_data.Resize(plugin.Size());
|
||||
plugin.Call(&(*i), WINIX_SESSION_CREATED);
|
||||
i->plugin_data.Resize(plugin->Size());
|
||||
plugin->Call(&(*i), WINIX_SESSION_CREATED);
|
||||
|
||||
/*
|
||||
!! IMPROVE ME
|
||||
@@ -648,7 +666,7 @@ SessionContainer::Iterator i;
|
||||
*/
|
||||
|
||||
if( i->puser )
|
||||
plugin.Call(&(*i), WINIX_USER_LOGGED);
|
||||
plugin->Call(&(*i), WINIX_USER_LOGGED);
|
||||
}
|
||||
|
||||
cur->session = &temporary_session;
|
||||
@@ -724,7 +742,7 @@ size_t SessionManager::MarkAllSessionsToRemove(long user_id)
|
||||
{
|
||||
if( i->puser && i->puser->id == user_id )
|
||||
{
|
||||
plugin.Call(&(*i), WINIX_PREPARE_USER_TO_LOGOUT, i->puser);
|
||||
plugin->Call(&(*i), WINIX_PREPARE_USER_TO_LOGOUT, i->puser);
|
||||
last_container->UserLogout(i->puser->id, i->id);
|
||||
i->remove_me = true;
|
||||
i->puser = 0;
|
||||
@@ -883,16 +901,16 @@ void SessionManager::DeleteSession(Session * del_session)
|
||||
{
|
||||
if( del_session->puser )
|
||||
{
|
||||
plugin.Call(del_session, WINIX_PREPARE_USER_TO_LOGOUT, del_session->puser);
|
||||
plugin->Call(del_session, WINIX_PREPARE_USER_TO_LOGOUT, del_session->puser);
|
||||
last_container->UserLogout(del_session->puser->id, del_session->id);
|
||||
del_session->puser = 0;
|
||||
}
|
||||
|
||||
long id = del_session->id;
|
||||
|
||||
plugin.Call(del_session, WINIX_PREPARE_SESSION_TO_REMOVE);
|
||||
plugin->Call(del_session, WINIX_PREPARE_SESSION_TO_REMOVE);
|
||||
session_tab.EraseById(del_session->id);
|
||||
plugin.Call((Session*)0, WINIX_SESSION_REMOVED, id);
|
||||
plugin->Call((Session*)0, WINIX_SESSION_REMOVED, id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user