From f54bf2a1eac3bc61222e5cceba77755bd340f996 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Thu, 4 Mar 2010 11:35:34 +0200 Subject: =?UTF-8?q?fixed=20EXT-5904=20=E2=80=9COffers=20embedding=20into?= =?UTF-8?q?=20IM=20windows=E2=80=9D,=20made=20all=20type=20offers=20be=20e?= =?UTF-8?q?mbedded=20to=20the=20IM=20floater;=20made=20showing=20offer=20t?= =?UTF-8?q?oast=20if=20IM=20floater=20isn't=20visible;=20corrected=20IM=20?= =?UTF-8?q?message=20counter=20on=20showing=20offer=20toast;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 1 - indra/newview/llimfloater.cpp | 22 +++++++++ indra/newview/llnotificationhandler.h | 15 ++++++ indra/newview/llnotificationhandlerutil.cpp | 73 +++++++++++++++++++++++++--- indra/newview/llnotificationofferhandler.cpp | 42 ++++++++++++---- indra/newview/llscreenchannel.cpp | 4 +- indra/newview/lltoastnotifypanel.cpp | 5 +- indra/newview/lltoastnotifypanel.h | 3 ++ 8 files changed, 144 insertions(+), 21 deletions(-) diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 8efa814a2e..c39c1a2056 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -320,7 +320,6 @@ LLNotificationChiclet::LLNotificationChiclet(const Params& p) // connect counter handlers to the signals connectCounterUpdatersToSignal("notify"); connectCounterUpdatersToSignal("groupnotify"); - connectCounterUpdatersToSignal("offer"); // ensure that notification well window exists, to synchronously // handle toast add/delete events. diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 8cdc50eb70..5f56690d2e 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -648,6 +648,15 @@ void LLIMFloater::updateMessages() if (msg.has("notification_id")) { chat.mNotifId = msg["notification_id"].asUUID(); + // remove embedded notification from channel + LLNotificationsUI::LLScreenChannel* channel = dynamic_cast + (LLNotificationsUI::LLChannelManager::getInstance()-> + findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + if (getVisible()) + { + // toast will be automatically closed since it is not storable toast + channel->hideToast(chat.mNotifId); + } } //process text message else @@ -657,6 +666,19 @@ void LLIMFloater::updateMessages() mChatHistory->appendMessage(chat, chat_args); mLastMessageIndex = msg["index"].asInteger(); + + // if it is a notification - next message is a notification history log, so skip it + if (chat.mNotifId.notNull() && LLNotificationsUtil::find(chat.mNotifId) != NULL) + { + if (++iter == iter_end) + { + break; + } + else + { + mLastMessageIndex++; + } + } } } } diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index a163b6fd62..1f5cff2505 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -297,6 +297,11 @@ public: */ static bool canSpawnSessionAndLogToIM(const LLNotificationPtr& notification); + /** + * Determines whether IM floater is opened. + */ + static bool isIMFloaterOpened(const LLNotificationPtr& notification); + /** * Writes notification message to IM session. */ @@ -343,6 +348,16 @@ public: * Adds notification panel to the IM floater. */ static void addNotifPanelToIM(const LLNotificationPtr& notification); + + /** + * Updates messages of visible IM floater. + */ + static void updateVisibleIMFLoaterMesages(const LLNotificationPtr& notification); + + /** + * Decrements counter of IM messages. + */ + static void decIMMesageCounter(const LLNotificationPtr& notification); }; } diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 546017f028..1a30eecf01 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -127,7 +127,9 @@ const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"), FRIENDSHIP_DECLINED_BYME("FriendshipDeclinedByMe"), FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline"), SERVER_OBJECT_MESSAGE("ServerObjectMessage"), - TELEPORT_OFFERED("TeleportOffered"); + TELEPORT_OFFERED("TeleportOffered"), + TELEPORT_OFFER_SENT("TeleportOfferSent"); + // static bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) @@ -141,7 +143,10 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) || FRIENDSHIP_DECLINED_BYME == notification->getName() || SERVER_OBJECT_MESSAGE == notification->getName() || INVENTORY_ACCEPTED == notification->getName() - || INVENTORY_DECLINED == notification->getName(); + || INVENTORY_DECLINED == notification->getName() + || USER_GIVE_ITEM == notification->getName() + || TELEPORT_OFFERED == notification->getName() + || TELEPORT_OFFER_SENT == notification->getName(); } // static @@ -161,23 +166,43 @@ bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) || FRIENDSHIP_ACCEPTED == notification->getName() || USER_GIVE_ITEM == notification->getName() || INVENTORY_ACCEPTED == notification->getName() - || INVENTORY_DECLINED == notification->getName(); + || INVENTORY_DECLINED == notification->getName() + || TELEPORT_OFFERED == notification->getName(); } // static bool LLHandlerUtil::canAddNotifPanelToIM(const LLNotificationPtr& notification) { return OFFER_FRIENDSHIP == notification->getName() - || USER_GIVE_ITEM == notification->getName(); + || USER_GIVE_ITEM == notification->getName() + || TELEPORT_OFFERED == notification->getName(); } - // static bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notification) { return canLogToIM(notification) && canSpawnIMSession(notification); } +// static +bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) +{ + bool res = false; + + LLUUID from_id = notification->getPayload()["from_id"]; + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, + from_id); + + LLIMFloater* im_floater = LLFloaterReg::findTypedInstance( + "impanel", session_id); + if (im_floater != NULL) + { + res = im_floater->getVisible() == TRUE; + } + + return res; +} + // static void LLHandlerUtil::logToIM(const EInstantMessage& session_type, const std::string& session_name, const std::string& from_name, @@ -348,6 +373,42 @@ void LLHandlerUtil::addNotifPanelToIM(const LLNotificationPtr& notification) offer["time"] = LLLogChat::timestamp(true); offer["index"] = (LLSD::Integer)session->mMsgs.size(); session->mMsgs.push_front(offer); +} + +// static +void LLHandlerUtil::updateVisibleIMFLoaterMesages(const LLNotificationPtr& notification) +{ + const std::string name = LLHandlerUtil::getSubstitutionName(notification); + LLUUID from_id = notification->getPayload()["from_id"]; + LLUUID session_id = spawnIMSession(name, from_id); + + LLIMFloater* im_floater = LLIMFloater::findInstance(session_id); + if (im_floater != NULL && im_floater->getVisible()) + { + im_floater->updateMessages(); + } +} + +// static +void LLHandlerUtil::decIMMesageCounter(const LLNotificationPtr& notification) +{ + const std::string name = LLHandlerUtil::getSubstitutionName(notification); + LLUUID from_id = notification->getPayload()["from_id"]; + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); + + LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession( + session_id); + + if (session == NULL) + { + return; + } - LLIMFloater::show(session_id); + LLSD arg; + arg["session_id"] = session_id; + session->mNumUnread--; + arg["num_unread"] = session->mNumUnread; + session->mParticipantUnreadMessageCount--; + arg["participant_unread"] = session->mParticipantUnreadMessageCount; + LLIMModel::getInstance()->mNewMsgSignal(arg); } diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 8ebd5de258..42e42d4f0a 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -113,36 +113,53 @@ bool LLOfferHandler::processNotification(const LLSD& notify) session_id = LLHandlerUtil::spawnIMSession(name, from_id); } - if (LLHandlerUtil::canAddNotifPanelToIM(notification)) + bool show_toast = true; + bool add_notid_to_im = LLHandlerUtil::canAddNotifPanelToIM(notification); + if (add_notid_to_im) { LLHandlerUtil::addNotifPanelToIM(notification); - LLHandlerUtil::logToIMP2P(notification, true); + if (LLHandlerUtil::isIMFloaterOpened(notification)) + { + show_toast = false; + } } - else if (notification->getPayload().has("SUPPRESS_TOAST") + + if (notification->getPayload().has("SUPPRESS_TOAST") && notification->getPayload()["SUPPRESS_TOAST"]) { - LLHandlerUtil::logToIMP2P(notification); LLNotificationsUtil::cancel(notification); } - else + else if(show_toast) { LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); - + // don't close notification on panel destroy since it will be used by IM floater + notify_box->setCloseNotificationOnDestroy(!add_notid_to_im); LLToast::Params p; p.notif_id = notification->getID(); p.notification = notification; p.panel = notify_box; p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1); + // we not save offer notifications to the syswell floater that should be added to the IM floater + p.can_be_stored = !add_notid_to_im; LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) channel->addToast(p); - LLHandlerUtil::logToIMP2P(notification); - // send a signal to the counter manager mNewNotificationSignal(); } + + if (LLHandlerUtil::canLogToIM(notification)) + { + LLHandlerUtil::logToIMP2P(notification); + } + + // update IM floater messages if need + if (add_notid_to_im) + { + LLHandlerUtil::updateVisibleIMFLoaterMesages(notification); + } } } else if (notify["sigtype"].asString() == "delete") @@ -155,6 +172,11 @@ bool LLOfferHandler::processNotification(const LLSD& notify) } else { + if (LLHandlerUtil::canAddNotifPanelToIM(notification) + && !LLHandlerUtil::isIMFloaterOpened(notification)) + { + LLHandlerUtil::decIMMesageCounter(notification); + } mChannel->killToastByNotificationID(notification->getID()); } } @@ -181,7 +203,9 @@ void LLOfferHandler::onRejectToast(LLUUID& id) if (notification && LLNotificationManager::getInstance()->getHandlerForNotification( - notification->getType()) == this) + notification->getType()) == this + // don't delete notification since it may be used by IM floater + && !LLHandlerUtil::canAddNotifPanelToIM(notification)) { LLNotifications::instance().cancel(notification); } diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index a4426b370e..dffb5e5e12 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -710,9 +710,7 @@ void LLScreenChannel::hideToast(const LLUUID& notification_id) if(mToastList.end() != it) { ToastElem te = *it; - te.toast->setVisible(FALSE); - te.toast->stopTimer(); - mToastList.erase(it); + te.toast->hide(); } } diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index c47c017143..9108cc9889 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -60,7 +60,8 @@ mInfoPanel(NULL), mControlPanel(NULL), mNumOptions(0), mNumButtons(0), -mAddedDefaultBtn(false) +mAddedDefaultBtn(false), +mCloseNotificationOnDestroy(true) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_notification.xml"); mInfoPanel = getChild("info_panel"); @@ -257,7 +258,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt LLToastNotifyPanel::~LLToastNotifyPanel() { std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer()); - if (LLNotificationsUtil::find(mNotification->getID()) != NULL) + if (mCloseNotificationOnDestroy && LLNotificationsUtil::find(mNotification->getID()) != NULL) { LLNotifications::getInstance()->cancel(mNotification); } diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index e791eea469..9c90a4dfa4 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -57,6 +57,7 @@ public: virtual ~LLToastNotifyPanel(); LLPanel * getControlPanel() { return mControlPanel; } + void setCloseNotificationOnDestroy(bool close) { mCloseNotificationOnDestroy = close; } protected: LLButton* createButton(const LLSD& form_element, BOOL is_option); @@ -68,6 +69,8 @@ protected: }; std::vector mBtnCallbackData; + bool mCloseNotificationOnDestroy; + private: typedef std::pair index_button_pair_t; -- cgit v1.2.3 From 66b60a71f1af684ed04882fff519f967c4d455f1 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Thu, 4 Mar 2010 19:37:26 +0200 Subject: Implemented normal subtasks EXT-5906 (Reverse buttons order in the inventory offers) and EXT-5907 (Reverse buttons order in the friendship offer). - Used reverse iterator when iterating over control list in LLChatHistory::appendMessage(). --HG-- branch : product-engine --- indra/newview/llchathistory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index e1c96d4a16..911ac9c485 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -743,7 +743,9 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL ctrl_list_t ctrls = notify_box->getControlPanel()->getCtrlList(); S32 offset = 0; - for (ctrl_list_t::iterator it = ctrls.begin(); it != ctrls.end(); it++) + // Children were added by addChild() which uses push_front to insert them into list, + // so to get buttons in correct order reverse iterator is used (EXT-5906) + for (ctrl_list_t::reverse_iterator it = ctrls.rbegin(); it != ctrls.rend(); it++) { LLButton * button = dynamic_cast (*it); if (button != NULL) -- cgit v1.2.3 From 462ab1c7523b1cc0987bc596df4fd3e4b32e5e54 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Fri, 5 Mar 2010 12:37:06 +0200 Subject: =?UTF-8?q?fixed=20EXT-5908=20=E2=80=9CAccepted=20friendship=20not?= =?UTF-8?q?ification=20shouldn't=20spawn=20chiclet=E2=80=9D,=20made=20not?= =?UTF-8?q?=20spawn=20IM=20chiclet=20friendship=20accepted=20notification;?= =?UTF-8?q?=20added=20friendship=20accepted=20notification=20to=20syswell?= =?UTF-8?q?=20chiclet;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 1 + indra/newview/llnotificationhandlerutil.cpp | 1 - indra/newview/llnotificationofferhandler.cpp | 8 ++++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index c39c1a2056..8efa814a2e 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -320,6 +320,7 @@ LLNotificationChiclet::LLNotificationChiclet(const Params& p) // connect counter handlers to the signals connectCounterUpdatersToSignal("notify"); connectCounterUpdatersToSignal("groupnotify"); + connectCounterUpdatersToSignal("offer"); // ensure that notification well window exists, to synchronously // handle toast add/delete events. diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 565016e63c..11f210be93 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -163,7 +163,6 @@ bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification) bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) { return OFFER_FRIENDSHIP == notification->getName() - || FRIENDSHIP_ACCEPTED == notification->getName() || USER_GIVE_ITEM == notification->getName() || INVENTORY_ACCEPTED == notification->getName() || INVENTORY_DECLINED == notification->getName() diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 42e42d4f0a..3304d7f030 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -146,8 +146,12 @@ bool LLOfferHandler::processNotification(const LLSD& notify) if(channel) channel->addToast(p); - // send a signal to the counter manager - mNewNotificationSignal(); + // if we not add notification to IM - add it to notification well + if (!add_notid_to_im) + { + // send a signal to the counter manager + mNewNotificationSignal(); + } } if (LLHandlerUtil::canLogToIM(notification)) -- cgit v1.2.3 From 27283c1de73282590e614b3d5e9bdabe922c0a94 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Fri, 5 Mar 2010 14:13:37 +0200 Subject: =?UTF-8?q?fixed=20EXT-5910=20=E2=80=9COffers=20logging=E2=80=9D,?= =?UTF-8?q?=20made=20logging=20offer=20notifications=20as=20from=20SecondL?= =?UTF-8?q?ife;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llnotificationhandlerutil.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 11f210be93..8d1c244a7e 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -279,8 +279,8 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi } else { - logToIM(IM_NOTHING_SPECIAL, session_name, name, notification->getMessage(), - from_id, from_id); + logToIM(IM_NOTHING_SPECIAL, session_name, "", notification->getMessage(), + from_id, LLUUID()); } } } @@ -348,7 +348,10 @@ std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notifica if (res.empty()) { LLUUID from_id = notification->getPayload()["FROM_ID"]; - gCacheName->getFullName(from_id, res); + if(!gCacheName->getFullName(from_id, res)) + { + res = ""; + } } return res; } -- cgit v1.2.3 From 2f9cc80c2e0a6ca648871ed74cc10b813d2c4940 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Fri, 5 Mar 2010 17:53:32 +0200 Subject: =?UTF-8?q?fixed=20EXT-5910=20=E2=80=9COffers=20logging=E2=80=9D,?= =?UTF-8?q?=20fixed=20IM=20message=20counter=20when=20received=20interacti?= =?UTF-8?q?ve=20notification(offer);=20corrected=20logging=20to=20file=20o?= =?UTF-8?q?f=20offer=20notification;=20enabled=20logging=20for=20FRIENDSHI?= =?UTF-8?q?P=5FACCEPTED=20notification;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/llmessage/llinstantmessage.cpp | 1 + indra/llmessage/llinstantmessage.h | 1 + indra/newview/llimview.cpp | 4 +++- indra/newview/llnotificationhandlerutil.cpp | 7 ++++--- indra/newview/llnotificationofferhandler.cpp | 16 +++++++++++++--- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index a9e1ee77ef..57e8a22546 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -61,6 +61,7 @@ const char EMPTY_BINARY_BUCKET[] = ""; const S32 EMPTY_BINARY_BUCKET_SIZE = 1; const U32 NO_TIMESTAMP = 0; const std::string SYSTEM_FROM("Second Life"); +const std::string INTERACTIVE_SYSTEM_FROM("F387446C-37C4-45f2-A438-D99CBDBB563B"); const S32 IM_TTL = 1; diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h index 272e753f3c..f11b649f78 100644 --- a/indra/llmessage/llinstantmessage.h +++ b/indra/llmessage/llinstantmessage.h @@ -226,6 +226,7 @@ extern const S32 EMPTY_BINARY_BUCKET_SIZE; extern const U32 NO_TIMESTAMP; extern const std::string SYSTEM_FROM; +extern const std::string INTERACTIVE_SYSTEM_FROM; // Number of retry attempts on sending the im. extern const S32 IM_TTL; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b3f085ef6d..9ea8364491 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -723,7 +723,9 @@ LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, session->mNumUnread++; //update count of unread messages from real participant - if (!(from_id.isNull() || from_id == gAgentID || SYSTEM_FROM == from)) + if (!(from_id.isNull() || from_id == gAgentID || SYSTEM_FROM == from) + // we should increment counter for interactive system messages() + || INTERACTIVE_SYSTEM_FROM == from) { ++(session->mParticipantUnreadMessageCount); } diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 8d1c244a7e..7b61b200cd 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -139,6 +139,7 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) || PAYMENT_RECIVED == notification->getName() || OFFER_FRIENDSHIP == notification->getName() || FRIENDSHIP_OFFERED == notification->getName() + || FRIENDSHIP_ACCEPTED == notification->getName() || FRIENDSHIP_ACCEPTED_BYME == notification->getName() || FRIENDSHIP_DECLINED_BYME == notification->getName() || SERVER_OBJECT_MESSAGE == notification->getName() @@ -274,12 +275,12 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi if(to_file_only) { - logToIM(IM_NOTHING_SPECIAL, session_name, name, notification->getMessage(), - LLUUID(), LLUUID()); + logToIM(IM_NOTHING_SPECIAL, session_name, "", notification->getMessage(), + from_id, LLUUID()); } else { - logToIM(IM_NOTHING_SPECIAL, session_name, "", notification->getMessage(), + logToIM(IM_NOTHING_SPECIAL, session_name, INTERACTIVE_SYSTEM_FROM, notification->getMessage(), from_id, LLUUID()); } } diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 3304d7f030..97a1df66df 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -156,7 +156,14 @@ bool LLOfferHandler::processNotification(const LLSD& notify) if (LLHandlerUtil::canLogToIM(notification)) { - LLHandlerUtil::logToIMP2P(notification); + if (LLHandlerUtil::isIMFloaterOpened(notification)) + { + LLHandlerUtil::logToIMP2P(notification, true); + } + else + { + LLHandlerUtil::logToIMP2P(notification); + } } // update IM floater messages if need @@ -192,8 +199,11 @@ bool LLOfferHandler::processNotification(const LLSD& notify) void LLOfferHandler::onDeleteToast(LLToast* toast) { - // send a signal to the counter manager - mDelNotificationSignal(); + if (!LLHandlerUtil::canAddNotifPanelToIM(toast->getNotification())) + { + // send a signal to the counter manager + mDelNotificationSignal(); + } // send a signal to a listener to let him perform some action // in this case listener is a SysWellWindow and it will remove a corresponding item from its list -- cgit v1.2.3 From 33133d4d7c5ee060dfbd6cb03fe50d8da0235146 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Tue, 9 Mar 2010 14:05:09 +0200 Subject: =?UTF-8?q?fixed=20EXT-5910=20=E2=80=9COffers=20logging=E2=80=9D,?= =?UTF-8?q?=20replaced=20interactive=20system=20message=20marker=20with=20?= =?UTF-8?q?correct=20from=20string=20value;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llimview.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 9ea8364491..6ce06adc80 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -717,8 +717,15 @@ LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, return NULL; } - addToHistory(session_id, from, from_id, utf8_text); - if (log2file) logToFile(session_id, from, from_id, utf8_text); + // replace interactive system message marker with correct from string value + std::string from_name = from; + if (INTERACTIVE_SYSTEM_FROM == from) + { + from_name = SYSTEM_FROM; + } + + addToHistory(session_id, from_name, from_id, utf8_text); + if (log2file) logToFile(session_id, from_name, from_id, utf8_text); session->mNumUnread++; -- cgit v1.2.3 From 7238ce83456b70f64efd15ba522d95ed526f4827 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Tue, 9 Mar 2010 17:55:53 +0200 Subject: Implemented normal sub-task EXT-5950(Do not spawn IM chiclet for "drop on avatar" inventory offers). - Removed check for INVENTORY_ACCEPTED from LLHandlerUtil::canSpawnIMSession(). --HG-- branch : product-engine --- indra/newview/llnotificationhandlerutil.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 7b61b200cd..8fb875ee1f 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -165,7 +165,6 @@ bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) { return OFFER_FRIENDSHIP == notification->getName() || USER_GIVE_ITEM == notification->getName() - || INVENTORY_ACCEPTED == notification->getName() || INVENTORY_DECLINED == notification->getName() || TELEPORT_OFFERED == notification->getName(); } -- cgit v1.2.3 From b2f6cab24f9cf9edf9b33d0f0f59ca4dab1fb209 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Wed, 10 Mar 2010 19:24:56 +0200 Subject: =?UTF-8?q?fixed=20EXT-5910=20=E2=80=9COffers=20logging=E2=80=9D,?= =?UTF-8?q?=20replaced=20interactive=20system=20message=20marker=20with=20?= =?UTF-8?q?correct=20from=20string=20value=20when=20message=20logged=20wit?= =?UTF-8?q?hout=20adding=20to=20the=20session;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llnotificationhandlerutil.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 8fb875ee1f..554b67c47d 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -214,7 +214,13 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, session_id); if (session == NULL) { - LLIMModel::instance().logToFile(session_name, from_name, from_id, message); + // replace interactive system message marker with correct from string value + std::string from = from_name; + if (INTERACTIVE_SYSTEM_FROM == from_name) + { + from = SYSTEM_FROM; + } + LLIMModel::instance().logToFile(session_name, from, from_id, message); } else { -- cgit v1.2.3 From 3ab788b14f9cdc3f33a06491d65abc985c045fa4 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Wed, 10 Mar 2010 19:50:24 +0200 Subject: Implemented normal sub-task EXT-5909(Accepted/declined inventory offer shouldn't spawn chiclet). - Removed check for INVENTORY_DECLINED from LLHandlerUtil::canSpawnIMSession(). - Added new method LLHandlerUtil::canSpawnToast() and check with it to LLTipHandler::processNotification() to supress toasts when respective IM window is open. --HG-- branch : product-engine --- indra/newview/llnotificationhandler.h | 7 +++++++ indra/newview/llnotificationhandlerutil.cpp | 10 +++++++++- indra/newview/llnotificationtiphandler.cpp | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 1f5cff2505..62daf5f105 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -297,6 +297,13 @@ public: */ static bool canSpawnSessionAndLogToIM(const LLNotificationPtr& notification); + /** + * Checks if passed notification can create toast. + * + * It returns false only for inventory accepted/declined notifications if respective IM window is open (EXT-5909) + */ + static bool canSpawnToast(const LLNotificationPtr& notification); + /** * Determines whether IM floater is opened. */ diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 554b67c47d..680309167e 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -165,7 +165,6 @@ bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) { return OFFER_FRIENDSHIP == notification->getName() || USER_GIVE_ITEM == notification->getName() - || INVENTORY_DECLINED == notification->getName() || TELEPORT_OFFERED == notification->getName(); } @@ -183,6 +182,15 @@ bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notificat return canLogToIM(notification) && canSpawnIMSession(notification); } +// static +bool LLHandlerUtil::canSpawnToast(const LLNotificationPtr& notification) +{ + bool cannot_spawn = isIMFloaterOpened(notification) && (INVENTORY_DECLINED == notification->getName() + || INVENTORY_ACCEPTED == notification->getName()); + + return !cannot_spawn; +} + // static bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) { diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index 4e2c5085ed..1f1afe293a 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -150,6 +150,12 @@ bool LLTipHandler::processNotification(const LLSD& notify) LLHandlerUtil::spawnIMSession(name, from_id); } + // don't spawn toast for inventory accepted/declined offers if respective IM window is open (EXT-5909) + if (!LLHandlerUtil::canSpawnToast(notification)) + { + return true; + } + LLToastPanel* notify_box = NULL; if("FriendOffline" == notification->getName() || "FriendOnline" == notification->getName()) { -- cgit v1.2.3 From ccbbfeb0a0ca268f528ae84b57e55156205ceb41 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Wed, 10 Mar 2010 20:03:28 +0200 Subject: =?UTF-8?q?fixed=20EXT-5904=20=E2=80=9COffers=20embedding=20into?= =?UTF-8?q?=20IM=20windows=E2=80=9D,=20shortened=20timestamp=20of=20embedd?= =?UTF-8?q?ed=20offers;=20unified=20sender=20name=20of=20session=20message?= =?UTF-8?q?=20entry=20and=20file=20log=20entry=20for=20system=20messages;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llnotificationhandlerutil.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 554b67c47d..1f08756859 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -208,6 +208,12 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, const std::string& message, const LLUUID& session_owner_id, const LLUUID& from_id) { + std::string from = from_name; + if (from_name.empty()) + { + from = SYSTEM_FROM; + } + LLUUID session_id = LLIMMgr::computeSessionID(session_type, session_owner_id); LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( @@ -215,7 +221,6 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, if (session == NULL) { // replace interactive system message marker with correct from string value - std::string from = from_name; if (INTERACTIVE_SYSTEM_FROM == from_name) { from = SYSTEM_FROM; @@ -231,7 +236,7 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, // set searched session as active to avoid IM toast popup LLIMModel::instance().setActiveSessionID(session_id); - LLIMModel::instance().addMessage(session_id, from_name, from_id, + LLIMModel::instance().addMessage(session_id, from, from_id, message); // restore active session id @@ -378,7 +383,7 @@ void LLHandlerUtil::addNotifPanelToIM(const LLNotificationPtr& notification) offer["notification_id"] = notification->getID(); offer["from_id"] = notification->getPayload()["from_id"]; offer["from"] = name; - offer["time"] = LLLogChat::timestamp(true); + offer["time"] = LLLogChat::timestamp(false); offer["index"] = (LLSD::Integer)session->mMsgs.size(); session->mMsgs.push_front(offer); } -- cgit v1.2.3 From e7027a57e17b565f98f401f3f2cd1af8c91f2af7 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Thu, 11 Mar 2010 17:53:49 +0200 Subject: =?UTF-8?q?fixed=20EXT-5904=20=E2=80=9COffers=20embedding=20into?= =?UTF-8?q?=20IM=20windows=E2=80=9D,=20revised=20embedding=20and=20logging?= =?UTF-8?q?=20offer=20notification=20to=20provide=20loading=20log=20entry?= =?UTF-8?q?=20in=20case=20notification=20doesn't=20exist;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llimfloater.cpp | 23 ++++++++++++++++------- indra/newview/llnotificationhandlerutil.cpp | 13 ++++++++++--- indra/newview/llnotificationofferhandler.cpp | 9 ++------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 5f56690d2e..9b5c69d33d 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -648,14 +648,23 @@ void LLIMFloater::updateMessages() if (msg.has("notification_id")) { chat.mNotifId = msg["notification_id"].asUUID(); - // remove embedded notification from channel - LLNotificationsUI::LLScreenChannel* channel = dynamic_cast - (LLNotificationsUI::LLChannelManager::getInstance()-> - findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - if (getVisible()) + // if notification exists - embed it + if (LLNotificationsUtil::find(chat.mNotifId) != NULL) { - // toast will be automatically closed since it is not storable toast - channel->hideToast(chat.mNotifId); + // remove embedded notification from channel + LLNotificationsUI::LLScreenChannel* channel = dynamic_cast + (LLNotificationsUI::LLChannelManager::getInstance()-> + findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + if (getVisible()) + { + // toast will be automatically closed since it is not storable toast + channel->hideToast(chat.mNotifId); + } + } + // if notification doesn't exist - try to use next message which should be log entry + else + { + continue; } } //process text message diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 741d08af1e..a37e796a6d 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -294,7 +294,7 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi if(to_file_only) { logToIM(IM_NOTHING_SPECIAL, session_name, "", notification->getMessage(), - from_id, LLUUID()); + LLUUID(), LLUUID()); } else { @@ -389,11 +389,18 @@ void LLHandlerUtil::addNotifPanelToIM(const LLNotificationPtr& notification) LLSD offer; offer["notification_id"] = notification->getID(); - offer["from_id"] = notification->getPayload()["from_id"]; - offer["from"] = name; + offer["from"] = SYSTEM_FROM; offer["time"] = LLLogChat::timestamp(false); offer["index"] = (LLSD::Integer)session->mMsgs.size(); session->mMsgs.push_front(offer); + + + // update IM floater and counters + LLSD arg; + arg["session_id"] = session_id; + arg["num_unread"] = ++(session->mNumUnread); + arg["participant_unread"] = ++(session->mParticipantUnreadMessageCount); + LLIMModel::getInstance()->mNewMsgSignal(arg); } // static diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 97a1df66df..0a42d8adbe 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -156,7 +156,8 @@ bool LLOfferHandler::processNotification(const LLSD& notify) if (LLHandlerUtil::canLogToIM(notification)) { - if (LLHandlerUtil::isIMFloaterOpened(notification)) + // log only to file if notif panel can be embedded to IM and IM is opened + if (add_notid_to_im && LLHandlerUtil::isIMFloaterOpened(notification)) { LLHandlerUtil::logToIMP2P(notification, true); } @@ -165,12 +166,6 @@ bool LLOfferHandler::processNotification(const LLSD& notify) LLHandlerUtil::logToIMP2P(notification); } } - - // update IM floater messages if need - if (add_notid_to_im) - { - LLHandlerUtil::updateVisibleIMFLoaterMesages(notification); - } } } else if (notify["sigtype"].asString() == "delete") -- cgit v1.2.3 From da3d0b104ac48ba0d5bcc0bc7b5b2561bae911b3 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Fri, 12 Mar 2010 16:18:56 +0200 Subject: Fixed reopened normal sub-task EXT-5950 (Do not spawn IM chiclet for "drop on avatar" inventory offers). - Added logging of "Inventory item offered" message when dnd'ing item on avatar via new LLToolDragAndDrop::logInventoryOffer() method. --HG-- branch : product-engine --- indra/newview/lltooldraganddrop.cpp | 38 +++++++++++++++++++------- indra/newview/lltooldraganddrop.h | 4 +++ indra/newview/skins/default/xui/en/strings.xml | 1 + 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 125c62474e..08f874d1d2 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1503,15 +1503,38 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent, LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY); + logInventoryOffer(to_agent, im_session_id); + + // add buddy to recent people list + LLRecentPeople::instance().add(to_agent); +} + +//static +void LLToolDragAndDrop::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im_session_id) +{ + // compute id of possible IM session with agent that has "to_agent" id + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, to_agent); // If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat. - if (im_session_id != LLUUID::null) + if (im_session_id.notNull()) { LLSD args; gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args); } - - // add buddy to recent people list - LLRecentPeople::instance().add(to_agent); + // If this item was given by drag-and-drop on avatar while IM panel was open, log this action in the IM panel chat. + else if (LLIMModel::getInstance()->findIMSession(session_id)) + { + LLSD args; + gIMMgr->addSystemMessage(session_id, "inventory_item_offered", args); + } + // If this item was given by drag-and-drop on avatar while IM panel wasn't open, log this action to IM history. + else + { + std::string full_name; + if (gCacheName->getFullName(to_agent, full_name)) + { + LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, LLTrans::getString("inventory_item_offered")); + } + } } void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent, @@ -1723,12 +1746,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent, LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY); - // If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat. - if (im_session_id != LLUUID::null) - { - LLSD args; - gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args); - } + logInventoryOffer(to_agent, im_session_id); } } diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 79b2bc32a3..0da13dac8b 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -227,6 +227,10 @@ protected: LLInventoryCategory* cat, const LLUUID &im_session_id = LLUUID::null); + // log "Inventory item offered" to IM + static void logInventoryOffer(const LLUUID& to_agent, + const LLUUID &im_session_id = LLUUID::null); + public: // helper functions static BOOL isInventoryDropAcceptable(LLViewerObject* obj, LLInventoryItem* item) { return (ACCEPT_YES_COPY_SINGLE <= willObjectAcceptInventory(obj, item)); } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 59c54f0cad..e1f5dd93d4 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2902,6 +2902,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Click here to instant message. To (Moderator) + Inventory item offered Started a voice call -- cgit v1.2.3 From 6e55e90f28f20a42bae87b346630f26ab4c6a0f6 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Fri, 12 Mar 2010 16:54:21 +0200 Subject: =?UTF-8?q?EXT-5904=20=E2=80=9COffers=20embedding=20into=20IM=20wi?= =?UTF-8?q?ndows=E2=80=9D,=20replaced=20unnecessary=20dynamic=20casting=20?= =?UTF-8?q?with=20static=20casting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llimfloater.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 9b5c69d33d..881972ceff 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -460,7 +460,7 @@ void LLIMFloater::getAllowedRect(LLRect& rect) void LLIMFloater::setDocked(bool docked, bool pop_on_undock) { // update notification channel state - LLNotificationsUI::LLScreenChannel* channel = dynamic_cast + LLNotificationsUI::LLScreenChannel* channel = static_cast (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); @@ -479,7 +479,7 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock) void LLIMFloater::setVisible(BOOL visible) { - LLNotificationsUI::LLScreenChannel* channel = dynamic_cast + LLNotificationsUI::LLScreenChannel* channel = static_cast (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); LLTransientDockableFloater::setVisible(visible); @@ -652,7 +652,7 @@ void LLIMFloater::updateMessages() if (LLNotificationsUtil::find(chat.mNotifId) != NULL) { // remove embedded notification from channel - LLNotificationsUI::LLScreenChannel* channel = dynamic_cast + LLNotificationsUI::LLScreenChannel* channel = static_cast (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); if (getVisible()) -- cgit v1.2.3 From fee3752311907c774b595246f1dbb93ef5b8cd53 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Mon, 15 Mar 2010 18:06:04 +0200 Subject: Implemented normal task EXT-5905 - Resolving offers. Added functionality to make Toasts accept multiple user inputs(clicks on option buttons). --HG-- branch : product-engine --- indra/llui/llnotifications.cpp | 25 ++++++++-- indra/llui/llnotifications.h | 10 ++++ indra/newview/lltoastnotifypanel.cpp | 89 +++++++++++++++++++++++++++++++++++- indra/newview/lltoastnotifypanel.h | 7 +++ indra/newview/llviewermessage.cpp | 20 ++++++++ indra/newview/llviewermessage.h | 2 + 6 files changed, 148 insertions(+), 5 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 5816cef6af..7b8970a153 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -402,7 +402,8 @@ LLNotification::LLNotification(const LLNotification::Params& p) : mRespondedTo(false), mPriority(p.priority), mCancelled(false), - mIgnored(false) + mIgnored(false), + mResponderObj(NULL) { if (p.functor.name.isChosen()) { @@ -416,6 +417,11 @@ LLNotification::LLNotification(const LLNotification::Params& p) : mTemporaryResponder = true; } + if(p.responder.isProvided()) + { + mResponderObj = p.responder; + } + mId.generate(); init(p.name, p.form_elements); } @@ -425,7 +431,8 @@ LLNotification::LLNotification(const LLSD& sd) : mTemporaryResponder(false), mRespondedTo(false), mCancelled(false), - mIgnored(false) + mIgnored(false), + mResponderObj(NULL) { mId.generate(); mSubstitutions = sd["substitutions"]; @@ -563,7 +570,9 @@ void LLNotification::respond(const LLSD& response) // and then call it functor(asLLSD(), response); - if (mTemporaryResponder) + bool is_resusable = getPayload()["reusable"].asBoolean(); + + if (mTemporaryResponder && !is_resusable) { LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName); mResponseFunctorName = ""; @@ -597,6 +606,16 @@ void LLNotification::setResponseFunctor(std::string const &responseFunctorName) mTemporaryResponder = false; } +void LLNotification::setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb) +{ + if(mTemporaryResponder) + { + LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName); + } + + LLNotificationFunctorRegistry::instance().registerFunctor(mResponseFunctorName, cb); +} + bool LLNotification::payloadContainsAll(const std::vector& required_fields) const { for(std::vector::const_iterator required_fields_it = required_fields.begin(); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 8d993b71d7..262633206b 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -296,6 +296,7 @@ public: Optional form_elements; Optional time_stamp; Optional context; + Optional responder; struct Functor : public LLInitParam::Choice { @@ -317,6 +318,7 @@ public: form_elements("form_elements") { time_stamp = LLDate::now(); + responder = NULL; } Params(const std::string& _name) @@ -329,6 +331,7 @@ public: functor.name = _name; name = _name; time_stamp = LLDate::now(); + responder = NULL; } }; @@ -344,6 +347,7 @@ private: bool mIgnored; ENotificationPriority mPriority; LLNotificationFormPtr mForm; + void* mResponderObj; // a reference to the template LLNotificationTemplatePtr mTemplatep; @@ -384,6 +388,8 @@ public: void setResponseFunctor(std::string const &responseFunctorName); + void setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb); + typedef enum e_response_template_type { WITHOUT_DEFAULT_BUTTON, @@ -423,6 +429,10 @@ public: void respond(const LLSD& sd); + void* getResponder() { return mResponderObj; } + + void setResponder(void* responder) { mResponderObj = responder; } + void setIgnored(bool ignore); bool isCancelled() const diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 9108cc9889..7c5af4a8bb 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -44,6 +44,7 @@ #include "llrect.h" #include "lltrans.h" #include "llnotificationsutil.h" +#include "llviewermessage.h" const S32 BOTTOM_PAD = VPAD * 3; const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding @@ -185,6 +186,8 @@ mCloseNotificationOnDestroy(true) // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed adjustPanelForScriptNotice(button_panel_width, button_panel_height); updateButtonsLayout(buttons, h_pad); + // save buttons for later use in disableButtons() + mButtons.assign(buttons.begin(), buttons.end()); } } // adjust panel's height to the text size @@ -334,6 +337,63 @@ void LLToastNotifyPanel::adjustPanelForTipNotice() } } +typedef std::set button_name_set_t; +typedef std::map disable_button_map_t; + +disable_button_map_t initUserGiveItemDisableButtonMap() +{ + // see EXT-5905 for disable rules + + disable_button_map_t disable_map; + button_name_set_t buttons; + + buttons.insert("Show"); + disable_map.insert(std::make_pair("Show", buttons)); + + buttons.insert("Discard"); + disable_map.insert(std::make_pair("Discard", buttons)); + + buttons.insert("Mute"); + disable_map.insert(std::make_pair("Mute", buttons)); + + return disable_map; +} + +button_name_set_t getButtonDisableList(const std::string& notification_name, const std::string& button_name) +{ + static disable_button_map_t user_give_item_disable_map = initUserGiveItemDisableButtonMap(); + + disable_button_map_t::const_iterator it; + disable_button_map_t::const_iterator it_end; + + if("UserGiveItem" == notification_name) + { + it = user_give_item_disable_map.find(button_name); + it_end = user_give_item_disable_map.end(); + } + + if(it_end != it) + { + return it->second; + } + return button_name_set_t(); +} + +void LLToastNotifyPanel::disableButtons(const std::string& notification_name, const std::string& selected_button) +{ + button_name_set_t buttons = getButtonDisableList(notification_name, selected_button); + + std::vector::const_iterator it = mButtons.begin(); + for ( ; it != mButtons.end(); it++) + { + LLButton* btn = it->second; + if(buttons.find(btn->getName()) != buttons.end()) + { + btn->setEnabled(FALSE); + } + } +} + // static void LLToastNotifyPanel::onClickButton(void* data) { @@ -346,8 +406,33 @@ void LLToastNotifyPanel::onClickButton(void* data) { response[button_name] = true; } + + bool is_reusable = self->mNotification->getPayload()["reusable"].asBoolean(); + // When we call respond(), LLOfferInfo will delete itself in inventory_offer_callback(), + // lets copy it while it's still valid. + LLOfferInfo* old_info = static_cast(self->mNotification->getResponder()); + LLOfferInfo* new_info = NULL; + if(is_reusable && old_info) + { + new_info = new LLOfferInfo(*old_info); + self->mNotification->setResponder(new_info); + } + self->mNotification->respond(response); - // disable all buttons - self->mControlPanel->setEnabled(FALSE); + if(is_reusable) + { + self->disableButtons(self->mNotification->getName(), button_name); + + if(new_info) + { + self->mNotification->setResponseFunctor( + boost::bind(&LLOfferInfo::inventory_offer_callback, new_info, _1, _2)); + } + } + else + { + // disable all buttons + self->mControlPanel->setEnabled(FALSE); + } } diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 9c90a4dfa4..5c83a893f0 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -85,6 +85,13 @@ private: */ void updateButtonsLayout(const std::vector& buttons, S32 h_pad); + /** + * Disable specific button(s) based on notification name and clicked button + */ + void disableButtons(const std::string& notification_name, const std::string& selected_button); + + std::vector mButtons; + // panel elements LLTextBase* mTextBox; LLPanel* mInfoPanel; // a panel, that contains an information diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 361f4e2326..de92e5f2ae 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1081,6 +1081,21 @@ LLOfferInfo::LLOfferInfo(const LLSD& sd) mHost = LLHost(sd["sender"].asString()); } +LLOfferInfo::LLOfferInfo(const LLOfferInfo& info) +{ + mIM = info.mIM; + mFromID = info.mFromID; + mFromGroup = info.mFromGroup; + mFromObject = info.mFromObject; + mTransactionID = info.mTransactionID; + mFolderID = info.mFolderID; + mObjectID = info.mObjectID; + mType = info.mType; + mFromName = info.mFromName; + mDesc = info.mDesc; + mHost = info.mHost; +} + LLSD LLOfferInfo::asLLSD() { LLSD sd; @@ -1570,7 +1585,12 @@ void inventory_offer_handler(LLOfferInfo* info) } else // Agent -> Agent Inventory Offer { + payload["reusable"] = true; + p.responder = info; // Note: sets inventory_offer_callback as the callback + // *TODO fix memory leak + // inventory_offer_callback() is not invoked if user received notification and + // closes viewer(without responding the notification) p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2)); p.name = "UserGiveItem"; diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 7dd629dcfd..88f9697037 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -215,6 +215,8 @@ struct LLOfferInfo mIM(IM_NOTHING_SPECIAL), mType(LLAssetType::AT_NONE) {}; LLOfferInfo(const LLSD& sd); + LLOfferInfo(const LLOfferInfo& info); + void forceResponse(InventoryOfferResponse response); EInstantMessage mIM; -- cgit v1.2.3 From 2fed8d5182813e2077522bb5bbb2cc565b5c283d Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Tue, 16 Mar 2010 14:48:20 +0200 Subject: =?UTF-8?q?fixed=20EXT-5904=20=E2=80=9COffers=20embedding=20into?= =?UTF-8?q?=20IM=20windows=E2=80=9D,=20corrected=20offer=20counter(used=20?= =?UTF-8?q?silent=20adding=20message=20to=20session=20without=20incrementi?= =?UTF-8?q?ng=20counter);=20avoided=20assertion=20when=20received=20offer?= =?UTF-8?q?=20from=20blocked=20avatar=20with=20closed=20IM=20session;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llnotificationhandlerutil.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index a37e796a6d..cb3d52fe13 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -244,7 +244,7 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, // set searched session as active to avoid IM toast popup LLIMModel::instance().setActiveSessionID(session_id); - LLIMModel::instance().addMessage(session_id, from, from_id, + LLIMModel::instance().addMessageSilently(session_id, from, from_id, message); // restore active session id @@ -367,6 +367,10 @@ std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notifica if (res.empty()) { LLUUID from_id = notification->getPayload()["FROM_ID"]; + if (from_id.isNull()) + { + from_id = notification->getPayload()["from_id"]; + } if(!gCacheName->getFullName(from_id, res)) { res = ""; -- cgit v1.2.3 From 97dea26dfca2ebd3d571f80c6e418d7c64779277 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 15:30:01 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Implemented requested feature - "Resolving offer in the notification toast shouldn't remove offer panel form IM log until IM session is restarted" --HG-- branch : product-engine --- indra/llui/llnotifications.cpp | 9 +++++++- indra/llui/llnotifications.h | 3 +++ indra/newview/lltoastnotifypanel.cpp | 43 +++++++++++++++++++++++++++++++++++- indra/newview/lltoastnotifypanel.h | 15 +++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 7b8970a153..56ec8c4262 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -486,6 +486,7 @@ void LLNotification::updateFrom(LLNotificationPtr other) mForm = other->mForm; mResponseFunctorName = other->mResponseFunctorName; mRespondedTo = other->mRespondedTo; + mResponse = other->mResponse; mTemporaryResponder = other->mTemporaryResponder; update(); @@ -563,7 +564,9 @@ std::string LLNotification::getSelectedOptionName(const LLSD& response) void LLNotification::respond(const LLSD& response) { + // *TODO may remove mRespondedTo and use mResponce.isDefined() in isRespondedTo() mRespondedTo = true; + mResponse = response; // look up the functor LLNotificationFunctorRegistry::ResponseFunctor functor = LLNotificationFunctorRegistry::instance().getFunctor(mResponseFunctorName); @@ -875,7 +878,11 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt if (wasFound) { abortProcessing = mChanged(payload); - mItems.erase(pNotification); + // do not delete the notification to make LLChatHistory::appendMessage add notification panel to IM window + if( ! pNotification->getPayload()["reusable"].asBoolean() ) + { + mItems.erase(pNotification); + } onDelete(pNotification); } } diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 262633206b..a516a6723e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -344,6 +344,7 @@ private: LLDate mExpiresAt; bool mCancelled; bool mRespondedTo; // once the notification has been responded to, this becomes true + LLSD mResponse; bool mIgnored; ENotificationPriority mPriority; LLNotificationFormPtr mForm; @@ -445,6 +446,8 @@ public: return mRespondedTo; } + const LLSD& getResponse() { return mResponse; } + bool isIgnored() const { return mIgnored; diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 77d1d1fc0b..530110239e 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -54,7 +54,9 @@ S32 BUTTON_WIDTH = 90; const LLFontGL* LLToastNotifyPanel::sFont = NULL; const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL; +LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal; LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : + LLToastPanel(notification), mTextBox(NULL), mInfoPanel(NULL), @@ -202,6 +204,18 @@ mCloseNotificationOnDestroy(true) // adjust panel's height to the text size mInfoPanel->setFollowsAll(); snapToMessageHeight(mTextBox, MAX_LENGTH); + + if(notification->getPayload()["reusable"].asBoolean()) + { + mButtonClickConnection = sButtonClickSignal.connect( + boost::bind(&LLToastNotifyPanel::onToastPanelButtonClicked, this, _1, _2)); + + if(notification->isRespondedTo()) + { + // User selected an option in toast, now disable required buttons in IM window + disableRespondedOptions(notification); + } + } } void LLToastNotifyPanel::addDefaultButton() { @@ -269,6 +283,8 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt LLToastNotifyPanel::~LLToastNotifyPanel() { + mButtonClickConnection.disconnect(); + std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer()); if (mCloseNotificationOnDestroy && LLNotificationsUtil::find(mNotification->getID()) != NULL) { @@ -431,7 +447,7 @@ void LLToastNotifyPanel::onClickButton(void* data) if(is_reusable) { - self->disableButtons(self->mNotification->getName(), button_name); + sButtonClickSignal(self->mNotification->getID(), button_name); if(new_info) { @@ -445,3 +461,28 @@ void LLToastNotifyPanel::onClickButton(void* data) self->mControlPanel->setEnabled(FALSE); } } + +void LLToastNotifyPanel::onToastPanelButtonClicked(const LLUUID& notification_id, const std::string btn_name) +{ + if(mNotification->getID() == notification_id) + { + disableButtons(mNotification->getName(), btn_name); + } +} + +void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification) +{ + LLSD response = notification->getResponse(); + for (LLSD::map_const_iterator response_it = response.beginMap(); + response_it != response.endMap(); ++response_it) + { + if (response_it->second.isBoolean() && response_it->second.asBoolean()) + { + // that after multiple responses there can be many pressed buttons + // need to process them all + disableButtons(notification->getName(), response_it->first); + } + } +} + +// EOF diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 1539c613af..d565085e3c 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -108,6 +108,21 @@ private: // internal handler for button being clicked static void onClickButton(void* data); + typedef boost::signals2::signal + button_click_signal_t; + static button_click_signal_t sButtonClickSignal; + boost::signals2::connection mButtonClickConnection; + + /** + * handle sButtonClickSignal (to disable buttons) across all panels with given notification_id + */ + void onToastPanelButtonClicked(const LLUUID& notification_id, const std::string btn_name); + + /** + * Process response data. Will disable selected options + */ + void disableRespondedOptions(LLNotificationPtr& notification); + bool mIsTip; bool mAddedDefaultBtn; bool mIsScriptDialog; -- cgit v1.2.3 From 02f6a41723245620d364aed071107d5b8cc9a144 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 15:41:34 +0200 Subject: merge --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 530110239e..7805d23f02 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -55,8 +55,8 @@ const LLFontGL* LLToastNotifyPanel::sFont = NULL; const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL; LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal; -LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : +LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : LLToastPanel(notification), mTextBox(NULL), mInfoPanel(NULL), -- cgit v1.2.3 From 30c586e77031f0c9141e8b8b96c344a6a9007876 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 17:04:55 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Update for TeleportOffered and OfferFriendship offers. --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 45 ++++++++++++++++++++++++++++++++++-- indra/newview/llviewermessage.cpp | 2 ++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 7805d23f02..2f77936cad 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -384,18 +384,59 @@ disable_button_map_t initUserGiveItemDisableButtonMap() return disable_map; } +disable_button_map_t initTeleportOfferedDisableButtonMap() +{ + disable_button_map_t disable_map; + button_name_set_t buttons; + + buttons.insert("Teleport"); + buttons.insert("Cancel"); + + disable_map.insert(std::make_pair("Teleport", buttons)); + disable_map.insert(std::make_pair("Cancel", buttons)); + + return disable_map; +} + +disable_button_map_t initFriendshipOfferedDisableButtonMap() +{ + disable_button_map_t disable_map; + button_name_set_t buttons; + + buttons.insert("Accept"); + buttons.insert("Decline"); + + disable_map.insert(std::make_pair("Accept", buttons)); + disable_map.insert(std::make_pair("Decline", buttons)); + + return disable_map; +} + button_name_set_t getButtonDisableList(const std::string& notification_name, const std::string& button_name) { static disable_button_map_t user_give_item_disable_map = initUserGiveItemDisableButtonMap(); + static disable_button_map_t teleport_offered_disable_map = initTeleportOfferedDisableButtonMap(); + static disable_button_map_t friendship_offered_disable_map = initFriendshipOfferedDisableButtonMap(); disable_button_map_t::const_iterator it; disable_button_map_t::const_iterator it_end; + disable_button_map_t search_map; if("UserGiveItem" == notification_name) { - it = user_give_item_disable_map.find(button_name); - it_end = user_give_item_disable_map.end(); + search_map = user_give_item_disable_map; } + else if("TeleportOffered" == notification_name) + { + search_map = teleport_offered_disable_map; + } + else if("FriendshipOffered" == notification_name) + { + search_map = friendship_offered_disable_map; + } + + it = search_map.find(button_name); + it_end = search_map.end(); if(it_end != it) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e6cf6e45ac..d44f5161f6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2318,6 +2318,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["from_id"] = from_id; payload["lure_id"] = session_id; payload["godlike"] = FALSE; + payload["reusable"] = true; LLNotificationsUtil::add("TeleportOffered", args, payload); } } @@ -2386,6 +2387,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { + payload["reusable"] = true; args["[MESSAGE]"] = message; LLNotificationsUtil::add("OfferFriendship", args, payload); } -- cgit v1.2.3 From b5ba328480b0d42343fa02219b98c017f3ac0aad Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Tue, 16 Mar 2010 17:50:14 +0200 Subject: =?UTF-8?q?EXT-5904=20=E2=80=9COffers=20embedding=20into=20IM=20wi?= =?UTF-8?q?ndows=E2=80=9D,=20added=20restoring=20IM=20counters=20when=20lo?= =?UTF-8?q?gging=20message;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llnotificationhandlerutil.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index cb3d52fe13..ae41e673bf 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -244,8 +244,13 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, // set searched session as active to avoid IM toast popup LLIMModel::instance().setActiveSessionID(session_id); + S32 unread = session->mNumUnread; + S32 participant_unread = session->mParticipantUnreadMessageCount; LLIMModel::instance().addMessageSilently(session_id, from, from_id, message); + // we shouldn't increment counters when logging, so restore them + session->mNumUnread = unread; + session->mParticipantUnreadMessageCount = participant_unread; // restore active session id if (active_session_id.isNull()) -- cgit v1.2.3 From b2cc39d462b33f5fdfed3e6a58dcf467f1b8da46 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 17 Mar 2010 13:26:34 +0200 Subject: (work in progress) low task EXT-6377 - Embedded offer panels aren't reshaped by height on IM window resize Added new Toast panel class for use in IM floater. New class handles IM floater reshape and updates Toast height. --HG-- branch : product-engine --- indra/newview/llchathistory.cpp | 2 +- indra/newview/lltoastnotifypanel.cpp | 24 ++++++++++++++++++++++++ indra/newview/lltoastnotifypanel.h | 11 +++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 911ac9c485..b2e49dd5c6 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -734,7 +734,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId); if (notification != NULL) { - LLToastNotifyPanel* notify_box = new LLToastNotifyPanel( + LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( notification); //we can't set follows in xml since it broke toasts behavior notify_box->setFollowsLeft(); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 2f77936cad..7d0fb4a46f 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -526,4 +526,28 @@ void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification } } + +////////////////////////////////////////////////////////////////////////// + +#include "llscrollcontainer.h" +LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect /* = LLRect::null */) + : LLToastNotifyPanel(pNotification, rect) +{ + mTextBox->setFollowsAll(); +} + +void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +{ + S32 text_height = mTextBox->getTextBoundingRect().getHeight(); + S32 widget_height = mTextBox->getRect().getHeight(); + S32 delta = text_height - widget_height; + LLRect rc = getRect(); + + rc.setLeftTopAndSize(rc.mLeft, rc.mTop, width, height + delta); + height = rc.getHeight(); + width = rc.getWidth(); + + LLToastPanel::reshape(width, height, called_from_parent); +} + // EOF diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index d565085e3c..a8d2d03236 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -79,8 +79,6 @@ protected: bool mCloseNotificationOnDestroy; -private: - typedef std::pair index_button_pair_t; void adjustPanelForScriptNotice(S32 max_width, S32 max_height); void adjustPanelForTipNotice(); @@ -136,4 +134,13 @@ private: static const LLFontGL* sFontSmall; }; +class LLIMToastNotifyPanel : public LLToastNotifyPanel +{ +public: + + LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null); + + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); +}; + #endif /* LLTOASTNOTIFYPANEL_H_ */ -- cgit v1.2.3 From f4e8d1dfb23060438f0c68952225d60722295d31 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 17 Mar 2010 14:06:03 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Mistyped offer name. --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 7d0fb4a46f..3b0708f705 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -430,7 +430,7 @@ button_name_set_t getButtonDisableList(const std::string& notification_name, con { search_map = teleport_offered_disable_map; } - else if("FriendshipOffered" == notification_name) + else if("OfferFriendship" == notification_name) { search_map = friendship_offered_disable_map; } -- cgit v1.2.3 From 3fa6c94511725c444cb146567b446fdcc3bf8709 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 17 Mar 2010 15:46:55 +0200 Subject: Removed unnesessary include --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 3b0708f705..d7a3bc1462 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -529,7 +529,6 @@ void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification ////////////////////////////////////////////////////////////////////////// -#include "llscrollcontainer.h" LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect /* = LLRect::null */) : LLToastNotifyPanel(pNotification, rect) { -- cgit v1.2.3 From 31370e1aaea10543be81d1707c28dc4c2559baac Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Wed, 17 Mar 2010 16:27:35 +0200 Subject: =?UTF-8?q?fixed=20EXT-6373=20=E2=80=9CConsecutive=20offer=20messa?= =?UTF-8?q?ges=20are=20unreadable=20in=20the=20IM=20log=E2=80=9D,=20added?= =?UTF-8?q?=20spacer=20panel=20for=20IM=20chat=20plaintext=20mode;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llchathistory.cpp | 16 ++++++++++++++++ indra/newview/llchathistory.h | 9 +++++++++ .../skins/default/xui/en/widgets/chat_history.xml | 1 + 3 files changed, 26 insertions(+) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 911ac9c485..b497dde9dd 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -447,6 +447,7 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p) : LLUICtrl(p), mMessageHeaderFilename(p.message_header), mMessageSeparatorFilename(p.message_separator), + mMessagePlaintextSeparatorFilename(p.message_plaintext_separator), mLeftTextPad(p.left_text_pad), mRightTextPad(p.right_text_pad), mLeftWidgetPad(p.left_widget_pad), @@ -534,6 +535,12 @@ LLView* LLChatHistory::getSeparator() return separator; } +LLView* LLChatHistory::getPlaintextSeparator() +{ + LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile(mMessagePlaintextSeparatorFilename, NULL, LLPanel::child_registry_t::instance()); + return separator; +} + LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params) { LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename); @@ -632,6 +639,15 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (use_plain_text_chat_history) { + // append plaintext separator + LLView* separator = getPlaintextSeparator(); + LLInlineViewSegment::Params p; + p.force_newline = true; + p.left_pad = mLeftWidgetPad; + p.right_pad = mRightWidgetPad; + p.view = separator; + mEditor->appendWidget(p, "\n", false); + mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params); if (utf8str_trim(chat.mFromName).size() != 0) diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index 950b32861b..dfe5ea98e6 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -47,6 +47,8 @@ class LLChatHistory : public LLUICtrl Optional message_header; //Message separator filename Optional message_separator; + //Message plaintext separator filename + Optional message_plaintext_separator; //Text left padding from the scroll rect Optional left_text_pad; //Text right padding from the scroll rect @@ -69,6 +71,7 @@ class LLChatHistory : public LLUICtrl Params() : message_header("message_header"), message_separator("message_separator"), + message_plaintext_separator("message_plaintext_separator"), left_text_pad("left_text_pad"), right_text_pad("right_text_pad"), left_widget_pad("left_widget_pad"), @@ -96,6 +99,11 @@ class LLChatHistory : public LLUICtrl * @return pointer to LLView separator object. */ LLView* getSeparator(); + /** + * Builds a message plaintext separator. + * @return pointer to LLView separator object. + */ + LLView* getPlaintextSeparator(); /** * Builds a message header. * @return pointer to LLView header object. @@ -133,6 +141,7 @@ class LLChatHistory : public LLUICtrl std::string mMessageHeaderFilename; std::string mMessageSeparatorFilename; + std::string mMessagePlaintextSeparatorFilename; S32 mLeftTextPad; S32 mRightTextPad; diff --git a/indra/newview/skins/default/xui/en/widgets/chat_history.xml b/indra/newview/skins/default/xui/en/widgets/chat_history.xml index ef885e8045..aa3ea736b8 100644 --- a/indra/newview/skins/default/xui/en/widgets/chat_history.xml +++ b/indra/newview/skins/default/xui/en/widgets/chat_history.xml @@ -2,6 +2,7 @@ Date: Thu, 18 Mar 2010 21:51:27 +0200 Subject: Related to EXT-5909 (Accepted/declined inventory offer shouldn't spawn chiclet). - Removed unnecessary string in strings.xml and substituted it in code with existing one. --HG-- branch : product-engine --- indra/newview/lltooldraganddrop.cpp | 2 +- indra/newview/skins/default/xui/en/strings.xml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 08f874d1d2..47e60a966e 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1532,7 +1532,7 @@ void LLToolDragAndDrop::logInventoryOffer(const LLUUID& to_agent, const LLUUID & std::string full_name; if (gCacheName->getFullName(to_agent, full_name)) { - LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, LLTrans::getString("inventory_item_offered")); + LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, LLTrans::getString("inventory_item_offered-im")); } } } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 338612664a..4b9140ee90 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2915,7 +2915,6 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Click here to instant message. To (Moderator) - Inventory item offered Started a voice call -- cgit v1.2.3 From 37812054480843bca8e9016e3f816e9fdee6e7d3 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Fri, 19 Mar 2010 15:32:14 +0200 Subject: Related to EXT-5986 ([HARD CODED]. "You paid ...... L$... " - message needs translation) - Slightly modified regexp to avoid adding of extra space after names and also made demands to the end of the message string more strict by escaping "." Reviewed by Kent at https://codereview.productengine.com/secondlife/r/55/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 32edbec822..2ba8bd7551 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4513,7 +4513,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // Each set of parenthesis will later be used to find arguments of message we generate // in the end of this if- (.*) gives us name of money receiver, (\\d+)-amount of money we pay // and ([^$]*)- reason of payment - boost::regex expr("You paid (.*)L\\$(\\d+)\\s?([^$]*)."); + boost::regex expr("You paid (?:.{0}|(.*) )L\\$(\\d+)\\s?([^$]*)\\."); boost::match_results matches; if(boost::regex_match(desc, matches, expr)) { -- cgit v1.2.3 From 1c4eeed50fddd32c43fc4093492727035c9da49b Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 19 Mar 2010 16:35:45 +0200 Subject: fixed EXT-6451 Name of people sending a IM some times is NoBody LLSD::maps keys accross the code are used in mix of cases, lower and upper. Using "from_id" and "FROM_ID" causes avatar id to be null and thus "no body" was displayed. BUT this fix is of no use since several minutes ago viewer-offers feature was merged into release, which overrides avatar name with "Second Life" to display message about teleport offering as system message Reviewed by Q at https://codereview.productengine.com/secondlife/r/72/ --HG-- branch : product-engine --- indra/newview/llnotificationhandlerutil.cpp | 4 +++- indra/newview/llviewermessage.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index ae41e673bf..5affd5c677 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -372,7 +372,9 @@ std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notifica if (res.empty()) { LLUUID from_id = notification->getPayload()["FROM_ID"]; - if (from_id.isNull()) + + //*TODO all keys everywhere should be made of the same case, there is a mix of keys in lower and upper cases + if (from_id.isNull()) { from_id = notification->getPayload()["from_id"]; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f0b61bbf45..7ecff4c2d8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5567,6 +5567,8 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response) args["TO_NAME"] = target_name; LLSD payload; + + //*TODO please rewrite all keys to the same case, lower or upper payload["from_id"] = target_id; payload["SESSION_NAME"] = target_name; payload["SUPPRESS_TOAST"] = true; -- cgit v1.2.3 From 627c5a365f4506c30af1471c4e1880f43922ca48 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Fri, 19 Mar 2010 16:59:25 +0200 Subject: (EXT-6470) [TRANSLATED BUT IN EN] Media Nav bar (Media Control) - Fixed panel name in en/panel_prim_media_controls.xml. Panel name mismatch in localized files prevented from using localized attributes (e.g. tool tips) of all children of this panel. Reviewed by Vadim Savchuk https://codereview.productengine.com/secondlife/r/73/ --HG-- branch : product-engine --- indra/newview/skins/default/xui/en/panel_prim_media_controls.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml index 6b5f0c3896..6bf00373ea 100644 --- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml @@ -1,7 +1,7 @@ Date: Fri, 19 Mar 2010 17:03:17 +0200 Subject: Update for critical bug EXT-6318 [TRUNCATION] [EN XUI REWORK] - Talk button is truncated "Sprechen". need xui designer to widen it by some 10 pixels * restored center aligning for Speak button's label. * also it is right aligned in 'de' locale which has too long value. * default right padding is set in 'en' locale (in has no effect on center aligned label) Reviewed by Vadim at https://codereview.productengine.com/secondlife/r/36/ --HG-- branch : product-engine --- indra/newview/skins/default/xui/de/panel_bottomtray.xml | 2 +- indra/newview/skins/default/xui/en/panel_bottomtray.xml | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/indra/newview/skins/default/xui/de/panel_bottomtray.xml b/indra/newview/skins/default/xui/de/panel_bottomtray.xml index d3f89b0ad3..d52b8dcf4d 100644 --- a/indra/newview/skins/default/xui/de/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/de/panel_bottomtray.xml @@ -9,7 +9,7 @@ - + diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index e70a0512d6..58c5c11e51 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -74,12 +74,15 @@ name="talk" top="5" width="105"> + Date: Fri, 19 Mar 2010 17:03:32 +0200 Subject: Done normal task EXT-6267 ([TRUNCATION] [EN XUI REWORK] - Side panel, profiles: the teleport button is truncated. need 'en' xui designer rework) * moved Map Button into the dropdown menu (with enable/click logic). New is added into the menu_profile_overflow.xml * redesigned rest of buttons to accommodate available space Now buttons' widths are enough to not truncate labels in all locales. NOTE: New "Map" item menu should be localized (just move values from panel_profile.xml to menu_profile_overflow.xml) in other locales. Reviewed by Vadim at https://codereview.productengine.com/secondlife/r/59/ --HG-- branch : product-engine --- indra/newview/llpanelavatar.cpp | 11 ++++++++ indra/newview/llpanelavatar.h | 1 + .../skins/default/xui/en/menu_profile_overflow.xml | 9 +++++++ .../newview/skins/default/xui/en/panel_profile.xml | 30 ++++++---------------- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 57b478ffef..a0ba2f739b 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -495,6 +495,7 @@ BOOL LLPanelAvatarProfile::postBuild() &LLPanelAvatarProfile::onMapButtonClick, this)), NULL); LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + registrar.add("Profile.ShowOnMap", boost::bind(&LLPanelAvatarProfile::onMapButtonClick, this)); registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this)); registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this)); registrar.add("Profile.BlockUnblock", boost::bind(&LLPanelAvatarProfile::toggleBlock, this)); @@ -504,6 +505,7 @@ BOOL LLPanelAvatarProfile::postBuild() registrar.add("Profile.CSR", boost::bind(&LLPanelAvatarProfile::csr, this)); LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable; + enable.add("Profile.EnableShowOnMap", boost::bind(&LLPanelAvatarProfile::enableShowOnMap, this)); enable.add("Profile.EnableGod", boost::bind(&enable_god)); enable.add("Profile.EnableBlock", boost::bind(&LLPanelAvatarProfile::enableBlock, this)); enable.add("Profile.EnableUnblock", boost::bind(&LLPanelAvatarProfile::enableUnblock, this)); @@ -698,6 +700,15 @@ void LLPanelAvatarProfile::toggleBlock() LLAvatarActions::toggleBlock(getAvatarId()); } +bool LLPanelAvatarProfile::enableShowOnMap() +{ + bool is_buddy_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()); + + bool enable_map_btn = (is_buddy_online && is_agent_mappable(getAvatarId())) + || gAgent.isGodlike(); + return enable_map_btn; +} + bool LLPanelAvatarProfile::enableBlock() { return LLAvatarActions::canBlock(getAvatarId()) && !LLAvatarActions::isBlocked(getAvatarId()); diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 2bd23b6e9c..bb8df2ff9c 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -202,6 +202,7 @@ protected: void unfreeze(); void csr(); + bool enableShowOnMap(); bool enableBlock(); bool enableUnblock(); bool enableGod(); diff --git a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml index 5162a4902f..b0b7b554b0 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml @@ -5,6 +5,15 @@ mouse_opaque="false" name="profile_overflow_menu" width="120"> + + + + + width="117" />