From 40d89ae418be2c43903955f1ee4dfbf05e38576c Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Fri, 25 Dec 2009 16:41:06 +0200 Subject: =?UTF-8?q?fixed=20EXT-700=20=E2=80=9C"Offer"=20notifications=20sh?= =?UTF-8?q?ould=20be=20accessible=20via=20chiclet=E2=80=9D=20made=20invent?= =?UTF-8?q?ory=20and=20teleport=20offers=20spawn=20chiclet;=20made=20'inve?= =?UTF-8?q?ntory=20accepted'=20toast=20as=20notytip;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llnotificationhandler.h | 5 ++++ indra/newview/llnotificationhandlerutil.cpp | 30 ++++++++++++++++++---- indra/newview/llnotificationofferhandler.cpp | 11 +------- indra/newview/llnotificationtiphandler.cpp | 13 ++++++++++ .../newview/skins/default/xui/en/notifications.xml | 2 +- 5 files changed, 45 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 515c86bae8..33ef4c81cd 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -298,6 +298,11 @@ public: * Writes notification message to nearby chat. */ static void logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type); + + /** + * Spawns IM session. + */ + static void spawnIMSession(const std::string& name, const LLUUID& from_id); }; } diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 5b54092c5c..174efd24a6 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -47,11 +47,13 @@ const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"), "ObjectGiveItem"), OBJECT_GIVE_ITEM_UNKNOWN_USER( "ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived"), ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"), - USER_GIVE_ITEM("UserGiveItem"), OFFER_FRIENDSHIP("OfferFriendship"), + USER_GIVE_ITEM("UserGiveItem"), INVENTORY_ACCEPTED("InventoryAccepted"), + OFFER_FRIENDSHIP("OfferFriendship"), FRIENDSHIP_ACCEPTED("FriendshipAccepted"), FRIENDSHIP_OFFERED("FriendshipOffered"), FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline"), - SERVER_OBJECT_MESSAGE("ServerObjectMessage"); + SERVER_OBJECT_MESSAGE("ServerObjectMessage"), + TELEPORT_OFFERED("TeleportOffered"); // static bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) @@ -60,7 +62,8 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) || REVOKED_MODIFY_RIGHTS == notification->getName() || PAYMENT_RECIVED == notification->getName() || FRIENDSHIP_OFFERED == notification->getName() - || SERVER_OBJECT_MESSAGE == notification->getName(); + || SERVER_OBJECT_MESSAGE == notification->getName() + || INVENTORY_ACCEPTED == notification->getName(); } // static @@ -68,7 +71,8 @@ bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification) { return notification->getType() == "notifytip" && FRIEND_ONLINE != notification->getName() - && FRIEND_OFFLINE != notification->getName(); + && FRIEND_OFFLINE != notification->getName() + && INVENTORY_ACCEPTED != notification->getName(); } // static @@ -76,7 +80,10 @@ bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) { return ADD_FRIEND_WITH_MESSAGE == notification->getName() || OFFER_FRIENDSHIP == notification->getName() - || FRIENDSHIP_ACCEPTED == notification->getName(); + || FRIENDSHIP_ACCEPTED == notification->getName() + || USER_GIVE_ITEM == notification->getName() + || INVENTORY_ACCEPTED == notification->getName() + || TELEPORT_OFFERED == notification->getName(); } // static @@ -169,3 +176,16 @@ void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChat } } +// static +void LLHandlerUtil::spawnIMSession(const std::string& name, const LLUUID& from_id) +{ + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); + + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + session_id); + if (session == NULL) + { + LLIMMgr::instance().addSession(name, IM_NOTHING_SPECIAL, from_id); + } +} + diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 4d64c5c0e4..5861a802e9 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -111,16 +111,7 @@ bool LLOfferHandler::processNotification(const LLSD& notify) LLUUID from_id = notification->getPayload()["from_id"]; - LLUUID session_id = LLIMMgr::computeSessionID( - IM_NOTHING_SPECIAL, from_id); - - LLIMModel::LLIMSession* session = - LLIMModel::instance().findIMSession(session_id); - if (session == NULL) - { - LLIMMgr::instance().addSession(name, IM_NOTHING_SPECIAL, - from_id); - } + LLHandlerUtil::spawnIMSession(name, from_id); } if (notification->getPayload().has("SUPPRES_TOST") diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index 9afaddae82..83a2215ac6 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -101,6 +101,19 @@ bool LLTipHandler::processNotification(const LLSD& notify) } } + const std::string name = notification->getSubstitutions()["NAME"]; + LLUUID from_id = notification->getPayload()["from_id"]; + if (LLHandlerUtil::canLogToIM(notification)) + { + LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, name, name, + notification->getMessage(), from_id, from_id); + } + + if (LLHandlerUtil::canSpawnIMSession(notification)) + { + LLHandlerUtil::spawnIMSession(name, from_id); + } + LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); LLToast::Params p; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index d4b712e048..ee8b7a5132 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4498,7 +4498,7 @@ You don't have permission to copy this. + type="notifytip"> [NAME] received your inventory offer. -- cgit v1.2.3