diff options
author | Alexei Arabadji <aarabadji@productengine.com> | 2009-12-07 15:15:41 +0200 |
---|---|---|
committer | Alexei Arabadji <aarabadji@productengine.com> | 2009-12-07 15:15:41 +0200 |
commit | 0a617f15a83262ab472ca88f146c57bb0f6a6a73 (patch) | |
tree | 849d190131693d9ea976c0ce25501801d03ce5cb | |
parent | 67ff38b51b59766ff7bc0af1e541b54ac067ea70 (diff) |
implemented EXT-2797 “Making friendship offer should be recorded into IM history”
--HG--
branch : product-engine
-rw-r--r-- | indra/llui/llnotificationsutil.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llnotificationsutil.h | 2 | ||||
-rw-r--r-- | indra/newview/llavataractions.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llnotificationhandlerutil.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llnotificationofferhandler.cpp | 33 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 7 |
6 files changed, 50 insertions, 15 deletions
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<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 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<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 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"/> </form> </notification> + + <notification + icon="notify.tga" + name="FriendshipOffered" + type="offer"> + You have offered friendship to [TO_NAME] + </notification> <notification icon="notify.tga" |