Skip to content
Snippets Groups Projects
Commit fc0019a3 authored by Alexei Arabadji's avatar Alexei Arabadji
Browse files
--HG--
branch : product-engine
parents 91a84107 40d89ae4
No related branches found
No related tags found
No related merge requests found
......@@ -298,6 +298,11 @@ class LLHandlerUtil
* Writes notification message to nearby chat.
*/
static void logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type);
/**
* Spawns IM session.
*/
static void spawnIMSession(const std::string& name, const LLUUID& from_id);
};
}
......
......@@ -47,11 +47,13 @@ const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
"ObjectGiveItem"), OBJECT_GIVE_ITEM_UNKNOWN_USER(
"ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived"),
ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"),
USER_GIVE_ITEM("UserGiveItem"), OFFER_FRIENDSHIP("OfferFriendship"),
USER_GIVE_ITEM("UserGiveItem"), INVENTORY_ACCEPTED("InventoryAccepted"),
OFFER_FRIENDSHIP("OfferFriendship"),
FRIENDSHIP_ACCEPTED("FriendshipAccepted"),
FRIENDSHIP_OFFERED("FriendshipOffered"),
FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline"),
SERVER_OBJECT_MESSAGE("ServerObjectMessage");
SERVER_OBJECT_MESSAGE("ServerObjectMessage"),
TELEPORT_OFFERED("TeleportOffered");
// static
bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
......@@ -60,7 +62,8 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
|| REVOKED_MODIFY_RIGHTS == notification->getName()
|| PAYMENT_RECIVED == notification->getName()
|| FRIENDSHIP_OFFERED == notification->getName()
|| SERVER_OBJECT_MESSAGE == notification->getName();
|| SERVER_OBJECT_MESSAGE == notification->getName()
|| INVENTORY_ACCEPTED == notification->getName();
}
// static
......@@ -68,7 +71,8 @@ bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification)
{
return notification->getType() == "notifytip"
&& FRIEND_ONLINE != notification->getName()
&& FRIEND_OFFLINE != notification->getName();
&& FRIEND_OFFLINE != notification->getName()
&& INVENTORY_ACCEPTED != notification->getName();
}
// static
......@@ -76,7 +80,10 @@ bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification)
{
return ADD_FRIEND_WITH_MESSAGE == notification->getName()
|| OFFER_FRIENDSHIP == notification->getName()
|| FRIENDSHIP_ACCEPTED == notification->getName();
|| FRIENDSHIP_ACCEPTED == notification->getName()
|| USER_GIVE_ITEM == notification->getName()
|| INVENTORY_ACCEPTED == notification->getName()
|| TELEPORT_OFFERED == notification->getName();
}
// static
......@@ -169,3 +176,16 @@ void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChat
}
}
// static
void LLHandlerUtil::spawnIMSession(const std::string& name, const LLUUID& 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);
}
}
......@@ -111,16 +111,7 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
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);
}
LLHandlerUtil::spawnIMSession(name, from_id);
}
if (notification->getPayload().has("SUPPRES_TOST")
......
......@@ -101,6 +101,19 @@ bool LLTipHandler::processNotification(const LLSD& notify)
}
}
const std::string name = notification->getSubstitutions()["NAME"];
LLUUID from_id = notification->getPayload()["from_id"];
if (LLHandlerUtil::canLogToIM(notification))
{
LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, name, name,
notification->getMessage(), from_id, from_id);
}
if (LLHandlerUtil::canSpawnIMSession(notification))
{
LLHandlerUtil::spawnIMSession(name, from_id);
}
LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
LLToast::Params p;
......
......@@ -4498,7 +4498,7 @@ You don't have permission to copy this.
<notification
icon="notifytip.tga"
name="InventoryAccepted"
type="offer">
type="notifytip">
[NAME] received your inventory offer.
</notification>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment