void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args) { LLUIString message; // null session id means near me (chat history) if (session_id.isNull()) { message = LLTrans::getString(message_name); message.setArgs(args); LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::getInstance()->addChatHistory(chat); } else // going to IM session { message = LLTrans::getString(message_name + "-im"); message.setArgs(args); if (hasSession(session_id)) { gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString()); } } }
AbstractSession& BaseSessionStore::getSession(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response) { // Get the cookies from the client. Poco::Net::NameValueCollection cookies; // Get the cookies request.getCookies(cookies); // Try to find a cookie with our session key name. Poco::Net::NameValueCollection::ConstIterator cookieIter = cookies.begin(); std::string sessionId; while (cookieIter != cookies.end()) { if (0 == cookieIter->first.compare(_sessionKeyName)) { if (sessionId.empty()) { sessionId = cookieIter->second; } else { Poco::Net::HTTPCookie cookie(_sessionKeyName); cookie.setMaxAge(0); // Invalidate the cookie. response.addCookie(cookie); } } ++cookieIter; } if (hasSession(sessionId)) { return getSession(sessionId); } else { // Create a new sesssion and return a reference. AbstractSession& session = createSession(); // Create a cookie with the session id. Poco::Net::HTTPCookie cookie(_sessionKeyName, session.getId()); // Send our cookie with the response. response.addCookie(cookie); return session; } }