diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmessage/llinstantmessage.cpp | 208 | ||||
-rw-r--r-- | indra/llmessage/llinstantmessage.h | 53 | ||||
-rw-r--r-- | indra/newview/llfloaterimsession.cpp | 25 | ||||
-rw-r--r-- | indra/newview/llfloaterimsession.h | 8 | ||||
-rw-r--r-- | indra/newview/llimprocessing.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llimview.h | 6 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 4 |
8 files changed, 30 insertions, 324 deletions
diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index b7f3e6e4f7..dd5a655d7e 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -51,98 +51,6 @@ const std::string INTERACTIVE_SYSTEM_FROM("F387446C-37C4-45f2-A438-D99CBDBB563B" const S32 IM_TTL = 1; -/** - * LLIMInfo - */ -LLIMInfo::LLIMInfo() : - mFromGroup(FALSE), - mParentEstateID(0), - mOffline(0), - mViewerThinksToIsOnline(false), - mIMType(IM_NOTHING_SPECIAL), - mTimeStamp(0), - mTTL(IM_TTL) -{ -} - -LLIMInfo::LLIMInfo( - const LLUUID& from_id, - BOOL from_group, - const LLUUID& to_id, - EInstantMessage im_type, - const std::string& name, - const std::string& message, - const LLUUID& id, - U32 parent_estate_id, - const LLUUID& region_id, - const LLVector3& position, - LLSD data, - U8 offline, - U32 timestamp, - S32 ttl) : - mFromID(from_id), - mFromGroup(from_group), - mToID(to_id), - mParentEstateID(0), - mRegionID(region_id), - mPosition(position), - mOffline(offline), - mViewerThinksToIsOnline(false), - mIMType(im_type), - mID(id), - mTimeStamp(timestamp), - mName(name), - mMessage(message), - mData(data), - mTTL(ttl) -{ -} - -LLIMInfo::LLIMInfo(LLMessageSystem* msg, S32 ttl) : - mViewerThinksToIsOnline(false), - mTTL(ttl) -{ - unpackMessageBlock(msg); -} - -LLIMInfo::~LLIMInfo() -{ -} - -void LLIMInfo::packInstantMessage(LLMessageSystem* msg) const -{ - LL_DEBUGS() << "LLIMInfo::packInstantMessage()" << LL_ENDL; - msg->newMessageFast(_PREHASH_ImprovedInstantMessage); - packMessageBlock(msg); -} - -void LLIMInfo::packMessageBlock(LLMessageSystem* msg) const -{ - // Construct binary bucket - std::vector<U8> bucket; - if (mData.has("binary_bucket")) - { - bucket = mData["binary_bucket"].asBinary(); - } - pack_instant_message_block( - msg, - mFromID, - mFromGroup, - LLUUID::null, - mToID, - mName, - mMessage, - mOffline, - mIMType, - mID, - mParentEstateID, - mRegionID, - mPosition, - mTimeStamp, - &bucket[0], - bucket.size()); -} - void pack_instant_message( LLMessageSystem* msg, const LLUUID& from_id, @@ -253,120 +161,4 @@ void pack_instant_message_block( msg->addBinaryDataFast(_PREHASH_BinaryBucket, bb, binary_bucket_size); } -void LLIMInfo::unpackMessageBlock(LLMessageSystem* msg) -{ - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, mFromID); - msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, mFromGroup); - msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ToAgentID, mToID); - msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, mParentEstateID); - msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, mRegionID); - msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, mPosition); - msg->getU8Fast(_PREHASH_MessageBlock, _PREHASH_Offline, mOffline); - U8 dialog; - msg->getU8Fast(_PREHASH_MessageBlock, _PREHASH_Dialog, dialog); - mIMType = (EInstantMessage) dialog; - msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, mID); - msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, mTimeStamp); - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, mName); - - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, mMessage); - - S32 binary_bucket_size = llmin( - MTUBYTES, - msg->getSizeFast( - _PREHASH_MessageBlock, - _PREHASH_BinaryBucket)); - if(binary_bucket_size > 0) - { - std::vector<U8> bucket; - bucket.resize(binary_bucket_size); - - msg->getBinaryDataFast( - _PREHASH_MessageBlock, - _PREHASH_BinaryBucket, - &bucket[0], - 0, - 0, - binary_bucket_size); - mData["binary_bucket"] = bucket; - } - else - { - mData.clear(); - } -} - -LLSD im_info_to_llsd(LLPointer<LLIMInfo> im_info) -{ - LLSD param_version; - param_version["version"] = 1; - LLSD param_message; - param_message["from_id"] = im_info->mFromID; - param_message["from_group"] = im_info->mFromGroup; - param_message["to_id"] = im_info->mToID; - param_message["from_name"] = im_info->mName; - param_message["message"] = im_info->mMessage; - param_message["type"] = (S32)im_info->mIMType; - param_message["id"] = im_info->mID; - param_message["timestamp"] = (S32)im_info->mTimeStamp; - param_message["offline"] = (S32)im_info->mOffline; - param_message["parent_estate_id"] = (S32)im_info->mParentEstateID; - param_message["region_id"] = im_info->mRegionID; - param_message["position"] = ll_sd_from_vector3(im_info->mPosition); - param_message["data"] = im_info->mData; - param_message["ttl"] = im_info->mTTL; - - LLSD param_agent; - param_agent["agent_id"] = im_info->mFromID; - - LLSD params; - params["version_params"] = param_version; - params["message_params"] = param_message; - params["agent_params"] = param_agent; - - return params; -} - -LLPointer<LLIMInfo> llsd_to_im_info(const LLSD& im_info_sd) -{ - LLSD param_message = im_info_sd["message_params"]; - LLSD param_agent = im_info_sd["agent_params"]; - - LLPointer<LLIMInfo> im_info = new LLIMInfo( - param_message["from_id"].asUUID(), - param_message["from_group"].asBoolean(), - param_message["to_id"].asUUID(), - (EInstantMessage) param_message["type"].asInteger(), - param_message["from_name"].asString(), - param_message["message"].asString(), - param_message["id"].asUUID(), - (U32) param_message["parent_estate_id"].asInteger(), - param_message["region_id"].asUUID(), - ll_vector3_from_sd(param_message["position"]), - param_message["data"], - (U8) param_message["offline"].asInteger(), - (U32) param_message["timestamp"].asInteger(), - param_message["ttl"].asInteger()); - - return im_info; -} - -LLPointer<LLIMInfo> LLIMInfo::clone() -{ - return new LLIMInfo( - mFromID, - mFromGroup, - mToID, - mIMType, - mName, - mMessage, - mID, - mParentEstateID, - mRegionID, - mPosition, - mData, - mOffline, - mTimeStamp, - mTTL); -} diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h index f7118f8ccf..55cda15405 100644 --- a/indra/llmessage/llinstantmessage.h +++ b/indra/llmessage/llinstantmessage.h @@ -177,59 +177,6 @@ extern const std::string INTERACTIVE_SYSTEM_FROM; // Number of retry attempts on sending the im. extern const S32 IM_TTL; - -class LLIMInfo : public LLRefCount -{ -protected: - LLIMInfo(); - ~LLIMInfo(); - -public: - LLIMInfo(LLMessageSystem* msg, - S32 ttl = IM_TTL); - - LLIMInfo( - const LLUUID& from_id, - BOOL from_group, - const LLUUID& to_id, - EInstantMessage im_type, - const std::string& name, - const std::string& message, - const LLUUID& id, - U32 parent_estate_id, - const LLUUID& region_id, - const LLVector3& position, - LLSD data, - U8 offline, - U32 timestamp, - S32 ttl = IM_TTL); - - void packInstantMessage(LLMessageSystem* msg) const; - void packMessageBlock(LLMessageSystem* msg) const; - void unpackMessageBlock(LLMessageSystem* msg); - LLPointer<LLIMInfo> clone(); -public: - LLUUID mFromID; - BOOL mFromGroup; - LLUUID mToID; - U32 mParentEstateID; - LLUUID mRegionID; - LLVector3 mPosition; - U8 mOffline; - bool mViewerThinksToIsOnline; - EInstantMessage mIMType; - LLUUID mID; - U32 mTimeStamp; - std::string mName; - std::string mMessage; - LLSD mData; - - S32 mTTL; -}; - -LLPointer<LLIMInfo> llsd_to_im_info(const LLSD& im_info_sd); -LLSD im_info_to_llsd(LLPointer<LLIMInfo> im_info); - void pack_instant_message( LLMessageSystem* msgsystem, const LLUUID& from_id, diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 6623ce0f80..a4ab1af9a8 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -82,8 +82,7 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id) mPositioned(false), mSessionInitialized(false), mMeTypingTimer(), - mOtherTypingTimer(), - mImInfo() + mOtherTypingTimer() { mIsNearbyChat = false; @@ -125,7 +124,7 @@ void LLFloaterIMSession::refresh() if (mOtherTyping && mOtherTypingTimer.getElapsedTimeF32() > OTHER_TYPING_TIMEOUT) { LL_DEBUGS("TypingMsgs") << "Received: is typing cleared due to timeout" << LL_ENDL; - removeTypingIndicator(mImInfo); + removeTypingIndicator(mImFromId); mOtherTyping = false; } @@ -1006,19 +1005,19 @@ void LLFloaterIMSession::setTyping(bool typing) } } -void LLFloaterIMSession::processIMTyping(const LLIMInfo* im_info, BOOL typing) +void LLFloaterIMSession::processIMTyping(const LLUUID& from_id, BOOL typing) { LL_DEBUGS("TypingMsgs") << "typing=" << typing << LL_ENDL; if ( typing ) { // other user started typing - addTypingIndicator(im_info); + addTypingIndicator(from_id); mOtherTypingTimer.reset(); } else { // other user stopped typing - removeTypingIndicator(im_info); + removeTypingIndicator(from_id); } } @@ -1218,7 +1217,7 @@ BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) return is_region_exist; } -void LLFloaterIMSession::addTypingIndicator(const LLIMInfo* im_info) +void LLFloaterIMSession::addTypingIndicator(const LLUUID& from_id) { /* Operation of "<name> is typing" state machine: Not Typing state: @@ -1248,35 +1247,35 @@ Note: OTHER_TYPING_TIMEOUT must be > ME_TYPING_TIMEOUT for proper operation of t */ // We may have lost a "stop-typing" packet, don't add it twice - if (im_info && !mOtherTyping) + if (from_id.notNull() && !mOtherTyping) { mOtherTyping = true; mOtherTypingTimer.reset(); // Save im_info so that removeTypingIndicator can be properly called because a timeout has occurred - mImInfo = im_info; + mImFromId = from_id; // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if ( speaker_mgr ) { - speaker_mgr->setSpeakerTyping(im_info->mFromID, TRUE); + speaker_mgr->setSpeakerTyping(from_id, TRUE); } } } -void LLFloaterIMSession::removeTypingIndicator(const LLIMInfo* im_info) +void LLFloaterIMSession::removeTypingIndicator(const LLUUID& from_id) { if (mOtherTyping) { mOtherTyping = false; - if (im_info) + if (from_id.notNull()) { // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if (speaker_mgr) { - speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); + speaker_mgr->setSpeakerTyping(from_id, FALSE); } } } diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index 0f7164a585..28464fc14b 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -122,7 +122,7 @@ public: const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state); - void processIMTyping(const LLIMInfo* im_info, BOOL typing); + void processIMTyping(const LLUUID& from_id, BOOL typing); void processAgentListUpdates(const LLSD& body); void processSessionUpdate(const LLSD& session_update); @@ -165,10 +165,10 @@ private: void boundVoiceChannel(); // Add the "User is typing..." indicator. - void addTypingIndicator(const LLIMInfo* im_info); + void addTypingIndicator(const LLUUID& from_id); // Remove the "User is typing..." indicator. - void removeTypingIndicator(const LLIMInfo* im_info = NULL); + void removeTypingIndicator(const LLUUID& from_id = LLUUID::null); static void closeHiddenIMToasts(); @@ -199,7 +199,7 @@ private: // connection to voice channel state change signal boost::signals2::connection mVoiceChannelStateChangeConnection; - const LLIMInfo* mImInfo; + LLUUID mImFromId; }; #endif // LL_FLOATERIMSESSION_H diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index da0c218f9f..9a11680d42 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -593,45 +593,13 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, case IM_TYPING_START: { - std::vector<U8> bucket(binary_bucket[0], binary_bucket_size); - LLSD data; - data["binary_bucket"] = bucket; - LLPointer<LLIMInfo> im_info = new LLIMInfo(from_id, - from_group, - to_id, - dialog, - agentName, - message, - session_id, - parent_estate_id, - region_id, - position, - data, - offline, - timestamp); - gIMMgr->processIMTypingStart(im_info); + gIMMgr->processIMTypingStart(from_id, dialog); } break; case IM_TYPING_STOP: { - std::vector<U8> bucket(binary_bucket[0], binary_bucket_size); - LLSD data; - data["binary_bucket"] = bucket; - LLPointer<LLIMInfo> im_info = new LLIMInfo(from_id, - from_group, - to_id, - dialog, - agentName, - message, - session_id, - parent_estate_id, - region_id, - position, - data, - offline, - timestamp); - gIMMgr->processIMTypingStop(im_info); + gIMMgr->processIMTypingStop(from_id, dialog); } break; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index d62b6300cb..0f5d514660 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -3432,23 +3432,23 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, } } -void LLIMMgr::processIMTypingStart(const LLIMInfo* im_info) +void LLIMMgr::processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type) { - processIMTypingCore(im_info, TRUE); + processIMTypingCore(from_id, im_type, TRUE); } -void LLIMMgr::processIMTypingStop(const LLIMInfo* im_info) +void LLIMMgr::processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type) { - processIMTypingCore(im_info, FALSE); + processIMTypingCore(from_id, im_type, FALSE); } -void LLIMMgr::processIMTypingCore(const LLIMInfo* im_info, BOOL typing) +void LLIMMgr::processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing) { - LLUUID session_id = computeSessionID(im_info->mIMType, im_info->mFromID); + LLUUID session_id = computeSessionID(im_type, from_id); LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id); if ( im_floater ) { - im_floater->processIMTyping(im_info, typing); + im_floater->processIMTyping(from_id, typing); } } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index e3851a56e0..81d3ffa1a6 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -391,8 +391,8 @@ public: const std::string& session_handle = LLStringUtil::null, const std::string& session_uri = LLStringUtil::null); - void processIMTypingStart(const LLIMInfo* im_info); - void processIMTypingStop(const LLIMInfo* im_info); + void processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type); + void processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type); // automatically start a call once the session has initialized void autoStartCallOnStartup(const LLUUID& session_id); @@ -471,7 +471,7 @@ private: void noteOfflineUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids); void noteMutedUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids); - void processIMTypingCore(const LLIMInfo* im_info, BOOL typing); + void processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing); static void onInviteNameLookup(LLSD payload, const LLUUID& id, const LLAvatarName& name); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 838de48308..da4b6a5008 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -3997,13 +3997,13 @@ void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, st { // Other end started typing // TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart(). - // It requires an LLIMInfo for the message, which we don't have here. + // It requires some info for the message, which we don't have here. } else if (!stricmp(notificationType.c_str(), "NotTyping")) { // Other end stopped typing // TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop(). - // It requires an LLIMInfo for the message, which we don't have here. + // It requires some info for the message, which we don't have here. } else { |