WebSession::Ptr WebSessionManager::create(const std::string& appName, const Poco::Net::HTTPServerRequest& request, int expireSeconds, BundleContext::Ptr pContext) { FastMutex::ScopedLock lock(_mutex); WebSession::Ptr pSession(new WebSession(createSessionId(request), expireSeconds, request.clientAddress().host(), pContext)); _cache.add(pSession->id(), pSession); addCookie(appName, request, pSession); pSession->setValue(WebSession::CSRF_TOKEN, createSessionId(request)); return pSession; }
/** * Initiates a shared session with a user or conference room. * * \param to The recipient to which this desktop will be linked, specified as a JID. * \param type Type of the session; i.e. private message or group chat. */ void SessionManager::initialiseSession(Glib::ustring const& to, State::SessionType type) { SPDocument* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", type, to); InkboardDocument* inkdoc = dynamic_cast< InkboardDocument* >(doc->rdoc); if(inkdoc == NULL) return; if(type == State::WHITEBOARD_PEER) { ChooseDesktop dialog; int result = dialog.run(); if(result == Gtk::RESPONSE_OK) { SPDesktop *desktop = dialog.getDesktop(); if(desktop != NULL) { Inkscape::XML::Document *old_doc = sp_desktop_document(desktop)->rdoc; inkdoc->root()->mergeFrom(old_doc->root(),"id"); } }else { return; } } char * sessionId = createSessionId(10); inkdoc->setSessionId(sessionId); makeInkboardDesktop(doc); addSession(WhiteboardRecord(sessionId, inkdoc)); inkdoc->startSessionNegotiation(); }