summaryrefslogtreecommitdiff
path: root/server/src/session.cc
diff options
context:
space:
mode:
authordeva <deva>2011-01-28 08:50:42 +0000
committerdeva <deva>2011-01-28 08:50:42 +0000
commit775d9c9c11f3906766c0dc7070eb7ef01606ef96 (patch)
tree7b957553d2778a4350d73f460997186e2484f5ca /server/src/session.cc
parent7917d099f34acda6c4c90bca28710a7bd67800e9 (diff)
New cross client system.
Diffstat (limited to 'server/src/session.cc')
-rw-r--r--server/src/session.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/server/src/session.cc b/server/src/session.cc
index 612f264..58249af 100644
--- a/server/src/session.cc
+++ b/server/src/session.cc
@@ -44,10 +44,14 @@
#include "connectionpool.h"
#include "sessionserialiser.h"
-Session::Session(std::string sessionid)
+Session::Session(std::string sessionid, std::string pid, std::string t)
{
_journal = NULL;
_database = NULL;
+
+ patientid = pid;
+ templ = t;
+
database()->setSessionId(sessionid);
}
@@ -141,9 +145,18 @@ static bool fexists(const std::string &f)
return ret;
}
-Session *Sessions::newSession()
+Session *Sessions::newSession(std::string patientid, std::string templ)
{
- Session *session = new Session();
+ std::map<std::string, Session *>::iterator i = sessions.begin();
+ while(i != sessions.end()) {
+ if(i->second->patientid == patientid &&
+ i->second->templ == templ) {
+ return i->second;
+ }
+ i++;
+ }
+
+ Session *session = new Session("", patientid, templ);
sessions[session->id()] = session;
return session;
}