From 775d9c9c11f3906766c0dc7070eb7ef01606ef96 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 28 Jan 2011 08:50:42 +0000 Subject: New cross client system. --- server/src/session.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'server/src/session.cc') 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::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; } -- cgit v1.2.3