diff options
| author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2025-04-02 17:22:17 +0300 | 
|---|---|---|
| committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2025-04-02 17:22:17 +0300 | 
| commit | db2c45ba23a10d34d89f556533f80a8b42600bf6 (patch) | |
| tree | 6f520194e83afd272f40935d4771dab5ea3c7e6e /indra/newview/llfloaterimnearbychatlistener.cpp | |
| parent | d77954ef50f300846eb14034a8dde3e4d7064dcf (diff) | |
#3857 pick new and updated LEAP functions from develop branch
Diffstat (limited to 'indra/newview/llfloaterimnearbychatlistener.cpp')
| -rw-r--r-- | indra/newview/llfloaterimnearbychatlistener.cpp | 34 | 
1 files changed, 17 insertions, 17 deletions
diff --git a/indra/newview/llfloaterimnearbychatlistener.cpp b/indra/newview/llfloaterimnearbychatlistener.cpp index 43173d3680..b15a32ce40 100644 --- a/indra/newview/llfloaterimnearbychatlistener.cpp +++ b/indra/newview/llfloaterimnearbychatlistener.cpp @@ -34,12 +34,12 @@  #include "llagent.h"  #include "llchat.h"  #include "llviewercontrol.h" +#include "stringize.h" +static const F32 CHAT_THROTTLE_PERIOD = 1.f; -LLFloaterIMNearbyChatListener::LLFloaterIMNearbyChatListener(LLFloaterIMNearbyChat & chatbar) -  : LLEventAPI("LLChatBar", -               "LLChatBar listener to (e.g.) sendChat, etc."), -    mChatbar(chatbar) +LLFloaterIMNearbyChatListener::LLFloaterIMNearbyChatListener() : +    LLEventAPI("LLChatBar", "LLChatBar listener to (e.g.) sendChat, etc.")  {      add("sendChat",          "Send chat to the simulator:\n" @@ -49,10 +49,18 @@ LLFloaterIMNearbyChatListener::LLFloaterIMNearbyChatListener(LLFloaterIMNearbyCh          &LLFloaterIMNearbyChatListener::sendChat);  } -  // "sendChat" command -void LLFloaterIMNearbyChatListener::sendChat(LLSD const & chat_data) const +void LLFloaterIMNearbyChatListener::sendChat(LLSD const& chat_data)  { +    F64 cur_time = LLTimer::getElapsedSeconds(); + +    if (cur_time < mLastThrottleTime + CHAT_THROTTLE_PERIOD) +    { +        LL_WARNS("LLFloaterIMNearbyChatListener") << "'sendChat' was  throttled" << LL_ENDL; +        return; +    } +    mLastThrottleTime = cur_time; +      // Extract the data      std::string chat_text = chat_data["message"].asString(); @@ -81,20 +89,12 @@ void LLFloaterIMNearbyChatListener::sendChat(LLSD const & chat_data) const      }      // Have to prepend /42 style channel numbers -    std::string chat_to_send; -    if (channel == 0) -    { -        chat_to_send = chat_text; -    } -    else +    if (channel)      { -        chat_to_send += "/"; -        chat_to_send += chat_data["channel"].asString(); -        chat_to_send += " "; -        chat_to_send += chat_text; +        chat_text = stringize("/", chat_data["channel"].asString(), " ", chat_text);      }      // Send it as if it was typed in -    mChatbar.sendChatFromViewer(chat_to_send, type_o_chat, ((bool)(channel == 0)) && gSavedSettings.getBOOL("PlayChatAnim")); +    LLFloaterIMNearbyChat::sendChatFromViewer(chat_text, type_o_chat, (channel == 0) && gSavedSettings.getBOOL("PlayChatAnim"));  }  | 
