summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2010-03-19 17:18:53 +0200
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2010-03-19 17:18:53 +0200
commita2150863f97bf4fc49ecc17a2405177abe9d8f73 (patch)
treea7f2ca34d45ccf23854482d959ec4cf3e57528f1 /indra
parent167be8f755ccc6e4af27cfce25506d666af58c25 (diff)
Updated normal task EXT-5905 - Resolving offers.
Reusable notifications are deleted when user closes IM floater(old - when user closes Viewer). --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llnotifications.cpp16
-rw-r--r--indra/llui/llnotifications.h5
-rw-r--r--indra/newview/llnotificationhandler.h5
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp8
-rw-r--r--indra/newview/llnotificationofferhandler.cpp2
-rw-r--r--indra/newview/lltoastnotifypanel.cpp6
-rw-r--r--indra/newview/llviewermessage.cpp3
7 files changed, 33 insertions, 12 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 56ec8c4262..d7424cf05a 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -403,7 +403,8 @@ LLNotification::LLNotification(const LLNotification::Params& p) :
mPriority(p.priority),
mCancelled(false),
mIgnored(false),
- mResponderObj(NULL)
+ mResponderObj(NULL),
+ mIsReusable(false)
{
if (p.functor.name.isChosen())
{
@@ -432,7 +433,8 @@ LLNotification::LLNotification(const LLSD& sd) :
mRespondedTo(false),
mCancelled(false),
mIgnored(false),
- mResponderObj(NULL)
+ mResponderObj(NULL),
+ mIsReusable(false)
{
mId.generate();
mSubstitutions = sd["substitutions"];
@@ -459,6 +461,7 @@ LLSD LLNotification::asLLSD()
output["expiry"] = mExpiresAt;
output["priority"] = (S32)mPriority;
output["responseFunctor"] = mResponseFunctorName;
+ output["reusable"] = mIsReusable;
return output;
}
@@ -488,6 +491,7 @@ void LLNotification::updateFrom(LLNotificationPtr other)
mRespondedTo = other->mRespondedTo;
mResponse = other->mResponse;
mTemporaryResponder = other->mTemporaryResponder;
+ mIsReusable = other->isReusable();
update();
}
@@ -573,9 +577,7 @@ void LLNotification::respond(const LLSD& response)
// and then call it
functor(asLLSD(), response);
- bool is_resusable = getPayload()["reusable"].asBoolean();
-
- if (mTemporaryResponder && !is_resusable)
+ if (mTemporaryResponder && !isReusable())
{
LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName);
mResponseFunctorName = "";
@@ -879,11 +881,11 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt
{
abortProcessing = mChanged(payload);
// do not delete the notification to make LLChatHistory::appendMessage add notification panel to IM window
- if( ! pNotification->getPayload()["reusable"].asBoolean() )
+ if( ! pNotification->isReusable() )
{
mItems.erase(pNotification);
+ onDelete(pNotification);
}
- onDelete(pNotification);
}
}
return abortProcessing;
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index a516a6723e..400491a154 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -349,6 +349,7 @@ private:
ENotificationPriority mPriority;
LLNotificationFormPtr mForm;
void* mResponderObj;
+ bool mIsReusable;
// a reference to the template
LLNotificationTemplatePtr mTemplatep;
@@ -517,6 +518,10 @@ public:
{
return mId;
}
+
+ bool isReusable() { return mIsReusable; }
+
+ void setReusable(bool reusable) { mIsReusable = reusable; }
// comparing two notifications normally means comparing them by UUID (so we can look them
// up quickly this way)
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index 62008b91a0..1dc0e414a2 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -291,6 +291,11 @@ public:
static bool canAddNotifPanelToIM(const LLNotificationPtr& notification);
/**
+ * Checks whether notification can be used multiple times or not.
+ */
+ static bool isNotificationReusable(const LLNotificationPtr& notification);
+
+ /**
* Checks if passed notification can create IM session and be written into it.
*
* This method uses canLogToIM() & canSpawnIMSession().
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 55e0f33121..d3ad61128d 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -177,6 +177,14 @@ bool LLHandlerUtil::canAddNotifPanelToIM(const LLNotificationPtr& notification)
}
// static
+bool LLHandlerUtil::isNotificationReusable(const LLNotificationPtr& notification)
+{
+ return OFFER_FRIENDSHIP == notification->getName()
+ || USER_GIVE_ITEM == notification->getName()
+ || TELEPORT_OFFERED == notification->getName();
+}
+
+// static
bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notification)
{
return canLogToIM(notification) && canSpawnIMSession(notification);
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 0a42d8adbe..e93aec9d01 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -103,6 +103,8 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
}
else
{
+ notification->setReusable(LLHandlerUtil::isNotificationReusable(notification));
+
LLUUID session_id;
if (LLHandlerUtil::canSpawnIMSession(notification))
{
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index d7a3bc1462..907740a88e 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -205,7 +205,7 @@ mCloseNotificationOnDestroy(true)
mInfoPanel->setFollowsAll();
snapToMessageHeight(mTextBox, MAX_LENGTH);
- if(notification->getPayload()["reusable"].asBoolean())
+ if(notification->isReusable())
{
mButtonClickConnection = sButtonClickSignal.connect(
boost::bind(&LLToastNotifyPanel::onToastPanelButtonClicked, this, _1, _2));
@@ -288,6 +288,8 @@ LLToastNotifyPanel::~LLToastNotifyPanel()
std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer());
if (mCloseNotificationOnDestroy && LLNotificationsUtil::find(mNotification->getID()) != NULL)
{
+ // let reusable notification be deleted
+ mNotification->setReusable(false);
LLNotifications::getInstance()->cancel(mNotification);
}
}
@@ -473,7 +475,7 @@ void LLToastNotifyPanel::onClickButton(void* data)
response[button_name] = true;
}
- bool is_reusable = self->mNotification->getPayload()["reusable"].asBoolean();
+ bool is_reusable = self->mNotification->isReusable();
// When we call respond(), LLOfferInfo will delete itself in inventory_offer_callback(),
// lets copy it while it's still valid.
LLOfferInfo* old_info = static_cast<LLOfferInfo*>(self->mNotification->getResponder());
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 7ecff4c2d8..3d0dfbed40 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1590,7 +1590,6 @@ void inventory_offer_handler(LLOfferInfo* info)
}
else // Agent -> Agent Inventory Offer
{
- payload["reusable"] = true;
p.responder = info;
// Note: sets inventory_offer_callback as the callback
// *TODO fix memory leak
@@ -2323,7 +2322,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
payload["from_id"] = from_id;
payload["lure_id"] = session_id;
payload["godlike"] = FALSE;
- payload["reusable"] = true;
LLNotificationsUtil::add("TeleportOffered", args, payload);
}
}
@@ -2392,7 +2390,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
}
else
{
- payload["reusable"] = true;
args["[MESSAGE]"] = message;
LLNotificationsUtil::add("OfferFriendship", args, payload);
}