diff options
author | James Cook <james@lindenlab.com> | 2008-03-11 00:09:44 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2008-03-11 00:09:44 +0000 |
commit | 9d12bd5e273b8cb032e25574461a8b4528d96343 (patch) | |
tree | 211de9b932d985198f2da7942e48dca7ef490adc /indra/newview/llchatbar.cpp | |
parent | ba607fe406a609b6b5d4afed4815dddc10443029 (diff) |
svn merge -r81924:81925 svn+ssh://svn.lindenlab.com/svn/linden/branches/browser-hud/browser-hud-4-merge-2
QAR-345 Browser HUD web based tutorial for new users
Diffstat (limited to 'indra/newview/llchatbar.cpp')
-rw-r--r-- | indra/newview/llchatbar.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 239d974bc3..73c00c1d82 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -45,6 +45,7 @@ #include "llagent.h" #include "llbutton.h" #include "llcombobox.h" +#include "llcommandhandler.h" // secondlife:///app/chat/ support #include "llviewercontrol.h" #include "llfloaterchat.h" #include "llgesturemgr.h" @@ -76,6 +77,7 @@ LLChatBar *gChatBar = NULL; // legacy calllback glue void toggleChatHistory(void* user_data); +void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); class LLChatBarGestureObserver : public LLGestureManagerObserver @@ -570,8 +572,6 @@ void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) { - LLMessageSystem* msg = gMessageSystem; - // Look for "/20 foo" channel chats. S32 channel = 0; LLWString out_text = stripChannelNumber(wtext, &channel); @@ -616,6 +616,12 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL } } + send_chat_from_viewer(utf8_out_text, type, channel); +} + +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()); @@ -670,3 +676,24 @@ void toggleChatHistory(void* user_data) { LLFloaterChat::toggleInstance(LLSD()); } + + +class LLChatHandler : public LLCommandHandler +{ +public: + // not allowed from outside the app + LLChatHandler() : LLCommandHandler("chat", false) { } + + // Your code here + bool handle(const LLSD& tokens, const LLSD& queryMap) + { + if (tokens.size() < 2) return false; + S32 channel = tokens[0].asInteger(); + std::string mesg = tokens[1].asString(); + send_chat_from_viewer(mesg, CHAT_TYPE_NORMAL, channel); + return true; + } +}; + +// Creating the object registers with the dispatcher. +LLChatHandler gChatHandler; |