--HG--
branch : product-engine
meow-7.2.2
Alexei Arabadji 2009-12-04 18:34:32 +02:00
commit 63096e40de
5 changed files with 46 additions and 5 deletions

View File

@ -265,6 +265,11 @@ public:
*/
static bool canLogToIM(const LLNotificationPtr& notification);
/**
* Checks sufficient conditions to spawn IM session.
*/
static bool canSpawnIMSession(const LLNotificationPtr& notification);
/**
* Writes notification message to IM session.
*/

View File

@ -43,7 +43,10 @@ using namespace LLNotificationsUI;
const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
REVOKED_MODIFY_RIGHTS("RevokedModifyRights"), OBJECT_GIVE_ITEM(
"ObjectGiveItem"), OBJECT_GIVE_ITEM_UNKNOWN_USER(
"ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived");
"ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived"),
ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"),
USER_GIVE_ITEM("UserGiveItem"), OFFER_FRIENDSHIP("OfferFriendship"),
FRIENDSHIP_ACCEPTED("FriendshipAccepted");
// static
bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
@ -53,6 +56,14 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
|| PAYMENT_RECIVED == notification->getName();
}
// static
bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification)
{
return ADD_FRIEND_WITH_MESSAGE == notification->getName()
|| OFFER_FRIENDSHIP == notification->getName()
|| FRIENDSHIP_ACCEPTED == notification->getName();
}
// static
void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
const std::string& session_name, const std::string& from_name,

View File

@ -40,6 +40,7 @@
#include "llnotificationmanager.h"
#include "llnotifications.h"
#include "llscriptfloater.h"
#include "llimview.h"
using namespace LLNotificationsUI;
@ -101,6 +102,26 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
}
else
{
if (LLHandlerUtil::canSpawnIMSession(notification))
{
const std::string name = notification->getSubstitutions().has(
"NAME") ? notification->getSubstitutions()["NAME"]
: notification->getSubstitutions()["[NAME]"];
LLUUID from_id = notification->getPayload()["from_id"];
LLUUID session_id = LLIMMgr::computeSessionID(
IM_NOTHING_SPECIAL, from_id);
LLIMModel::LLIMSession* session =
LLIMModel::instance().findIMSession(session_id);
if (session == NULL)
{
LLIMMgr::instance().addSession(name, IM_NOTHING_SPECIAL,
from_id);
}
}
LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
LLToast::Params p;

View File

@ -2010,13 +2010,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_INVENTORY_ACCEPTED:
{
args["NAME"] = name;
LLNotificationsUtil::add("InventoryAccepted", args);
LLSD payload;
payload["from_id"] = from_id;
LLNotificationsUtil::add("InventoryAccepted", args, payload);
break;
}
case IM_INVENTORY_DECLINED:
{
args["NAME"] = name;
LLNotificationsUtil::add("InventoryDeclined", args);
LLSD payload;
payload["from_id"] = from_id;
LLNotificationsUtil::add("InventoryDeclined", args, payload);
break;
}
// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856

View File

@ -4499,14 +4499,14 @@ You don't have permission to copy this.
<notification
icon="notifytip.tga"
name="InventoryAccepted"
type="notifytip">
type="offer">
[NAME] received your inventory offer.
</notification>
<notification
icon="notifytip.tga"
name="InventoryDeclined"
type="notifytip">
type="offer">
[NAME] declined your inventory offer.
</notification>