From 08a3d7c360b9da1bbeafa657ebd2237b876934a6 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 9 Oct 2014 13:23:41 +0200 Subject: [PATCH] Extend previous changes to take repeated channel send into account --- indra/newview/fsfloaternearbychat.cpp | 4 ++-- indra/newview/fsnearbychathub.cpp | 15 ++++++++------- indra/newview/fsnearbychathub.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 958fbe6d6f..9029910243 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -995,7 +995,7 @@ void FSFloaterNearbyChat::sendChat( EChatType type ) // Check if this is destined for another channel S32 channel = 0; bool is_set = false; - FSNearbyChat::stripChannelNumber(text, &channel, &is_set); + FSNearbyChat::stripChannelNumber(text, &channel, &sLastSpecialChatChannel, &is_set); // If "/" is not specified, see if a channel has been set in // the spinner. if (!is_set && @@ -1089,7 +1089,7 @@ void FSFloaterNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType t { S32 channel = 0; bool is_set = false; - LLWString out_text = FSNearbyChat::stripChannelNumber(wtext, &channel, &is_set); + LLWString out_text = FSNearbyChat::stripChannelNumber(wtext, &channel, &sLastSpecialChatChannel, &is_set); // If "/" is not specified, see if a channel has been set in // the spinner. if (!is_set && diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index f107065e6b..d8535f0834 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -263,7 +263,7 @@ void FSNearbyChat::sendChatFromViewer(const LLWString& wtext, EChatType type, BO // Look for "/20 foo" channel chats. S32 channel = 0; bool is_set = false; - LLWString out_text = stripChannelNumber(wtext, &channel, &is_set); + LLWString out_text = stripChannelNumber(wtext, &channel, &sLastSpecialChatChannel, &is_set); // If "/" is not specified, see if a channel has been set in // the spinner. if (!is_set && @@ -371,7 +371,7 @@ EChatType FSNearbyChat::processChatTypeTriggers(EChatType type, std::string &str // If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. // Otherwise returns input and channel 0. -LLWString FSNearbyChat::stripChannelNumber(const LLWString &mesg, S32* channel, bool* is_set) +LLWString FSNearbyChat::stripChannelNumber(const LLWString &mesg, S32* channel, S32* last_channel, bool* is_set) { *is_set = false; @@ -379,7 +379,8 @@ LLWString FSNearbyChat::stripChannelNumber(const LLWString &mesg, S32* channel, && mesg[1] == '/') { // This is a "repeat channel send" - *channel = sLastSpecialChatChannel; + *is_set = true; + *channel = *last_channel; return mesg.substr(2, mesg.length() - 2); } else if (mesg[0] == '/' @@ -424,15 +425,15 @@ LLWString FSNearbyChat::stripChannelNumber(const LLWString &mesg, S32* channel, pos++; } - sLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); + *last_channel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); // FIRE-11412: Allow saying /-channel for negative numbers // (this code was here; documenting for the future) if (mesg[1] == '-') { - sLastSpecialChatChannel = -sLastSpecialChatChannel; + *last_channel = -(*last_channel); } // FIRE-11412 - *channel = sLastSpecialChatChannel; + *channel = *last_channel; return mesg.substr(pos, mesg.length() - pos); } else @@ -459,7 +460,7 @@ void FSNearbyChat::sendChat(LLWString text, EChatType type) // Check if this is destined for another channel S32 channel = 0; bool is_set = false; - stripChannelNumber(text, &channel, &is_set); + stripChannelNumber(text, &channel, &sLastSpecialChatChannel, &is_set); // If "/" is not specified, see if a channel has been set in // the spinner. if (!is_set && diff --git a/indra/newview/fsnearbychathub.h b/indra/newview/fsnearbychathub.h index b17f5a2e7e..b205183f2e 100644 --- a/indra/newview/fsnearbychathub.h +++ b/indra/newview/fsnearbychathub.h @@ -55,7 +55,7 @@ public: void showDefaultChatBar(BOOL visible,const char* text=0) const; void sendChat(LLWString text,EChatType type); - static LLWString stripChannelNumber(const LLWString &mesg, S32* channel, bool* is_set); + static LLWString stripChannelNumber(const LLWString &mesg, S32* channel, S32* last_channel, bool* is_set); EChatType processChatTypeTriggers(EChatType type, std::string &str); void sendChatFromViewer(const std::string& utf8text, EChatType type, BOOL animate); void sendChatFromViewer(const LLWString& wtext, EChatType type, BOOL animate);