aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewermessage.cpp')
-rw-r--r--linden/indra/newview/llviewermessage.cpp472
1 files changed, 441 insertions, 31 deletions
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index 9aa44fc..d5d9324 100644
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -80,7 +80,6 @@
80#include "llfloaterland.h" 80#include "llfloaterland.h"
81#include "llfloaterregioninfo.h" 81#include "llfloaterregioninfo.h"
82#include "llfloaterlandholdings.h" 82#include "llfloaterlandholdings.h"
83#include "llfloatermap.h"
84#include "llurldispatcher.h" 83#include "llurldispatcher.h"
85#include "llfloatermute.h" 84#include "llfloatermute.h"
86#include "llfloaterpostcard.h" 85#include "llfloaterpostcard.h"
@@ -95,7 +94,6 @@
95#include "llinventoryview.h" 94#include "llinventoryview.h"
96#include "llmenugl.h" 95#include "llmenugl.h"
97#include "llmutelist.h" 96#include "llmutelist.h"
98#include "llnetmap.h"
99#include "llnotify.h" 97#include "llnotify.h"
100#include "llpanelgrouplandmoney.h" 98#include "llpanelgrouplandmoney.h"
101#include "llselectmgr.h" 99#include "llselectmgr.h"
@@ -142,6 +140,11 @@
142#include "llwindebug.h" // For the invalid message handler 140#include "llwindebug.h" // For the invalid message handler
143#endif 141#endif
144 142
143// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
144#include "llfloateravatarinfo.h"
145extern LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; // Only defined in llfloateravatarinfo.cpp
146// [/RLVa:KB]
147
145// 148//
146// Constants 149// Constants
147// 150//
@@ -1009,8 +1012,17 @@ void inventory_offer_callback(S32 button, void* user_data)
1009 std::string first_name, last_name; 1012 std::string first_name, last_name;
1010 if (gCacheName->getName(info->mFromID, first_name, last_name)) 1013 if (gCacheName->getName(info->mFromID, first_name, last_name))
1011 { 1014 {
1012 from_string = std::string("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; 1015// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e)
1013 chatHistory_string = info->mFromName + " owned by " + first_name + " " + last_name; 1016 std::string full_name = first_name + " " + last_name;
1017 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(info->mFromID)) )
1018 {
1019 full_name = gRlvHandler.getAnonym(full_name);
1020 }
1021 from_string = std::string("An object named '") + info->mFromName + "' owned by " + full_name;
1022 chatHistory_string = info->mFromName + " owned by " + full_name;
1023// [/RLVa:KB]
1024 //from_string = std::string("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name;
1025 //chatHistory_string = info->mFromName + " owned by " + first_name + " " + last_name;
1014 } 1026 }
1015 else 1027 else
1016 { 1028 {
@@ -1029,6 +1041,21 @@ void inventory_offer_callback(S32 button, void* user_data)
1029 switch(button) 1041 switch(button)
1030 { 1042 {
1031 case IOR_ACCEPT: 1043 case IOR_ACCEPT:
1044// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.2a
1045 // Only change the inventory offer's destination folder to the shared root if:
1046 // - the user has enabled the feature
1047 // - the inventory offer came from a script (and specifies a folder)
1048 // - the name starts with the prefix [mDesc format (quotes are part of the string): "[OBJECTNAME] ( http://slurl.com/... )"]
1049 if ( (rlv_handler_t::isEnabled()) && (!RlvSettings::getForbidGiveToRLV()) &&
1050 (IM_TASK_INVENTORY_OFFERED == info->mIM) && (LLAssetType::AT_CATEGORY == info->mType) && (info->mDesc.find(RLV_PUTINV_PREFIX) == 1) )
1051 {
1052 LLViewerInventoryCategory* pRlvRoot = gRlvHandler.getSharedRoot();
1053 if (pRlvRoot)
1054 {
1055 info->mFolderID = pRlvRoot->getUUID();
1056 }
1057 }
1058// [/RLVa:KB]
1032 // ACCEPT. The math for the dialog works, because the accept 1059 // ACCEPT. The math for the dialog works, because the accept
1033 // for inventory_offered, task_inventory_offer or 1060 // for inventory_offered, task_inventory_offer or
1034 // group_notice_inventory is 1 greater than the offer integer value. 1061 // group_notice_inventory is 1 greater than the offer integer value.
@@ -1191,6 +1218,13 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
1191 if(indx >= 0) 1218 if(indx >= 0)
1192 { 1219 {
1193 LLStringUtil::truncate(msg, indx); 1220 LLStringUtil::truncate(msg, indx);
1221// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-1.0.0a
1222 // TODO-RLVa: needs revisiting when LL saves open notifications to disk to accept them on the next relog
1223 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
1224 {
1225 gRlvHandler.filterLocation(info->mDesc);
1226 }
1227// [/RLVa:KB]
1194 } 1228 }
1195 1229
1196 LLStringUtil::format_map_t args; 1230 LLStringUtil::format_map_t args;
@@ -1231,6 +1265,13 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
1231 std::string first_name, last_name; 1265 std::string first_name, last_name;
1232 if (gCacheName->getName(info->mFromID, first_name, last_name)) 1266 if (gCacheName->getName(info->mFromID, first_name, last_name))
1233 { 1267 {
1268// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e)
1269 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(info->mFromID)) )
1270 {
1271 first_name = gRlvHandler.getAnonym(first_name.append(" ").append(last_name));
1272 last_name.clear();
1273 }
1274// [/RLVa:KB]
1234 args["[FIRST]"] = first_name; 1275 args["[FIRST]"] = first_name;
1235 args["[LAST]"] = last_name; 1276 args["[LAST]"] = last_name;
1236 name_found = TRUE; 1277 name_found = TRUE;
@@ -1245,7 +1286,16 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
1245 else 1286 else
1246 { 1287 {
1247 // *TODO:translate -> [FIRST] [LAST] 1288 // *TODO:translate -> [FIRST] [LAST]
1248 args["[NAME]"] = info->mFromName; 1289// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e)
1290 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(info->mFromID)) )
1291 {
1292 args["[NAME]"] = gRlvHandler.getAnonym(info->mFromName);
1293 }
1294// [/RLVa:KB]
1295 else
1296 {
1297 args["[NAME]"] = info->mFromName;
1298 }
1249 LLNotifyBox::showXml("UserGiveItem", args, 1299 LLNotifyBox::showXml("UserGiveItem", args,
1250 &inventory_offer_callback, (void*)info); 1300 &inventory_offer_callback, (void*)info);
1251 } 1301 }
@@ -1413,7 +1463,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1413 // do nothing -- don't distract newbies in 1463 // do nothing -- don't distract newbies in
1414 // Prelude with global IMs 1464 // Prelude with global IMs
1415 } 1465 }
1416 else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) 1466// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
1467 else if ( (rlv_handler_t::isEnabled()) && (offline == IM_ONLINE) && ("@version" == message) )
1468 {
1469 rlvSendBusyMessage(from_id, gRlvHandler.getVersionString(), session_id);
1470 // We won't receive a typing stop message, so do that manually (see comment at the end of LLFloaterIMPanel::sendMsg)
1471 LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
1472 gIMMgr->processIMTypingStop(im_info);
1473 }
1474// [/RLVa:KB]
1475// else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM)
1476// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
1477 else if ( (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) &&
1478 ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, from_id))) )
1479// [/RLVa:KB]
1417 { 1480 {
1418 // return a standard "busy" message, but only do it to online IM 1481 // return a standard "busy" message, but only do it to online IM
1419 // (i.e. not other auto responses and not store-and-forward IM) 1482 // (i.e. not other auto responses and not store-and-forward IM)
@@ -1470,6 +1533,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1470 } 1533 }
1471 else if (to_id.isNull()) 1534 else if (to_id.isNull())
1472 { 1535 {
1536// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e)
1537 // Filter region messages that weren't sent by a Linden
1538 if ( (rlv_handler_t::isEnabled()) && (LLMuteList::getInstance()) &&
1539 (!LLMuteList::getInstance()->isLinden(name)) && (from_id != gAgent.getID()) )
1540 {
1541 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
1542 gRlvHandler.filterLocation(message);
1543 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
1544 {
1545 name = gRlvHandler.getAnonym(name);
1546 gRlvHandler.filterNames(message);
1547 }
1548 }
1549// [/RLVa:KB]
1550
1473 // Message to everyone from GOD 1551 // Message to everyone from GOD
1474 args["[NAME]"] = name; 1552 args["[NAME]"] = name;
1475 args["[MESSAGE]"] = message; 1553 args["[MESSAGE]"] = message;
@@ -1485,6 +1563,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1485 else 1563 else
1486 { 1564 {
1487 // standard message, not from system 1565 // standard message, not from system
1566// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
1567 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) && (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) )
1568 {
1569 rlvSendBusyMessage(from_id, rlv_handler_t::cstrMsgRecvIM, session_id);
1570
1571 message = message.substr(0, message_offset) + rlv_handler_t::cstrBlockedRecvIM;
1572 }
1573// [/RLVa:KB]
1574
1488 std::string saved; 1575 std::string saved;
1489 if(offline == IM_OFFLINE) 1576 if(offline == IM_OFFLINE)
1490 { 1577 {
@@ -1690,6 +1777,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1690 bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0]; 1777 bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0];
1691 info->mType = (LLAssetType::EType) bucketp->asset_type; 1778 info->mType = (LLAssetType::EType) bucketp->asset_type;
1692 info->mObjectID = bucketp->object_id; 1779 info->mObjectID = bucketp->object_id;
1780
1781// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
1782 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(from_id)) )
1783 {
1784 name = gRlvHandler.getAnonym(name);
1785 }
1786// [/RLVa:KB]
1693 } 1787 }
1694 else 1788 else
1695 { 1789 {
@@ -1734,13 +1828,23 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1734 1828
1735 case IM_INVENTORY_ACCEPTED: 1829 case IM_INVENTORY_ACCEPTED:
1736 { 1830 {
1737 args["[NAME]"] = name; 1831// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
1832 bool fRlvObfuscate = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) &&
1833 (gRlvHandler.isAgentNearby(from_id)) && (!gAvatarInfoInstances.checkData(from_id));
1834 args["[NAME]"] = (!fRlvObfuscate) ? name : gRlvHandler.getAnonym(name);
1835// [/RLVa:KB]
1836// args["[NAME]"] = name;
1738 LLNotifyBox::showXml("InventoryAccepted", args); 1837 LLNotifyBox::showXml("InventoryAccepted", args);
1739 break; 1838 break;
1740 } 1839 }
1741 case IM_INVENTORY_DECLINED: 1840 case IM_INVENTORY_DECLINED:
1742 { 1841 {
1743 args["[NAME]"] = name; 1842// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
1843 bool fRlvObfuscate = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) &&
1844 (gRlvHandler.isAgentNearby(from_id)) && (!gAvatarInfoInstances.checkData(from_id));
1845 args["[NAME]"] = (!fRlvObfuscate) ? name : gRlvHandler.getAnonym(name);
1846// [/RLVa:KB]
1847// args["[NAME]"] = name;
1744 LLNotifyBox::showXml("InventoryDeclined", args); 1848 LLNotifyBox::showXml("InventoryDeclined", args);
1745 break; 1849 break;
1746 } 1850 }
@@ -1774,6 +1878,22 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1774 return; 1878 return;
1775 } 1879 }
1776 1880
1881// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
1882 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) )
1883 {
1884 if (gAgent.isInGroup(session_id))
1885 {
1886 if (!gRlvHandler.isException(RLV_BHVR_RECVIM, session_id))
1887 return;
1888 }
1889 else
1890 {
1891 if ( (from_id != gAgent.getID()) && (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) )
1892 message = message.substr(0, message_offset) + rlv_handler_t::cstrBlockedRecvIM;
1893 }
1894 }
1895// [/RLVa:KB]
1896
1777 // standard message, not from system 1897 // standard message, not from system
1778 std::string saved; 1898 std::string saved;
1779 if(offline == IM_OFFLINE) 1899 if(offline == IM_OFFLINE)
@@ -1804,15 +1924,51 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1804 break; 1924 break;
1805 1925
1806 case IM_FROM_TASK: 1926 case IM_FROM_TASK:
1807 if (is_busy && !is_owned_by_me)
1808 { 1927 {
1809 return; 1928 if (is_busy && !is_owned_by_me)
1929 {
1930 return;
1931 }
1932 chat.mText = name + separator_string + message.substr(message_offset);
1933 chat.mFromName = name;
1934
1935 // Build a link to open the object IM info window.
1936 std::string location = ll_safe_string((char*)binary_bucket,binary_bucket_size);
1937
1938 LLSD query_string;
1939 query_string["owner"] = from_id;
1940 query_string["slurl"] = location.c_str();
1941 query_string["name"] = name;
1942 if (from_group)
1943 {
1944 query_string["groupowned"] = "true";
1945 }
1946
1947 if (session_id.notNull())
1948 {
1949 chat.mFromID = session_id;
1950 }
1951 else
1952 {
1953 // This message originated on a region without the updated code for task id and slurl information.
1954 // We just need a unique ID for this object that isn't the owner ID.
1955 // If it is the owner ID it will overwrite the style that contains the link to that owner's profile.
1956 // This isn't ideal - it will make 1 style for all objects owned by the the same person/group.
1957 // This works because the only thing we can really do in this case is show the owner name and link to their profile.
1958 chat.mFromID = from_id ^ gAgent.getSessionID();
1959 }
1960
1961 std::ostringstream link;
1962 link << "secondlife:///app/objectim/" << session_id
1963 << LLURI::mapToQueryString(query_string);
1964
1965 chat.mURL = link.str();
1966
1967 // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because
1968 // IMs from objcts don't open IM sessions.
1969 chat.mSourceType = CHAT_SOURCE_OBJECT;
1970 LLFloaterChat::addChat(chat, FALSE, FALSE);
1810 } 1971 }
1811 chat.mText = name + separator_string + message.substr(message_offset);
1812 // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because
1813 // IMs from objcts don't open IM sessions.
1814 chat.mSourceType = CHAT_SOURCE_OBJECT;
1815 LLFloaterChat::addChat(chat, FALSE, FALSE);
1816 break; 1972 break;
1817 case IM_FROM_TASK_AS_ALERT: 1973 case IM_FROM_TASK_AS_ALERT:
1818 if (is_busy && !is_owned_by_me) 1974 if (is_busy && !is_owned_by_me)
@@ -1820,6 +1976,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1820 return; 1976 return;
1821 } 1977 }
1822 { 1978 {
1979// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e)
1980 // TODO-RLVa: what actually generates this?
1981 if (rlv_handler_t::isEnabled())
1982 {
1983 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
1984 gRlvHandler.filterLocation(message);
1985 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
1986 gRlvHandler.filterNames(message);
1987 }
1988// [/RLVa:KB]
1989
1823 // Construct a viewer alert for this message. 1990 // Construct a viewer alert for this message.
1824 args["[NAME]"] = name; 1991 args["[NAME]"] = name;
1825 args["[MESSAGE]"] = message; 1992 args["[MESSAGE]"] = message;
@@ -1852,12 +2019,48 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1852 } 2019 }
1853 else 2020 else
1854 { 2021 {
1855 // *TODO:translate -> [FIRST] [LAST] (maybe) 2022// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d)
1856 LLLureInfo* info = new LLLureInfo(from_id, session_id, FALSE); 2023 if (rlv_handler_t::isEnabled())
1857 args["[NAME]"] = name; 2024 {
1858 args["[MESSAGE]"] = message; 2025 // Disallow if: 1) @tplure=n restricted (sender isn't an exception), or 2) @unsit=n restricted and currently sitting
1859 LLNotifyBox::showXml("OfferTeleport", args, 2026 LLVOAvatar* pAvatar = gAgent.getAvatarObject();
1860 lure_callback, (void*)info); 2027 if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_TPLURE)) && (!gRlvHandler.isException(RLV_BHVR_TPLURE, from_id)) ) ||
2028 ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (pAvatar) && (pAvatar->mIsSitting) ) )
2029 {
2030 rlvSendBusyMessage(from_id, rlv_handler_t::cstrMsgTpLure);
2031 return;
2032 }
2033
2034 // Censor teleport message if: 1) @revcim=n restricted (sender isn't an exception), or 2) @showloc=n restricted
2035 if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) && (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) ) ||
2036 (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
2037 {
2038 message = rlv_handler_t::cstrHidden;
2039 }
2040 }
2041// [/RLVa:KB]
2042
2043// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.0b
2044 if ( (rlv_handler_t::isEnabled()) &&
2045 ((gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTP)) || (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, from_id))) )
2046 {
2047 gRlvHandler.setCanCancelTp(false);
2048 // (see IM_GODLIKE_LURE_USER below)
2049 LLLureInfo* info = new LLLureInfo(from_id, session_id, TRUE);
2050 lure_callback(0, (void*)info);
2051 }
2052 else
2053 {
2054// [/RLVa:KB]
2055 // *TODO:translate -> [FIRST] [LAST] (maybe)
2056 LLLureInfo* info = new LLLureInfo(from_id, session_id, FALSE);
2057 args["[NAME]"] = name;
2058 args["[MESSAGE]"] = message;
2059 LLNotifyBox::showXml("OfferTeleport", args,
2060 lure_callback, (void*)info);
2061// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.0b
2062 }
2063// [/RLVa:KB]
1861 } 2064 }
1862 } 2065 }
1863 break; 2066 break;
@@ -2202,8 +2405,13 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2202 chat.mPosAgent = chatter->getPositionAgent(); 2405 chat.mPosAgent = chatter->getPositionAgent();
2203 2406
2204 // Make swirly things only for talking objects. (not script debug messages, though) 2407 // Make swirly things only for talking objects. (not script debug messages, though)
2205 if (chat.mSourceType == CHAT_SOURCE_OBJECT 2408// if (chat.mSourceType == CHAT_SOURCE_OBJECT
2206 && chat.mChatType != CHAT_TYPE_DEBUG_MSG) 2409// && chat.mChatType != CHAT_TYPE_DEBUG_MSG)
2410// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
2411 // Don't show swirly things for llOwnerSay() chat here because we handle those further down
2412 if ( (chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mChatType != CHAT_TYPE_DEBUG_MSG) &&
2413 ((!rlv_handler_t::isEnabled()) || (CHAT_TYPE_OWNER != chat.mChatType)) )
2414// [/RLVa:KB]
2207 { 2415 {
2208 LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); 2416 LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent());
2209 psc->setSourceObject(chatter); 2417 psc->setSourceObject(chatter);
@@ -2236,6 +2444,50 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2236 color.setVec(1.f,1.f,1.f,1.f); 2444 color.setVec(1.f,1.f,1.f,1.f);
2237 msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); 2445 msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg);
2238 2446
2447// [RLVa:KB] - Checked: 2009-08-04 (RLVa-1.0.1d) | Modified: RLVa-1.0.1d
2448 if ( (rlv_handler_t::isEnabled()) &&
2449 (CHAT_TYPE_START != chat.mChatType) && (CHAT_TYPE_STOP != chat.mChatType) && (CHAT_TYPE_OWNER != chat.mChatType) )
2450 {
2451 // NOTE: chatter can be NULL (may not have rezzed yet, or could be another avie's HUD attachment)
2452 BOOL is_attachment = (chatter) ? chatter->isAttachment() : FALSE;
2453
2454 // Filtering "rules":
2455 // avatar => filter all avie text (unless it's this avie or they're an exemption)
2456 // objects => filter everything except attachments this avie owns
2457 if ( ((CHAT_SOURCE_AGENT == chat.mSourceType) && (from_id != gAgent.getID())) || (!is_owned_by_me) || (!is_attachment) )
2458 {
2459 if (!rlvIsEmote(mesg))
2460 {
2461 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVCHAT)) && (!gRlvHandler.isException(RLV_BHVR_RECVCHAT, from_id)) )
2462 gRlvHandler.filterChat(mesg, false);
2463 }
2464 else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVEMOTE)) && (!gRlvHandler.isException(RLV_BHVR_RECVEMOTE, from_id)) )
2465 {
2466 mesg = "/me ...";
2467 }
2468 }
2469
2470 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
2471 {
2472 // Filtering "rules":
2473 // avatar => filter only their name (unless it's this avie)
2474 // other => filter everything except attachments this avie owns but then we still do filter their text
2475 if (CHAT_SOURCE_AGENT == chat.mSourceType)
2476 {
2477 if (chat.mFromID != gAgent.getID())
2478 from_name = gRlvHandler.getAnonym(from_name);
2479 }
2480 else
2481 {
2482 if ( (!is_owned_by_me) || (!is_attachment) )
2483 gRlvHandler.filterNames(from_name);
2484 gRlvHandler.filterNames(mesg);
2485 }
2486 chat.mRlvNamesFiltered = true;
2487 }
2488 }
2489// [/RLVa:KB]
2490
2239 BOOL ircstyle = FALSE; 2491 BOOL ircstyle = FALSE;
2240 2492
2241 // Look for IRC-style emotes here so chatbubbles work 2493 // Look for IRC-style emotes here so chatbubbles work
@@ -2300,8 +2552,76 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2300 case CHAT_TYPE_WHISPER: 2552 case CHAT_TYPE_WHISPER:
2301 verb = " " + LLTrans::getString("whisper") + " "; 2553 verb = " " + LLTrans::getString("whisper") + " ";
2302 break; 2554 break;
2303 case CHAT_TYPE_DEBUG_MSG:
2304 case CHAT_TYPE_OWNER: 2555 case CHAT_TYPE_OWNER:
2556// [RLVa:KB] - Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e
2557 if ( (rlv_handler_t::isEnabled()) && (mesg.length() > 3) && (RLV_CMD_PREFIX == mesg[0]) )
2558 {
2559 mesg.erase(0, 1);
2560 LLStringUtil::toLower(mesg);
2561
2562 std::string strExecuted, strFailed, strRetained, *pstr;
2563
2564 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
2565 boost::char_separator<char> sep(",", "", boost::drop_empty_tokens);
2566 tokenizer tokens(mesg, sep);
2567 for (tokenizer::iterator itToken = tokens.begin(); itToken != tokens.end(); ++itToken)
2568 {
2569 if (LLStartUp::getStartupState() == STATE_STARTED)
2570 {
2571 if (gRlvHandler.processCommand(from_id, *itToken, true))
2572 pstr = &strExecuted;
2573 else
2574 pstr = &strFailed;
2575 }
2576 else
2577 {
2578 gRlvHandler.retainCommand(from_name, from_id, *itToken);
2579 pstr = &strRetained;
2580 }
2581
2582 if (!pstr->empty())
2583 pstr->push_back(',');
2584 pstr->append(*itToken);
2585 }
2586
2587 if (!RlvSettings::getDebug())
2588 return;
2589
2590 // Silly people want comprehensive debug messages, blah :p
2591 if ( (!strExecuted.empty()) && (strFailed.empty()) && (strRetained.empty()) )
2592 verb = " executes: @";
2593 else if ( (strExecuted.empty()) && (!strFailed.empty()) && (strRetained.empty()) )
2594 verb = " failed: @";
2595 else if ( (strExecuted.empty()) && (strFailed.empty()) && (!strRetained.empty()) )
2596 verb = " retained: @";
2597 else
2598 {
2599 verb = ": @";
2600 if (!strExecuted.empty())
2601 mesg += "\n - executed: @" + strExecuted;
2602 if (!strFailed.empty())
2603 mesg += "\n - failed: @" + strFailed;
2604 if (!strRetained.empty())
2605 mesg += "\n - retained: @" + strRetained;
2606 }
2607
2608 break;
2609 }
2610// [/RLVa:KB]
2611// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
2612 // Copy/paste from above
2613 if ( (chatter) && (chat.mChatType != CHAT_TYPE_DEBUG_MSG) )
2614 {
2615 LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent());
2616 psc->setSourceObject(chatter);
2617 psc->setColor(color);
2618 //We set the particles to be owned by the object's owner,
2619 //just in case they should be muted by the mute list
2620 psc->setOwnerUUID(owner_id);
2621 LLViewerPartSim::getInstance()->addPartSource(psc);
2622 }
2623// [/RLVa:KB]
2624 case CHAT_TYPE_DEBUG_MSG:
2305 case CHAT_TYPE_NORMAL: 2625 case CHAT_TYPE_NORMAL:
2306 verb = ": "; 2626 verb = ": ";
2307 break; 2627 break;
@@ -2370,7 +2690,10 @@ void process_teleport_start(LLMessageSystem *msg, void**)
2370 U32 teleport_flags = 0x0; 2690 U32 teleport_flags = 0x0;
2371 msg->getU32("Info", "TeleportFlags", teleport_flags); 2691 msg->getU32("Info", "TeleportFlags", teleport_flags);
2372 2692
2373 if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) 2693 //if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
2694// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b
2695 if ( (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) || (!gRlvHandler.getCanCancelTp()) )
2696// [/RLVa:KB]
2374 { 2697 {
2375 gViewerWindow->setProgressCancelButtonVisible(FALSE); 2698 gViewerWindow->setProgressCancelButtonVisible(FALSE);
2376 } 2699 }
@@ -2405,7 +2728,10 @@ void process_teleport_progress(LLMessageSystem* msg, void**)
2405 } 2728 }
2406 U32 teleport_flags = 0x0; 2729 U32 teleport_flags = 0x0;
2407 msg->getU32("Info", "TeleportFlags", teleport_flags); 2730 msg->getU32("Info", "TeleportFlags", teleport_flags);
2408 if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) 2731 //if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
2732// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b
2733 if ( (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) || (!gRlvHandler.getCanCancelTp()) )
2734// [/RLVa:KB]
2409 { 2735 {
2410 gViewerWindow->setProgressCancelButtonVisible(FALSE); 2736 gViewerWindow->setProgressCancelButtonVisible(FALSE);
2411 } 2737 }
@@ -2720,6 +3046,10 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2720 // appropriate. 3046 // appropriate.
2721 LLVector3 shift_vector = regionp->getPosRegionFromGlobal( 3047 LLVector3 shift_vector = regionp->getPosRegionFromGlobal(
2722 gAgent.getRegion()->getOriginGlobal()); 3048 gAgent.getRegion()->getOriginGlobal());
3049 // don't shift objects, if teleporting more than about 1000 sims, as
3050 // for long teleports shifting objects garbles the view at the target region
3051 if (shift_vector.lengthSquared() > 6.5e10f)
3052 shift_vector = LLVector3::zero;
2723 gAgent.setRegion(regionp); 3053 gAgent.setRegion(regionp);
2724 gObjectList.shiftObjects(shift_vector); 3054 gObjectList.shiftObjects(shift_vector);
2725 gAssetStorage->setUpstream(msg->getSender()); 3055 gAssetStorage->setUpstream(msg->getSender());
@@ -2742,7 +3072,10 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2742 // know what you look like. 3072 // know what you look like.
2743 gAgent.sendAgentSetAppearance(); 3073 gAgent.sendAgentSetAppearance();
2744 3074
2745 if (avatarp) 3075// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
3076 if ( (avatarp) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
3077// [/RLVa:KB]
3078// if (avatarp)
2746 { 3079 {
2747 // Chat the "back" SLURL. (DEV-4907) 3080 // Chat the "back" SLURL. (DEV-4907)
2748 LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL()); 3081 LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL());
@@ -2822,6 +3155,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2822 3155
2823 // If the server version has changed, display an info box and offer 3156 // If the server version has changed, display an info box and offer
2824 // to display the release notes, unless this is the initial log in. 3157 // to display the release notes, unless this is the initial log in.
3158 // Also verify we're on an OpenSimulator here.
2825 if (gLastVersionChannel == version_channel) 3159 if (gLastVersionChannel == version_channel)
2826 { 3160 {
2827 return; 3161 return;
@@ -2833,6 +3167,15 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2833 "ServerVersionChanged", display_release_notes, NULL); 3167 "ServerVersionChanged", display_release_notes, NULL);
2834 } 3168 }
2835 3169
3170 if (version_channel.find("OpenSim") != std::string::npos)
3171 {
3172 gSavedSettings.setBOOL("LoggedIntoOpenSim", TRUE);
3173 }
3174 else
3175 {
3176 gSavedSettings.setBOOL("LoggedIntoOpenSim", FALSE);
3177 }
3178
2836 gLastVersionChannel = version_channel; 3179 gLastVersionChannel = version_channel;
2837} 3180}
2838 3181
@@ -4322,7 +4665,13 @@ void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_q
4322 if (viewregion) 4665 if (viewregion)
4323 { 4666 {
4324 // got the region, so include the region and 3d coordinates of the object 4667 // got the region, so include the region and 3d coordinates of the object
4325 notice.setArg("[REGIONNAME]", viewregion->getName()); 4668 notice.setArg("[REGIONNAME]", viewregion->getName());
4669// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
4670 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
4671 {
4672 notice.setArg("[REGIONNAME]", rlv_handler_t::cstrHiddenRegion);
4673 }
4674// [/RLVa:KB]
4326 std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); 4675 std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]);
4327 notice.setArg("[REGIONPOS]", formatpos); 4676 notice.setArg("[REGIONPOS]", formatpos);
4328 4677
@@ -4527,8 +4876,31 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
4527 4876
4528 LLScriptQuestionCBData *cbdata = new LLScriptQuestionCBData(taskid, itemid, sender, questions, object_name, owner_name); 4877 LLScriptQuestionCBData *cbdata = new LLScriptQuestionCBData(taskid, itemid, sender, questions, object_name, owner_name);
4529 4878
4879// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0e
4880 S32 rlvQuestionsOther = questions;
4881
4882 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour("acceptpermission")) )
4883 {
4884 LLViewerObject* pObj = gObjectList.findObject(taskid);
4885 if (pObj)
4886 {
4887 if (pObj->permYouOwner())
4888 {
4889 // PERMISSION_TAKE_CONTROLS and PERMISSION_ATTACH are only auto-granted to objects this avie owns
4890 rlvQuestionsOther &= ~(LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TAKE_CONTROLS] |
4891 LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH]);
4892 }
4893 }
4894 }
4895
4896 if ( (!caution) && (!rlvQuestionsOther) )
4897 {
4898 script_question_cb(0, cbdata);
4899 }
4900 else if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
4901// [/RLVa:KB]
4530 // check whether cautions are even enabled or not 4902 // check whether cautions are even enabled or not
4531 if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) 4903 //if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
4532 { 4904 {
4533 if (caution) 4905 if (caution)
4534 { 4906 {
@@ -4820,6 +5192,21 @@ void handle_lure_callback(S32 option, const std::string& text, void* userdata)
4820 5192
4821 if(0 == option) 5193 if(0 == option)
4822 { 5194 {
5195// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0b
5196 bool fRlvCensorMessage = false;
5197 if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM))
5198 {
5199 for (LLDynamicArray<LLUUID>::iterator it = invitees->begin(); it != invitees->end(); ++it)
5200 {
5201 if (!gRlvHandler.isException(RLV_BHVR_SENDIM, *it))
5202 {
5203 fRlvCensorMessage = true;
5204 break;
5205 }
5206 }
5207 }
5208// [/RLVa:KB]
5209
4823 LLMessageSystem* msg = gMessageSystem; 5210 LLMessageSystem* msg = gMessageSystem;
4824 msg->newMessageFast(_PREHASH_StartLure); 5211 msg->newMessageFast(_PREHASH_StartLure);
4825 msg->nextBlockFast(_PREHASH_AgentData); 5212 msg->nextBlockFast(_PREHASH_AgentData);
@@ -4827,7 +5214,10 @@ void handle_lure_callback(S32 option, const std::string& text, void* userdata)
4827 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 5214 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
4828 msg->nextBlockFast(_PREHASH_Info); 5215 msg->nextBlockFast(_PREHASH_Info);
4829 msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in. 5216 msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in.
4830 msg->addStringFast(_PREHASH_Message, text); 5217// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0b
5218 msg->addStringFast(_PREHASH_Message, (!fRlvCensorMessage) ? text : rlv_handler_t::cstrHidden);
5219// [/RLVa:KB]
5220 //msg->addStringFast(_PREHASH_Message, text);
4831 for(LLDynamicArray<LLUUID>::iterator itr = invitees->begin(); itr != invitees->end(); ++itr) 5221 for(LLDynamicArray<LLUUID>::iterator itr = invitees->begin(); itr != invitees->end(); ++itr)
4832 { 5222 {
4833 msg->nextBlockFast(_PREHASH_TargetData); 5223 msg->nextBlockFast(_PREHASH_TargetData);
@@ -4857,8 +5247,28 @@ void handle_lure(LLDynamicArray<LLUUID>& ids)
4857{ 5247{
4858 LLDynamicArray<LLUUID>* userdata = new LLDynamicArray<LLUUID>(ids); 5248 LLDynamicArray<LLUUID>* userdata = new LLDynamicArray<LLUUID>(ids);
4859 5249
5250// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-1.0.0a
5251 // Only allow offering teleports if everyone is a @tplure exception or able to map this avie under @showloc=n
5252 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
5253 {
5254 for (LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); ++it)
5255 {
5256 const LLRelationship* pBuddyInfo = LLAvatarTracker::instance().getBuddyInfo(*it);
5257 if ( (!gRlvHandler.isException(RLV_BHVR_TPLURE, *it)) &&
5258 ((!pBuddyInfo) || (!pBuddyInfo->isOnline()) || (!pBuddyInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION))) )
5259 {
5260 delete userdata;
5261 return;
5262 }
5263 }
5264 }
5265// [/RLVa:KB]
5266
4860 LLStringUtil::format_map_t edit_args; 5267 LLStringUtil::format_map_t edit_args;
4861 edit_args["[REGION]"] = gAgent.getRegion()->getName(); 5268// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-1.0.0a
5269 edit_args["[REGION]"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? gAgent.getRegion()->getName() : rlv_handler_t::cstrHidden;
5270// [/RLVa:KB]
5271 //edit_args["[REGION]"] = gAgent.getRegion()->getName();
4862 if (gAgent.isGodlike()) 5272 if (gAgent.isGodlike())
4863 { 5273 {
4864 gViewerWindow->alertXmlEditText("OfferTeleportFromGod", edit_args, 5274 gViewerWindow->alertXmlEditText("OfferTeleportFromGod", edit_args,