From 1350365769bca149311d3713350ab3809a8e5333 Mon Sep 17 00:00:00 2001 From: phr0z3nt04st Date: Sun, 23 May 2010 21:46:04 -0500 Subject: [PATCH] Added negative channels to the chat bar. --- indra/newview/llchatbar.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 04474bd5d..1f8aaae68 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -340,11 +340,17 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) } else if (mesg[0] == '/' && mesg[1] - && LLStringOps::isDigit(mesg[1])) + && ( LLStringOps::isDigit(mesg[1]) + // + || mesg[1] == '-' )) + // { // This a special "/20" speak on a channel S32 pos = 0; - + // + if(mesg[1] == '-') + pos++; + // // Copy the channel number into a string LLWString channel_string; llwchar c; @@ -366,6 +372,10 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) } mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); + // + if(mesg[1] == '-') + mLastSpecialChatChannel = -mLastSpecialChatChannel; + // *channel = mLastSpecialChatChannel; return mesg.substr(pos, mesg.length() - pos); } @@ -630,6 +640,10 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) { LLMessageSystem* msg = gMessageSystem; + // + if(channel >= 0) + { + // msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -638,7 +652,21 @@ void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 msg->addStringFast(_PREHASH_Message, utf8_out_text); msg->addU8Fast(_PREHASH_Type, type); msg->addS32("Channel", channel); - + // + } + else + { + msg->newMessage("ScriptDialogReply"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("Data"); + msg->addUUID("ObjectID", gAgent.getID()); + msg->addS32("ChatChannel", channel); + msg->addS32("ButtonIndex", 0); + msg->addString("ButtonLabel", utf8_out_text); + } + // gAgent.sendReliableMessage(); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT);