Merge commit 'c7bdaf66329b018159c834d75fcc3d807b188ccb'

This commit is contained in:
Siana Gearz
2012-07-23 05:10:56 +02:00
13 changed files with 834 additions and 225 deletions

View File

@@ -109,6 +109,7 @@ set(viewer_SOURCE_FILES
jcfloaterareasearch.cpp
chatbar_as_cmdline.cpp
qtoolalign.cpp
NACLantispam.cpp
llaccountingcostmanager.cpp
llagent.cpp
llagentaccess.cpp
@@ -567,6 +568,7 @@ set(viewer_HEADER_FILES
CMakeLists.txt
ViewerInstall.cmake
NACLantispam.h
sgmemstat.h
sgversion.h
llviewerobjectbackup.h

View File

@@ -0,0 +1,406 @@
#include "llviewerprecompiledheaders.h"
#include "NACLantispam.h"
#include "llviewercontrol.h"
#include "llnotificationsutil.h"
#include "llviewerobjectlist.h"
#include "llagent.h"
#include <time.h>
U32 NACLAntiSpamRegistry::globalAmount;
U32 NACLAntiSpamRegistry::globalTime;
bool NACLAntiSpamRegistry::bGlobalQueue;
NACLAntiSpamQueue* NACLAntiSpamRegistry::queues[NACLAntiSpamRegistry::QUEUE_MAX] = {0};
std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*> NACLAntiSpamRegistry::globalEntries;
std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*>::iterator NACLAntiSpamRegistry::it2;
const std::string COLLISION_SOUNDS[] ={"dce5fdd4-afe4-4ea1-822f-dd52cac46b08","51011582-fbca-4580-ae9e-1a5593f094ec","68d62208-e257-4d0c-bbe2-20c9ea9760bb","75872e8c-bc39-451b-9b0b-042d7ba36cba","6a45ba0b-5775-4ea8-8513-26008a17f873","992a6d1b-8c77-40e0-9495-4098ce539694","2de4da5a-faf8-46be-bac6-c4d74f1e5767","6e3fb0f7-6d9c-42ca-b86b-1122ff562d7d","14209133-4961-4acc-9649-53fc38ee1667","bc4a4348-cfcc-4e5e-908e-8a52a8915fe6","9e5c1297-6eed-40c0-825a-d9bcd86e3193","e534761c-1894-4b61-b20c-658a6fb68157","8761f73f-6cf9-4186-8aaa-0948ed002db1","874a26fd-142f-4173-8c5b-890cd846c74d","0e24a717-b97e-4b77-9c94-b59a5a88b2da","75cf3ade-9a5b-4c4d-bb35-f9799bda7fb2","153c8bf7-fb89-4d89-b263-47e58b1b4774","55c3e0ce-275a-46fa-82ff-e0465f5e8703","24babf58-7156-4841-9a3f-761bdbb8e237","aca261d8-e145-4610-9e20-9eff990f2c12","0642fba6-5dcf-4d62-8e7b-94dbb529d117","25a863e8-dc42-4e8a-a357-e76422ace9b5","9538f37c-456e-4047-81be-6435045608d4","8c0f84c3-9afd-4396-b5f5-9bca2c911c20","be582e5d-b123-41a2-a150-454c39e961c8","c70141d4-ba06-41ea-bcbc-35ea81cb8335","7d1826f4-24c4-4aac-8c2e-eff45df37783","063c97d3-033a-4e9b-98d8-05c8074922cb","00000000-0000-0000-0000-000000000120"};
const int COLLISION_SOUNDS_SIZE=29;
// NaClAntiSpamQueueEntry
NACLAntiSpamQueueEntry::NACLAntiSpamQueueEntry()
{
entryTime=0;
entryAmount=0;
blocked=false;
}
void NACLAntiSpamQueueEntry::clearEntry()
{
entryTime=0;
entryAmount=0;
blocked=false;
}
U32 NACLAntiSpamQueueEntry::getEntryAmount()
{
return entryAmount;
}
U32 NACLAntiSpamQueueEntry::getEntryTime()
{
return entryTime;
}
void NACLAntiSpamQueueEntry::updateEntryAmount()
{
entryAmount++;
}
void NACLAntiSpamQueueEntry::updateEntryTime()
{
entryTime=time(0);
}
void NACLAntiSpamQueueEntry::setBlocked()
{
blocked=true;
}
bool NACLAntiSpamQueueEntry::getBlocked()
{
return blocked;
}
// NaClAntiSpamQueue
NACLAntiSpamQueue::NACLAntiSpamQueue(U32 time, U32 amount)
{
queueTime=time;
queueAmount=amount;
}
void NACLAntiSpamQueue::setAmount(U32 amount)
{
queueAmount=amount;
}
void NACLAntiSpamQueue::setTime(U32 time)
{
queueTime=time;
}
void NACLAntiSpamQueue::clearEntries()
{
for(it = entries.begin(); it != entries.end(); it++)
{
it->second->clearEntry();
}
}
void NACLAntiSpamQueue::purgeEntries()
{
for(it = entries.begin(); it != entries.end(); it++)
{
delete it->second;
}
entries.clear();
}
void NACLAntiSpamQueue::blockEntry(LLUUID& source)
{
it=entries.find(source.asString());
if(it == entries.end())
{
entries[source.asString()]=new NACLAntiSpamQueueEntry();
}
entries[source.asString()]->setBlocked();
}
int NACLAntiSpamQueue::checkEntry(LLUUID& name, U32 multiplier)
{
it=entries.find(name.asString());
if(it != entries.end())
{
if(it->second->getBlocked()) return 2;
U32 eTime=it->second->getEntryTime();
U32 currentTime=time(0);
if((currentTime-eTime) <= queueTime)
{
it->second->updateEntryAmount();
U32 eAmount=it->second->getEntryAmount();
if(eAmount > (queueAmount*multiplier))
{
it->second->setBlocked();
return 1;
}
else
return 0;
}
else
{
it->second->clearEntry();
it->second->updateEntryAmount();
it->second->updateEntryTime();
return 0;
}
}
else
{
entries[name.asString()]=new NACLAntiSpamQueueEntry();
entries[name.asString()]->updateEntryAmount();
entries[name.asString()]->updateEntryTime();
return 0;
}
}
// NaClAntiSpamRegistry
static const char* QUEUE_NAME[NACLAntiSpamRegistry::QUEUE_MAX] = {
"Chat",
"Inventory",
"Instant Message",
"Calling Card",
"Sound",
"Sound Preload",
"Script Dialog",
"Teleport"};
NACLAntiSpamRegistry::NACLAntiSpamRegistry(U32 time, U32 amount)
{
globalTime=time;
globalAmount=amount;
static LLCachedControl<bool> _NACL_AntiSpamGlobalQueue(gSavedSettings,"_NACL_AntiSpamGlobalQueue");
bGlobalQueue=_NACL_AntiSpamGlobalQueue;
for(int queue = 0; queue < QUEUE_MAX; ++queue)
{
queues[queue] = new NACLAntiSpamQueue(time,amount);
}
}
const char* NACLAntiSpamRegistry::getQueueName(U32 queue_id)
{
if(queue_id >= QUEUE_MAX)
return "Unknown";
return QUEUE_NAME[queue_id];
}
void NACLAntiSpamRegistry::registerQueues(U32 time, U32 amount)
{
globalTime=time;
globalAmount=amount;
static LLCachedControl<bool> _NACL_AntiSpamGlobalQueue(gSavedSettings,"_NACL_AntiSpamGlobalQueue");
bGlobalQueue=_NACL_AntiSpamGlobalQueue;
for(int queue = 0; queue < QUEUE_MAX; ++queue)
{
queues[queue] = new NACLAntiSpamQueue(time,amount);
}
}
void NACLAntiSpamRegistry::registerQueue(U32 name, U32 time, U32 amount)
{
/*
it=queues.find(name);
if(it == queues.end())
{
queues[name]=new NACLAntiSpamQueue(time,amount);
}
*/
}
void NACLAntiSpamRegistry::setRegisteredQueueTime(U32 name, U32 time)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
return;
}
queues[name]->setTime(time);
}
void NACLAntiSpamRegistry::setRegisteredQueueAmount(U32 name, U32 amount)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
return;
}
queues[name]->setAmount(amount);
}
void NACLAntiSpamRegistry::setAllQueueTimes(U32 time)
{
globalTime=time;
for(int queue = 0; queue < QUEUE_MAX; ++queue)
queues[queue]->setTime(time);
}
void NACLAntiSpamRegistry::setAllQueueAmounts(U32 amount)
{
globalAmount=amount;
for(int queue = 0; queue < QUEUE_MAX; ++queue)
{
if(queue == QUEUE_SOUND || queue == QUEUE_SOUND_PRELOAD)
queues[queue]->setAmount(amount*5);
else
queues[queue]->setAmount(amount);
}
}
void NACLAntiSpamRegistry::clearRegisteredQueue(U32 name)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
return;
}
queues[name]->clearEntries();
}
void NACLAntiSpamRegistry::purgeRegisteredQueue(U32 name)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
return;
}
queues[name]->purgeEntries();
}
void NACLAntiSpamRegistry::blockOnQueue(U32 name, LLUUID& source)
{
if(bGlobalQueue)
{
NACLAntiSpamRegistry::blockGlobalEntry(source);
}
else
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
return;
}
queues[name]->blockEntry(source);
}
}
void NACLAntiSpamRegistry::blockGlobalEntry(LLUUID& source)
{
it2=globalEntries.find(source.asString());
if(it2 == globalEntries.end())
{
globalEntries[source.asString()]=new NACLAntiSpamQueueEntry();
}
globalEntries[source.asString()]->setBlocked();
}
bool NACLAntiSpamRegistry::checkQueue(U32 name, LLUUID& source, U32 multiplier, bool silent)
{
if(source.isNull()) return false;
if(gAgent.getID() == source) return false;
LLViewerObject *obj=gObjectList.findObject(source);
if(obj)
if(obj->permYouOwner()) return false;
int result;
if(bGlobalQueue)
{
result=NACLAntiSpamRegistry::checkGlobalEntry(source,multiplier);
}
else
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
return false;
}
result=queues[name]->checkEntry(source,multiplier);
}
if(result==0)
{
return false;
}
else if(result==2)
{
return true;
}
else
{
if(!silent)
{
LLSD args;
args["MESSAGE"] = std::string(getQueueName(name))+": Blocked object "+source.asString();
LLNotificationsUtil::add("SystemMessageTip", args);
}
return true;
}
}
// Global queue stoof
void NACLAntiSpamRegistry::setGlobalQueue(bool value)
{
NACLAntiSpamRegistry::purgeAllQueues();
bGlobalQueue=value;
}
void NACLAntiSpamRegistry::setGlobalAmount(U32 amount)
{
globalAmount=amount;
}
void NACLAntiSpamRegistry::setGlobalTime(U32 time)
{
globalTime=time;
}
void NACLAntiSpamRegistry::clearAllQueues()
{
if(bGlobalQueue)
NACLAntiSpamRegistry::clearGlobalEntries();
else
for(int queue = 0; queue < QUEUE_MAX; ++queue)
{
queues[queue]->clearEntries();
}
}
void NACLAntiSpamRegistry::purgeAllQueues()
{
if(bGlobalQueue)
NACLAntiSpamRegistry::purgeGlobalEntries();
else
for(int queue = 0; queue < QUEUE_MAX; ++queue)
{
queues[queue]->purgeEntries();
}
}
int NACLAntiSpamRegistry::checkGlobalEntry(LLUUID& name, U32 multiplier)
{
it2=globalEntries.find(name.asString());
if(it2 != globalEntries.end())
{
if(it2->second->getBlocked()) return 2;
U32 eTime=it2->second->getEntryTime();
U32 currentTime=time(0);
if((currentTime-eTime) <= globalTime)
{
it2->second->updateEntryAmount();
U32 eAmount=it2->second->getEntryAmount();
if(eAmount > (globalAmount*multiplier))
return 1;
else
return 0;
}
else
{
it2->second->clearEntry();
it2->second->updateEntryAmount();
it2->second->updateEntryTime();
return 0;
}
}
else
{
globalEntries[name.asString()]=new NACLAntiSpamQueueEntry();
globalEntries[name.asString()]->updateEntryAmount();
globalEntries[name.asString()]->updateEntryTime();
return 0;
}
}
void NACLAntiSpamRegistry::clearGlobalEntries()
{
for(it2 = globalEntries.begin(); it2 != globalEntries.end(); it2++)
{
it2->second->clearEntry();
}
}
void NACLAntiSpamRegistry::purgeGlobalEntries()
{
for(it2 = globalEntries.begin(); it2 != globalEntries.end(); it2++)
{
delete it2->second;
it2->second = 0;
}
globalEntries.clear();
}
bool NACLAntiSpamRegistry::handleNaclAntiSpamGlobalQueueChanged(const LLSD& newvalue)
{
setGlobalQueue(newvalue.asBoolean());
return true;
}
bool NACLAntiSpamRegistry::handleNaclAntiSpamTimeChanged(const LLSD& newvalue)
{
setAllQueueTimes(newvalue.asInteger());
return true;
}
bool NACLAntiSpamRegistry::handleNaclAntiSpamAmountChanged(const LLSD& newvalue)
{
setAllQueueAmounts(newvalue.asInteger());
return true;
}

