Extend previous changes to take repeated channel send into account

Ansariel 2014-10-09 13:23:41 +02:00
parent 1bff13ce0c
commit 08a3d7c360
3 changed files with 11 additions and 10 deletions

View File

@ -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 "/<number>" 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 "/<number>" is not specified, see if a channel has been set in
// the spinner.
if (!is_set &&

View File

@ -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 "/<number>" 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);
//<FS:TS> 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);
}
//</FS:TS> 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 "/<number>" is not specified, see if a channel has been set in
// the spinner.
if (!is_set &&

View File

@ -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);