summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave SIMmONs <simon@lindenlab.com>2011-03-16 13:20:18 -0700
committerDave SIMmONs <simon@lindenlab.com>2011-03-16 13:20:18 -0700
commitacb763878543f2a25131b40646559feb7405c4fa (patch)
treeef8fb5a4fdc68412e09caee7349d262030923209 /indra/newview
parentb91ac7ae99c4034b31a07a8074f2e14d64790976 (diff)
ER-614: Add lleventhost API to send chat messages. Cleanup code a bit, now invoking proper routine to make viewer do chat animations.
Commented out some un-used chat related code in llchatbar.cpp and llnotificationmanager.h. Also re-named a singleton class in llnearbychatbar.cpp so we don't have multiple LLChatHandler classes. Reviewed by Kelly
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llchatbar.cpp4
-rw-r--r--indra/newview/llnearbychatbar.cpp6
-rw-r--r--indra/newview/llnearbychatbarlistener.cpp23
-rw-r--r--indra/newview/llnotificationmanager.h2
4 files changed, 26 insertions, 9 deletions
diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp
index 6e58be8174..4a58dc558a 100644
--- a/indra/newview/llchatbar.cpp
+++ b/indra/newview/llchatbar.cpp
@@ -671,6 +671,9 @@ void LLChatBar::onCommitGesture(LLUICtrl* ctrl)
}
}
+
+/* Cruft - global gChatHandler declared below has been commented out,
+ so this class is never used. See similar code in llnearbychatbar.cpp
class LLChatHandler : public LLCommandHandler
{
public:
@@ -710,3 +713,4 @@ public:
// Creating the object registers with the dispatcher.
//LLChatHandler gChatHandler;
+cruft */
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 836ae9a0cf..7ed949cd10 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -864,11 +864,11 @@ void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT);
}
-class LLChatHandler : public LLCommandHandler
+class LLChatCommandHandler : public LLCommandHandler
{
public:
// not allowed from outside the app
- LLChatHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { }
+ LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { }
// Your code here
bool handle(const LLSD& tokens, const LLSD& query_map,
@@ -902,6 +902,6 @@ public:
};
// Creating the object registers with the dispatcher.
-LLChatHandler gChatHandler;
+LLChatCommandHandler gChatHandler;
diff --git a/indra/newview/llnearbychatbarlistener.cpp b/indra/newview/llnearbychatbarlistener.cpp
index c30e89c35e..99286d972b 100644
--- a/indra/newview/llnearbychatbarlistener.cpp
+++ b/indra/newview/llnearbychatbarlistener.cpp
@@ -29,15 +29,12 @@
#include "llviewerprecompiledheaders.h"
#include "llnearbychatbarlistener.h"
+#include "llnearbychatbar.h"
#include "llagent.h"
#include "llchat.h"
-// Ugly glue for llnearbychatbar.cpp utility function. Avoids pulling in a bunch of UI
-// definitions. Also needs to get cleaned up from llchatbar.cpp
-extern void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
-
LLNearbyChatBarListener::LLNearbyChatBarListener(LLNearbyChatBar & chatbar)
: LLEventAPI("LLChatBar",
@@ -82,6 +79,22 @@ void LLNearbyChatBarListener::sendChat(LLSD const & chat_data) const
type_o_chat = CHAT_TYPE_SHOUT;
}
}
- send_chat_from_viewer(chat_text, type_o_chat, channel);
+
+ // Have to prepend /42 style channel numbers
+ std::string chat_to_send;
+ if (channel == 0)
+ {
+ chat_to_send = chat_text;
+ }
+ else
+ {
+ chat_to_send += "/";
+ chat_to_send += chat_data["channel"].asString();
+ chat_to_send += " ";
+ chat_to_send += chat_text;
+ }
+
+ // Send it as if it was typed in
+ mChatbar.sendChatFromViewer(chat_to_send, type_o_chat, (BOOL)(channel == 0));
}
diff --git a/indra/newview/llnotificationmanager.h b/indra/newview/llnotificationmanager.h
index 72fa394621..16e82e4cce 100644
--- a/indra/newview/llnotificationmanager.h
+++ b/indra/newview/llnotificationmanager.h
@@ -69,7 +69,7 @@ public:
private:
//TODO (*)
std::map<std::string, boost::shared_ptr<LLEventHandler> > mNotifyHandlers;
- std::map<std::string, LLChatHandler*> mChatHandlers;
+ // cruft std::map<std::string, LLChatHandler*> mChatHandlers;
};
}