diff options
author | Dave SIMmONs <simon@lindenlab.com> | 2011-03-17 11:38:43 -0700 |
---|---|---|
committer | Dave SIMmONs <simon@lindenlab.com> | 2011-03-17 11:38:43 -0700 |
commit | 62214c96d465650f814194215b6b8f39ae38873a (patch) | |
tree | fc844585de8ac7ea63275abbcec15f0e0509d05e | |
parent | 034cf7273fab18a7c6ad1fda1b0d2dd600f31825 (diff) |
ER-616 : Create LLEventHost API to receive incoming chat messages. Added "LLChat" LLEventStream and pass incoming chat to it. Reviewed by Kelly.
-rw-r--r-- | indra/newview/llnearbychathandler.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llnearbychathandler.h | 4 |
2 files changed, 21 insertions, 14 deletions
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index de5439e4e0..7e0f066b1d 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -441,6 +441,8 @@ void LLNearbyChatScreenChannel::reshape (S32 width, S32 height, BOOL called_fr //----------------------------------------------------------------------------------------------- //LLNearbyChatHandler //----------------------------------------------------------------------------------------------- +boost::scoped_ptr<LLEventPump> LLNearbyChatHandler::sChatWatcher(new LLEventStream("LLChat")); + LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& id) { mType = type; @@ -525,6 +527,19 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) LLFirstUse::otherAvatarChatFirst(); } + // Build data and send event on to LLEventStream + LLSD notification; + notification["message"] = chat_msg.mText; + notification["from"] = chat_msg.mFromName; + notification["from_id"] = chat_msg.mFromID; + notification["time"] = chat_msg.mTime; + notification["source"] = (S32)chat_msg.mSourceType; + notification["chat_type"] = (S32)chat_msg.mChatType; + notification["chat_style"] = (S32)chat_msg.mChatStyle; + + sChatWatcher->post(notification); + + if( nearby_chat->getVisible() || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseChatBubbles") ) @@ -558,24 +573,13 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) } */ - LLUUID id; - id.generate(); - LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel); - if(channel) { - LLSD notification; + LLUUID id; + id.generate(); notification["id"] = id; - notification["message"] = chat_msg.mText; - notification["from"] = chat_msg.mFromName; - notification["from_id"] = chat_msg.mFromID; - notification["time"] = chat_msg.mTime; - notification["source"] = (S32)chat_msg.mSourceType; - notification["chat_type"] = (S32)chat_msg.mChatType; - notification["chat_style"] = (S32)chat_msg.mChatStyle; - std::string r_color_name = "White"; F32 r_color_alpha = 1.0f; LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); @@ -585,7 +589,6 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; channel->addNotification(notification); } - } void LLNearbyChatHandler::onDeleteToast(LLToast* toast) diff --git a/indra/newview/llnearbychathandler.h b/indra/newview/llnearbychathandler.h index ec1f29cdfc..b0e4f62d51 100644 --- a/indra/newview/llnearbychathandler.h +++ b/indra/newview/llnearbychathandler.h @@ -29,6 +29,8 @@ #include "llnotificationhandler.h" +class LLEventPump; + //add LLNearbyChatHandler to LLNotificationsUI namespace namespace LLNotificationsUI{ @@ -44,6 +46,8 @@ public: protected: virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); + + static boost::scoped_ptr<LLEventPump> sChatWatcher; }; } |