diff options
author | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
commit | 2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch) | |
tree | 95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/newview/llimview.cpp | |
parent | Second Life viewer sources 1.20.6 (diff) | |
download | meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2 meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz |
Second Life viewer sources 1.20.7
Diffstat (limited to 'linden/indra/newview/llimview.cpp')
-rw-r--r-- | linden/indra/newview/llimview.cpp | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/linden/indra/newview/llimview.cpp b/linden/indra/newview/llimview.cpp index e451388..797c2a4 100644 --- a/linden/indra/newview/llimview.cpp +++ b/linden/indra/newview/llimview.cpp | |||
@@ -83,6 +83,7 @@ LLIMMgr* gIMMgr = NULL; | |||
83 | // *FIXME: make these all either UIStrings or Strings | 83 | // *FIXME: make these all either UIStrings or Strings |
84 | static LLString sOnlyUserMessage; | 84 | static LLString sOnlyUserMessage; |
85 | static LLUIString sOfflineMessage; | 85 | static LLUIString sOfflineMessage; |
86 | static LLString sMutedMessage; | ||
86 | static LLUIString sInviteMessage; | 87 | static LLUIString sInviteMessage; |
87 | 88 | ||
88 | std::map<std::string,LLString> LLFloaterIM::sEventStringsMap; | 89 | std::map<std::string,LLString> LLFloaterIM::sEventStringsMap; |
@@ -161,6 +162,7 @@ BOOL LLFloaterIM::postBuild() | |||
161 | sOfflineMessage = getUIString("offline_message"); | 162 | sOfflineMessage = getUIString("offline_message"); |
162 | 163 | ||
163 | sInviteMessage = getUIString("invite_message"); | 164 | sInviteMessage = getUIString("invite_message"); |
165 | sMutedMessage = childGetText("muted_message"); | ||
164 | 166 | ||
165 | if ( sErrorStringsMap.find("generic") == sErrorStringsMap.end() ) | 167 | if ( sErrorStringsMap.find("generic") == sErrorStringsMap.end() ) |
166 | { | 168 | { |
@@ -400,10 +402,10 @@ void LLIMMgr::addMessage( | |||
400 | EInstantMessage dialog, | 402 | EInstantMessage dialog, |
401 | U32 parent_estate_id, | 403 | U32 parent_estate_id, |
402 | const LLUUID& region_id, | 404 | const LLUUID& region_id, |
403 | const LLVector3& position) | 405 | const LLVector3& position, |
406 | bool link_name) // If this is true, then we insert the name and link it to a profile | ||
404 | { | 407 | { |
405 | LLUUID other_participant_id = target_id; | 408 | LLUUID other_participant_id = target_id; |
406 | bool is_from_system = target_id.isNull() || !strcmp(from, SYSTEM_FROM); | ||
407 | 409 | ||
408 | // don't process muted IMs | 410 | // don't process muted IMs |
409 | if (LLMuteList::getInstance()->isMuted( | 411 | if (LLMuteList::getInstance()->isMuted( |
@@ -420,8 +422,6 @@ void LLIMMgr::addMessage( | |||
420 | other_participant_id = LLUUID::null; | 422 | other_participant_id = LLUUID::null; |
421 | } | 423 | } |
422 | 424 | ||
423 | |||
424 | |||
425 | LLFloaterIMPanel* floater; | 425 | LLFloaterIMPanel* floater; |
426 | LLUUID new_session_id = session_id; | 426 | LLUUID new_session_id = session_id; |
427 | if (new_session_id.isNull()) | 427 | if (new_session_id.isNull()) |
@@ -482,15 +482,17 @@ void LLIMMgr::addMessage( | |||
482 | } | 482 | } |
483 | 483 | ||
484 | // now add message to floater | 484 | // now add message to floater |
485 | if ( is_from_system ) // chat came from system | 485 | bool is_from_system = target_id.isNull() || !strcmp(from, SYSTEM_FROM); |
486 | const LLColor4& color = ( is_from_system ? | ||
487 | gSavedSettings.getColor4("SystemChatColor") : | ||
488 | gSavedSettings.getColor("IMChatColor")); | ||
489 | if ( !link_name ) | ||
486 | { | 490 | { |
487 | floater->addHistoryLine( | 491 | floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally |
488 | msg, | ||
489 | gSavedSettings.getColor4("SystemChatColor")); | ||
490 | } | 492 | } |
491 | else | 493 | else |
492 | { | 494 | { |
493 | floater->addHistoryLine(other_participant_id, msg, gSavedSettings.getColor("IMChatColor")); | 495 | floater->addHistoryLine(msg, color, true, other_participant_id, from); // Insert linked name to front of message |
494 | } | 496 | } |
495 | 497 | ||
496 | LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(LLSD()); | 498 | LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(LLSD()); |
@@ -615,6 +617,8 @@ LLUUID LLIMMgr::addSession( | |||
615 | 617 | ||
616 | noteOfflineUsers(floater, ids); | 618 | noteOfflineUsers(floater, ids); |
617 | LLFloaterChatterBox::showInstance(session_id); | 619 | LLFloaterChatterBox::showInstance(session_id); |
620 | noteMutedUsers(floater, ids); | ||
621 | LLFloaterChatterBox::getInstance(LLSD())->showFloater(floater); | ||
618 | } | 622 | } |
619 | else | 623 | else |
620 | { | 624 | { |
@@ -659,6 +663,7 @@ LLUUID LLIMMgr::addSession( | |||
659 | 663 | ||
660 | noteOfflineUsers(floater, ids); | 664 | noteOfflineUsers(floater, ids); |
661 | LLFloaterChatterBox::showInstance(session_id); | 665 | LLFloaterChatterBox::showInstance(session_id); |
666 | noteMutedUsers(floater, ids); | ||
662 | } | 667 | } |
663 | else | 668 | else |
664 | { | 669 | { |
@@ -1232,6 +1237,31 @@ void LLIMMgr::noteOfflineUsers( | |||
1232 | } | 1237 | } |
1233 | } | 1238 | } |
1234 | 1239 | ||
1240 | void LLIMMgr::noteMutedUsers(LLFloaterIMPanel* floater, | ||
1241 | const LLDynamicArray<LLUUID>& ids) | ||
1242 | { | ||
1243 | S32 count = ids.count(); | ||
1244 | if(count > 0) | ||
1245 | { | ||
1246 | const LLRelationship* info = NULL; | ||
1247 | LLAvatarTracker& at = LLAvatarTracker::instance(); | ||
1248 | for(S32 i = 0; i < count; ++i) | ||
1249 | { | ||
1250 | info = at.getBuddyInfo(ids.get(i)); | ||
1251 | char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ | ||
1252 | char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ | ||
1253 | if(info && LLMuteList::getInstance() && LLMuteList::getInstance()->isMuted(ids.get(i)) | ||
1254 | && gCacheName->getName(ids.get(i), first, last)) | ||
1255 | { | ||
1256 | LLUIString muted = sMutedMessage; | ||
1257 | muted.setArg("[FIRST]", first); | ||
1258 | muted.setArg("[LAST]", last); | ||
1259 | floater->addHistoryLine(muted); | ||
1260 | } | ||
1261 | } | ||
1262 | } | ||
1263 | } | ||
1264 | |||
1235 | void LLIMMgr::processIMTypingStart(const LLIMInfo* im_info) | 1265 | void LLIMMgr::processIMTypingStart(const LLIMInfo* im_info) |
1236 | { | 1266 | { |
1237 | processIMTypingCore(im_info, TRUE); | 1267 | processIMTypingCore(im_info, TRUE); |
@@ -1520,8 +1550,7 @@ public: | |||
1520 | snprintf( | 1550 | snprintf( |
1521 | buffer, | 1551 | buffer, |
1522 | sizeof(buffer), | 1552 | sizeof(buffer), |
1523 | "%s%s%s%s", | 1553 | "%s%s%s", |
1524 | name.c_str(), | ||
1525 | separator_string, | 1554 | separator_string, |
1526 | saved, | 1555 | saved, |
1527 | (message.c_str() + message_offset)); /*Flawfinder: ignore*/ | 1556 | (message.c_str() + message_offset)); /*Flawfinder: ignore*/ |
@@ -1540,7 +1569,8 @@ public: | |||
1540 | IM_SESSION_INVITE, | 1569 | IM_SESSION_INVITE, |
1541 | message_params["parent_estate_id"].asInteger(), | 1570 | message_params["parent_estate_id"].asInteger(), |
1542 | message_params["region_id"].asUUID(), | 1571 | message_params["region_id"].asUUID(), |
1543 | ll_vector3_from_sd(message_params["position"])); | 1572 | ll_vector3_from_sd(message_params["position"]), |
1573 | true); | ||
1544 | 1574 | ||
1545 | snprintf( | 1575 | snprintf( |
1546 | buffer, | 1576 | buffer, |
@@ -1628,4 +1658,3 @@ LLHTTPRegistration<LLViewerChatterBoxInvitation> | |||
1628 | gHTTPRegistrationMessageChatterBoxInvitation( | 1658 | gHTTPRegistrationMessageChatterBoxInvitation( |
1629 | "/message/ChatterBoxInvitation"); | 1659 | "/message/ChatterBoxInvitation"); |
1630 | 1660 | ||
1631 | |||