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:
2012-03-17 05:11:23 +00:00
parent 70421b7bd1
commit e83fd91423
25 changed files with 444 additions and 183 deletions

View File

@@ -11,8 +11,10 @@
#ifndef headerfile_winix_core_pluginmsg
#define headerfile_winix_core_pluginmsg
// here you can add your own EZC functions ([function])
// PluginInfo.p1 is a pointer to Ezc::Functions object
// session pointer is null
#define WINIX_TEMPLATES_CREATEFUNCTIONS 999
// here you can add your own EZC functions to notify system
@@ -24,6 +26,7 @@
// Ezc::Functions<NotifyStream> ezc_functions;
// and Notify Stream is:
// typedef TextStream<std::wstring> NotifyStream;
// session pointer is null
#define WINIX_NOTIFY_TEMPLATES_CREATEFUNCTIONS 998
// winix function and parameters have been parsed
@@ -48,13 +51,22 @@
// here you should remove your session data
// this message can be sent even if you don't assing your plugin data
#define WINIX_SESSION_REMOVE 30010
#define WINIX_PLUGIN_SESSION_DATA_REMOVE 30010
// when a session is changed (you can save a pointer to your data here)
// 'session changed' means that there is a new request
// !! IMPROVE ME it has to be changed to a better name
#define WINIX_SESSION_CHANGED 30020
// a session has changed its id
// it is typically when you are logging in
// 'login' winix function will change the session id (for security reasons)
// in l1 you have the old id, in l2 you have the new id
#define WINIX_SESSION_CHANGED_ID 30025
// the winix is closing
// there is not any sessions available (cur->session is null)
// session pointer is null
#define WINIX_CLOSE 30040
// preparing to remove a file (rm function)
@@ -84,14 +96,17 @@
// winix is initialized,
// now you can initialize your plugin
// session pointer is null
#define WINIX_PLUGIN_INIT 30080
// here you can add your own mount point, file systems, mount parameters
// for adding a new mount type call: system->mounts.AddMountType("new_mount_name")
// session pointer is null
#define WINIX_ADD_MOUNTS 30090
// add plugin functions (winix functions) here
// call info.functions->Add() to add a function
// session pointer is null
#define WINIX_CREATE_FUNCTIONS 30100
// choose a default function
@@ -100,11 +115,13 @@
// /etc/fstab has been changed
// now we have new mount points
// session pointer is null
#define WINIX_FSTAB_CHANGED 30120
// here you add your own template to notification system
// call system->notify.AddTemplate() method
// with a template file name
// session pointer is null
#define WINIX_NOTIFY_ADD_TEMPLATE 30130
// the request is being ended
@@ -143,14 +160,16 @@
// a thumbnail was created
// this message is called from another thread
// the thread is called Lock() before sending this message
// the thread called Lock() before sending this message
// in p1 you have a pointer to the Item struct
// session pointer is null
#define WINIX_CREATED_THUMB 30500
// an image has been resized
// this message is called from another thread
// the thread is called Lock() before sending this message
// the thread called Lock() before sending this message
// in p1 you have a pointer to the Item struct
// session pointer is null
#define WINIX_IMAGE_RESIZED 30520
// content of a directory was sorted
@@ -165,6 +184,8 @@
// a WINIX_USER_LOGGED is sent
// in p1 you have a pointer to User struct
// (if at least one plugin returns false then the user will not be logged)
// this message is not sent when winix starts and sessions are read from a sessions file
// in such a case only WINIX_USER_LOGGED will be sent
#define WINIX_PREPARE_USER_TO_LOGIN 30550
// a user has been logged
@@ -175,6 +196,9 @@
// a user is going to logout
// in p1 you have a pointer to User struct
// the message is also sent from the session GC (special thread for deleting sessions)
// in such a case is sent with Lock() and Unlock()
// so *don't* use Lock() in your procedure
#define WINIX_PREPARE_USER_TO_LOGOUT 30610
// here you add your own html templates
@@ -185,6 +209,7 @@
// the message will be sent too whenever 'reload/templates' winix function is called
// templates you should add only in this message
// in other cases after 'reload' function the indexes would be wrong
// session pointer is null
#define WINIX_ADD_TEMPLATE 31000
// a user will be removed