diff options
Diffstat (limited to 'server/src/session.cc')
-rw-r--r-- | server/src/session.cc | 19 |
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; } |