diff --git a/indra/newview/alchatcommand.cpp b/indra/newview/alchatcommand.cpp index 7b86c1f7663536f14e507c26caf6e45c2d771576..13d42bef881ee3edd66a176656b7db9a124cc4e4 100644 --- a/indra/newview/alchatcommand.cpp +++ b/indra/newview/alchatcommand.cpp @@ -73,6 +73,7 @@ bool ALChatCommand::parseCommand(std::string data) static LLCachedControl<std::string> sMaptoCommand(gSavedSettings, "AlchemyChatCommandMapto", "/mapto"); static LLCachedControl<std::string> sClearCommand(gSavedSettings, "AlchemyChatCommandClearNearby", "/clr"); static LLCachedControl<std::string> sRegionMsgCommand(gSavedSettings, "AlchemyChatCommandRegionMessage", "/regionmsg"); + static LLCachedControl<std::string> sSetNearbyChatChannelCmd(gSavedSettings, "AlchemyChatCommandSetChatChannel", "/setchannel"); static LLCachedControl<std::string> sResyncAnimCommand(gSavedSettings, "AlchemyChatCommandResyncAnim", "/resync"); if (cmd == utf8str_tolower(sDrawDistanceCommand)) // dd @@ -240,6 +241,16 @@ bool ALChatCommand::parseCommand(std::string data) return true; } } + else if (cmd == utf8str_tolower(sSetNearbyChatChannelCmd)) // Set nearby chat channel + { + S32 chan; + if (input >> chan) + { + boost::lexical_cast<S32>(chan); + gSavedSettings.setS32("AlchemyNearbyChatChannel", chan); + return true; + } + } else if (cmd == utf8str_tolower(sResyncAnimCommand)) // Resync Animations { for (S32 i = 0; i < gObjectList.getNumObjects(); i++) diff --git a/indra/newview/app_settings/settings_alchemy.xml b/indra/newview/app_settings/settings_alchemy.xml index feb9b5ee764c38c3682c3c6b301dab65be3d9569..a0e6d89247aa076a1a63bd5a8dce6d4de4144b60 100644 --- a/indra/newview/app_settings/settings_alchemy.xml +++ b/indra/newview/app_settings/settings_alchemy.xml @@ -134,6 +134,17 @@ <key>Value</key> <string>/pos</string> </map> + <key>AlchemyChatCommandSetChatChannel</key> + <map> + <key>Comment</key> + <string>Command to set nearby chat channel</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string>/setchannel</string> + </map> <key>AlchemyChatCommandRegionMessage</key> <map> <key>Comment</key> @@ -475,6 +486,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>AlchemyNearbyChatChannel</key> + <map> + <key>Comment</key> + <string>Chat channel used for sending nearby chat from the viewer</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>0</integer> + </map> <key>AlchemyNearbyTypingIndicators</key> <map> <key>Comment</key> diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index a44c2a25fc2602223a42838c7b46b237f217e8ff..135e37e8012706f2fab830cd1fd481eef7ca0cd3 100755 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -119,7 +119,7 @@ BOOL LLFloaterIMNearbyChat::postBuild() mInputEditor->setKeystrokeCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxKeystroke, this)); mInputEditor->setFocusLostCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusLost, this)); mInputEditor->setFocusReceivedCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusReceived, this)); - mInputEditor->setLabel(LLTrans::getString("NearbyChatTitle")); + changeChannelLabel(gSavedSettings.getS32("AlchemyNearbyChatChannel")); // Title must be defined BEFORE call to addConversationListItem() because // it is used to show the item's name in the conversations list @@ -713,7 +713,7 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const std::string &utf8text, ECha void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) { // Look for "/20 foo" channel chats. - S32 channel = 0; + S32 channel = gSavedSettings.getS32("AlchemyNearbyChatChannel"); LLWString out_text = stripChannelNumber(wtext, &channel); std::string utf8_out_text = wstring_to_utf8str(out_text); std::string utf8_text = wstring_to_utf8str(wtext); @@ -759,6 +759,18 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType send_chat_from_viewer(utf8_out_text, type, channel); } +void LLFloaterIMNearbyChat::changeChannelLabel(S32 channel) +{ + if (channel == 0) + mInputEditor->setLabel(LLTrans::getString("NearbyChatTitle")); + else + { + LLStringUtil::format_map_t args; + args["CHANNEL"] = llformat("%d", channel); + mInputEditor->setLabel(LLTrans::getString("NearbyChatTitleChannel", args)); + } +} + // static bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) { @@ -863,7 +875,6 @@ LLWString LLFloaterIMNearbyChat::stripChannelNumber(const LLWString &mesg, S32* else { // This is normal chat. - *channel = 0; return mesg; } } @@ -871,15 +882,30 @@ LLWString LLFloaterIMNearbyChat::stripChannelNumber(const LLWString &mesg, S32* void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) { LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ChatFromViewer); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_ChatData); - msg->addStringFast(_PREHASH_Message, utf8_out_text); - msg->addU8Fast(_PREHASH_Type, type); - msg->addS32("Channel", channel); - + if (channel >= 0) + { + + msg->newMessageFast(_PREHASH_ChatFromViewer); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ChatData); + msg->addStringFast(_PREHASH_Message, utf8_out_text); + msg->addU8Fast(_PREHASH_Type, type); + msg->addS32("Channel", channel); + } + else + { + msg->newMessageFast(_PREHASH_ScriptDialogReply); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Data); + msg->addUUIDFast(_PREHASH_ObjectID, gAgent.getID()); + msg->addS32("ChatChannel", channel); + msg->addS32Fast(_PREHASH_ButtonIndex, 0); + msg->addStringFast(_PREHASH_ButtonLabel, utf8_out_text); + } gAgent.sendReliableMessage(); add(LLStatViewer::CHAT_COUNT, 1); diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h index f0daacd6a9e7212e572f147f40d3082e7d84a94a..28fbe431e087d972672ff27036067b7745b97e8d 100755 --- a/indra/newview/llfloaterimnearbychat.h +++ b/indra/newview/llfloaterimnearbychat.h @@ -83,6 +83,7 @@ public: static bool isWordsName(const std::string& name); void showHistory(); + void changeChannelLabel(S32 channel); protected: static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 85cc1c5d93f5261d23c4d52dd162615e40d66ba9..848b5f50566109706c5d96a7518730f31cd6719a 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -76,7 +76,9 @@ #include "llstartup.h" #include "llupdaterservice.h" +#include "llfloaterreg.h" #include "llfloatercamera.h" // <alchemy/> +#include "llfloaterimnearbychat.h" #include "llfloaterimsessiontab.h" #include "llviewerchat.h" @@ -154,6 +156,12 @@ static bool validateVSync(const LLSD& val) return preset <= 2U; } +static bool handleChatChannelChanged(const LLSD& val) +{ + LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->changeChannelLabel(val.asInteger()); + return true; +} + static bool handleRenderPerfTestChanged(const LLSD& newvalue) { bool status = !newvalue.asBoolean(); @@ -811,6 +819,7 @@ void settings_setup_listeners() gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); gSavedSettings.getControl("RenderVerticalSync")->getValidateSignal()->connect(boost::bind(validateVSync, _2)); + gSavedSettings.getControl("AlchemyNearbyChatChannel")->getValidateSignal()->connect(boost::bind(&handleChatChannelChanged, _2)); #if ALCHEMY_TEST gSavedSettings.getControl("CameraPreset")->getSignal()->connect(boost::bind(&handleCameraPresetChanged, _2)); // <alchemy/> #endif diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index bfc0a1d7fc968235d00c323209fc1b86e1448bbd..1f954ad2108399473da4ec96f72ff39934f956a9 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4162,6 +4162,7 @@ Try enclosing path to the editor with double quotes. <!-- Build Floater--> <string name="BuildMultiSelect">(multiple)</string> <string name="NotifyIncomingMessage">Incoming message from [NAME]...</string> + <string name="NearbyChatTitleChannel">Nearby chat (on channel [CHANNEL])</string> <string name="AvatarTyping">Typing</string>