View File

@@ -0,0 +1,93 @@
#ifndef NACLANTISPAM_H
#define NACLANTISPAM_H
#include <boost/tr1/unordered_map.hpp>
#include "stdtypes.h"
#include "lluuid.h"
class NACLAntiSpamQueueEntry
{
friend class NACLAntiSpamQueue;
friend class NACLAntiSpamRegistry;
protected:
NACLAntiSpamQueueEntry();
void clearEntry();
U32 getEntryAmount();
U32 getEntryTime();
void updateEntryAmount();
void updateEntryTime();
bool getBlocked();
void setBlocked();
private:
U32 entryAmount;
U32 entryTime;
bool blocked;
};
class NACLAntiSpamQueue
{
friend class NACLAntiSpamRegistry;
protected:
NACLAntiSpamQueue(U32 time, U32 amount);
void setAmount(U32 amount);
void setTime(U32 time);
void clearEntries();
void purgeEntries();
void blockEntry(LLUUID& source);
int checkEntry(LLUUID& source, U32 multiplier);
private:
std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*> entries;
std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*>::iterator it;
U32 queueAmount;
U32 queueTime;
};
class NACLAntiSpamRegistry
{
public:
NACLAntiSpamRegistry(U32 time=2, U32 amount=10);
static void registerQueues(U32 time=2, U32 amount=10);
static void registerQueue(U32 name, U32 time, U32 amount);
static void setRegisteredQueueTime(U32 name, U32 time);
static void setRegisteredQueueAmount(U32 name,U32 amount);
static void setAllQueueTimes(U32 amount);
static void setAllQueueAmounts(U32 time);
static bool checkQueue(U32 name, LLUUID& source, U32 multiplier=1, bool silent=false);
static bool handleNaclAntiSpamGlobalQueueChanged(const LLSD& newvalue);
static bool handleNaclAntiSpamTimeChanged(const LLSD& newvalue);
static bool handleNaclAntiSpamAmountChanged(const LLSD& newvalue);
static void clearRegisteredQueue(U32 name);
static void purgeRegisteredQueue(U32 name);
static void clearAllQueues();
static void purgeAllQueues();
static void setGlobalQueue(bool value);
static void setGlobalAmount(U32 amount);
static void setGlobalTime(U32 time);
static void blockOnQueue(U32 name,LLUUID& owner_id);
enum {
QUEUE_CHAT,
QUEUE_INVENTORY,
QUEUE_IM,
QUEUE_CALLING_CARD,
QUEUE_SOUND,
QUEUE_SOUND_PRELOAD,
QUEUE_SCRIPT_DIALOG,
QUEUE_TELEPORT,
QUEUE_MAX
};
private:
static const char* getQueueName(U32 queue_id);
static NACLAntiSpamQueue* queues[QUEUE_MAX];
static std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*> globalEntries;
static std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*>::iterator it2;
static U32 globalTime;
static U32 globalAmount;
static bool bGlobalQueue;
static int checkGlobalEntry(LLUUID& source, U32 multiplier);
static void clearGlobalEntries();
static void purgeGlobalEntries();
static void blockGlobalEntry(LLUUID& source);
};
extern const std::string COLLISION_SOUNDS[];
extern const int COLLISION_SOUNDS_SIZE;
#endif //NACLANTISPAM_H

View File

@@ -8,7 +8,6 @@
<string>settings_sh.xml</string>
<string>settings_rlv.xml</string>
</array>
<key>SianaRenderDeferredInvisiprim</key>
<map>
<key>Comment</key>
@@ -894,6 +893,83 @@
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>_NACL_Antispam</key>
<map>
<key>Comment</key>
<string>When true, all dialogs will be blocked, resets on restart.</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>_NACL_AntiSpamGlobalQueue</key>
<map>
<key>Comment</key>
<string> </string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>_NACL_AntiSpamTime</key>
<map>
<key>Comment</key>
<string> </string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>2</integer>
</map>
<key>_NACL_AntiSpamAmount</key>
<map>
<key>Comment</key>
<string> </string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>10</integer>
</map>
<key>_NACL_AntiSpamSoundMulti</key>
<map>
<key>Comment</key>
<string> </string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>4</integer>
</map>
<key>_NACL_AntiSpamNewlines</key>
<map>
<key>Comment</key>
<string>How many newlines a message can have before it's considered spam.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>30</integer>
</map>
<key>_NACL_AntiSpamSoundPreloadMulti</key>
<map>
<key>Comment</key>
<string> </string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>4</integer>
</map>
<!-- Vanilla SL settings that are now optionally Account-Specific -->
<key>AgentChatColor</key>
@@ -15108,3 +15184,4 @@
</map>
</map>
</llsd>

View File

@@ -141,94 +141,6 @@
<real>1.0</real>
</map>
<key>SGBlockGeneralSpam</key>
<map>
<key>Comment</key>
<string>Enable automatic general spam blocking</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SGBlockCardSpam</key>
<map>
<key>Comment</key>
<string>Enable automatic calling card spam blocking</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>SGBlockChatSpam</key>
<map>
<key>Comment</key>
<string>Enable automatic chat spam blocking</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SGBlockDialogSpam</key>
<map>
<key>Comment</key>
<string>Enable automatic dialog spam blocking</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>SGSpamTime</key>
<map>
<key>Comment</key>
<string>Time of Evalulating spam. (Default: 1.000)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>SGSpamCount</key>
<map>
<key>Comment</key>
<string>Number of items spammed per time period in SGSpamTime. (Default: 4)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<real>4</real>
</map>
<key>SGChatSpamTime</key>
<map>
<key>Comment</key>
<string>Time of Evalulating spam. (Default: 1.000)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>SGChatSpamCount</key>
<map>
<key>Comment</key>
<string>Number of items spammed per time set in SGSpamTime. (Default: 10)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<real>10.0</real>
</map>
<key>ShyotlUseLegacyTextureBatching</key>
<map>
<key>Comment</key>

View File

