diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llnotificationalerthandler.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llnotificationhandler.h | 16 | ||||
-rw-r--r-- | indra/newview/llnotificationhandlerutil.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llnotificationofferhandler.cpp | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 2 |
5 files changed, 47 insertions, 10 deletions
diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp index c3df4cbaf4..52de8355e9 100644 --- a/indra/newview/llnotificationalerthandler.cpp +++ b/indra/newview/llnotificationalerthandler.cpp @@ -93,6 +93,19 @@ bool LLAlertHandler::processNotification(const LLSD& notify) if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "load") { + if (LLHandlerUtil::canSpawnSessionAndLogToIM(notification)) + { + const std::string name = LLHandlerUtil::getSubstitutionName(notification); + + LLUUID from_id = notification->getPayload()["from_id"]; + + // firstly create session... + LLHandlerUtil::spawnIMSession(name, from_id); + + // ...then log message to have IM Well notified about new message + LLHandlerUtil::logToIMP2P(notification); + } + LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal); LLToast::Params p; p.notif_id = notification->getID(); diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 33ef4c81cd..0fb438bfe9 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -277,6 +277,13 @@ public: static bool canSpawnIMSession(const LLNotificationPtr& notification); /** + * Checks if passed notification can create IM session and be written into it. + * + * This method uses canLogToIM() & canSpawnIMSession(). + */ + static bool canSpawnSessionAndLogToIM(const LLNotificationPtr& notification); + + /** * Writes notification message to IM session. */ static void logToIM(const EInstantMessage& session_type, @@ -303,6 +310,15 @@ public: * Spawns IM session. */ static void spawnIMSession(const std::string& name, const LLUUID& from_id); + + /** + * Returns name from the notification's substitution. + * + * Methods gets "NAME" or "[NAME]" from the substitution map. + * + * @param notification - Notification which substitution's name will be returned. + */ + static std::string getSubstitutionName(const LLNotificationPtr& notification); }; } diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 34807485a6..fba5773602 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -63,6 +63,7 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) return GRANTED_MODIFY_RIGHTS == notification->getName() || REVOKED_MODIFY_RIGHTS == notification->getName() || PAYMENT_RECIVED == notification->getName() + || OFFER_FRIENDSHIP == notification->getName() || FRIENDSHIP_OFFERED == notification->getName() || SERVER_OBJECT_MESSAGE == notification->getName() || INVENTORY_ACCEPTED == notification->getName() @@ -82,8 +83,7 @@ bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification) // static bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) { - return ADD_FRIEND_WITH_MESSAGE == notification->getName() - || OFFER_FRIENDSHIP == notification->getName() + return OFFER_FRIENDSHIP == notification->getName() || FRIENDSHIP_ACCEPTED == notification->getName() || USER_GIVE_ITEM == notification->getName() || INVENTORY_ACCEPTED == notification->getName() @@ -91,6 +91,12 @@ bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) } // static +bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notification) +{ + return canLogToIM(notification) && canSpawnIMSession(notification); +} + +// static void LLHandlerUtil::logToIM(const EInstantMessage& session_type, const std::string& session_name, const std::string& from_name, const std::string& message, const LLUUID& session_owner_id, @@ -124,10 +130,7 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, // static void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification) { - const std::string - name = - notification->getSubstitutions().has("NAME") ? notification->getSubstitutions()["NAME"] - : notification->getSubstitutions()["[NAME]"]; + const std::string name = LLHandlerUtil::getSubstitutionName(notification); const std::string session_name = notification->getPayload().has( "SESSION_NAME") ? notification->getPayload()["SESSION_NAME"].asString() : name; @@ -193,3 +196,10 @@ void LLHandlerUtil::spawnIMSession(const std::string& name, const LLUUID& from_i } } +// static +std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notification) +{ + return notification->getSubstitutions().has("NAME") + ? notification->getSubstitutions()["NAME"] + : notification->getSubstitutions()["[NAME]"]; +} diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 5861a802e9..dd66a6c507 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -105,9 +105,7 @@ bool LLOfferHandler::processNotification(const LLSD& notify) { if (LLHandlerUtil::canSpawnIMSession(notification)) { - const std::string name = notification->getSubstitutions().has( - "NAME") ? notification->getSubstitutions()["NAME"] - : notification->getSubstitutions()["[NAME]"]; + const std::string name = LLHandlerUtil::getSubstitutionName(notification); LLUUID from_id = notification->getPayload()["from_id"]; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index e4ec98c35c..af02a182db 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5106,7 +5106,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you [O <notification icon="notify.tga" name="OfferFriendship" - type="offer"> + type="alertmodal"> [NAME] is offering friendship. [MESSAGE] |