aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-10-18 17:58:27 -0700
committerMcCabe Maxsted2009-10-18 17:58:27 -0700
commite4b0e7c82d670081c071d8a3da31b5ec407b8e07 (patch)
tree9410962bbb582eedbec448139e217f2714050777 /linden/indra/newview/llviewermessage.cpp
parentStarted 1.3.0 branch (diff)
parentUpdated and added some Linux libs. (diff)
downloadmeta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.zip
meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.gz
meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.bz2
meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.xz
Merged working branch of 1.2 into LL 1.23 merge
Diffstat (limited to 'linden/indra/newview/llviewermessage.cpp')
-rw-r--r--linden/indra/newview/llviewermessage.cpp442
1 files changed, 425 insertions, 17 deletions
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index 5d83065..d64eecd 100644
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -80,6 +80,7 @@
80#include "llfloatergroupinfo.h" 80#include "llfloatergroupinfo.h"
81#include "llfloaterimagepreview.h" 81#include "llfloaterimagepreview.h"
82#include "llfloaterland.h" 82#include "llfloaterland.h"
83#include "llfloatermap.h"
83#include "llfloaterregioninfo.h" 84#include "llfloaterregioninfo.h"
84#include "llfloaterlandholdings.h" 85#include "llfloaterlandholdings.h"
85#include "llurldispatcher.h" 86#include "llurldispatcher.h"
@@ -112,7 +113,7 @@
112#include "llui.h" // for make_ui_sound 113#include "llui.h" // for make_ui_sound
113#include "lluploaddialog.h" 114#include "lluploaddialog.h"
114#include "llviewercamera.h" 115#include "llviewercamera.h"
115#include "llviewercontrol.h" 116//#include "llviewercontrol.h"
116#include "llviewergenericmessage.h" 117#include "llviewergenericmessage.h"
117#include "llviewerinventory.h" 118#include "llviewerinventory.h"
118#include "llviewermenu.h" 119#include "llviewermenu.h"
@@ -142,6 +143,17 @@
142#include "llwindebug.h" // For the invalid message handler 143#include "llwindebug.h" // For the invalid message handler
143#endif 144#endif
144 145
146// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
147#include "llfloateravatarinfo.h"
148extern LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; // Only defined in llfloateravatarinfo.cpp
149// [/RLVa:KB]
150
151//silly spam define D:
152bool dialogSpamOn;
153static LLFrameTimer d_spam;
154std::map< std::string , S32 > lastd_names;
155LLDynamicArray< std::string > blacklisted_names;
156
145// 157//
146// Constants 158// Constants
147// 159//
@@ -1115,6 +1127,21 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
1115 switch(button) 1127 switch(button)
1116 { 1128 {
1117 case IOR_ACCEPT: 1129 case IOR_ACCEPT:
1130// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.2a
1131 // Only change the inventory offer's destination folder to the shared root if:
1132 // - the user has enabled the feature
1133 // - the inventory offer came from a script (and specifies a folder)
1134 // - the name starts with the prefix [mDesc format (quotes are part of the string): "[OBJECTNAME] ( http://slurl.com/... )"]
1135 if ( (rlv_handler_t::isEnabled()) && (!RlvSettings::getForbidGiveToRLV()) &&
1136 (IM_TASK_INVENTORY_OFFERED == info->mIM) && (LLAssetType::AT_CATEGORY == info->mType) && (info->mDesc.find(RLV_PUTINV_PREFIX) == 1) )
1137 {
1138 LLViewerInventoryCategory* pRlvRoot = gRlvHandler.getSharedRoot();
1139 if (pRlvRoot)
1140 {
1141 info->mFolderID = pRlvRoot->getUUID();
1142 }
1143 }
1144// [/RLVa:KB]
1118 // ACCEPT. The math for the dialog works, because the accept 1145 // ACCEPT. The math for the dialog works, because the accept
1119 // for inventory_offered, task_inventory_offer or 1146 // for inventory_offered, task_inventory_offer or
1120 // group_notice_inventory is 1 greater than the offer integer value. 1147 // group_notice_inventory is 1 greater than the offer integer value.
@@ -1277,6 +1304,13 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
1277 if(indx >= 0) 1304 if(indx >= 0)
1278 { 1305 {
1279 LLStringUtil::truncate(msg, indx); 1306 LLStringUtil::truncate(msg, indx);
1307// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-1.0.0a
1308 // TODO-RLVa: needs revisiting when LL saves open notifications to disk to accept them on the next relog
1309 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
1310 {
1311 gRlvHandler.filterLocation(info->mDesc);
1312 }
1313// [/RLVa:KB]
1280 } 1314 }
1281 1315
1282 LLSD args; 1316 LLSD args;
@@ -1505,7 +1539,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1505 // do nothing -- don't distract newbies in 1539 // do nothing -- don't distract newbies in
1506 // Prelude with global IMs 1540 // Prelude with global IMs
1507 } 1541 }
1508 else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) 1542// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
1543 else if ( (rlv_handler_t::isEnabled()) && (offline == IM_ONLINE) && ("@version" == message) )
1544 {
1545 rlvSendBusyMessage(from_id, gRlvHandler.getVersionString(), session_id);
1546 // We won't receive a typing stop message, so do that manually (see comment at the end of LLFloaterIMPanel::sendMsg)
1547 LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
1548 gIMMgr->processIMTypingStop(im_info);
1549 }
1550// [/RLVa:KB]
1551// else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM)
1552// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
1553 else if ( (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) &&
1554 ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, from_id))) )
1555// [/RLVa:KB]
1509 { 1556 {
1510 // return a standard "busy" message, but only do it to online IM 1557 // return a standard "busy" message, but only do it to online IM
1511 // (i.e. not other auto responses and not store-and-forward IM) 1558 // (i.e. not other auto responses and not store-and-forward IM)
@@ -1562,6 +1609,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1562 } 1609 }
1563 else if (to_id.isNull()) 1610 else if (to_id.isNull())
1564 { 1611 {
1612// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e)
1613 // Filter region messages that weren't sent by a Linden
1614 if ( (rlv_handler_t::isEnabled()) && (LLMuteList::getInstance()) &&
1615 (!LLMuteList::getInstance()->isLinden(name)) && (from_id != gAgent.getID()) )
1616 {
1617 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
1618 gRlvHandler.filterLocation(message);
1619 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
1620 {
1621 name = gRlvHandler.getAnonym(name);
1622 gRlvHandler.filterNames(message);
1623 }
1624 }
1625// [/RLVa:KB]
1626
1565 // Message to everyone from GOD 1627 // Message to everyone from GOD
1566 args["NAME"] = name; 1628 args["NAME"] = name;
1567 args["MESSAGE"] = message; 1629 args["MESSAGE"] = message;
@@ -1577,6 +1639,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1577 else 1639 else
1578 { 1640 {
1579 // standard message, not from system 1641 // standard message, not from system
1642// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
1643 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) && (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) )
1644 {
1645 rlvSendBusyMessage(from_id, rlv_handler_t::cstrMsgRecvIM, session_id);
1646
1647 message = message.substr(0, message_offset) + rlv_handler_t::cstrBlockedRecvIM;
1648 }
1649// [/RLVa:KB]
1650
1580 std::string saved; 1651 std::string saved;
1581 if(offline == IM_OFFLINE) 1652 if(offline == IM_OFFLINE)
1582 { 1653 {
@@ -1794,6 +1865,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1794 bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0]; 1865 bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0];
1795 info->mType = (LLAssetType::EType) bucketp->asset_type; 1866 info->mType = (LLAssetType::EType) bucketp->asset_type;
1796 info->mObjectID = bucketp->object_id; 1867 info->mObjectID = bucketp->object_id;
1868
1869// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
1870 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(from_id)) )
1871 {
1872 name = gRlvHandler.getAnonym(name);
1873 }
1874// [/RLVa:KB]
1797 } 1875 }
1798 else 1876 else
1799 { 1877 {
@@ -1831,6 +1909,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1831 } 1909 }
1832 else 1910 else
1833 { 1911 {
1912// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-09-10 (RLVa-1.0.3a)
1913 if ( (rlv_handler_t::isEnabled()) && (dialog == IM_TASK_INVENTORY_OFFERED) &&
1914 (info->mDesc.find(RLV_PUTINV_PREFIX) == 1) && (gRlvHandler.getSharedRoot()) )
1915 {
1916 LLFirstUse::warnRlvGiveToRLV();
1917 }
1918// [/RLVa:KB]
1919
1834 inventory_offer_handler(info, dialog == IM_TASK_INVENTORY_OFFERED); 1920 inventory_offer_handler(info, dialog == IM_TASK_INVENTORY_OFFERED);
1835 } 1921 }
1836 } 1922 }
@@ -1880,6 +1966,22 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1880 return; 1966 return;
1881 } 1967 }
1882 1968
1969// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
1970 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) )
1971 {
1972 if (gAgent.isInGroup(session_id))
1973 {
1974 if (!gRlvHandler.isException(RLV_BHVR_RECVIM, session_id))
1975 return;
1976 }
1977 else
1978 {
1979 if ( (from_id != gAgent.getID()) && (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) )
1980 message = message.substr(0, message_offset) + rlv_handler_t::cstrBlockedRecvIM;
1981 }
1982 }
1983// [/RLVa:KB]
1984
1883 // standard message, not from system 1985 // standard message, not from system
1884 std::string saved; 1986 std::string saved;
1885 if(offline == IM_OFFLINE) 1987 if(offline == IM_OFFLINE)
@@ -1915,12 +2017,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1915 { 2017 {
1916 return; 2018 return;
1917 } 2019 }
1918 chat.mText = name + separator_string + message.substr(message_offset); 2020 chat.mText = std::string("IM: ") + name + separator_string + message.substr(message_offset);
1919 chat.mFromName = name; 2021 chat.mFromName = name;
1920 2022
1921 // Build a link to open the object IM info window. 2023 // Build a link to open the object IM info window.
1922 std::string location = ll_safe_string((char*)binary_bucket,binary_bucket_size); 2024 std::string location = ll_safe_string((char*)binary_bucket,binary_bucket_size);
1923 2025
1924 LLSD query_string; 2026 LLSD query_string;
1925 query_string["owner"] = from_id; 2027 query_string["owner"] = from_id;
1926 query_string["slurl"] = location.c_str(); 2028 query_string["slurl"] = location.c_str();
@@ -1928,7 +2030,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1928 if (from_group) 2030 if (from_group)
1929 { 2031 {
1930 query_string["groupowned"] = "true"; 2032 query_string["groupowned"] = "true";
1931 } 2033 }
1932 2034
1933 if (session_id.notNull()) 2035 if (session_id.notNull())
1934 { 2036 {
@@ -1949,11 +2051,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1949 << LLURI::mapToQueryString(query_string); 2051 << LLURI::mapToQueryString(query_string);
1950 2052
1951 chat.mURL = link.str(); 2053 chat.mURL = link.str();
1952 chat.mText = name + separator_string + message.substr(message_offset); 2054 chat.mText = std::string("IM: ") + name + separator_string + message.substr(message_offset);
1953 2055
1954 // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because 2056 // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because
1955 // IMs from objcts don't open IM sessions. 2057 // IMs from objcts don't open IM sessions.
1956 chat.mSourceType = CHAT_SOURCE_OBJECT; 2058 chat.mSourceType = CHAT_SOURCE_OBJECT_IM;
1957 LLFloaterChat::addChat(chat, FALSE, FALSE); 2059 LLFloaterChat::addChat(chat, FALSE, FALSE);
1958 } 2060 }
1959 break; 2061 break;
@@ -1963,6 +2065,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1963 return; 2065 return;
1964 } 2066 }
1965 { 2067 {
2068// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e)
2069 // TODO-RLVa: what actually generates this?
2070 if (rlv_handler_t::isEnabled())
2071 {
2072 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
2073 gRlvHandler.filterLocation(message);
2074 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
2075 gRlvHandler.filterNames(message);
2076 }
2077// [/RLVa:KB]
2078
1966 // Construct a viewer alert for this message. 2079 // Construct a viewer alert for this message.
1967 args["NAME"] = name; 2080 args["NAME"] = name;
1968 args["MESSAGE"] = message; 2081 args["MESSAGE"] = message;
@@ -2283,8 +2396,13 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2283 chat.mPosAgent = chatter->getPositionAgent(); 2396 chat.mPosAgent = chatter->getPositionAgent();
2284 2397
2285 // Make swirly things only for talking objects. (not script debug messages, though) 2398 // Make swirly things only for talking objects. (not script debug messages, though)
2286 if (chat.mSourceType == CHAT_SOURCE_OBJECT 2399// if (chat.mSourceType == CHAT_SOURCE_OBJECT
2287 && chat.mChatType != CHAT_TYPE_DEBUG_MSG) 2400// && chat.mChatType != CHAT_TYPE_DEBUG_MSG)
2401// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
2402 // Don't show swirly things for llOwnerSay() chat here because we handle those further down
2403 if ( (chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mChatType != CHAT_TYPE_DEBUG_MSG) &&
2404 ((!rlv_handler_t::isEnabled()) || (CHAT_TYPE_OWNER != chat.mChatType)) )
2405// [/RLVa:KB]
2288 { 2406 {
2289 LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); 2407 LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent());
2290 psc->setSourceObject(chatter); 2408 psc->setSourceObject(chatter);
@@ -2309,6 +2427,32 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2309 is_owned_by_me = chatter->permYouOwner(); 2427 is_owned_by_me = chatter->permYouOwner();
2310 } 2428 }
2311 2429
2430 if(chat.mSourceType == CHAT_SOURCE_OBJECT
2431 && chat.mChatType != CHAT_TYPE_DEBUG_MSG
2432 && !owner_id.isNull()
2433 && owner_id != gAgent.getID())
2434 {
2435 std::string tempname = from_name;
2436
2437 size_t found = tempname.find(" ");
2438 while(found != std::string::npos)
2439 {
2440 tempname.replace(found, 1, "");
2441 found = tempname.find(" ");
2442 }
2443
2444 if (tempname.length() < 1)
2445 {
2446 from_name = "no name";
2447 chat.mFromName = from_name;
2448 }
2449
2450 // std::string ownername;
2451 // if(gCacheName->getFullName(owner_id,ownername))
2452 // from_name += (" (" + ownername + ")");
2453 chat.mURL = llformat("secondlife:///app/agent/%s/about",owner_id.asString().c_str());
2454 }
2455
2312 if (is_audible) 2456 if (is_audible)
2313 { 2457 {
2314 BOOL visible_in_chat_bubble = FALSE; 2458 BOOL visible_in_chat_bubble = FALSE;
@@ -2317,6 +2461,51 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2317 color.setVec(1.f,1.f,1.f,1.f); 2461 color.setVec(1.f,1.f,1.f,1.f);
2318 msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); 2462 msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg);
2319 2463
2464// [RLVa:KB] - Checked: 2009-10-06 (RLVa-1.0.4d) | Modified: RLVa-1.0.4d
2465 if ( (rlv_handler_t::isEnabled()) &&
2466 (CHAT_TYPE_START != chat.mChatType) && (CHAT_TYPE_STOP != chat.mChatType) && (CHAT_TYPE_OWNER != chat.mChatType) )
2467 {
2468 // NOTE: chatter can be NULL (may not have rezzed yet, or could be another avie's HUD attachment)
2469 BOOL is_attachment = (chatter) ? chatter->isAttachment() : FALSE;
2470
2471 // Filtering "rules":
2472 // avatar => filter all avie text (unless it's this avie or they're an exemption)
2473 // objects => filter everything except attachments this avie owns
2474 if ( ( (CHAT_SOURCE_AGENT == chat.mSourceType) && (from_id != gAgent.getID()) ) ||
2475 ( (CHAT_SOURCE_OBJECT == chat.mSourceType) && ((!is_owned_by_me) || (!is_attachment)) ) )
2476 {
2477 if (!rlvIsEmote(mesg))
2478 {
2479 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVCHAT)) && (!gRlvHandler.isException(RLV_BHVR_RECVCHAT, from_id)) )
2480 gRlvHandler.filterChat(mesg, false);
2481 }
2482 else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVEMOTE)) && (!gRlvHandler.isException(RLV_BHVR_RECVEMOTE, from_id)) )
2483 {
2484 mesg = "/me ...";
2485 }
2486 }
2487
2488 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
2489 {
2490 // Filtering "rules":
2491 // avatar => filter only their name (unless it's this avie)
2492 // other => filter everything except attachments this avie owns but then we still do filter their text
2493 if (CHAT_SOURCE_AGENT == chat.mSourceType)
2494 {
2495 if (chat.mFromID != gAgent.getID())
2496 from_name = gRlvHandler.getAnonym(from_name);
2497 }
2498 else
2499 {
2500 if ( (!is_owned_by_me) || (!is_attachment) )
2501 gRlvHandler.filterNames(from_name);
2502 gRlvHandler.filterNames(mesg);
2503 }
2504 chat.mRlvNamesFiltered = true;
2505 }
2506 }
2507// [/RLVa:KB]
2508
2320 BOOL ircstyle = FALSE; 2509 BOOL ircstyle = FALSE;
2321 2510
2322 // Look for IRC-style emotes here so chatbubbles work 2511 // Look for IRC-style emotes here so chatbubbles work
@@ -2342,6 +2531,12 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2342 { 2531 {
2343 ((LLVOAvatar*)chatter)->startTyping(); 2532 ((LLVOAvatar*)chatter)->startTyping();
2344 } 2533 }
2534
2535 if (LLFloaterMap::getInstance())
2536 {
2537 LLFloaterMap::getInstance()->updateTypingList(from_id, false);
2538 }
2539
2345 return; 2540 return;
2346 } 2541 }
2347 else if (CHAT_TYPE_STOP == chat.mChatType) 2542 else if (CHAT_TYPE_STOP == chat.mChatType)
@@ -2353,6 +2548,15 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2353 { 2548 {
2354 ((LLVOAvatar*)chatter)->stopTyping(); 2549 ((LLVOAvatar*)chatter)->stopTyping();
2355 } 2550 }
2551
2552 if (LLFloaterMap::getInstance())
2553 {
2554 if (LLFloaterMap::getInstance()->isTyping(from_id))
2555 {
2556 LLFloaterMap::getInstance()->updateTypingList(from_id, true);
2557 }
2558 }
2559
2356 return; 2560 return;
2357 } 2561 }
2358 2562
@@ -2381,8 +2585,74 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2381 case CHAT_TYPE_WHISPER: 2585 case CHAT_TYPE_WHISPER:
2382 verb = " " + LLTrans::getString("whisper") + " "; 2586 verb = " " + LLTrans::getString("whisper") + " ";
2383 break; 2587 break;
2384 case CHAT_TYPE_DEBUG_MSG:
2385 case CHAT_TYPE_OWNER: 2588 case CHAT_TYPE_OWNER:
2589// [RLVa:KB] - Checked: 2009-08-28 (RLVa-1.0.2a) | Modified: RLVa-1.0.2a
2590 if ( (rlv_handler_t::isEnabled()) && (mesg.length() > 3) && (RLV_CMD_PREFIX == mesg[0]) && (CHAT_TYPE_OWNER == chat.mChatType) )
2591 {
2592 mesg.erase(0, 1);
2593 LLStringUtil::toLower(mesg);
2594
2595 std::string strExecuted, strFailed, strRetained, *pstr;
2596
2597 boost_tokenizer tokens(mesg, boost::char_separator<char>(",", "", boost::drop_empty_tokens));
2598 for (boost_tokenizer::const_iterator itToken = tokens.begin(); itToken != tokens.end(); ++itToken)
2599 {
2600 if (LLStartUp::getStartupState() == STATE_STARTED)
2601 {
2602 if (gRlvHandler.processCommand(from_id, *itToken, true))
2603 pstr = &strExecuted;
2604 else
2605 pstr = &strFailed;
2606 }
2607 else
2608 {
2609 gRlvHandler.retainCommand(from_name, from_id, *itToken);
2610 pstr = &strRetained;
2611 }
2612
2613 if (!pstr->empty())
2614 pstr->push_back(',');
2615 pstr->append(*itToken);
2616 }
2617
2618 if (!RlvSettings::getDebug())
2619 return;
2620
2621 // Silly people want comprehensive debug messages, blah :p
2622 if ( (!strExecuted.empty()) && (strFailed.empty()) && (strRetained.empty()) )
2623 verb = " executes: @";
2624 else if ( (strExecuted.empty()) && (!strFailed.empty()) && (strRetained.empty()) )
2625 verb = " failed: @";
2626 else if ( (strExecuted.empty()) && (strFailed.empty()) && (!strRetained.empty()) )
2627 verb = " retained: @";
2628 else
2629 {
2630 verb = ": @";
2631 if (!strExecuted.empty())
2632 mesg += "\n - executed: @" + strExecuted;
2633 if (!strFailed.empty())
2634 mesg += "\n - failed: @" + strFailed;
2635 if (!strRetained.empty())
2636 mesg += "\n - retained: @" + strRetained;
2637 }
2638
2639 break;
2640 }
2641// [/RLVa:KB]
2642// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
2643 // Copy/paste from above
2644 if ( (chatter) && (chat.mChatType != CHAT_TYPE_DEBUG_MSG) )
2645 {
2646 LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent());
2647 psc->setSourceObject(chatter);
2648 psc->setColor(color);
2649 //We set the particles to be owned by the object's owner,
2650 //just in case they should be muted by the mute list
2651 psc->setOwnerUUID(owner_id);
2652 LLViewerPartSim::getInstance()->addPartSource(psc);
2653 }
2654// [/RLVa:KB]
2655 case CHAT_TYPE_DEBUG_MSG:
2386 case CHAT_TYPE_NORMAL: 2656 case CHAT_TYPE_NORMAL:
2387 verb = ": "; 2657 verb = ": ";
2388 break; 2658 break;
@@ -2451,7 +2721,10 @@ void process_teleport_start(LLMessageSystem *msg, void**)
2451 U32 teleport_flags = 0x0; 2721 U32 teleport_flags = 0x0;
2452 msg->getU32("Info", "TeleportFlags", teleport_flags); 2722 msg->getU32("Info", "TeleportFlags", teleport_flags);
2453 2723
2454 if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) 2724 //if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
2725// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b
2726 if ( (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) || (!gRlvHandler.getCanCancelTp()) )
2727// [/RLVa:KB]
2455 { 2728 {
2456 gViewerWindow->setProgressCancelButtonVisible(FALSE); 2729 gViewerWindow->setProgressCancelButtonVisible(FALSE);
2457 } 2730 }
@@ -2486,7 +2759,10 @@ void process_teleport_progress(LLMessageSystem* msg, void**)
2486 } 2759 }
2487 U32 teleport_flags = 0x0; 2760 U32 teleport_flags = 0x0;
2488 msg->getU32("Info", "TeleportFlags", teleport_flags); 2761 msg->getU32("Info", "TeleportFlags", teleport_flags);
2489 if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) 2762 //if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
2763// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b
2764 if ( (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) || (!gRlvHandler.getCanCancelTp()) )
2765// [/RLVa:KB]
2490 { 2766 {
2491 gViewerWindow->setProgressCancelButtonVisible(FALSE); 2767 gViewerWindow->setProgressCancelButtonVisible(FALSE);
2492 } 2768 }
@@ -2796,6 +3072,10 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2796 // appropriate. 3072 // appropriate.
2797 LLVector3 shift_vector = regionp->getPosRegionFromGlobal( 3073 LLVector3 shift_vector = regionp->getPosRegionFromGlobal(
2798 gAgent.getRegion()->getOriginGlobal()); 3074 gAgent.getRegion()->getOriginGlobal());
3075 // don't shift objects, if teleporting more than about 1000 sims, as
3076 // for long teleports shifting objects garbles the view at the target region
3077 if (shift_vector.lengthSquared() > 6.5e10f)
3078 shift_vector = LLVector3::zero;
2799 gAgent.setRegion(regionp); 3079 gAgent.setRegion(regionp);
2800 gObjectList.shiftObjects(shift_vector); 3080 gObjectList.shiftObjects(shift_vector);
2801 gAssetStorage->setUpstream(msg->getSender()); 3081 gAssetStorage->setUpstream(msg->getSender());
@@ -2818,7 +3098,10 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2818 // know what you look like. 3098 // know what you look like.
2819 gAgent.sendAgentSetAppearance(); 3099 gAgent.sendAgentSetAppearance();
2820 3100
2821 if (avatarp) 3101// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
3102 if ( (avatarp) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
3103// [/RLVa:KB]
3104// if (avatarp)
2822 { 3105 {
2823 // Chat the "back" SLURL. (DEV-4907) 3106 // Chat the "back" SLURL. (DEV-4907)
2824 LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL()); 3107 LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL());
@@ -2898,6 +3181,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2898 3181
2899 // If the server version has changed, display an info box and offer 3182 // If the server version has changed, display an info box and offer
2900 // to display the release notes, unless this is the initial log in. 3183 // to display the release notes, unless this is the initial log in.
3184 // Also verify we're on an OpenSimulator here.
2901 if (gLastVersionChannel == version_channel) 3185 if (gLastVersionChannel == version_channel)
2902 { 3186 {
2903 return; 3187 return;
@@ -2910,6 +3194,15 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2910 LLNotifications::instance().add("ServerVersionChanged", LLSD(), payload); 3194 LLNotifications::instance().add("ServerVersionChanged", LLSD(), payload);
2911 } 3195 }
2912 3196
3197 if (version_channel.find("OpenSim") != std::string::npos)
3198 {
3199 gSavedSettings.setBOOL("LoggedIntoOpenSim", TRUE);
3200 }
3201 else
3202 {
3203 gSavedSettings.setBOOL("LoggedIntoOpenSim", FALSE);
3204 }
3205
2913 gLastVersionChannel = version_channel; 3206 gLastVersionChannel = version_channel;
2914} 3207}
2915 3208
@@ -4126,7 +4419,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
4126 LLUUID tid; 4419 LLUUID tid;
4127 msg->getUUID("MoneyData", "TransactionID", tid); 4420 msg->getUUID("MoneyData", "TransactionID", tid);
4128 static std::deque<LLUUID> recent; 4421 static std::deque<LLUUID> recent;
4129 if(!desc.empty() && gSavedSettings.getBOOL("NotifyMoneyChange") 4422 if(!desc.empty() && gSavedSettings.getBOOL("NotifyMoneyChange") && !gDisconnected
4130 && (std::find(recent.rbegin(), recent.rend(), tid) == recent.rend())) 4423 && (std::find(recent.rbegin(), recent.rend(), tid) == recent.rend()))
4131 { 4424 {
4132 // Make the user confirm the transaction, since they might 4425 // Make the user confirm the transaction, since they might
@@ -4537,7 +4830,13 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp
4537 if (viewregion) 4830 if (viewregion)
4538 { 4831 {
4539 // got the region, so include the region and 3d coordinates of the object 4832 // got the region, so include the region and 3d coordinates of the object
4540 notice.setArg("[REGIONNAME]", viewregion->getName()); 4833 notice.setArg("[REGIONNAME]", viewregion->getName());
4834// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
4835 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
4836 {
4837 notice.setArg("[REGIONNAME]", rlv_handler_t::cstrHiddenRegion);
4838 }
4839// [/RLVa:KB]
4541 std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); 4840 std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]);
4542 notice.setArg("[REGIONPOS]", formatpos); 4841 notice.setArg("[REGIONPOS]", formatpos);
4543 4842
@@ -4749,8 +5048,31 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
4749 payload["object_name"] = object_name; 5048 payload["object_name"] = object_name;
4750 payload["owner_name"] = owner_name; 5049 payload["owner_name"] = owner_name;
4751 5050
5051// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0e
5052 S32 rlvQuestionsOther = questions;
5053
5054 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTPERMISSION)) )
5055 {
5056 LLViewerObject* pObj = gObjectList.findObject(taskid);
5057 if (pObj)
5058 {
5059 if (pObj->permYouOwner())
5060 {
5061 // PERMISSION_TAKE_CONTROLS and PERMISSION_ATTACH are only auto-granted to objects this avie owns
5062 rlvQuestionsOther &= ~(LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TAKE_CONTROLS] |
5063 LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH]);
5064 }
5065 }
5066 }
5067
5068 if ( (!caution) && (!rlvQuestionsOther) )
5069 {
5070 script_question_cb(0, cbdata);
5071 }
5072 else if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
5073// [/RLVa:KB]
4752 // check whether cautions are even enabled or not 5074 // check whether cautions are even enabled or not
4753 if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) 5075 //if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
4754 { 5076 {
4755 // display the caution permissions prompt 5077 // display the caution permissions prompt
4756 LLNotifications::instance().add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload); 5078 LLNotifications::instance().add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload);
@@ -5081,6 +5403,21 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response)
5081 5403
5082 if(0 == option) 5404 if(0 == option)
5083 { 5405 {
5406// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0b
5407 bool fRlvCensorMessage = false;
5408 if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM))
5409 {
5410 for (LLDynamicArray<LLUUID>::iterator it = invitees->begin(); it != invitees->end(); ++it)
5411 {
5412 if (!gRlvHandler.isException(RLV_BHVR_SENDIM, *it))
5413 {
5414 fRlvCensorMessage = true;
5415 break;
5416 }
5417 }
5418 }
5419// [/RLVa:KB]
5420
5084 LLMessageSystem* msg = gMessageSystem; 5421 LLMessageSystem* msg = gMessageSystem;
5085 msg->newMessageFast(_PREHASH_StartLure); 5422 msg->newMessageFast(_PREHASH_StartLure);
5086 msg->nextBlockFast(_PREHASH_AgentData); 5423 msg->nextBlockFast(_PREHASH_AgentData);
@@ -5088,7 +5425,10 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response)
5088 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 5425 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
5089 msg->nextBlockFast(_PREHASH_Info); 5426 msg->nextBlockFast(_PREHASH_Info);
5090 msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in. 5427 msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in.
5091 msg->addStringFast(_PREHASH_Message, text); 5428// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0b
5429 msg->addStringFast(_PREHASH_Message, (!fRlvCensorMessage) ? text : rlv_handler_t::cstrHidden);
5430// [/RLVa:KB]
5431 //msg->addStringFast(_PREHASH_Message, text);
5092 for(LLSD::array_const_iterator it = notification["payload"]["ids"].beginArray(); 5432 for(LLSD::array_const_iterator it = notification["payload"]["ids"].beginArray();
5093 it != notification["payload"]["ids"].endArray(); 5433 it != notification["payload"]["ids"].endArray();
5094 ++it) 5434 ++it)
@@ -5266,6 +5606,35 @@ void process_script_dialog(LLMessageSystem* msg, void**)
5266 msg->getString("Data", "Message", message); 5606 msg->getString("Data", "Message", message);
5267 msg->getS32("Data", "ChatChannel", chat_channel); 5607 msg->getS32("Data", "ChatChannel", chat_channel);
5268 5608
5609 // Don't show lldialog boxes from muted avs -- McCabe
5610 std::string agent_name = first_name + " " + last_name;
5611 if (!last_name.empty())
5612 {
5613 std::vector<LLMute> mutes = LLMuteList::getInstance()->getMutes();
5614 for (U32 i = 0; i < mutes.size(); i++)
5615 {
5616 //this is almost like saying (mutes[i].mType != LLMute::Object), but more verbose ... -Kaku
5617 if (
5618 ((mutes[i].mType == LLMute::AGENT)
5619 && (mutes[i].mName == agent_name))
5620 || ((mutes[i].mType == LLMute::GROUP)
5621 && (mutes[i].mName == last_name))
5622 || ((mutes[i].mType == LLMute::BY_NAME)
5623 //don't mute groups by name in case a group has a last name as a group name.
5624 && ((mutes[i].mName == agent_name)))
5625 )
5626 {
5627 delete info;
5628 return;
5629 }
5630 }
5631 }
5632 // or Scriptdialog boxes from muted objects -- Kakurady
5633 if (LLMuteList::getInstance()->isMuted(info->mObjectID, title)){
5634 delete info;
5635 return;
5636 }
5637
5269 // unused for now 5638 // unused for now
5270 LLUUID image_id; 5639 LLUUID image_id;
5271 msg->getUUID("Data", "ImageID", image_id); 5640 msg->getUUID("Data", "ImageID", image_id);
@@ -5296,6 +5665,45 @@ void process_script_dialog(LLMessageSystem* msg, void**)
5296 LLNotificationPtr notification; 5665 LLNotificationPtr notification;
5297 if (!first_name.empty()) 5666 if (!first_name.empty())
5298 { 5667 {
5668 // Dialog Spam Prevention by Cryogenic
5669 if(dialogSpamOn)
5670 {
5671 if(!d_spam.getStarted())
5672 {
5673 d_spam.start();
5674 }
5675 if(blacklisted_names.find(agent_name) != -1)
5676 {
5677 return;
5678 }
5679 std::map< std::string , S32 >::iterator itr = lastd_names.find(agent_name);
5680 if(itr != lastd_names.end())
5681 {
5682 if(d_spam.getElapsedTimeF32() <= gSavedSettings.getF32("SpamTime"))
5683 {
5684 if((*itr).second > gSavedSettings.getF32("SpamCount"))
5685 {
5686 blacklisted_names.put(agent_name);
5687 LL_INFOS("process_script_dialog") << "blocked " << info->mObjectID.asString() << " owned by " << agent_name << LL_ENDL;//" (" << key.asString() << ")" <<LL_ENDL;
5688 return;
5689 }
5690 else
5691 {
5692 (*itr).second++;
5693 }
5694 }
5695 else
5696 {
5697 lastd_names.erase(lastd_names.begin(),lastd_names.end());
5698 d_spam.reset();
5699 }
5700 }
5701 else
5702 {
5703 //llinfos << "Added " << fullname << " to list" << llendl;
5704 lastd_names[agent_name] = 0;
5705 }
5706 }
5299 args["FIRST"] = first_name; 5707 args["FIRST"] = first_name;
5300 args["LAST"] = last_name; 5708 args["LAST"] = last_name;
5301 notification = LLNotifications::instance().add( 5709 notification = LLNotifications::instance().add(