summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimnearbychatlistener.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterimnearbychatlistener.cpp')
-rw-r--r--indra/newview/llfloaterimnearbychatlistener.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/indra/newview/llfloaterimnearbychatlistener.cpp b/indra/newview/llfloaterimnearbychatlistener.cpp
index e8fb510111..9093db282a 100644
--- a/indra/newview/llfloaterimnearbychatlistener.cpp
+++ b/indra/newview/llfloaterimnearbychatlistener.cpp
@@ -34,6 +34,7 @@
#include "llagent.h"
#include "llchat.h"
#include "llviewercontrol.h"
+#include "stringize.h"
static const F32 CHAT_THROTTLE_PERIOD = 1.f;
@@ -51,17 +52,16 @@ LLFloaterIMNearbyChatListener::LLFloaterIMNearbyChatListener()
// "sendChat" command
-void LLFloaterIMNearbyChatListener::sendChat(LLSD const & chat_data) const
+void LLFloaterIMNearbyChatListener::sendChat(LLSD const & chat_data)
{
- static F64 last_throttle_time = 0.0;
F64 cur_time = LLTimer::getElapsedSeconds();
- if (cur_time < last_throttle_time + CHAT_THROTTLE_PERIOD)
+ if (cur_time < mLastThrottleTime + CHAT_THROTTLE_PERIOD)
{
LL_DEBUGS("LLFloaterIMNearbyChatListener") << "'sendChat' was throttled" << LL_ENDL;
return;
}
- last_throttle_time = cur_time;
+ mLastThrottleTime = cur_time;
// Extract the data
std::string chat_text = LUA_PREFIX + chat_data["message"].asString();
@@ -91,20 +91,14 @@ void LLFloaterIMNearbyChatListener::sendChat(LLSD const & chat_data) const
}
// Have to prepend /42 style channel numbers
- std::string chat_to_send;
- if (channel == 0)
+ if (channel)
{
- chat_to_send = chat_text;
- }
- else
- {
- 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
- LLFloaterIMNearbyChat::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"));
}