@@ -40,6 +40,7 @@
#include "llradiogroup.h"
#include "lluictrlfactory.h"
#include "llviewercontrol.h"
#include "NACLantispam.h"
#include "lgghunspell_wrapper.h"
#include "llstartup.h"
@@ -78,7 +79,8 @@ LLPrefsAscentChat::LLPrefsAscentChat()
addChild(mObjectDropTarget);
}
if (LLStartUp::getStartupState() == STATE_STARTED)
bool started = LLStartUp::getStartupState() == STATE_STARTED;
if (started)
{
LLUUID itemid = (LLUUID)gSavedPerAccountSettings.getString("AscentInstantMessageResponseItemData");
LLViewerInventoryItem* item = gInventory.getItem(itemid);
@@ -91,6 +93,9 @@ LLPrefsAscentChat::LLPrefsAscentChat()
childSetCommitCallback("im_response", onCommitAutoResponse, this);
childSetEnabled("reset_antispam", started);
childSetCommitCallback("reset_antispam", onCommitResetAS, this);
childSetCommitCallback("KeywordsOn", onCommitKeywords, this);
childSetCommitCallback("KeywordsList", onCommitKeywords, this);
childSetCommitCallback("KeywordsSound", onCommitKeywords, this);
@@ -218,7 +223,7 @@ void LLPrefsAscentChat::onCommitTimeDate(LLUICtrl* ctrl, void* userdata)
//static
void LLPrefsAscentChat::onCommitAutoResponse(LLUICtrl* ctrl, void* user_data)
{
LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data;
LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data;
gSavedPerAccountSettings.setBOOL("AscentInstantMessageResponseAnyone", self->childGetValue("AscentInstantMessageResponseAnyone"));
gSavedPerAccountSettings.setBOOL("AscentInstantMessageResponseFriends", self->childGetValue("AscentInstantMessageResponseFriends"));
@@ -237,6 +242,12 @@ void LLPrefsAscentChat::SinguIMResponseItemDrop(LLViewerInventoryItem* item)
sInst->childSetValue("im_give_disp_rect_txt","Currently set to: "+item->getName());
}
//static
void LLPrefsAscentChat::onCommitResetAS(LLUICtrl*, void*)
{
NACLAntiSpamRegistry::purgeAllQueues();
}
//static
void LLPrefsAscentChat::onCommitKeywords(LLUICtrl* ctrl, void* user_data)
{
@@ -316,13 +327,13 @@ void LLPrefsAscentChat::refreshValues()
mIMResponseText = gSavedPerAccountSettings.getString("AscentInstantMessageResponse");
//Spam --------------------------------------------------------------------------------
mBlockChatSpam = gSavedSettings.getBOOL("SGBlockChatSpam");
mChatSpamCount = gSavedSettings.getU32("SGChatSpamCount");
mChatSpamTime = gSavedSettings.getF32("SGChatSpamTime");
mBlockDialogSpam = gSavedSettings.getBOOL("SGBlockDialogSpam");
mBlockCardSpam = gSavedSettings.getBOOL("SGBlockCardSpam");
mSpamCount = gSavedSettings.getU32("SGSpamCount");
mSpamTime = gSavedSettings.getF32("SGSpamTime");
mGlobalQueue = gSavedSettings.getBOOL("_NACL_AntiSpamGlobalQueue");
mChatSpamCount = gSavedSettings.getU32("_NACL_AntiSpamAmount");
mChatSpamTime = gSavedSettings.getU32("_NACL_AntiSpamTime");
mBlockDialogSpam = gSavedSettings.getBOOL("_NACL_Antispam");
mSoundMulti = gSavedSettings.getU32("_NACL_AntiSpamSoundMulti");
mNewLines = gSavedSettings.getU32("_NACL_AntiSpamNewlines");
mPreloadMulti = gSavedSettings.getU32("_NACL_AntiSpamSoundPreloadMulti");
//Text Options ------------------------------------------------------------------------
mSpellDisplay = gSavedSettings.getBOOL("SpellDisplay");
@@ -503,13 +514,13 @@ void LLPrefsAscentChat::cancel()
gSavedPerAccountSettings.setString("AscentInstantMessageResponse", mIMResponseText);
//Spam --------------------------------------------------------------------------------
gSavedSettings.setBOOL("SGBlockChatSpam", mBlockChatSpam);
gSavedSettings.setU32("SGChatSpamCount", mChatSpamCount);
gSavedSettings.setF32("SGChatSpamTime", mChatSpamTime);
gSavedSettings.setBOOL("SGBlockDialogSpam", mBlockDialogSpam);
gSavedSettings.setBOOL("SGBlockCardSpam", mBlockCardSpam);
gSavedSettings.setU32("SGSpamCount", mSpamCount);
gSavedSettings.setF32("SGSpamTime", mSpamTime);
gSavedSettings.setBOOL("_NACL_AntiSpamGlobalQueue", mGlobalQueue);
gSavedSettings.setU32("_NACL_AntiSpamAmount", mChatSpamCount);
gSavedSettings.setU32("_NACL_AntiSpamTime", mChatSpamTime);
gSavedSettings.setBOOL("_NACL_Antispam", mBlockDialogSpam);
gSavedSettings.setU32("_NACL_AntiSpamSoundMulti", mSoundMulti);
gSavedSettings.setU32("_NACL_AntiSpamNewlines", mNewLines);
gSavedSettings.setU32("_NACL_AntiSpamSoundPreloadMulti", mPreloadMulti);
//Text Options ------------------------------------------------------------------------
gSavedSettings.setBOOL("SpellDisplay", mSpellDisplay);

View File

@@ -56,6 +56,7 @@ protected:
static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata);
static void onCommitTimeDate(LLUICtrl* ctrl, void *userdata);
static void onCommitAutoResponse(LLUICtrl* ctrl, void* user_data);
static void onCommitResetAS(LLUICtrl*,void*);
static void onCommitKeywords(LLUICtrl* ctrl, void* user_data);
//Chat/IM -----------------------------------------------------------------------------
@@ -84,13 +85,13 @@ protected:
std::string mIMResponseText;
//Spam --------------------------------------------------------------------------------
BOOL mBlockChatSpam;
BOOL mGlobalQueue;
U32 mChatSpamCount;
F32 mChatSpamTime;
U32 mChatSpamTime;
BOOL mBlockDialogSpam;
BOOL mBlockCardSpam;
U32 mSpamCount;
F32 mSpamTime;
BOOL mSoundMulti;
U32 mNewLines;
U32 mPreloadMulti;
//Text Options ------------------------------------------------------------------------
BOOL mSpellDisplay;

View File

@@ -100,6 +100,8 @@
#include "llattachmentsmgr.h"
// [/RLVa:KB]
#include "NACLantispam.h" // for NaCl Antispam Registry
using namespace LLVOAvatarDefines;
const BOOL ANIMATE = TRUE;
@@ -665,6 +667,10 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
<< " located at " << ip << llendl;
if (mRegionp)
{
// NaCl - Antispam Registry
NACLAntiSpamRegistry::purgeAllQueues();
// NaCl End
// We've changed regions, we're now going to change our agent coordinate frame.
mAgentOriginGlobal = regionp->getOriginGlobal();
LLVector3d agent_offset_global = mRegionp->getOriginGlobal();

View File

@@ -233,6 +233,8 @@
#include "lldxhardware.h"
#endif
#include "NACLantispam.h" // for NaCl Antispam Registry
//
// exported globals
//
@@ -1057,6 +1059,15 @@ bool idle_startup()
LLFile::mkdir(gDirUtilp->getChatLogsDir());
LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
// NaCl - Antispam
U32 antispam_time = gSavedSettings.getU32("_NACL_AntiSpamTime");
U32 antispam_amount = gSavedSettings.getU32("_NACL_AntiSpamAmount");
NACLAntiSpamRegistry::registerQueues(antispam_time, antispam_amount);
gSavedSettings.getControl("_NACL_AntiSpamGlobalQueue")->getSignal()->connect(boost::bind(&NACLAntiSpamRegistry::handleNaclAntiSpamGlobalQueueChanged, _2));
gSavedSettings.getControl("_NACL_AntiSpamTime")->getSignal()->connect(boost::bind(&NACLAntiSpamRegistry::handleNaclAntiSpamTimeChanged, _2));
gSavedSettings.getControl("_NACL_AntiSpamAmount")->getSignal()->connect(boost::bind(&NACLAntiSpamRegistry::handleNaclAntiSpamAmountChanged, _2));
// NaCl End
//good as place as any to create user windlight directories
std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", ""));
LLFile::mkdir(user_windlight_path_name.c_str());
@@ -4354,3 +4365,4 @@ bool process_login_success_response(std::string& password)
}
return success;
}

