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
meow-7.2.2
Dave SIMmONs 2011-03-16 13:20:18 -07:00
parent b91ac7ae99
commit acb7638785
4 changed files with 26 additions and 9 deletions

View File

@ -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 */

View File

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

View File

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

View File

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