Support modern event slurls
This commit is contained in:
@@ -43,8 +43,54 @@
|
|||||||
#include "llfloaterworldmap.h"
|
#include "llfloaterworldmap.h"
|
||||||
#include "llagent.h"
|
#include "llagent.h"
|
||||||
#include "llappviewer.h" // for gPacificDaylightTime
|
#include "llappviewer.h" // for gPacificDaylightTime
|
||||||
|
#include "llcommandhandler.h" // secondlife:///app/... support
|
||||||
#include "llviewercontrol.h"
|
#include "llviewercontrol.h"
|
||||||
|
|
||||||
|
class LLEventHandler : public LLCommandHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// requires trusted browser to trigger
|
||||||
|
LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { }
|
||||||
|
bool handle(const LLSD& params, const LLSD& query_map,
|
||||||
|
LLMediaCtrl* web)
|
||||||
|
{
|
||||||
|
if (params.size() < 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::string event_command = params[1].asString();
|
||||||
|
S32 event_id = params[0].asInteger();
|
||||||
|
if (event_command == "about" || event_command == "details")
|
||||||
|
{
|
||||||
|
LLFloaterEventInfo::show(event_id);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(event_command == "notify")
|
||||||
|
{
|
||||||
|
// we're adding or removing a notification, so grab the date, name and notification bool
|
||||||
|
if (params.size() < 3)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(params[2].asString() == "enable")
|
||||||
|
{
|
||||||
|
gEventNotifier.add(event_id);
|
||||||
|
// tell the server to modify the database as this was a slurl event notification command
|
||||||
|
gEventNotifier.serverPushRequest(event_id, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gEventNotifier.remove(event_id);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
LLEventHandler gEventHandler;
|
||||||
|
|
||||||
|
|
||||||
LLEventNotifier gEventNotifier;
|
LLEventNotifier gEventNotifier;
|
||||||
|
|
||||||
LLEventNotifier::LLEventNotifier()
|
LLEventNotifier::LLEventNotifier()
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#include "llfloaterevent.h"
|
#include "llfloaterevent.h"
|
||||||
|
|
||||||
// viewer project includes
|
// viewer project includes
|
||||||
#include "llcommandhandler.h"
|
|
||||||
#include "llpanelevent.h"
|
#include "llpanelevent.h"
|
||||||
|
|
||||||
// linden library includes
|
// linden library includes
|
||||||
@@ -52,29 +51,6 @@
|
|||||||
|
|
||||||
LLMap< U32, LLFloaterEventInfo* > gEventInfoInstances;
|
LLMap< U32, LLFloaterEventInfo* > gEventInfoInstances;
|
||||||
|
|
||||||
class LLEventHandler : public LLCommandHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// requires trusted browser to trigger
|
|
||||||
LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { }
|
|
||||||
bool handle(const LLSD& tokens, const LLSD& query_map,
|
|
||||||
LLMediaCtrl* web)
|
|
||||||
{
|
|
||||||
if (tokens.size() < 2)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
U32 event_id = tokens[0].asInteger();
|
|
||||||
if (tokens[1].asString() == "about")
|
|
||||||
{
|
|
||||||
LLFloaterEventInfo::show(event_id);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
LLEventHandler gEventHandler;
|
|
||||||
|
|
||||||
LLFloaterEventInfo::LLFloaterEventInfo(const std::string& name, const U32 event_id)
|
LLFloaterEventInfo::LLFloaterEventInfo(const std::string& name, const U32 event_id)
|
||||||
: LLFloater(name),
|
: LLFloater(name),
|
||||||
mEventID( event_id )
|
mEventID( event_id )
|
||||||
|
|||||||
Reference in New Issue
Block a user