diff --git a/indra/llui/llnotificationsutil.cpp b/indra/llui/llnotificationsutil.cpp index 2cd165f1b30656130e73053a97112f05eb213105..f343d27cb4e0bbff5e8524a28792333d39b00229 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 a0801b338ff64bc8ecee18e44db9b51eefb54c6a..d552fa915b432ff316a8db852df51551856c7367 100644 --- a/indra/llui/llnotificationsutil.h +++ b/indra/llui/llnotificationsutil.h @@ -63,6 +63,8 @@ namespace LLNotificationsUtil boost::function<void (const LLSD&, const LLSD&)> 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 a7a6da3ac21f09196c5732d6d29d0c2d9b22f097..5af023f5657de6853da13da6d102389a6260cead 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 0fbc6575e8f5eaf73d6ecb9e35e6d236acde7d77..6748bd79823757675f5c84ed49e75d9415821ff8 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 b7f95ae2fa62e105d0d2c16df9044180b1a0d793..4d64c5c0e4043d29eef27ffe1e36825e5ed7a853 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<LLScreenChannel*>(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<LLScreenChannel*>(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 0d7351395ab0cfe4fcc8778daf930d6efa480a93..c4946b895ec50639639d9e4630a7ee58035f8637 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"/> </form> </notification> + + <notification + icon="notify.tga" + name="FriendshipOffered" + type="offer"> + You have offered friendship to [TO_NAME] + </notification> <notification icon="notify.tga"