View File

@@ -83,6 +83,8 @@
#include "lldrawpoolbump.h"
#include "emeraldboobutils.h"
#include "NACLantispam.h" // for NaCl Antispam Registry
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
BOOL gHackGodmode = FALSE;
#endif

View File

@@ -178,6 +178,13 @@
#include "llwindebug.h" // For the invalid message handler
#endif
// NaCl - Antispam Registry
#include "NACLantispam.h"
// NaCl - Newline flood protection
#include <boost/regex.hpp>
static const boost::regex NEWLINES("\\n{1}");
// NaCl End
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
#include "llfloateravatarinfo.h"
extern LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; // Only defined in llfloateravatarinfo.cpp
@@ -238,75 +245,6 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] =
FALSE // ControlYourCamera
};
template <typename T>
class SH_SpamHandler
{
public:
SH_SpamHandler(const char *pToggleCtrl, const char *pDurCtrl, const char *pFreqCtrl) :
mDuration(pDurCtrl, 1.f),
mFrequency(pFreqCtrl, 5),
mEnabled(false)
{
gSavedSettings.getControl(pToggleCtrl)->getSignal()->connect(boost::bind(&SH_SpamHandler::CtrlToggle, this, _2));
CtrlToggle(gSavedSettings.getBOOL(pToggleCtrl));
}
bool CtrlToggle(const LLSD& newvalue)
{
bool on = newvalue.asBoolean();
if(on == mEnabled)
return true;
mEnabled = on;
mTimer.stop();
mActiveList.clear();
mBlockedList.clear();
return true;
}
bool isBlocked(const T &owner, const LLUUID &source_id, const char *pNotification, LLSD args=LLSD())
{
if(!mEnabled || isAgent(owner))
return false;
if(mBlockedList.find(owner) != mBlockedList.end())
return true;
if(mTimer.getStarted() && mTimer.getElapsedTimeF32() < mDuration)
{
typename std::map<const T,U32>::iterator it = mActiveList.insert(std::pair<const T, U32>(owner,0)).first;
if(++(it->second)>=mFrequency)
{
mBlockedList.insert(owner);
if(pNotification)
{
args["OWNER"] = owner;
args["SOURCE"] = source_id;
LLNotifications::getInstance()->add(pNotification,args);
}
return true;
}
}
else
{
mActiveList.clear();
mTimer.start();
}
return false;
}
private:
//Owner is either a key, or a name. Do not look up perms since object may be unknown.
static bool isAgent(const T &owner);
bool mEnabled;
LLFrameTimer mTimer;
const LLCachedControl<F32> mDuration;
const LLCachedControl<U32> mFrequency;
std::map<const T,U32> mActiveList;
std::set<T> mBlockedList;
};
template<> bool SH_SpamHandler<LLUUID>::isAgent(const LLUUID &owner) { return gAgent.getID() == owner; }
template<> bool SH_SpamHandler<std::string>::isAgent(const std::string &owner)
{
std::string str;
gAgent.getName(str);
return str == owner;
}
bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -1704,7 +1642,12 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
info->forceResponse(IOR_BUSY);
return;
}
// NaCl - Antispam Registry
static LLCachedControl<bool> antispam(gSavedSettings,"_NACL_Antispam");
if(antispam || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_INVENTORY,info->mFromID))
return;
// NaCl End
//If muted, don't even go through the messaging stuff. Just curtail the offer here.
if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName))
{
@@ -1958,6 +1901,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
{
return;
}
static LLCachedControl<bool> antispam(gSavedSettings,"_NACL_Antispam");
LLUUID from_id;
BOOL from_group;
LLUUID to_id;
@@ -1986,6 +1930,24 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
//msg->getData("MessageBlock", "Count", &count);
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name);
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message);
// NaCl - Newline flood protection
LLViewerObject* obj=gObjectList.findObject(from_id);
if(!from_id.isNull() //Not from nothing.
&& gAgent.getID() != from_id //Not from self.
&& !(obj && obj->permYouOwner())) //Not from own object.
{
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
boost::sregex_iterator iter(message.begin(), message.end(), NEWLINES);
if(std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines)
{
NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id);
LLSD args;
args["MESSAGE"] = "Message: Blocked newline flood from "+from_id.asString();
LLNotificationsUtil::add("SystemMessageTip", args);
return;
}
}
// NaCl End
msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id);
msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id);
msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position);
@@ -1993,6 +1955,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
binary_bucket_size = msg->getSizeFast(_PREHASH_MessageBlock, _PREHASH_BinaryBucket);
EInstantMessage dialog = (EInstantMessage)d;
// NaCl - Antispam Registry
if((dialog != IM_TYPING_START && dialog != IM_TYPING_STOP)
&& NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id))
return;
// NaCl End
// make sure that we don't have an empty or all-whitespace name
LLStringUtil::trim(name);
if (name.empty())
@@ -2022,15 +1990,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
{
LLSD args;
args["NAME"] = name;
static SH_SpamHandler<LLUUID> avatar_spam_check("SGBlockGeneralSpam","SGSpamTime","SGSpamCount");
static SH_SpamHandler<LLUUID> object_spam_check("SGBlockGeneralSpam","SGSpamTime","SGSpamCount");
if(d==IM_FROM_TASK||d==IM_GOTO_URL||d==IM_FROM_TASK_AS_ALERT||d==IM_TASK_INVENTORY_OFFERED||d==IM_TASK_INVENTORY_ACCEPTED||d==IM_TASK_INVENTORY_DECLINED)
{
if(object_spam_check.isBlocked(from_id,session_id,"BlockedGeneralObjects",args))
return;
}
else if(avatar_spam_check.isBlocked(from_id,from_id,"BlockedGeneralAvatar",args))
return;
}
LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing.
@@ -2464,6 +2423,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_GROUP_NOTICE:
case IM_GROUP_NOTICE_REQUESTED:
{
// NaCl - Antispam
if(antispam)
return;
// NaCl End
LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL;
// Read the binary bucket for more information.
struct notice_bucket_header_t
@@ -2559,6 +2522,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
break;
case IM_GROUP_INVITATION:
{
// NaCl - Antispam
if(antispam)
return;
// NaCl End
//if (!is_linden && (is_busy || is_muted))
if ((is_busy || is_muted))
{
@@ -2603,6 +2570,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_TASK_INVENTORY_OFFERED:
// Someone has offered us some inventory.
{
// NaCl - Antispam
if(antispam)
return;
// NaCl End
LLOfferInfo* info = new LLOfferInfo;
if (IM_INVENTORY_OFFERED == dialog)
@@ -2855,6 +2826,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
}
break;
case IM_FROM_TASK_AS_ALERT:
// NaCl - Antispam
if(antispam)
return;
// NaCl End
if (is_busy && !is_owned_by_me)
{
return;
@@ -2892,6 +2867,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_LURE_USER:
{
if(antispam) return; //NaCl Antispam
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c
// If the lure sender is a specific @accepttp exception they will override muted and busy status
bool fRlvSummon = (rlv_handler_t::isEnabled()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, from_id));
@@ -3032,6 +3008,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_GOTO_URL:
{
// NaCl - Antispam
if(antispam)
return;
// NaCl End
LLSD args;
// n.b. this is for URLs sent by the system, not for
// URLs sent by scripts (i.e. llLoadURL)
@@ -3056,6 +3036,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_FRIENDSHIP_OFFERED:
{
// NaCl - Antispam
if(antispam)
return;
// NaCl End
LLSD payload;
payload["from_id"] = from_id;
payload["session_id"] = session_id;;
@@ -3190,11 +3174,22 @@ static LLNotificationFunctorRegistration callingcard_offer_cb_reg("OfferCallingC
void process_offer_callingcard(LLMessageSystem* msg, void**)
{
// NaCl - Antispam
static LLCachedControl<bool> antispam(gSavedSettings,"_NACL_Antispam");
if(antispam)
return;
// NaCl End
// someone has offered to form a friendship
LL_DEBUGS("Messaging") << "callingcard offer" << LL_ENDL;
LLUUID source_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, source_id);
// NaCl - Antispam Registry
if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CALLING_CARD,source_id))
return;
// NaCl End
LLUUID tid;
msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_TransactionID, tid);
@@ -3227,9 +3222,6 @@ void process_offer_callingcard(LLMessageSystem* msg, void**)
}
else
{
static SH_SpamHandler<LLUUID> spam_check("SGBlockCardSpam","SHSpamTime","SGSpamCount");
if(spam_check.isBlocked(source_id,source_id,"BlockedCards",args))
return;
LLNotificationsUtil::add("OfferCallingCard", args, payload);
}
}
@@ -3384,6 +3376,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
msg->getU8("ChatData", "ChatType", type_temp);
chat.mChatType = (EChatType)type_temp;
// NaCL - Antispam Registry
if((chat.mChatType != CHAT_TYPE_START && chat.mChatType != CHAT_TYPE_STOP) //Chat type isn't typing
&&((owner_id.isNull() && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,from_id)) //Spam from an object?
||(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id)))) //Spam from a resident?
return;
// NaCl End
msg->getU8Fast(_PREHASH_ChatData, _PREHASH_Audible, audible_temp);
chat.mAudible = (EChatAudible)audible_temp;
@@ -3431,12 +3431,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
{
LLSD args;
args["NAME"] = from_name;
static SH_SpamHandler<LLUUID> avatar_spam_check("SGBlockChatSpam","SGChatSpamTime","SGChatSpamCount");
static SH_SpamHandler<LLUUID> object_spam_check("SGBlockChatSpam","SGChatSpamTime","SGChatSpamCount");
if( (chatter->isAvatar() && avatar_spam_check.isBlocked(from_id,from_id,"BlockedChatterAvatar",args)) ||
(!chatter->isAvatar() && object_spam_check.isBlocked(owner_id,from_id,"BlockedChatterObjects",args)) )
return;
chat.mPosAgent = chatter->getPositionAgent();
// Make swirly things only for talking objects. (not script debug messages, though)
@@ -3508,6 +3502,25 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
if (is_audible)
{
msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg);
// NaCl - Newline flood protection
LLViewerObject* obj=gObjectList.findObject(from_id);
if(!(from_id.isNull()) //Not from nothing.
|| !(gAgent.getID() != from_id) //Not from self.
|| !(obj && obj->permYouOwner())) //Not from own object.
{
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
boost::sregex_iterator iter(mesg.begin(), mesg.end(), NEWLINES);
if(std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines)
{
NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id);
LLSD args;
args["MESSAGE"] = "Chat: Blocked newline flood from "+owner_id.asString();
LLNotificationsUtil::add("SystemMessageTip", args);
return;
}
}
// NaCl End
static std::map<LLUUID, bool> sChatObjectAuth;
@@ -4832,6 +4845,23 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_SoundID, sound_id);
msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_OwnerID, owner_id);
msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id);
// NaCl - Antispam Registry
/*if(owner_id.isNull())
{*/
bool bDoSpamCheck=1;
std::string sSound=sound_id.asString();
static LLCachedControl<U32> _NACL_AntiSpamSoundMulti(gSavedSettings,"_NACL_AntiSpamSoundMulti");
for(int i=0;i< COLLISION_SOUNDS_SIZE;i++)
if(COLLISION_SOUNDS[i] == sSound)
bDoSpamCheck=0;
if(bDoSpamCheck)
if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,object_id, _NACL_AntiSpamSoundMulti,true)) return;
/*}
else
if(NACLAntiSpamRegistry::checkQueue("Soundspam",owner_id)) return;*/
// NaCl End
msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ParentID, parent_id);
msg->getU64Fast(_PREHASH_SoundData, _PREHASH_Handle, region_handle);
msg->getVector3Fast(_PREHASH_SoundData, _PREHASH_Position, pos_local);
@@ -4895,6 +4925,14 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data)
msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id);
msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
// NaCl - Antispam Registry
static LLCachedControl<U32> _NACL_AntiSpamSoundPreloadMulti(gSavedSettings,"_NACL_AntiSpamSoundPreloadMulti");
if((owner_id.isNull()
&& NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD,object_id,_NACL_AntiSpamSoundPreloadMulti))
|| NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD,owner_id,_NACL_AntiSpamSoundPreloadMulti))
return;
// NaCl End
LLViewerObject *objectp = gObjectList.findObject(object_id);
if (!objectp) return;
@@ -4930,6 +4968,14 @@ void process_attached_sound(LLMessageSystem *msg, void **user_data)
msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id);
msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id);
msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
// NaCl - Antispam Registry
if(/*owner_id.isNull()
&&*/ NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,object_id))
/*|| (NACLAntiSpamRegistry::checkQueue("Soundspam",owner_id))*/
return;
// NaCl End
msg->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain);
msg->getU8Fast(_PREHASH_DataBlock, _PREHASH_Flags, flags);
@@ -6022,6 +6068,10 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/)
void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted)
{
// NaCl - Antispam Registry
LLUUID task_id = notification["payload"]["task_id"].asUUID();
if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,task_id)) return;
// NaCl End
// only continue if at least some permissions were requested
if (orig_questions)
{
@@ -6188,7 +6238,12 @@ static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestio
void process_script_question(LLMessageSystem *msg, void **user_data)
{
// *TODO:translate owner name -> [FIRST] [LAST]
// NaCl - Antispam
static LLCachedControl<bool> antispam(gSavedSettings,"_NACL_Antispam");
if(antispam)
return;
// NaCl End
// *TODO: Translate owner name -> [FIRST] [LAST]
LLHost sender = msg->getSender();
@@ -6202,6 +6257,14 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid );
// itemid -> script asset key of script requesting permissions
msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid );
// NaCl - Antispam Registry
if((taskid.isNull()
&& NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,itemid))
|| NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,taskid))
return;
// NaCl End
msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name);
msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name);
msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions );
@@ -6860,17 +6923,33 @@ static LLNotificationFunctorRegistration callback_script_dialog_reg_2("ScriptDia
void process_script_dialog(LLMessageSystem* msg, void**)
{
// NaCl - Antispam
static LLCachedControl<bool> antispam(gSavedSettings,"_NACL_Antispam");
if(antispam)
return;
// NaCl End
S32 i;
LLSD payload;
LLUUID object_id;
msg->getUUID("Data", "ObjectID", object_id);
// For compability with OS grids first check for presence of extended packet before fetching data.
// NaCl - Antispam Registry
if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,object_id))
return;
// NaCl End
// For compability with OS grids first check for presence of extended packet before fetching data.
LLUUID owner_id;
if (gMessageSystem->getNumberOfBlocks("OwnerData") > 0)
{
msg->getUUID("OwnerData", "OwnerID", owner_id);
// NaCl - Antispam Registry
if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,owner_id))
return;
// NaCl End
}
if (LLMuteList::getInstance()->isMuted(object_id) || LLMuteList::getInstance()->isMuted(owner_id))
@@ -6943,10 +7022,6 @@ void process_script_dialog(LLMessageSystem* msg, void**)
{
args["NAME"] = LLCacheName::buildFullName(first_name, last_name);
static SH_SpamHandler<std::string> spam_check("SGBlockDialogSpam","SGSpamTime","SGSpamCount");
if(spam_check.isBlocked(first_name + " " + last_name,object_id,"BlockedDialogs",args))
return;
if (is_text_box)
{
args["DEFAULT"] = default_text;
@@ -7030,6 +7105,11 @@ void callback_load_url_name(const LLUUID& id, const std::string& full_name, bool
void process_load_url(LLMessageSystem* msg, void**)
{
// NaCl - Antispam
static LLCachedControl<bool> antispam(gSavedSettings,"_NACL_Antispam");
if(antispam)
return;
// NaCl End
LLUUID object_id;
LLUUID owner_id;
BOOL owner_is_group;
@@ -7040,6 +7120,14 @@ void process_load_url(LLMessageSystem* msg, void**)
msg->getString("Data", "ObjectName", 256, object_name);
msg->getUUID( "Data", "ObjectID", object_id);
msg->getUUID( "Data", "OwnerID", owner_id);
// NaCl - Antispam Registry
if((owner_id.isNull()
&& NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,object_id))
|| NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,owner_id))
return;
// NaCl End
msg->getBOOL( "Data", "OwnerIsGroup", owner_is_group);
msg->getString("Data", "Message", 256, message);
msg->getString("Data", "URL", 256, url);
@@ -7112,6 +7200,11 @@ void process_initiate_download(LLMessageSystem* msg, void**)
void process_script_teleport_request(LLMessageSystem* msg, void**)
{
// NaCl - Antispam
static LLCachedControl<bool> antispam(gSavedSettings,"_NACL_Antispam");
if(antispam)
return;
// NaCl End
if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return;
std::string object_name;

View File

@@ -68,20 +68,14 @@
</panel>
<panel border="true" left="1" bottom="-408" height="408" width="500" label="Spam" name="Spam">
<check_box left="10" bottom_delta="-25" follows="top" font="SansSerifSmall"
label="Enable chat spam blocking" tool_tip="Enable automatic chat spam blocking" name="AscChatSpamBlock" control_name="SGBlockChatSpam"/>
<spinner left_delta="20" height="18" width="120" follows="top" decimal_digits="0" increment="1" initial_val="10" min_val="2" max_val="100"
label="Chat count" label_width="70" tool_tip="Number of items spammed per time set. (Default: 10)" name="AscChatSpamCount" control_name="SGChatSpamCount"/>
<spinner height="18" width="120" follows="left|top" decimal_digits="1" increment="1" initial_val="1.0" min_val="1" max_val="60"
label="Chat time" label_width="70" name="AscChatSpamTime" control_name="SGChatSpamTime" tool_tip="Time of evalulating spam in seconds. (Default: 1.0)"/>
<text bottom_delta="0" left_delta="130" height="16" follows="top" name="" width="100">seconds</text>
<check_box left_delta="-150" height="16" follows="top" label="Enable dialog spam blocking" tool_tip="Enable automatic dialog spam blocking" name="AscDialogSpamBlock" control_name="SGBlockDialogSpam"/>
<check_box height="16" follows="left|top" label="Enable calling card spam blocking" tool_tip="Enable automatic calling card spam blocking" name="AscCardSpamBlock" control_name="SGBlockCardSpam"/>
<spinner left_delta="20" height="18" width="120" follows="top" decimal_digits="0" increment="1" initial_val="4" min_val="2" max_val="100"
label="Spam count" label_width="70" name="AscSpamCount" control_name="SGSpamCount" tool_tip="This setting applies to both Dialog and Card spam (Default: 4)"/>
<spinner height="18" width="120" follows="left|top" decimal_digits="1" increment="1" initial_val="1.0" min_val="1" max_val="60"
label="Spam time" label_width="70" name="AscSpamTime" control_name="SGSpamTime" tool_tip="This setting applies to both Dialog and Card spam (Default: 1.0)"/>
<text bottom_delta="0" left_delta="130" height="16" follows="top" name="">seconds</text>
<check_box control_name="_NACL_AntiSpamGlobalQueue" label="No messagetype-specific spam queues" name="spammsg_checkbox" width="256" left="6"/>
<button height="23" label="Reset antispam queues" label_selected="Reset antispam queues" name="reset_antispam" width="230" bottom_delta="0" left="260"/>
<spinner control_name="_NACL_AntiSpamTime" decimal_digits="0" increment="1" min_val="1" max_val="60" label="Antispam time(seconds):" label_width="330" name="antispamtime" width="390" left="10"/>
<spinner control_name="_NACL_AntiSpamAmount" decimal_digits="0" increment="1" min_val="5" max_val="100" label="Antispam amount:" label_width="330" name="antispamamount" width="390"/>
<spinner control_name="_NACL_AntiSpamSoundMulti" decimal_digits="0" increment="1" min_val="1" max_val="100" label="Amount multiplicatior for sound antispam:" label_width="330" left="10" name="antispamsoundmulti" width="390"/>
<spinner control_name="_NACL_AntiSpamSoundPreloadMulti" decimal_digits="0" increment="1" min_val="1" max_val="99999" label="Amount multiplicatior for sound preload antispam:" label_width="330" name="antispamsoundpreloadmulti" width="390"/>
<spinner control_name="_NACL_AntiSpamNewlines" decimal_digits="0" increment="1" min_val="5" max_val="99999" label="Amount of newlines to instablock message:" label_width="330" name="antispamnewlines" width="390"/>
<check_box control_name="_NACL_Antispam" height="16" label="Disable -all- dialogs (resets on login)" name="antispam_checkbox" left="6"/>
</panel>
<panel border="true" bottom="-580" height="525" label="Text Options" left="1" name="TextOptions" width="418">

View File

@@ -47,21 +47,21 @@
<check_box bottom_delta="-17" control_name="RenderDeferred" initial_value="true" label="Lighting and Shadows" tool_tip="Deferred Shading" left_delta="0" name="RenderDeferred"/>
<check_box bottom_delta="-17" control_name="RenderDeferredSSAO" height="16" initial_value="true" label="Ambient Occlusion" left_delta="0" name="UseSSAO"/>
<check_box bottom_delta="-17" control_name="RenderDepthOfField" initial_value="true" label="Depth of Field" left_delta="0" name="RenderDepthOfField"/>
<text bottom_delta="-20" height="12" left="15" name="TerrainScaleText">Terrain Scale:</text>
<combo_box bottom_delta="-16" control_name="RenderTerrainScale" label="Terrain Scale" left_delta="-2" name="TerrainScaleCombo" width="160" height="16">
<text bottom_delta="-17" height="12" left="15" name="TerrainScaleText">Terrain Scale:</text>
<combo_box bottom_delta="-22" control_name="RenderTerrainScale" label="Terrain Scale" left_delta="-2" name="TerrainScaleCombo" width="160" height="16">
<combo_item name="Low" value="12">Low</combo_item>
<combo_item name="Medium" value="9">Medium</combo_item>
<combo_item name="High" value="7">High</combo_item>
<combo_item name="Ultra" value="5">Ultra</combo_item>
</combo_box>
<text bottom_delta="-20" height="12" left="15" name="ShadowDetailText">Shadows:</text>
<combo_box bottom_delta="-16" control_name="RenderShadowDetail" label="Shadow Detail" left_delta="-2" name="ShadowDetailCombo" width="160" height="16">
<text bottom_delta="-17" height="12" left="15" name="ShadowDetailText">Shadows:</text>
<combo_box bottom_delta="-22" control_name="RenderShadowDetail" label="Shadow Detail" left_delta="-2" name="ShadowDetailCombo" width="160" height="16">
<combo_item name="0" value="0">Disabled</combo_item>
<combo_item name="1" value="1">Sun/Moon</combo_item>
<combo_item name="2" value="2">Sun/Moon + Projectors</combo_item>
</combo_box>
<text bottom_delta="-20" height="12" left="15" name="ReflectionDetailText">Water Reflections:</text>
<combo_box bottom_delta="-16" control_name="RenderReflectionDetail" label="Reflection Detail" left_delta="-2" name="ReflectionDetailCombo" width="160" height="16">
<text bottom_delta="-17" height="12" left="15" name="ReflectionDetailText">Water Reflections:</text>
<combo_box bottom_delta="-22" control_name="RenderReflectionDetail" label="Reflection Detail" left_delta="-2" name="ReflectionDetailCombo" width="160" height="16">
<combo_item name="0" value="0">Minimal</combo_item>
<combo_item name="1" value="1">Terrain and trees</combo_item>
<combo_item name="2" value="2">All static objects</combo_item>
@@ -69,7 +69,7 @@
<combo_item name="4" value="4">Everything</combo_item>
</combo_box>
<slider bottom_delta="-24" left="5" control_name="RenderAvatarPhysicsLODFactor" increment="0.1" label=" Avatar Physics:" label_width="79" max_val="1" min_val="0" name="AvatarPhysicsDetail" show_text="false" width="160"/>
<slider bottom_delta="-20" left="5" control_name="RenderAvatarPhysicsLODFactor" increment="0.1" label=" Avatar Physics:" label_width="79" max_val="1" min_val="0" name="AvatarPhysicsDetail" show_text="false" width="160"/>
<text bottom_delta="-2" left="170" height="12" name="AvatarPhysicsDetailText">Off</text>
<!--text bottom="-131" height="12" left="464" name="DrawDistanceMeterText1">m</text-->
<text bottom="-131" height="12" left="470" name="DrawDistanceMeterText2">m</text>