From 0a617f15a83262ab472ca88f146c57bb0f6a6a73 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Mon, 7 Dec 2009 15:15:41 +0200 Subject: =?UTF-8?q?implemented=20EXT-2797=20=E2=80=9CMaking=20friendship?= =?UTF-8?q?=20offer=20should=20be=20recorded=20into=20IM=20history?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/llui/llnotificationsutil.cpp | 5 ++++ indra/llui/llnotificationsutil.h | 2 ++ indra/newview/llavataractions.cpp | 7 +++++ indra/newview/llnotificationhandlerutil.cpp | 11 ++++++-- indra/newview/llnotificationofferhandler.cpp | 33 ++++++++++++++-------- .../newview/skins/default/xui/en/notifications.xml | 7 +++++ 6 files changed, 50 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/llui/llnotificationsutil.cpp b/indra/llui/llnotificationsutil.cpp index 2cd165f1b3..f343d27cb4 100644 --- a/indra/llui/llnotificationsutil.cpp +++ b/indra/llui/llnotificationsutil.cpp @@ -89,3 +89,8 @@ S32 LLNotificationsUtil::getSelectedOption(const LLSD& notification, const LLSD& { return LLNotification::getSelectedOption(notification, response); } + +void LLNotificationsUtil::cancel(LLNotificationPtr pNotif) +{ + LLNotifications::instance().cancel(pNotif); +} diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h index a0801b338f..d552fa915b 100644 --- a/indra/llui/llnotificationsutil.h +++ b/indra/llui/llnotificationsutil.h @@ -63,6 +63,8 @@ namespace LLNotificationsUtil boost::function functor); S32 getSelectedOption(const LLSD& notification, const LLSD& response); + + void cancel(LLNotificationPtr pNotif); } #endif diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index a7a6da3ac2..5af023f565 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -487,6 +487,13 @@ void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::stri IM_ONLINE, IM_FRIENDSHIP_OFFERED, calling_card_folder_id); + + LLSD args; + args["TO_NAME"] = target_name; + LLSD payload; + payload["SESSION_NAME"] = target_name; + payload["SUPPRES_TOST"] = true; + LLNotificationsUtil::add("FriendshipOffered", args, payload); } //static diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 0fbc6575e8..6748bd7982 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -46,14 +46,16 @@ const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"), "ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived"), ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"), USER_GIVE_ITEM("UserGiveItem"), OFFER_FRIENDSHIP("OfferFriendship"), - FRIENDSHIP_ACCEPTED("FriendshipAccepted"); + FRIENDSHIP_ACCEPTED("FriendshipAccepted"), + FRIENDSHIP_OFFERED("FriendshipOffered"); // static bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) { return GRANTED_MODIFY_RIGHTS == notification->getName() || REVOKED_MODIFY_RIGHTS == notification->getName() - || PAYMENT_RECIVED == notification->getName(); + || PAYMENT_RECIVED == notification->getName() + || FRIENDSHIP_OFFERED == notification->getName(); } // static @@ -103,13 +105,16 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification) notification->getSubstitutions().has("NAME") ? notification->getSubstitutions()["NAME"] : notification->getSubstitutions()["[NAME]"]; + const std::string session_name = notification->getPayload().has( + "SESSION_NAME") ? notification->getPayload()["SESSION_NAME"].asString() : name; + // don't create IM p2p session with objects, it's necessary condition to log if (notification->getName() != OBJECT_GIVE_ITEM && notification->getName() != OBJECT_GIVE_ITEM_UNKNOWN_USER) { LLUUID from_id = notification->getPayload()["from_id"]; - logToIM(IM_NOTHING_SPECIAL, name, name, notification->getMessage(), + logToIM(IM_NOTHING_SPECIAL, session_name, name, notification->getMessage(), from_id, from_id); } } diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index b7f95ae2fa..4d64c5c0e4 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -41,6 +41,7 @@ #include "llnotifications.h" #include "llscriptfloater.h" #include "llimview.h" +#include "llnotificationsutil.h" using namespace LLNotificationsUI; @@ -122,20 +123,28 @@ bool LLOfferHandler::processNotification(const LLSD& notify) } } - LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); + if (notification->getPayload().has("SUPPRES_TOST") + && notification->getPayload()["SUPPRES_TOST"]) + { + LLNotificationsUtil::cancel(notification); + } + else + { + LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); - 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); - - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->addToast(p); + 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); - // send a signal to the counter manager - mNewNotificationSignal(); + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->addToast(p); + + // send a signal to the counter manager + mNewNotificationSignal(); + } } } else if (notify["sigtype"].asString() == "delete") diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 0d7351395a..c4946b895e 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5128,6 +5128,13 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you [O text="Decline"/> + + + You have offered friendship to [TO_NAME] +