diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llviewermessage.cpp | 152 |
1 files changed, 61 insertions, 91 deletions
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index 4973989..87ff5aa 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp | |||
@@ -787,15 +787,15 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) | |||
787 | if (check_offer_throttle(from_name, false)) | 787 | if (check_offer_throttle(from_name, false)) |
788 | { | 788 | { |
789 | // I'm not sure this is a good idea. JC | 789 | // I'm not sure this is a good idea. JC |
790 | // bool show_keep_discard = item->getPermissions().getCreator() != gAgent.getID(); | 790 | bool show_keep_discard = item->getPermissions().getCreator() != gAgent.getID(); |
791 | bool show_keep_discard = true; | 791 | //bool show_keep_discard = true; |
792 | switch(item->getType()) | 792 | switch(item->getType()) |
793 | { | 793 | { |
794 | case LLAssetType::AT_NOTECARD: | 794 | case LLAssetType::AT_NOTECARD: |
795 | open_notecard(*it, LLString("Note: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); | 795 | open_notecard((LLViewerInventoryItem*)item, LLString("Note: ") + item->getName(), LLUUID::null, show_keep_discard, LLUUID::null, FALSE); |
796 | break; | 796 | break; |
797 | case LLAssetType::AT_LANDMARK: | 797 | case LLAssetType::AT_LANDMARK: |
798 | open_landmark(*it, LLString("Landmark: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); | 798 | open_landmark((LLViewerInventoryItem*)item, LLString("Landmark: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); |
799 | break; | 799 | break; |
800 | case LLAssetType::AT_TEXTURE: | 800 | case LLAssetType::AT_TEXTURE: |
801 | open_texture(*it, LLString("Texture: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); | 801 | open_texture(*it, LLString("Texture: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); |
@@ -850,7 +850,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, | |||
850 | const char* first_name, | 850 | const char* first_name, |
851 | const char* last_name, | 851 | const char* last_name, |
852 | BOOL is_group, | 852 | BOOL is_group, |
853 | void*) | 853 | void* user_data) |
854 | { | 854 | { |
855 | LLString from_name; | 855 | LLString from_name; |
856 | LLMute::EType type; | 856 | LLMute::EType type; |
@@ -874,10 +874,35 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, | |||
874 | gFloaterMute->show(); | 874 | gFloaterMute->show(); |
875 | gFloaterMute->selectMute(blocked_id); | 875 | gFloaterMute->selectMute(blocked_id); |
876 | } | 876 | } |
877 | |||
878 | // purge the offer queue of any previously queued inventory offers from the same source. | ||
879 | LLView::child_list_t notification_queue(*(gNotifyBoxView->getChildList())); | ||
880 | for(LLView::child_list_iter_t iter = notification_queue.begin(); | ||
881 | iter != notification_queue.end(); | ||
882 | iter++) | ||
883 | { | ||
884 | LLNotifyBox* notification = (LLNotifyBox*)*iter; | ||
885 | // scan for other inventory offers (i.e. ignore other types of notifications). | ||
886 | // we can tell by looking for the associated callback they were created with. | ||
887 | if(notification->getNotifyCallback() == inventory_offer_callback) | ||
888 | { | ||
889 | // found one. | ||
890 | // safe to downcast user data because we know it's associated with offer callback. | ||
891 | LLOfferInfo* offer_data = (LLOfferInfo*)notification->getUserData(); | ||
892 | if(offer_data == user_data) | ||
893 | { | ||
894 | continue; // don't remove the msg triggering us. it will be dequeued normally. | ||
895 | } | ||
896 | if(offer_data->mFromID == blocked_id) | ||
897 | { | ||
898 | gNotifyBoxView->removeChild(notification); | ||
899 | } | ||
900 | } | ||
901 | } | ||
877 | } | 902 | } |
878 | 903 | ||
879 | void inventory_offer_callback(S32 option, void* user_data) | 904 | void inventory_offer_callback(S32 button, void* user_data) |
880 | { | 905 | { |
881 | LLChat chat; | 906 | LLChat chat; |
882 | LLString log_message; | 907 | LLString log_message; |
883 | 908 | ||
@@ -889,9 +914,9 @@ void inventory_offer_callback(S32 option, void* user_data) | |||
889 | // * callback may be called immediately, | 914 | // * callback may be called immediately, |
890 | // * adding the mute sends a message, | 915 | // * adding the mute sends a message, |
891 | // * we can't build two messages at once. JC | 916 | // * we can't build two messages at once. JC |
892 | if (option == 2) | 917 | if (2 == button) |
893 | { | 918 | { |
894 | gCacheName->get(info->mFromID, info->mFromGroup, inventory_offer_mute_callback, NULL); | 919 | gCacheName->get(info->mFromID, info->mFromGroup, inventory_offer_mute_callback, user_data); |
895 | } | 920 | } |
896 | 921 | ||
897 | LLMessageSystem* msg = gMessageSystem; | 922 | LLMessageSystem* msg = gMessageSystem; |
@@ -922,7 +947,8 @@ void inventory_offer_callback(S32 option, void* user_data) | |||
922 | } | 947 | } |
923 | 948 | ||
924 | // XUI:translate | 949 | // XUI:translate |
925 | LLString from_string; | 950 | LLString from_string; // Used in the pop-up. |
951 | LLString chatHistory_string; // Used in chat history. | ||
926 | if (info->mFromObject == TRUE) | 952 | if (info->mFromObject == TRUE) |
927 | { | 953 | { |
928 | if (info->mFromGroup) | 954 | if (info->mFromGroup) |
@@ -931,10 +957,12 @@ void inventory_offer_callback(S32 option, void* user_data) | |||
931 | if (gCacheName->getGroupName(info->mFromID, group_name)) | 957 | if (gCacheName->getGroupName(info->mFromID, group_name)) |
932 | { | 958 | { |
933 | from_string = LLString("An object named '") + info->mFromName + "' owned by the group '" + group_name + "'"; | 959 | from_string = LLString("An object named '") + info->mFromName + "' owned by the group '" + group_name + "'"; |
960 | chatHistory_string = info->mFromName + " owned by the group '" + group_name + "'"; | ||
934 | } | 961 | } |
935 | else | 962 | else |
936 | { | 963 | { |
937 | from_string = LLString("An object named '") + info->mFromName + "' owned by an unknown group"; | 964 | from_string = LLString("An object named '") + info->mFromName + "' owned by an unknown group"; |
965 | chatHistory_string = info->mFromName + " owned by an unknown group"; | ||
938 | } | 966 | } |
939 | } | 967 | } |
940 | else | 968 | else |
@@ -944,21 +972,23 @@ void inventory_offer_callback(S32 option, void* user_data) | |||
944 | if (gCacheName->getName(info->mFromID, first_name, last_name)) | 972 | if (gCacheName->getName(info->mFromID, first_name, last_name)) |
945 | { | 973 | { |
946 | from_string = LLString("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; | 974 | from_string = LLString("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; |
975 | chatHistory_string = info->mFromName + " owned by " + first_name + " " + last_name; | ||
947 | } | 976 | } |
948 | else | 977 | else |
949 | { | 978 | { |
950 | from_string = LLString("An object named '") + info->mFromName + "' owned by an unknown user"; | 979 | from_string = LLString("An object named '") + info->mFromName + "' owned by an unknown user"; |
980 | chatHistory_string = info->mFromName + " owned by an unknown user"; | ||
951 | } | 981 | } |
952 | } | 982 | } |
953 | } | 983 | } |
954 | else | 984 | else |
955 | { | 985 | { |
956 | from_string = info->mFromName; | 986 | from_string = chatHistory_string = info->mFromName; |
957 | } | 987 | } |
958 | 988 | ||
959 | bool busy=FALSE; | 989 | bool busy=FALSE; |
960 | 990 | ||
961 | switch(option) | 991 | switch(button) |
962 | { | 992 | { |
963 | case IOR_ACCEPT: | 993 | case IOR_ACCEPT: |
964 | // ACCEPT. The math for the dialog works, because the accept | 994 | // ACCEPT. The math for the dialog works, because the accept |
@@ -975,7 +1005,7 @@ void inventory_offer_callback(S32 option, void* user_data) | |||
975 | //don't spam them if they are getting flooded | 1005 | //don't spam them if they are getting flooded |
976 | if (check_offer_throttle(info->mFromName, true)) | 1006 | if (check_offer_throttle(info->mFromName, true)) |
977 | { | 1007 | { |
978 | log_message = info->mFromName + " gave you " + info->mDesc + "."; | 1008 | log_message = chatHistory_string + " gave you " + info->mDesc + "."; |
979 | chat.mText = log_message; | 1009 | chat.mText = log_message; |
980 | LLFloaterChat::addChatHistory(chat); | 1010 | LLFloaterChat::addChatHistory(chat); |
981 | } | 1011 | } |
@@ -1017,7 +1047,7 @@ void inventory_offer_callback(S32 option, void* user_data) | |||
1017 | default: | 1047 | default: |
1018 | llwarns << "inventory_offer_callback: unknown offer type" << llendl; | 1048 | llwarns << "inventory_offer_callback: unknown offer type" << llendl; |
1019 | break; | 1049 | break; |
1020 | } | 1050 | } // end switch (info->mIM) |
1021 | break; | 1051 | break; |
1022 | 1052 | ||
1023 | case IOR_BUSY: | 1053 | case IOR_BUSY: |
@@ -1040,6 +1070,10 @@ void inventory_offer_callback(S32 option, void* user_data) | |||
1040 | 1070 | ||
1041 | log_message = "You decline " + info->mDesc + " from " + info->mFromName + "."; | 1071 | log_message = "You decline " + info->mDesc + " from " + info->mFromName + "."; |
1042 | chat.mText = log_message; | 1072 | chat.mText = log_message; |
1073 | if( gMuteListp->isMuted(info->mFromID ) && ! gMuteListp->isLinden(info->mFromName) ) // muting for SL-42269 | ||
1074 | { | ||
1075 | chat.mMuted = TRUE; | ||
1076 | } | ||
1043 | LLFloaterChat::addChatHistory(chat); | 1077 | LLFloaterChat::addChatHistory(chat); |
1044 | 1078 | ||
1045 | // If it's from an agent, we have to fetch the item to throw | 1079 | // If it's from an agent, we have to fetch the item to throw |
@@ -1086,7 +1120,6 @@ void inventory_offer_callback(S32 option, void* user_data) | |||
1086 | 1120 | ||
1087 | void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) | 1121 | void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) |
1088 | { | 1122 | { |
1089 | |||
1090 | //Until throttling is implmented, busy mode should reject inventory instead of silently | 1123 | //Until throttling is implmented, busy mode should reject inventory instead of silently |
1091 | //accepting it. SEE SL-39554 | 1124 | //accepting it. SEE SL-39554 |
1092 | if (gAgent.getBusy()) | 1125 | if (gAgent.getBusy()) |
@@ -1101,15 +1134,15 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) | |||
1101 | inventory_offer_callback(IOR_MUTE, info); | 1134 | inventory_offer_callback(IOR_MUTE, info); |
1102 | return; | 1135 | return; |
1103 | } | 1136 | } |
1104 | 1137 | ||
1105 | if (gSavedSettings.getBOOL("ShowNewInventory") | 1138 | // Avoid the Accept/Discard dialog if the user so desires. JC |
1139 | if (gSavedSettings.getBOOL("AutoAcceptNewInventory") | ||
1106 | && (info->mType == LLAssetType::AT_NOTECARD | 1140 | && (info->mType == LLAssetType::AT_NOTECARD |
1107 | || info->mType == LLAssetType::AT_LANDMARK | 1141 | || info->mType == LLAssetType::AT_LANDMARK |
1108 | || info->mType == LLAssetType::AT_TEXTURE)) | 1142 | || info->mType == LLAssetType::AT_TEXTURE)) |
1109 | { | 1143 | { |
1110 | // For certain types, just accept the items into the inventory, | 1144 | // For certain types, just accept the items into the inventory, |
1111 | // and we'll automatically open them on receipt. | 1145 | // and possibly open them on receipt depending upon "ShowNewInventory". |
1112 | // 0 = accept button | ||
1113 | inventory_offer_callback(IOR_ACCEPT, info); | 1146 | inventory_offer_callback(IOR_ACCEPT, info); |
1114 | return; | 1147 | return; |
1115 | } | 1148 | } |
@@ -1678,86 +1711,23 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1678 | } | 1711 | } |
1679 | break; | 1712 | break; |
1680 | 1713 | ||
1681 | case IM_SESSION_911_SEND: | 1714 | case IM_SESSION_SEND: |
1682 | { | 1715 | { |
1683 | //this is just the same code as IM_SESSION_SEND for a bit | ||
1684 | //I was too lazy to make this a function....sorry - jwolk | ||
1685 | if (!is_linden && is_busy) | 1716 | if (!is_linden && is_busy) |
1686 | { | 1717 | { |
1687 | return; | 1718 | return; |
1688 | } | 1719 | } |
1689 | |||
1690 | // standard message, not from system | ||
1691 | char saved[MAX_STRING]; /* Flawfinder: ignore */ | ||
1692 | saved[0] = '\0'; | ||
1693 | if(offline == IM_OFFLINE) | ||
1694 | { | ||
1695 | char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ | ||
1696 | snprintf(saved, /* Flawfinder: ignore */ | ||
1697 | MAX_STRING, | ||
1698 | "(Saved %s) ", | ||
1699 | formatted_time(timestamp, time_buf)); | ||
1700 | } | ||
1701 | |||
1702 | snprintf(buffer, /* Flawfinder: ignore */ | ||
1703 | sizeof(buffer), | ||
1704 | "%s%s%s%s", | ||
1705 | name, | ||
1706 | separator_string, | ||
1707 | saved, | ||
1708 | (message+message_offset)); | ||
1709 | |||
1710 | BOOL is_this_agent = FALSE; | ||
1711 | if(from_id == gAgentID) | ||
1712 | { | ||
1713 | from_id = LLUUID::null; | ||
1714 | is_this_agent = TRUE; | ||
1715 | } | ||
1716 | |||
1717 | gIMView->addMessage( | ||
1718 | session_id, | ||
1719 | from_id, | ||
1720 | name, | ||
1721 | buffer, | ||
1722 | (char*)binary_bucket, | ||
1723 | IM_SESSION_ADD, | ||
1724 | parent_estate_id, | ||
1725 | region_id, | ||
1726 | position); | ||
1727 | 1720 | ||
1728 | snprintf(buffer, sizeof(buffer), "IM: %s%s%s%s", name, separator_string, saved, (message+message_offset)); /* Flawfinder: ignore */ | 1721 | // System messages, specifically "Foo Bar has left this session" |
1729 | chat.mText = buffer; | 1722 | // are not shown unless you actually have that session open. |
1730 | LLFloaterChat::addChat(chat, TRUE, is_this_agent); | 1723 | // Band-aid. JC |
1731 | 1724 | if (offline == IM_ONLINE | |
1732 | //ok, now we want to add a teleport button if we are receving | 1725 | && chat.mFromName == SYSTEM_FROM |
1733 | //a message from not ourself | 1726 | && !gIMView->hasSession(session_id)) |
1734 | LLFloaterIMPanel* panel = | ||
1735 | gIMView->findFloaterBySession(session_id); | ||
1736 | |||
1737 | if (panel && !is_this_agent ) | ||
1738 | { | ||
1739 | //don't add a teleport button for yourself | ||
1740 | panel->addTeleportButton(); | ||
1741 | } | ||
1742 | break; | ||
1743 | } | ||
1744 | case IM_SESSION_SEND: | ||
1745 | { | ||
1746 | if (!is_linden && is_busy) | ||
1747 | { | 1727 | { |
1748 | return; | 1728 | return; |
1749 | } | 1729 | } |
1750 | 1730 | ||
1751 | // System messages, specifically "Foo Bar has left this session" | ||
1752 | // are not shown unless you actually have that session open. | ||
1753 | // Band-aid. JC | ||
1754 | if (offline == IM_ONLINE | ||
1755 | && chat.mFromName == SYSTEM_FROM | ||
1756 | && !gIMView->hasSession(session_id)) | ||
1757 | { | ||
1758 | return; | ||
1759 | } | ||
1760 | |||
1761 | // standard message, not from system | 1731 | // standard message, not from system |
1762 | char saved[MAX_STRING]; /* Flawfinder: ignore */ | 1732 | char saved[MAX_STRING]; /* Flawfinder: ignore */ |
1763 | saved[0] = '\0'; | 1733 | saved[0] = '\0'; |
@@ -1782,7 +1752,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1782 | name, | 1752 | name, |
1783 | buffer, | 1753 | buffer, |
1784 | (char*)binary_bucket, | 1754 | (char*)binary_bucket, |
1785 | IM_SESSION_ADD, | 1755 | IM_SESSION_INVITE, |
1786 | parent_estate_id, | 1756 | parent_estate_id, |
1787 | region_id, | 1757 | region_id, |
1788 | position); | 1758 | position); |
@@ -2184,7 +2154,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2184 | if (chat.mSourceType == CHAT_SOURCE_OBJECT | 2154 | if (chat.mSourceType == CHAT_SOURCE_OBJECT |
2185 | && chat.mChatType != CHAT_TYPE_DEBUG_MSG) | 2155 | && chat.mChatType != CHAT_TYPE_DEBUG_MSG) |
2186 | { | 2156 | { |
2187 | LLViewerPartSourceChat *psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); | 2157 | LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); |
2188 | psc->setSourceObject(chatter); | 2158 | psc->setSourceObject(chatter); |
2189 | psc->setColor(color); | 2159 | psc->setColor(color); |
2190 | //We set the particles to be owned by the object's owner, | 2160 | //We set the particles to be owned by the object's owner, |