merging in latest changes
commit
2feff5fe74
|
|
@ -4676,7 +4676,7 @@
|
|||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>LandBrushSize</key>
|
||||
<map>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "llchannelmanager.h"
|
||||
#include "llchicletbar.h"
|
||||
#include "llconsole.h"
|
||||
#include "lldonotdisturbnotificationstorage.h"
|
||||
#include "llenvmanager.h"
|
||||
#include "llfirstuse.h"
|
||||
#include "llfloatercamera.h"
|
||||
|
|
@ -1389,11 +1390,16 @@ BOOL LLAgent::getAFK() const
|
|||
//-----------------------------------------------------------------------------
|
||||
// setDoNotDisturb()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgent::setDoNotDisturb(bool pIsDotNotDisturb)
|
||||
void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)
|
||||
{
|
||||
mIsDoNotDisturb = pIsDotNotDisturb;
|
||||
sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDotNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP));
|
||||
LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDotNotDisturb);
|
||||
bool isDoNotDisturbSwitchedOff = (mIsDoNotDisturb && !pIsDoNotDisturb);
|
||||
mIsDoNotDisturb = pIsDoNotDisturb;
|
||||
sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP));
|
||||
LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDoNotDisturb);
|
||||
if (isDoNotDisturbSwitchedOff)
|
||||
{
|
||||
LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -139,7 +139,9 @@ void LLChannelManager::onLoginCompleted()
|
|||
}
|
||||
|
||||
LLPersistentNotificationStorage::getInstance()->loadNotifications();
|
||||
|
||||
LLDoNotDisturbNotificationStorage::getInstance()->initialize();
|
||||
LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
LLCommunicationChannel::LLCommunicationChannel(const std::string& pName, const std::string& pParentName)
|
||||
: LLNotificationChannel(pName, pParentName, filterByDoNotDisturbStatus)
|
||||
, mHistory()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -61,6 +62,11 @@ LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::e
|
|||
return mHistory.end();
|
||||
}
|
||||
|
||||
void LLCommunicationChannel::clearHistory()
|
||||
{
|
||||
mHistory.clear();
|
||||
}
|
||||
|
||||
void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr)
|
||||
{
|
||||
std::string notificationType = pNotificationPtr->getType();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public:
|
|||
typedef std::multimap<LLDate, LLNotificationPtr> history_list_t;
|
||||
history_list_t::const_iterator beginHistory() const;
|
||||
history_list_t::const_iterator endHistory() const;
|
||||
|
||||
void clearHistory();
|
||||
|
||||
protected:
|
||||
virtual void onFilterFail(LLNotificationPtr pNotificationPtr);
|
||||
|
|
|
|||
|
|
@ -29,14 +29,25 @@
|
|||
|
||||
#include "lldonotdisturbnotificationstorage.h"
|
||||
|
||||
#define XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT 0
|
||||
|
||||
#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
|
||||
#include "llchannelmanager.h"
|
||||
#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
|
||||
#include "llcommunicationchannel.h"
|
||||
#include "lldir.h"
|
||||
#include "llerror.h"
|
||||
#include "llfasttimer_class.h"
|
||||
#include "llnotifications.h"
|
||||
#include "llnotificationhandler.h"
|
||||
#include "llnotificationstorage.h"
|
||||
#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
|
||||
#include "llscreenchannel.h"
|
||||
#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
|
||||
#include "llscriptfloater.h"
|
||||
#include "llsd.h"
|
||||
#include "llsingleton.h"
|
||||
#include "lluuid.h"
|
||||
|
||||
LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
|
||||
: LLSingleton<LLDoNotDisturbNotificationStorage>()
|
||||
|
|
@ -85,6 +96,76 @@ static LLFastTimer::DeclareTimer FTM_LOAD_DND_NOTIFICATIONS("Load DND Notificati
|
|||
|
||||
void LLDoNotDisturbNotificationStorage::loadNotifications()
|
||||
{
|
||||
LLFastTimer _(FTM_LOAD_DND_NOTIFICATIONS);
|
||||
|
||||
LLSD input;
|
||||
if (!readNotifications(input) ||input.isUndefined())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLSD& data = input["data"];
|
||||
if (data.isUndefined())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
|
||||
LLNotificationsUI::LLScreenChannel* notification_channel =
|
||||
dynamic_cast<LLNotificationsUI::LLScreenChannel*>(LLNotificationsUI::LLChannelManager::getInstance()->
|
||||
findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
|
||||
#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
|
||||
|
||||
LLNotifications& instance = LLNotifications::instance();
|
||||
|
||||
for (LLSD::array_const_iterator notification_it = data.beginArray();
|
||||
notification_it != data.endArray();
|
||||
++notification_it)
|
||||
{
|
||||
LLSD notification_params = *notification_it;
|
||||
LLNotificationPtr notification(new LLNotification(notification_params));
|
||||
|
||||
const LLUUID& notificationID = notification->id();
|
||||
if (instance.find(notificationID))
|
||||
{
|
||||
instance.update(notification);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLNotificationResponderInterface* responder = createResponder(notification_params["name"], notification_params["responder"]);
|
||||
if (responder == NULL)
|
||||
{
|
||||
LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '"
|
||||
<< notification->getType() << "'" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLNotificationResponderPtr responderPtr(responder);
|
||||
notification->setResponseFunctor(responderPtr);
|
||||
}
|
||||
|
||||
instance.add(notification);
|
||||
}
|
||||
|
||||
#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
|
||||
// hide script floaters so they don't confuse the user and don't overlap startup toast
|
||||
LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false);
|
||||
|
||||
if(notification_channel)
|
||||
{
|
||||
// hide saved toasts so they don't confuse the user
|
||||
notification_channel->hideToast(notification->getID());
|
||||
}
|
||||
#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
|
||||
}
|
||||
|
||||
// Clear the communication channel history and rewrite the save file to empty it as well
|
||||
LLNotificationChannelPtr channelPtr = getCommunicationChannel();
|
||||
LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
|
||||
llassert(commChannel != NULL);
|
||||
commChannel->clearHistory();
|
||||
|
||||
saveNotifications();
|
||||
}
|
||||
|
||||
LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChannel() const
|
||||
|
|
|
|||
|
|
@ -29,14 +29,39 @@
|
|||
#include "llnotificationstorage.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "llerror.h"
|
||||
#include "llfile.h"
|
||||
#include "llnotifications.h"
|
||||
#include "llpointer.h"
|
||||
#include "llsd.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llsingleton.h"
|
||||
#include "llviewermessage.h"
|
||||
|
||||
|
||||
class LLResponderRegistry : public LLSingleton<LLResponderRegistry>
|
||||
{
|
||||
public:
|
||||
LLResponderRegistry();
|
||||
~LLResponderRegistry();
|
||||
|
||||
LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
template<typename RESPONDER_TYPE> static LLNotificationResponderInterface* create(const LLSD& pParams);
|
||||
|
||||
typedef boost::function<LLNotificationResponderInterface* (const LLSD& params)> responder_constructor_t;
|
||||
|
||||
void add(const std::string& pNotificationName, const responder_constructor_t& pConstructor);
|
||||
|
||||
typedef std::map<std::string, responder_constructor_t> build_map_t;
|
||||
build_map_t mBuildMap;
|
||||
};
|
||||
|
||||
LLNotificationStorage::LLNotificationStorage(std::string pFileName)
|
||||
: mFileName(pFileName)
|
||||
{
|
||||
|
|
@ -90,3 +115,53 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData) const
|
|||
|
||||
return didFileRead;
|
||||
}
|
||||
|
||||
LLNotificationResponderInterface* LLNotificationStorage::createResponder(const std::string& pNotificationName, const LLSD& pParams) const
|
||||
{
|
||||
return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams);
|
||||
}
|
||||
|
||||
LLResponderRegistry::LLResponderRegistry()
|
||||
: LLSingleton<LLResponderRegistry>()
|
||||
, mBuildMap()
|
||||
{
|
||||
add("ObjectGiveItem", &create<LLOfferInfo>);
|
||||
add("OwnObjectGiveItem", &create<LLOfferInfo>);
|
||||
add("UserGiveItem", &create<LLOfferInfo>);
|
||||
|
||||
add("TeleportOffered", &create<LLOfferInfo>);
|
||||
add("TeleportOffered_MaturityExceeded", &create<LLOfferInfo>);
|
||||
|
||||
add("OfferFriendship", &create<LLOfferInfo>);
|
||||
}
|
||||
|
||||
LLResponderRegistry::~LLResponderRegistry()
|
||||
{
|
||||
}
|
||||
|
||||
LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& pNotificationName, const LLSD& pParams)
|
||||
{
|
||||
build_map_t::const_iterator it = mBuildMap.find(pNotificationName);
|
||||
if(mBuildMap.end() == it)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
responder_constructor_t ctr = it->second;
|
||||
return ctr(pParams);
|
||||
}
|
||||
|
||||
template<typename RESPONDER_TYPE> LLNotificationResponderInterface* LLResponderRegistry::create(const LLSD& pParams)
|
||||
{
|
||||
RESPONDER_TYPE* responder = new RESPONDER_TYPE();
|
||||
responder->fromLLSD(pParams);
|
||||
return responder;
|
||||
}
|
||||
|
||||
void LLResponderRegistry::add(const std::string& pNotificationName, const responder_constructor_t& pConstructor)
|
||||
{
|
||||
if (mBuildMap.find(pNotificationName) != mBuildMap.end())
|
||||
{
|
||||
LL_ERRS("LLResponderRegistry") << "Responder is already registered : " << pNotificationName << LL_ENDL;
|
||||
}
|
||||
mBuildMap.insert(std::make_pair<std::string, responder_constructor_t>(pNotificationName, pConstructor));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "llerror.h"
|
||||
|
||||
class LLNotificationResponderInterface;
|
||||
class LLSD;
|
||||
|
||||
class LLNotificationStorage
|
||||
|
|
@ -44,6 +45,8 @@ protected:
|
|||
bool writeNotifications(const LLSD& pNotificationData) const;
|
||||
bool readNotifications(LLSD& pNotificationData) const;
|
||||
|
||||
LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams) const;
|
||||
|
||||
private:
|
||||
std::string mFileName;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,34 +36,6 @@
|
|||
#include "llscriptfloater.h"
|
||||
#include "llviewermessage.h"
|
||||
|
||||
class LLResponderRegistry
|
||||
{
|
||||
public:
|
||||
|
||||
static void registerResponders();
|
||||
|
||||
static LLNotificationResponderInterface* createResponder(const std::string& notification_name, const LLSD& params);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
template<typename RESPONDER_TYPE>
|
||||
static LLNotificationResponderInterface* create(const LLSD& params)
|
||||
{
|
||||
RESPONDER_TYPE* responder = new RESPONDER_TYPE();
|
||||
responder->fromLLSD(params);
|
||||
return responder;
|
||||
}
|
||||
|
||||
typedef boost::function<LLNotificationResponderInterface* (const LLSD& params)> responder_constructor_t;
|
||||
|
||||
static void add(const std::string& notification_name, const responder_constructor_t& ctr);
|
||||
|
||||
typedef std::map<std::string, responder_constructor_t> build_map_t;
|
||||
|
||||
static build_map_t sBuildMap;
|
||||
};
|
||||
|
||||
LLPersistentNotificationStorage::LLPersistentNotificationStorage()
|
||||
: LLSingleton<LLPersistentNotificationStorage>()
|
||||
, LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml"))
|
||||
|
|
@ -114,7 +86,6 @@ static LLFastTimer::DeclareTimer FTM_LOAD_NOTIFICATIONS("Load Notifications");
|
|||
void LLPersistentNotificationStorage::loadNotifications()
|
||||
{
|
||||
LLFastTimer _(FTM_LOAD_NOTIFICATIONS);
|
||||
LLResponderRegistry::registerResponders();
|
||||
|
||||
LLNotifications::instance().getChannel("Persistent")->
|
||||
connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
|
||||
|
|
@ -144,8 +115,7 @@ void LLPersistentNotificationStorage::loadNotifications()
|
|||
LLSD notification_params = *notification_it;
|
||||
LLNotificationPtr notification(new LLNotification(notification_params));
|
||||
|
||||
LLNotificationResponderPtr responder(LLResponderRegistry::
|
||||
createResponder(notification_params["name"], notification_params["responder"]));
|
||||
LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"]));
|
||||
notification->setResponseFunctor(responder);
|
||||
|
||||
instance.add(notification);
|
||||
|
|
@ -172,39 +142,4 @@ bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& pay
|
|||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLResponderRegistry::build_map_t LLResponderRegistry::sBuildMap;
|
||||
|
||||
void LLResponderRegistry::registerResponders()
|
||||
{
|
||||
sBuildMap.clear();
|
||||
|
||||
add("ObjectGiveItem", &create<LLOfferInfo>);
|
||||
add("UserGiveItem", &create<LLOfferInfo>);
|
||||
}
|
||||
|
||||
LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& notification_name, const LLSD& params)
|
||||
{
|
||||
build_map_t::const_iterator it = sBuildMap.find(notification_name);
|
||||
if(sBuildMap.end() == it)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
responder_constructor_t ctr = it->second;
|
||||
return ctr(params);
|
||||
}
|
||||
|
||||
void LLResponderRegistry::add(const std::string& notification_name, const responder_constructor_t& ctr)
|
||||
{
|
||||
if(sBuildMap.find(notification_name) != sBuildMap.end())
|
||||
{
|
||||
llwarns << "Responder is already registered : " << notification_name << llendl;
|
||||
llassert(!"Responder already registered");
|
||||
}
|
||||
sBuildMap[notification_name] = ctr;
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
|
|||
|
|
@ -6583,7 +6583,7 @@ However, this region contains content accessible to adults only.
|
|||
log_to_im="true"
|
||||
log_to_chat="false"
|
||||
show_toast="false"
|
||||
type="offer">
|
||||
type="notify">
|
||||
Teleport offer sent to [TO_NAME]
|
||||
</notification>
|
||||
|
||||
|
|
@ -6636,7 +6636,7 @@ However, this region contains content accessible to adults only.
|
|||
name="FriendshipOffered"
|
||||
log_to_im="true"
|
||||
show_toast="false"
|
||||
type="offer">
|
||||
type="notify">
|
||||
<tag>friendship</tag>
|
||||
You have offered friendship to [TO_NAME]
|
||||
</notification>
|
||||
|
|
@ -6666,7 +6666,7 @@ However, this region contains content accessible to adults only.
|
|||
icon="notify.tga"
|
||||
name="FriendshipAccepted"
|
||||
log_to_im="true"
|
||||
type="offer">
|
||||
type="notify">
|
||||
<tag>friendship</tag>
|
||||
<nolink>[NAME]</nolink> accepted your friendship offer.
|
||||
</notification>
|
||||
|
|
@ -6686,7 +6686,7 @@ However, this region contains content accessible to adults only.
|
|||
name="FriendshipAcceptedByMe"
|
||||
log_to_im="true"
|
||||
show_toast="false"
|
||||
type="offer">
|
||||
type="notify">
|
||||
<tag>friendship</tag>
|
||||
Friendship offer accepted.
|
||||
</notification>
|
||||
|
|
@ -6696,7 +6696,7 @@ Friendship offer accepted.
|
|||
name="FriendshipDeclinedByMe"
|
||||
log_to_im="true"
|
||||
show_toast="false"
|
||||
type="offer">
|
||||
type="notify">
|
||||
<tag>friendship</tag>
|
||||
Friendship offer declined.
|
||||
</notification>
|
||||
|
|
|
|||
Loading…
Reference in New Issue