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()) { LLFloaterChat* floaterp = LLFloaterChat::getInstance(); message = floaterp->getString(message_name); message.setArgs(args); LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::getInstance()->addChatHistory(chat); } else // going to IM session { LLFloaterIMPanel* floaterp = findFloaterBySession(session_id); if (floaterp) { message = floaterp->getString(message_name); message.setArgs(args); gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString()); } } }
void LLIMMgr::processIMTypingCore(const LLIMInfo* im_info, BOOL typing) { LLUUID session_id = computeSessionID(im_info->mIMType, im_info->mFromID); LLFloaterIMPanel* floater = findFloaterBySession(session_id); if (floater) { floater->processIMTyping(im_info, typing); } }
void LLIMMgr::updateFloaterSessionID( const LLUUID& old_session_id, const LLUUID& new_session_id) { LLFloaterIMPanel* floater = findFloaterBySession(old_session_id); if (floater) { floater->sessionInitReplyReceived(new_session_id); } }
// try to decrypt message, true if successful bool LLIMMgr::decryptMessage( const LLUUID& session_id, const LLUUID& target_id, const std::string& msg, std::string& decrypted_msg) { LLFloaterIMPanel* floater = findFloaterBySession(session_id); if(!floater) return false; return floater->decryptMsg(msg, decrypted_msg); }
// This removes the panel referenced by the uuid, and then restores // internal consistency. The internal pointer is not deleted. void LLIMMgr::removeSession(const LLUUID& session_id) { LLFloaterIMPanel* floater = findFloaterBySession(session_id); if(floater) { mFloaters.erase(floater->getHandle()); LLFloaterChatterBox::getInstance(LLSD())->removeFloater(floater); //mTabContainer->removeTabPanel(floater); clearPendingInvitation(session_id); clearPendingAgentListUpdates(session_id); } }
void LLIMMgr::autoStartCallOnStartup(const LLUUID& session_id) { // Singu TODO: LLIMModel LLFloaterIMPanel* floater = findFloaterBySession(session_id); if (!floater) return; if (floater->getSessionInitialized()) { startCall(session_id); } else { floater->mStartCallOnInitialize = true; } }
LLUUID LLIMMgr::addP2PSession(const std::string& name, const LLUUID& other_participant_id, const std::string& voice_session_handle, const std::string& caller_uri) { LLUUID session_id = addSession(name, IM_NOTHING_SPECIAL, other_participant_id); LLFloaterIMPanel* floater = findFloaterBySession(session_id); if(floater) { LLVoiceChannelP2P* voice_channelp = (LLVoiceChannelP2P*)floater->getVoiceChannel(); voice_channelp->setSessionHandle(voice_session_handle, caller_uri); } return session_id; }
// Adds a session using the given session_id. If the session already exists // the dialog type is assumed correct. Returns the uuid of the session. LLUUID LLIMMgr::addSession( const std::string& name, EInstantMessage dialog, const LLUUID& other_participant_id, const LLDynamicArray<LLUUID>& ids) { if (0 == ids.getLength()) { return LLUUID::null; } LLUUID session_id = computeSessionID( dialog, other_participant_id); LLFloaterIMPanel* floater = findFloaterBySession(session_id); if(!floater) { // On creation, use the first element of ids as the // "other_participant_id" floater = createFloater( session_id, other_participant_id, name, ids, dialog, TRUE); if ( !floater ) return LLUUID::null; noteOfflineUsers(floater, ids); LLFloaterChatterBox::showInstance(session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) { noteMutedUsers(floater, ids); } } else { floater->open(); } //mTabContainer->selectTabPanel(panel); floater->setInputFocus(TRUE); return floater->getSessionID(); }
// This adds a session to the talk view. The name is the local name of // the session, dialog specifies the type of session. If the session // exists, it is brought forward. Specifying id = NULL results in an // im session to everyone. Returns the uuid of the session. LLUUID LLIMMgr::addSession( const std::string& name, EInstantMessage dialog, const LLUUID& other_participant_id) { LLUUID session_id = computeSessionID(dialog, other_participant_id); LLFloaterIMPanel* floater = findFloaterBySession(session_id); if(!floater) { std::vector<LLUUID> ids; ids.push_back(other_participant_id); floater = createFloater(session_id, other_participant_id, name, dialog, ids, true); noteOfflineUsers(floater, ids); LLFloaterChatterBox::showInstance(session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) { noteMutedUsers(floater, ids); } static LLCachedControl<bool> tear_off("OtherChatsTornOff"); if(tear_off) { // removal sets up relationship for re-attach LLFloaterChatterBox::getInstance(LLSD())->removeFloater(floater); // reparent to floater view gFloaterView->addChild(floater); gFloaterView->bringToFront(floater); } else LLFloaterChatterBox::getInstance(LLSD())->showFloater(floater); } else { floater->open(); } //mTabContainer->selectTabPanel(panel); if(gSavedSettings.getBOOL("PhoenixIMAnnounceStealFocus")) { floater->setInputFocus(TRUE); } return floater->getSessionID(); }
// This adds a session to the talk view. The name is the local name of // the session, dialog specifies the type of session. If the session // exists, it is brought forward. Specifying id = NULL results in an // im session to everyone. Returns the uuid of the session. LLUUID LLIMMgr::addSession( const std::string& name, EInstantMessage dialog, const LLUUID& other_participant_id) { //lggtodo LLUUID session_id = computeSessionID(dialog, other_participant_id); LLFloaterIMPanel* floater = findFloaterBySession(session_id); if(!floater) { LLDynamicArray<LLUUID> ids; ids.put(other_participant_id); floater = createFloater( session_id, other_participant_id, name, ids, dialog, TRUE); noteOfflineUsers(floater, ids); LLFloaterChatterBox::showInstance(session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) { noteMutedUsers(floater, ids); } LLFloaterChatterBox::getInstance(LLSD())->showFloater(floater); } else { floater->open(); } //mTabContainer->selectTabPanel(panel); floater->setInputFocus(TRUE); return floater->getSessionID(); }
// This method returns TRUE if the local viewer has a session // currently open keyed to the uuid. BOOL LLIMMgr::isIMSessionOpen(const LLUUID& uuid) { LLFloaterIMPanel* floater = findFloaterBySession(uuid); if(floater) return TRUE; return FALSE; }
// Add a message to a session. void LLIMMgr::addMessage( const LLUUID& session_id, const LLUUID& target_id, const std::string& from, const std::string& msg, const std::string& session_name, EInstantMessage dialog, U32 parent_estate_id, const LLUUID& region_id, const LLVector3& position, bool link_name) // If this is true, then we insert the name and link it to a profile { LLUUID other_participant_id = target_id; // don't process muted IMs if (LLMuteList::getInstance()->isMuted( other_participant_id, LLMute::flagTextChat) && !LLMuteList::getInstance()->isLinden(from)) { return; } //not sure why...but if it is from ourselves we set the target_id //to be NULL if( other_participant_id == gAgent.getID() ) { other_participant_id = LLUUID::null; } LLFloaterIMPanel* floater; LLUUID new_session_id = session_id; if (new_session_id.isNull()) { //no session ID...compute new one new_session_id = computeSessionID(dialog, other_participant_id); } floater = findFloaterBySession(new_session_id); if (!floater) { floater = findFloaterBySession(other_participant_id); if (floater) { llinfos << "found the IM session " << session_id << " by participant " << other_participant_id << llendl; } } // create IM window as necessary if(!floater) { if (gIMMgr->getIgnoreGroupListCount() > 0 && gAgent.isInGroup(session_id)) { // Check to see if we're blocking this group's chat LLGroupData* group_data = NULL; // Search for this group in the agent's groups list LLDynamicArray<LLGroupData>::iterator i; for (i = gAgent.mGroups.begin(); i != gAgent.mGroups.end(); i++) { if (i->mID == session_id) { group_data = &*i; break; } } // If the group is in our list then return if (group_data && gIMMgr->getIgnoreGroup(group_data->mID)) { return; } } std::string name = from; if(!session_name.empty() && session_name.size()>1) { name = session_name; } floater = createFloater( new_session_id, other_participant_id, name, dialog, FALSE); // When we get a new IM, and if you are a god, display a bit // of information about the source. This is to help liaisons // when answering questions. if(gAgent.isGodlike()) { // *TODO:translate (low priority, god ability) std::ostringstream bonus_info; bonus_info << "*** parent estate: " << parent_estate_id << ((parent_estate_id == 1) ? ", mainland" : "") << ((parent_estate_id == 5) ? ", teen" : ""); // once we have web-services (or something) which returns // information about a region id, we can print this out // and even have it link to map-teleport or something. //<< "*** region_id: " << region_id << std::endl //<< "*** position: " << position << std::endl; floater->addHistoryLine(bonus_info.str(), gSavedSettings.getColor4("SystemChatColor")); } make_ui_sound("UISndNewIncomingIMSession"); } // now add message to floater bool is_from_system = target_id.isNull() || (from == SYSTEM_FROM); const LLColor4& color = ( is_from_system ? gSavedSettings.getColor4("SystemChatColor") : gSavedSettings.getColor("IMChatColor")); if ( !link_name ) { floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally } else { if( other_participant_id == session_id ) { // The name can be bogus on InWorldz floater->addHistoryLine(msg, color, true, LLUUID::null, from); } else { // Insert linked name to front of message floater->addHistoryLine(msg, color, true, other_participant_id, from); } } LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(LLSD()); if( !chat_floater->getVisible() && !floater->getVisible()) { //if the IM window is not open and the floater is not visible (i.e. not torn off) LLFloater* previouslyActiveFloater = chat_floater->getActiveFloater(); // select the newly added floater (or the floater with the new line added to it). // it should be there. chat_floater->selectFloater(floater); //there was a previously unseen IM, make that old tab flashing //it is assumed that the most recently unseen IM tab is the one current selected/active if ( previouslyActiveFloater && getIMReceived() ) { chat_floater->setFloaterFlashing(previouslyActiveFloater, TRUE); } //notify of a new IM notifyNewIM(); mIMUnreadCount++; } }
BOOL LLIMMgr::hasSession(const LLUUID& session_id) { return (findFloaterBySession(session_id) != NULL); }
// Add a message to a session. void LLIMMgr::addMessage( const LLUUID& session_id, const LLUUID& target_id, const std::string& from, const std::string& msg, const std::string& session_name, EInstantMessage dialog, U32 parent_estate_id, const LLUUID& region_id, const LLVector3& position, bool link_name) // If this is true, then we insert the name and link it to a profile { LLUUID other_participant_id = target_id; // don't process muted IMs if (LLMuteList::getInstance()->isMuted( other_participant_id, LLMute::flagTextChat) && !LLMuteList::getInstance()->isLinden(from)) { return; } LLUUID new_session_id = session_id; if (new_session_id.isNull()) { //no session ID...compute new one new_session_id = computeSessionID(dialog, other_participant_id); } LLFloaterIMPanel* floater = findFloaterBySession(new_session_id); if (!floater) { floater = findFloaterBySession(other_participant_id); if (floater) { LL_INFOS() << "found the IM session " << new_session_id << " by participant " << other_participant_id << LL_ENDL; } } if (LLVOAvatar* from_avatar = find_avatar_from_object(target_id)) from_avatar->mIdleTimer.reset(); // Not idle, message sent to somewhere // create IM window as necessary if(!floater) { // Return now if we're blocking this group's chat or conferences if (gAgent.isInGroup(session_id) ? getIgnoreGroup(session_id) : dialog != IM_NOTHING_SPECIAL && dialog != IM_SESSION_P2P_INVITE && block_conference(other_participant_id)) return; std::string name = (session_name.size() > 1) ? session_name : from; floater = createFloater(new_session_id, other_participant_id, name, dialog); // When we get a new IM, and if you are a god, display a bit // of information about the source. This is to help liaisons // when answering questions. if(gAgent.isGodlike()) { std::ostringstream bonus_info; bonus_info << LLTrans::getString("***")+ " "+ LLTrans::getString("IMParentEstate") + LLTrans::getString(":") + " " << parent_estate_id << ((parent_estate_id == 1) ? LLTrans::getString(",") + LLTrans::getString("IMMainland") : "") << ((parent_estate_id == 5) ? LLTrans::getString(",") + LLTrans::getString ("IMTeen") : ""); // once we have web-services (or something) which returns // information about a region id, we can print this out // and even have it link to map-teleport or something. //<< "*** region_id: " << region_id << std::endl //<< "*** position: " << position << std::endl; floater->addHistoryLine(bonus_info.str(), gSavedSettings.getColor4("SystemChatColor")); } make_ui_sound("UISndNewIncomingIMSession"); } // now add message to floater LLColor4 color = agent_chat_color(other_participant_id, from, false); if (dialog == IM_BUSY_AUTO_RESPONSE) { color *= .75f; color += LLColor4::transparent*.25f; } if ( !link_name ) { floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally } else { if( other_participant_id == session_id ) { // The name can be bogus on InWorldz floater->addHistoryLine(msg, color, true, LLUUID::null, from); } else { // Insert linked name to front of message floater->addHistoryLine(msg, color, true, other_participant_id, from); } } if (!gIMMgr->getFloaterOpen() && floater->getParent() != gFloaterView) { // If the chat floater is closed and not torn off) notify of a new IM mIMUnreadCount++; } }
// Add a message to a session. void LLIMMgr::addMessage( const LLUUID& session_id, const LLUUID& target_id, const std::string& from, const std::string& msg, const std::string& session_name, EInstantMessage dialog, U32 parent_estate_id, const LLUUID& region_id, const LLVector3& position, bool link_name) // If this is true, then we insert the name and link it to a profile { LLUUID other_participant_id = target_id; BOOL is_linden = LLMuteList::getInstance()->isLinden(other_participant_id); // don't process muted IMs if (LLMuteList::getInstance()->isMuted( other_participant_id, LLMute::flagTextChat) && !is_linden) { return; } //not sure why...but if it is from ourselves we set the target_id //to be NULL if( other_participant_id == gAgent.getID() ) { other_participant_id = LLUUID::null; } LLFloaterIMPanel* floater; LLUUID new_session_id = session_id; if (new_session_id.isNull()) { //no session ID...compute new one new_session_id = computeSessionID(dialog, other_participant_id); } floater = findFloaterBySession(new_session_id); if (!floater) { floater = findFloaterBySession(other_participant_id); if (floater) { llinfos << "found the IM session " << session_id << " by participant " << other_participant_id << llendl; } } // create IM window as necessary if(!floater) { std::string name = from; if(!session_name.empty() && session_name.size()>1) { name = session_name; } floater = createFloater( new_session_id, other_participant_id, name, dialog, FALSE); // When we get a new IM, and if you are a god, display a bit // of information about the source. This is to help liaisons // when answering questions. if(gAgent.isGodlike()) { // *TODO:translate (low priority, god ability) std::ostringstream bonus_info; bonus_info << "*** parent estate: " << parent_estate_id << ((parent_estate_id == 1) ? ", mainland" : "") << ((parent_estate_id == 5) ? ", teen" : ""); // once we have web-services (or something) which returns // information about a region id, we can print this out // and even have it link to map-teleport or something. //<< "*** region_id: " << region_id << std::endl //<< "*** position: " << position << std::endl; floater->addHistoryLine(bonus_info.str(), gSavedSettings.getColor4("SystemChatColor")); } make_ui_sound("UISndNewIncomingIMSession"); } // now add message to floater bool is_from_system = target_id.isNull() || (from == SYSTEM_FROM); bool is_encrypted = (msg.substr(0, 3) == "\xe2\x80\xa7"); LLColor4 color; //Phoenix:KC - color chat from friends. taking care not to color when RLV hide names is in effect, lol static BOOL* sPhoenixColorFriendsChat = rebind_llcontrol<BOOL>("PhoenixColorFriendsChat", &gSavedSettings, true); static BOOL* sPhoenixColorLindensChat = rebind_llcontrol<BOOL>("PhoenixColorLindensChat", &gSavedSettings, true); if (is_from_system) { color = gSavedSettings.getColor4("SystemChatColor"); } else if (is_encrypted) { color = gSavedSettings.getColor4("PhoenixIMEncryptedChatColor"); } else if (target_id == gAgent.getID()) { color = gSavedSettings.getColor("UserChatColor"); } else if (*sPhoenixColorFriendsChat && LLAvatarTracker::instance().isBuddy(other_participant_id) && (!rlv_handler_t::isEnabled() || !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))) { color = gSavedSettings.getColor4("PhoenixFriendChatColor"); } else if (*sPhoenixColorLindensChat && is_linden) { color = gSavedSettings.getColor4("PhoenixLindensChatColor"); } else { color = gSavedSettings.getColor4("IMChatColor"); } if ( !link_name ) { floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally } else { floater->addHistoryLine(msg, color, true, other_participant_id, from); // Insert linked name to front of message } LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(LLSD()); if( !chat_floater->getVisible() && !floater->getVisible()) { //if the IM window is not open and the floater is not visible (i.e. not torn off) LLFloater* previouslyActiveFloater = chat_floater->getActiveFloater(); // select the newly added floater (or the floater with the new line added to it). // it should be there. chat_floater->selectFloater(floater); //there was a previously unseen IM, make that old tab flashing //it is assumed that the most recently unseen IM tab is the one current selected/active if ( previouslyActiveFloater && getIMReceived() ) { chat_floater->setFloaterFlashing(previouslyActiveFloater, TRUE); } //notify of a new IM notifyNewIM(); mIMUnreadCount++; } }