Disable Newline AntiSpam when AntiSpam is not enabled.
This commit is contained in:
@@ -1946,23 +1946,26 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
|
|||||||
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name);
|
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name);
|
||||||
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message);
|
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message);
|
||||||
// NaCl - Newline flood protection
|
// NaCl - Newline flood protection
|
||||||
LLViewerObject* obj=gObjectList.findObject(from_id);
|
static LLCachedControl<bool> AntiSpamEnabled(gSavedSettings,"AntiSpamEnabled",false);
|
||||||
if(!from_id.isNull() //Not from nothing.
|
if(AntiSpamEnabled){
|
||||||
&& gAgent.getID() != from_id //Not from self.
|
LLViewerObject* obj=gObjectList.findObject(from_id);
|
||||||
&& !(obj && obj->permYouOwner())) //Not from own object.
|
if(!from_id.isNull() //Not from nothing.
|
||||||
{
|
&& gAgent.getID() != from_id //Not from self.
|
||||||
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
|
&& !(obj && obj->permYouOwner())) //Not from own object.
|
||||||
boost::sregex_iterator iter(message.begin(), message.end(), NEWLINES);
|
|
||||||
if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines)
|
|
||||||
{
|
{
|
||||||
NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id);
|
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
|
||||||
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
boost::sregex_iterator iter(message.begin(), message.end(), NEWLINES);
|
||||||
|
if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines)
|
||||||
{
|
{
|
||||||
LLSD args;
|
NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id);
|
||||||
args["MESSAGE"] = "Message: Blocked newline flood from "+from_id.asString();
|
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
||||||
LLNotificationsUtil::add("SystemMessageTip", args);
|
{
|
||||||
|
LLSD args;
|
||||||
|
args["MESSAGE"] = "Message: Blocked newline flood from "+from_id.asString();
|
||||||
|
LLNotificationsUtil::add("SystemMessageTip", args);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// NaCl End
|
// NaCl End
|
||||||
@@ -3519,23 +3522,26 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
|
|||||||
msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg);
|
msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg);
|
||||||
|
|
||||||
// NaCl - Newline flood protection
|
// NaCl - Newline flood protection
|
||||||
LLViewerObject* obj=gObjectList.findObject(from_id);
|
static LLCachedControl<bool> AntiSpamEnabled(gSavedSettings,"AntiSpamEnabled",false);
|
||||||
if(!(from_id.isNull()) //Not from nothing.
|
if(AntiSpamEnabled){
|
||||||
|| !(gAgent.getID() != from_id) //Not from self.
|
LLViewerObject* obj=gObjectList.findObject(from_id);
|
||||||
|| !(obj && obj->permYouOwner())) //Not from own object.
|
if(!(from_id.isNull()) //Not from nothing.
|
||||||
{
|
|| !(gAgent.getID() != from_id) //Not from self.
|
||||||
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
|
|| !(obj && obj->permYouOwner())) //Not from own object.
|
||||||
boost::sregex_iterator iter(mesg.begin(), mesg.end(), NEWLINES);
|
|
||||||
if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines)
|
|
||||||
{
|
{
|
||||||
NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id);
|
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
|
||||||
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
boost::sregex_iterator iter(mesg.begin(), mesg.end(), NEWLINES);
|
||||||
|
if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines)
|
||||||
{
|
{
|
||||||
LLSD args;
|
NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id);
|
||||||
args["MESSAGE"] = "Chat: Blocked newline flood from "+owner_id.asString();
|
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
||||||
LLNotificationsUtil::add("SystemMessageTip", args);
|
{
|
||||||
|
LLSD args;
|
||||||
|
args["MESSAGE"] = "Chat: Blocked newline flood from "+owner_id.asString();
|
||||||
|
LLNotificationsUtil::add("SystemMessageTip", args);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// NaCl End
|
// NaCl End
|
||||||
|
|||||||
Reference in New Issue
Block a user