Merge remote-tracking branch 'Lirusaito/Canon' into Cupcake
This commit is contained in:
@@ -182,6 +182,7 @@
|
||||
|
||||
// NaCl - Antispam Registry
|
||||
#include "NACLantispam.h"
|
||||
bool can_block(const LLUUID& id);
|
||||
// NaCl - Newline flood protection
|
||||
#include <boost/regex.hpp>
|
||||
static const boost::regex NEWLINES("\\n{1}");
|
||||
@@ -211,7 +212,7 @@ extern bool gShiftFrame;
|
||||
|
||||
// function prototypes
|
||||
bool check_offer_throttle(const std::string& from_name, bool check_only);
|
||||
void callbackCacheEstateOwnerName(const LLUUID& id, const std::string& full_name, bool is_group);
|
||||
void callbackCacheEstateOwnerName(const LLUUID& id, const LLAvatarName& av_name);
|
||||
static void process_money_balance_reply_extended(LLMessageSystem* msg);
|
||||
|
||||
//inventory offer throttle globals
|
||||
@@ -1956,27 +1957,22 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
|
||||
msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message);
|
||||
// NaCl - Newline flood protection
|
||||
static LLCachedControl<bool> AntiSpamEnabled(gSavedSettings,"AntiSpamEnabled",false);
|
||||
if(AntiSpamEnabled){
|
||||
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.
|
||||
if (AntiSpamEnabled && can_block(from_id))
|
||||
{
|
||||
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
|
||||
boost::sregex_iterator iter(message.begin(), message.end(), NEWLINES);
|
||||
if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines)
|
||||
{
|
||||
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
|
||||
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);
|
||||
llinfos << "[antispam] blocked owner due to too many newlines: " << from_id << llendl;
|
||||
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
||||
{
|
||||
NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id);
|
||||
llinfos << "[antispam] blocked owner due to too many newlines: " << from_id << llendl;
|
||||
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
||||
{
|
||||
LLSD args;
|
||||
args["SOURCE"] = from_id.asString();
|
||||
args["AMOUNT"] = boost::lexical_cast<std::string>(SpamNewlines);
|
||||
LLNotificationsUtil::add("AntiSpamNewlineFlood", args);
|
||||
}
|
||||
return;
|
||||
LLSD args;
|
||||
args["SOURCE"] = from_id.asString();
|
||||
args["AMOUNT"] = boost::lexical_cast<std::string>(SpamNewlines);
|
||||
LLNotificationsUtil::add("AntiSpamNewlineFlood", args);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// NaCl End
|
||||
@@ -3540,25 +3536,20 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
|
||||
|
||||
// NaCl - Newline flood protection
|
||||
static LLCachedControl<bool> AntiSpamEnabled(gSavedSettings,"AntiSpamEnabled",false);
|
||||
if(AntiSpamEnabled){
|
||||
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.
|
||||
if (AntiSpamEnabled && can_block(from_id))
|
||||
{
|
||||
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
|
||||
boost::sregex_iterator iter(mesg.begin(), mesg.end(), NEWLINES);
|
||||
if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines)
|
||||
{
|
||||
static LLCachedControl<U32> SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines");
|
||||
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);
|
||||
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
||||
{
|
||||
NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id);
|
||||
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
||||
{
|
||||
LLSD args;
|
||||
args["MESSAGE"] = "Chat: Blocked newline flood from "+owner_id.asString();
|
||||
LLNotificationsUtil::add("SystemMessageTip", args);
|
||||
}
|
||||
return;
|
||||
LLSD args;
|
||||
args["MESSAGE"] = "Chat: Blocked newline flood from "+owner_id.asString();
|
||||
LLNotificationsUtil::add("SystemMessageTip", args);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// NaCl End
|
||||
@@ -7657,8 +7648,11 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
|
||||
|
||||
LLPanelEstateCovenant::updateEstateName(estate_name);
|
||||
LLPanelLandCovenant::updateEstateName(estate_name);
|
||||
LLPanelEstateInfo::updateEstateName(estate_name);
|
||||
LLFloaterBuyLand::updateEstateName(estate_name);
|
||||
|
||||
LLAvatarNameCache::get(estate_owner_id, boost::bind(&callbackCacheEstateOwnerName, _1, _2));
|
||||
|
||||
// standard message, not from system
|
||||
std::string last_modified;
|
||||
if (covenant_timestamp == 0)
|
||||
@@ -7673,9 +7667,6 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
|
||||
LLPanelEstateCovenant::updateLastModified(last_modified);
|
||||
LLPanelLandCovenant::updateLastModified(last_modified);
|
||||
LLFloaterBuyLand::updateLastModified(last_modified);
|
||||
|
||||
gCacheName->get(estate_owner_id, false,
|
||||
boost::bind(&callbackCacheEstateOwnerName, _1, _2, _3));
|
||||
|
||||
// load the actual covenant asset data
|
||||
const BOOL high_priority = TRUE;
|
||||
@@ -7709,22 +7700,14 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
|
||||
}
|
||||
}
|
||||
|
||||
void callbackCacheEstateOwnerName(const LLUUID& id,
|
||||
const std::string& full_name,
|
||||
bool is_group)
|
||||
void callbackCacheEstateOwnerName(const LLUUID& id, const LLAvatarName& av_name)
|
||||
{
|
||||
std::string name;
|
||||
|
||||
if (id.isNull())
|
||||
{
|
||||
name = "(none)";
|
||||
}
|
||||
else
|
||||
{
|
||||
name = full_name;
|
||||
}
|
||||
LLAvatarNameCache::getPNSName(av_name, name);
|
||||
|
||||
LLPanelEstateCovenant::updateEstateOwnerName(name);
|
||||
LLPanelLandCovenant::updateEstateOwnerName(name);
|
||||
LLPanelEstateInfo::updateEstateOwnerName(name);
|
||||
LLFloaterBuyLand::updateEstateOwnerName(name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user