diff options
Diffstat (limited to 'linden/indra/newview/llviewermessage.cpp')
-rwxr-xr-x | linden/indra/newview/llviewermessage.cpp | 165 |
1 files changed, 145 insertions, 20 deletions
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index cbcfb86..858137a 100755 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp | |||
@@ -158,6 +158,10 @@ | |||
158 | #include "llwindebug.h" // For the invalid message handler | 158 | #include "llwindebug.h" // For the invalid message handler |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | #if USE_OTR // [$PLOTR$] | ||
162 | #include "otr_wrapper.h" | ||
163 | #endif // USE_OTR // [/$PLOTR$] | ||
164 | |||
161 | //silly spam define D: | 165 | //silly spam define D: |
162 | bool dialogSpamOn; | 166 | bool dialogSpamOn; |
163 | static LLFrameTimer d_spam; | 167 | static LLFrameTimer d_spam; |
@@ -1278,7 +1282,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& | |||
1278 | 1282 | ||
1279 | log_message = "You decline " + mDesc + " from " + mFromName + "."; | 1283 | log_message = "You decline " + mDesc + " from " + mFromName + "."; |
1280 | chat.mText = log_message; | 1284 | chat.mText = log_message; |
1281 | if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 | 1285 | if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isGod(mFromName) ) // muting for SL-42269 |
1282 | { | 1286 | { |
1283 | chat.mMuted = TRUE; | 1287 | chat.mMuted = TRUE; |
1284 | } | 1288 | } |
@@ -1566,12 +1570,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1566 | 1570 | ||
1567 | BOOL is_busy = gAgent.getBusy(); | 1571 | BOOL is_busy = gAgent.getBusy(); |
1568 | BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat); | 1572 | BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat); |
1569 | BOOL is_linden = LLMuteList::getInstance()->isLinden(name); | 1573 | BOOL is_god = LLMuteList::getInstance()->isGod(name); |
1570 | BOOL is_owned_by_me = FALSE; | 1574 | BOOL is_owned_by_me = FALSE; |
1571 | 1575 | ||
1572 | LLUUID computed_session_id = LLIMMgr::computeSessionID(dialog,from_id); | 1576 | LLUUID computed_session_id = LLIMMgr::computeSessionID(dialog,from_id); |
1573 | 1577 | ||
1574 | chat.mMuted = is_muted && !is_linden; | 1578 | chat.mMuted = is_muted && !is_god; |
1575 | chat.mFromID = from_id; | 1579 | chat.mFromID = from_id; |
1576 | chat.mFromName = name; | 1580 | chat.mFromName = name; |
1577 | chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; | 1581 | chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; |
@@ -1582,14 +1586,135 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1582 | is_owned_by_me = source->permYouOwner(); | 1586 | is_owned_by_me = source->permYouOwner(); |
1583 | } | 1587 | } |
1584 | 1588 | ||
1589 | #if USE_OTR // [$PLOTR$] | ||
1590 | std::string decrypted_msg; | ||
1591 | bool encrypted = false; | ||
1592 | // if ((CHAT_SOURCE_SYSTEM == chat.mSourceType) && | ||
1593 | // ((std::string::npos != message.find("not online")) || | ||
1594 | // (std::string::npos != message.find("stored and delivered later")))) | ||
1595 | // { | ||
1596 | // llinfos << "$PLOTR$ Looks like " << from_id << " went offline." << llendl; | ||
1597 | // } | ||
1598 | U32 otrpref = gSavedSettings.getU32("EmeraldUseOTR"); | ||
1599 | // otrpref: 0 == Require use of OTR in IMs, 1 == Request OTR if available, 2 == Accept OTR requests, 3 == Decline use of OTR | ||
1600 | if ((otrpref != 3) && !is_muted && (chat.mSourceType == CHAT_SOURCE_AGENT)) | ||
1601 | { | ||
1602 | int ignore_message = 0; | ||
1603 | char *newmessage = NULL; | ||
1604 | OtrlTLV *tlvs = NULL; | ||
1605 | char my_uuid[UUID_STR_SIZE]; | ||
1606 | char their_uuid[UUID_STR_SIZE]; | ||
1607 | |||
1608 | if (gOTR && | ||
1609 | ((IM_NOTHING_SPECIAL == dialog) || | ||
1610 | ((IM_TYPING_STOP == dialog) && | ||
1611 | (! ((message == "typing") || (message == "cryo::ping")))))) | ||
1612 | { | ||
1613 | // only try OTR for 1 on 1 IM's or special tagged typing_stop packets | ||
1614 | gAgent.getID().toString(&(my_uuid[0])); | ||
1615 | from_id.toString(&(their_uuid[0])); | ||
1616 | ignore_message = otrl_message_receiving( | ||
1617 | gOTR->get_userstate(), | ||
1618 | gOTR->get_uistate(), | ||
1619 | &session_id, | ||
1620 | my_uuid, | ||
1621 | gOTR->get_protocolid(), | ||
1622 | their_uuid, | ||
1623 | &(message[0]), &newmessage, | ||
1624 | &tlvs, | ||
1625 | NULL, NULL); | ||
1626 | } | ||
1627 | if (tlvs) | ||
1628 | { | ||
1629 | llinfos << "$PLOTR$ recieved TLVs" << llendl; | ||
1630 | LLUUID session = LLIMMgr::computeSessionID(dialog,from_id); | ||
1631 | |||
1632 | if(!otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED)) | ||
1633 | { | ||
1634 | // currently the only TLVs we deal with are SMP, and they require an IM panel | ||
1635 | if(!gIMMgr->hasSession(session)) | ||
1636 | { | ||
1637 | gIMMgr->addSession(name,IM_NOTHING_SPECIAL,from_id); | ||
1638 | } | ||
1639 | |||
1640 | } | ||
1641 | LLFloaterIMPanel* pan = gIMMgr->findFloaterBySession(session); | ||
1642 | if (pan) pan->handleOtrTlvs(tlvs); | ||
1643 | otrl_tlv_free(tlvs); | ||
1644 | } | ||
1645 | if (1 == ignore_message) | ||
1646 | { | ||
1647 | OtrlMessageType msgtype = otrl_proto_message_type(&(message[0])); | ||
1648 | if (OTRL_MSGTYPE_NOTOTR == msgtype) | ||
1649 | { | ||
1650 | llinfos << "$PLOTR$ [not otr, but to be ignored (" << message << ")]" << llendl; | ||
1651 | if ((0 == otrpref) && (IM_NOTHING_SPECIAL == dialog) && !is_muted) | ||
1652 | { | ||
1653 | LLUUID session = LLIMMgr::computeSessionID(dialog,from_id); | ||
1654 | if(!gIMMgr->hasSession(session)) | ||
1655 | { | ||
1656 | gIMMgr->addSession(name,IM_NOTHING_SPECIAL,from_id); | ||
1657 | } | ||
1658 | // NOT deliver_otr_message since those might go via typing_stop | ||
1659 | deliver_message( // $TODO$ move the following message to some .xml file | ||
1660 | "/me's settings require OTR encrypted instant messages. Your message was not displayed.", | ||
1661 | session, from_id, IM_NOTHING_SPECIAL); | ||
1662 | LLFloaterIMPanel* pan = gIMMgr->findFloaterBySession(session); | ||
1663 | if(pan)pan->doOtrStart(); | ||
1664 | } | ||
1665 | } | ||
1666 | else | ||
1667 | { | ||
1668 | // an internal OTR protocol message was recieved, don't show anything to the user | ||
1669 | llinfos << "$PLOTR$ [OTR PROTOCOL MESSAGE (" << message << ")]" << llendl; | ||
1670 | } | ||
1671 | otr_show_status(session_id); | ||
1672 | return; | ||
1673 | } | ||
1674 | if (newmessage) | ||
1675 | { | ||
1676 | // message was processed by OTR. Maybe decrypted, maybe just stripping off the | ||
1677 | // white-space "I have OTR" tag | ||
1678 | decrypted_msg = newmessage; // use processed message | ||
1679 | message = newmessage; // use processed message | ||
1680 | otrl_message_free(newmessage); | ||
1681 | ConnContext *context = otrl_context_find( | ||
1682 | gOTR->get_userstate(), | ||
1683 | their_uuid, | ||
1684 | my_uuid, | ||
1685 | gOTR->get_protocolid(), | ||
1686 | 0, NULL, NULL, NULL); | ||
1687 | encrypted = (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate)); | ||
1688 | if (IM_TYPING_STOP == dialog) | ||
1689 | { | ||
1690 | if ("typing" == message) return; // don't display whitespace tagged "typing" stop messages | ||
1691 | dialog = IM_NOTHING_SPECIAL; // display messages received in typing_stop packets | ||
1692 | } | ||
1693 | } | ||
1694 | } | ||
1695 | |||
1696 | #endif // USE_OTR // [/$PLOTR$] | ||
1697 | |||
1585 | std::string separator_string(": "); | 1698 | std::string separator_string(": "); |
1586 | int message_offset = 0; | 1699 | int message_offset = 0; |
1587 | 1700 | ||
1701 | #if USE_OTR // [$PLOTR$] | ||
1702 | if(encrypted) | ||
1703 | { | ||
1704 | separator_string = "\xe2\x80\xa7: "; | ||
1705 | message = decrypted_msg; | ||
1706 | } | ||
1707 | #endif // USE_OTR // [/$PLOTR$] | ||
1708 | |||
1588 | //Handle IRC styled /me messages. | 1709 | //Handle IRC styled /me messages. |
1589 | std::string prefix = message.substr(0, 4); | 1710 | std::string prefix = message.substr(0, 4); |
1590 | if (prefix == "/me " || prefix == "/me'") | 1711 | if (prefix == "/me " || prefix == "/me'") |
1591 | { | 1712 | { |
1713 | #if USE_OTR // [$PLOTR$] | ||
1714 | separator_string = encrypted ? "\xe2\x80\xa7" : ""; | ||
1715 | #else | ||
1592 | separator_string = ""; | 1716 | separator_string = ""; |
1717 | #endif // USE_OTR // [/$PLOTR$] | ||
1593 | message_offset = 3; | 1718 | message_offset = 3; |
1594 | } | 1719 | } |
1595 | 1720 | ||
@@ -1848,7 +1973,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1848 | { | 1973 | { |
1849 | case IM_CONSOLE_AND_CHAT_HISTORY: | 1974 | case IM_CONSOLE_AND_CHAT_HISTORY: |
1850 | // These are used for system messages, hence don't need the name, | 1975 | // These are used for system messages, hence don't need the name, |
1851 | // as it is always "Imprudence". | 1976 | // as it is always "Imprudence". Or "meta-impy" maybe? shrugs |
1852 | // *TODO:translate | 1977 | // *TODO:translate |
1853 | args["MESSAGE"] = message; | 1978 | args["MESSAGE"] = message; |
1854 | 1979 | ||
@@ -1875,9 +2000,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1875 | gIMMgr->processIMTypingStop(im_info); | 2000 | gIMMgr->processIMTypingStop(im_info); |
1876 | } | 2001 | } |
1877 | // [/RLVa:KB] | 2002 | // [/RLVa:KB] |
1878 | // else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) | 2003 | // else if (offline == IM_ONLINE && !is_god && is_busy && name != SYSTEM_FROM) |
1879 | // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | 2004 | // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) |
1880 | else if ( (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) && | 2005 | else if ( (offline == IM_ONLINE && !is_god && is_busy && name != SYSTEM_FROM) && |
1881 | ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, from_id))) ) | 2006 | ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, from_id))) ) |
1882 | // [/RLVa:KB] | 2007 | // [/RLVa:KB] |
1883 | { | 2008 | { |
@@ -1937,9 +2062,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1937 | else if (to_id.isNull()) | 2062 | else if (to_id.isNull()) |
1938 | { | 2063 | { |
1939 | // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | 2064 | // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) |
1940 | // Filter region messages that weren't sent by a Linden | 2065 | // Filter region messages that weren't sent by a god |
1941 | if ( (rlv_handler_t::isEnabled()) && (LLMuteList::getInstance()) && | 2066 | if ( (rlv_handler_t::isEnabled()) && (LLMuteList::getInstance()) && |
1942 | (!LLMuteList::getInstance()->isLinden(name)) && (from_id != gAgent.getID()) ) | 2067 | (!LLMuteList::getInstance()->isGod(name)) && (from_id != gAgent.getID()) ) |
1943 | { | 2068 | { |
1944 | if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) | 2069 | if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) |
1945 | gRlvHandler.filterLocation(message); | 2070 | gRlvHandler.filterLocation(message); |
@@ -1984,7 +2109,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1984 | 2109 | ||
1985 | LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; | 2110 | LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; |
1986 | 2111 | ||
1987 | if (!is_muted || is_linden) | 2112 | if (!is_muted || is_god) |
1988 | { | 2113 | { |
1989 | gIMMgr->addMessage( | 2114 | gIMMgr->addMessage( |
1990 | session_id, | 2115 | session_id, |
@@ -2130,7 +2255,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
2130 | break; | 2255 | break; |
2131 | case IM_GROUP_INVITATION: | 2256 | case IM_GROUP_INVITATION: |
2132 | { | 2257 | { |
2133 | //if (!is_linden && (is_busy || is_muted)) | 2258 | //if (!is_god && (is_busy || is_muted)) |
2134 | if ((is_busy || is_muted)) | 2259 | if ((is_busy || is_muted)) |
2135 | { | 2260 | { |
2136 | LLMessageSystem *msg = gMessageSystem; | 2261 | LLMessageSystem *msg = gMessageSystem; |
@@ -2297,7 +2422,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
2297 | 2422 | ||
2298 | case IM_SESSION_SEND: | 2423 | case IM_SESSION_SEND: |
2299 | { | 2424 | { |
2300 | if (!is_linden && is_busy) | 2425 | if (!is_god && is_busy) |
2301 | { | 2426 | { |
2302 | return; | 2427 | return; |
2303 | } | 2428 | } |
@@ -2922,14 +3047,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2922 | BOOL is_busy = gAgent.getBusy(); | 3047 | BOOL is_busy = gAgent.getBusy(); |
2923 | 3048 | ||
2924 | BOOL is_muted = FALSE; | 3049 | BOOL is_muted = FALSE; |
2925 | BOOL is_linden = FALSE; | 3050 | BOOL is_god = FALSE; |
2926 | is_muted = LLMuteList::getInstance()->isMuted( | 3051 | is_muted = LLMuteList::getInstance()->isMuted( |
2927 | from_id, | 3052 | from_id, |
2928 | from_name, | 3053 | from_name, |
2929 | LLMute::flagTextChat) | 3054 | LLMute::flagTextChat) |
2930 | || LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagTextChat); | 3055 | || LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagTextChat); |
2931 | is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT && | 3056 | is_god = chat.mSourceType != CHAT_SOURCE_OBJECT && |
2932 | LLMuteList::getInstance()->isLinden(from_name); | 3057 | LLMuteList::getInstance()->isGod(from_name); |
2933 | 3058 | ||
2934 | BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible); | 3059 | BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible); |
2935 | chatter = gObjectList.findObject(from_id); | 3060 | chatter = gObjectList.findObject(from_id); |
@@ -2958,7 +3083,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2958 | 3083 | ||
2959 | // record last audible utterance | 3084 | // record last audible utterance |
2960 | if (is_audible | 3085 | if (is_audible |
2961 | && (is_linden || (!is_muted && !is_busy))) | 3086 | && (is_god || (!is_muted && !is_busy))) |
2962 | { | 3087 | { |
2963 | if (chat.mChatType != CHAT_TYPE_START | 3088 | if (chat.mChatType != CHAT_TYPE_START |
2964 | && chat.mChatType != CHAT_TYPE_STOP) | 3089 | && chat.mChatType != CHAT_TYPE_STOP) |
@@ -3286,7 +3411,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
3286 | } | 3411 | } |
3287 | 3412 | ||
3288 | // truth table: | 3413 | // truth table: |
3289 | // LINDEN BUSY MUTED OWNED_BY_YOU TASK DISPLAY STORE IN HISTORY | 3414 | // GOD BUSY MUTED OWNED_BY_YOU TASK DISPLAY STORE IN HISTORY |
3290 | // F F F F * Yes Yes | 3415 | // F F F F * Yes Yes |
3291 | // F F F T * Yes Yes | 3416 | // F F F T * Yes Yes |
3292 | // F F T F * No No | 3417 | // F F T F * No No |
@@ -3297,11 +3422,11 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
3297 | // F T T T * No No | 3422 | // F T T T * No No |
3298 | // T * * * F Yes Yes | 3423 | // T * * * F Yes Yes |
3299 | 3424 | ||
3300 | chat.mMuted = is_muted && !is_linden; | 3425 | chat.mMuted = is_muted && !is_god; |
3301 | 3426 | ||
3302 | 3427 | ||
3303 | if (!visible_in_chat_bubble | 3428 | if (!visible_in_chat_bubble |
3304 | && (is_linden || !is_busy || is_owned_by_me)) | 3429 | && (is_god || !is_busy || is_owned_by_me)) |
3305 | { | 3430 | { |
3306 | // show on screen and add to history | 3431 | // show on screen and add to history |
3307 | check_translate_chat(mesg, chat, FALSE); | 3432 | check_translate_chat(mesg, chat, FALSE); |
@@ -5295,7 +5420,7 @@ void process_alert_core(const std::string& message, BOOL modal) | |||
5295 | else if( message == "Home position set." ) | 5420 | else if( message == "Home position set." ) |
5296 | { | 5421 | { |
5297 | // save the home location image to disk | 5422 | // save the home location image to disk |
5298 | std::string snap_filename = gDirUtilp->getLindenUserDir(); | 5423 | std::string snap_filename = gDirUtilp->getViewerUserDir(); |
5299 | snap_filename += gDirUtilp->getDirDelimiter(); | 5424 | snap_filename += gDirUtilp->getDirDelimiter(); |
5300 | snap_filename += SCREEN_HOME_FILENAME; | 5425 | snap_filename += SCREEN_HOME_FILENAME; |
5301 | gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, FALSE); | 5426 | gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, FALSE); |
@@ -6650,7 +6775,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**) | |||
6650 | } | 6775 | } |
6651 | else | 6776 | else |
6652 | { | 6777 | { |
6653 | covenant_text = "There is no Covenant provided for this Estate. The land on this estate is being sold by the Estate owner, not Linden Lab. Please contact the Estate Owner for sales details."; | 6778 | covenant_text = "There is no Covenant provided for this Estate. The land on this estate is being sold by the Estate owner, not the grid owners. Please contact the Estate Owner for sales details."; |
6654 | } | 6779 | } |
6655 | LLPanelEstateCovenant::updateCovenantText(covenant_text, covenant_id); | 6780 | LLPanelEstateCovenant::updateCovenantText(covenant_text, covenant_id); |
6656 | LLPanelLandCovenant::updateCovenantText(covenant_text); | 6781 | LLPanelLandCovenant::updateCovenantText(covenant_text); |