mplemented EXT-2798 “Record online/offline notifications into IM history only”,
excluded FriendOnline, FriendOffline notifications from logging to nearby chat; --HG-- branch : product-enginemeow-7.2.2
parent
d5f7f1b723
commit
8728bddc7c
|
|
@ -265,6 +265,11 @@ public:
|
|||
*/
|
||||
static bool canLogToIM(const LLNotificationPtr& notification);
|
||||
|
||||
/**
|
||||
* Checks sufficient conditions to log notification message to nearby chat session.
|
||||
*/
|
||||
static bool canLogToNearbyChat(const LLNotificationPtr& notification);
|
||||
|
||||
/**
|
||||
* Checks sufficient conditions to spawn IM session.
|
||||
*/
|
||||
|
|
@ -287,6 +292,11 @@ public:
|
|||
* Writes group notice notification message to IM group session.
|
||||
*/
|
||||
static void logGroupNoticeToIMGroup(const LLNotificationPtr& notification);
|
||||
|
||||
/**
|
||||
* Writes notification message to nearby chat.
|
||||
*/
|
||||
static void logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
#include "llnotifications.h"
|
||||
#include "llimview.h"
|
||||
#include "llagent.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "llnearbychat.h"
|
||||
|
||||
using namespace LLNotificationsUI;
|
||||
|
||||
|
|
@ -47,7 +49,8 @@ const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
|
|||
ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"),
|
||||
USER_GIVE_ITEM("UserGiveItem"), OFFER_FRIENDSHIP("OfferFriendship"),
|
||||
FRIENDSHIP_ACCEPTED("FriendshipAccepted"),
|
||||
FRIENDSHIP_OFFERED("FriendshipOffered");
|
||||
FRIENDSHIP_OFFERED("FriendshipOffered"),
|
||||
FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline");
|
||||
|
||||
// static
|
||||
bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
|
||||
|
|
@ -58,6 +61,14 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
|
|||
|| FRIENDSHIP_OFFERED == notification->getName();
|
||||
}
|
||||
|
||||
// static
|
||||
bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification)
|
||||
{
|
||||
return notification->getType() == "notifytip"
|
||||
&& FRIEND_ONLINE != notification->getName()
|
||||
&& FRIEND_OFFLINE != notification->getName();
|
||||
}
|
||||
|
||||
// static
|
||||
bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification)
|
||||
{
|
||||
|
|
@ -144,3 +155,15 @@ void LLHandlerUtil::logGroupNoticeToIMGroup(
|
|||
payload["group_id"], sender_id);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type)
|
||||
{
|
||||
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
|
||||
if(nearby_chat)
|
||||
{
|
||||
LLChat chat_msg(notification->getMessage());
|
||||
chat_msg.mSourceType = type;
|
||||
nearby_chat->addMessage(chat_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,18 +88,17 @@ bool LLTipHandler::processNotification(const LLSD& notify)
|
|||
if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
|
||||
{
|
||||
// archive message in nearby chat
|
||||
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
|
||||
if(nearby_chat)
|
||||
if (LLHandlerUtil::canLogToNearbyChat(notification))
|
||||
{
|
||||
LLChat chat_msg(notification->getMessage());
|
||||
chat_msg.mSourceType = CHAT_SOURCE_SYSTEM;
|
||||
nearby_chat->addMessage(chat_msg);
|
||||
LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
|
||||
|
||||
// don't show toast if Nearby Chat is opened
|
||||
LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<
|
||||
LLNearbyChat>("nearby_chat", LLSD());
|
||||
if (nearby_chat->getVisible())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
|
||||
|
|
|
|||
Loading…
Reference in New Issue