// static 
void LLFloaterReporter::onClickObjPicker(void *userdata)
{
	LLFloaterReporter *self = (LLFloaterReporter *)userdata;
	LLToolObjPicker::getInstance()->setExitCallback(LLFloaterReporter::closePickTool, self);
	LLToolMgr::getInstance()->setTransientTool(LLToolObjPicker::getInstance());
	self->mPicking = TRUE;
	self->childSetText("object_name", LLStringUtil::null);
	self->childSetText("owner_name", LLStringUtil::null);
	LLButton* pick_btn = self->getChild<LLButton>("pick_btn");
	if (pick_btn) pick_btn->setToggleState(TRUE);
}
// static
void LLFloaterReporter::closePickTool(void *userdata)
{
	LLFloaterReporter *self = (LLFloaterReporter *)userdata;

	LLUUID object_id = LLToolObjPicker::getInstance()->getObjectID();
	self->getObjectInfo(object_id);

	LLToolMgr::getInstance()->clearTransientTool();
	self->mPicking = FALSE;
	LLButton* pick_btn = self->getChild<LLButton>("pick_btn");
	if (pick_btn) pick_btn->setToggleState(FALSE);
}
// static
void LLFloaterReporter::onClickCancel(void *userdata)
{
	LLFloaterReporter *self = (LLFloaterReporter *)userdata;

	// reset flag in case the next report also contains this text
	self->mCopyrightWarningSeen = FALSE;

	if (self->mPicking)
	{
		closePickTool(self);
	}
	self->close();
}
// static
void LLFloaterReporter::showFromMenu(EReportType report_type)
{
	if (COMPLAINT_REPORT != report_type)
	{
		llwarns << "Unknown LLViewerReporter type : " << report_type << llendl;
		return;
	}

	LLFloaterReporter* f = getInstance();
	if (f)
	{
		f->setReportType(report_type);
	}
}
void LLFloaterReporter::setDescription(const std::string& description, LLMeanCollisionData *mcd)
{
	LLFloaterReporter *self = gReporterInstances[COMPLAINT_REPORT];
	if (self)
	{
		self->childSetText("details_edit", description);

		for_each(self->mMCDList.begin(), self->mMCDList.end(), DeletePointer());
		self->mMCDList.clear();
		if (mcd)
		{
			self->mMCDList.push_back(new LLMeanCollisionData(mcd));
		}
	}
}
// static
void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data)
{
	LLFloaterReporter* self = (LLFloaterReporter*) data;

	if (ids.empty() || names.empty()) return;

	// this should never be called in a bug report but here for safety.
	if ( self->mReportType != BUG_REPORT )
	{
		self->childSetText("abuser_name_edit", names[0] );
		
		self->mAbuserID = ids[0];

		self->refresh();
	};
}
// static
void LLFloaterReporter::showFromMenu(EReportType report_type)
{
	if (COMPLAINT_REPORT != report_type)
	{
		LL_WARNS() << "Unknown LLViewerReporter type : " << report_type << LL_ENDL;
		return;
	}

	// Prevent menu from appearing in screen shot.
	LLMenuGL::sMenuContainer->hideMenus();
	LLFloaterReporter* f = getInstance();
	if (f)
	{
		f->setReportType(report_type);
	}
}
// static
void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_name)
{
	LLFloaterReporter* f = getInstance();

	if (avatar_name.empty())
	{
		// Request info for this object
		f->getObjectInfo(object_id);
	}
	else
	{
		f->setFromAvatarID(object_id);
	}

	// Need to deselect on close
	f->mDeselectOnClose = TRUE;

	f->open();		/* Flawfinder: ignore */
}
// static
void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_name)
{
	LLFloaterReporter* f = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter");

	if (avatar_name.empty())
	{
		// Request info for this object
		f->getObjectInfo(object_id);
	}
	else
	{
		f->setFromAvatarID(object_id);
	}

	// Need to deselect on close
	f->mDeselectOnClose = TRUE;

	f->openFloater();
}
// static
void LLFloaterReporter::showFromMenu(EReportType report_type)
{
	if (gReporterInstances.checkData(report_type))
	{
		// ...bring that window to front
		LLFloaterReporter *f = gReporterInstances.getData(report_type);
		f->open();		/* Flawfinder: ignore */
	}
	else
	{
		LLFloaterReporter *f;
		if (BUG_REPORT == report_type)
		{
			f = LLFloaterReporter::createNewBugReporter();
		}
		else if (COMPLAINT_REPORT == report_type)
		{
			f = LLFloaterReporter::createNewAbuseReporter();
		}
		else
		{
			llwarns << "Unknown LLViewerReporter type : " << report_type << llendl;
			return;
		}

		f->center();

		if (report_type == BUG_REPORT)
		{
 			LLNotifications::instance().add("HelpReportBug");
		}
		else
		{
			// popup for abuse reports is triggered elsewhere
		}

		// grab the user's name
		std::string fullname;
		gAgent.buildFullname(fullname);
		f->childSetText("reporter_field", fullname);
	}
}
Example #11
0
// static
void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
	LLUploadDialog::modalUploadFinished();

	LLResourceData* data = (LLResourceData*)user_data;

	if(result < 0)
	{
		LLStringUtil::format_map_t args;
		std::string reason = std::string(LLAssetStorage::getErrorString(result));
		args["[REASON]"] = reason;
		gViewerWindow->alertXml("ErrorUploadingReportScreenshot", args);

		std::string err_msg("There was a problem uploading a report screenshot");
		err_msg += " due to the following reason: " + reason;
		llwarns << err_msg << llendl;
		return;
	}

	EReportType report_type = UNKNOWN_REPORT;
	if (data->mPreferredLocation == -1)
	{
		report_type = BUG_REPORT;
	}
	else if (data->mPreferredLocation == -2)
	{
		report_type = COMPLAINT_REPORT;
	}
	else 
	{
		llwarns << "Unknown report type : " << data->mPreferredLocation << llendl;
	}

	LLFloaterReporter *self = getReporter(report_type);
	if (self)
	{
		self->mScreenID = uuid;
		llinfos << "Got screen shot " << uuid << llendl;
		self->sendReportViaLegacy(self->gatherReport());
		self->close();
	}
}
// static
void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_name)
{
	LLFloaterReporter* f = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter");

	// grab the user's name
	std::string fullname;
	LLAgentUI::buildFullname(fullname);
	f->getChild<LLUICtrl>("reporter_field")->setValue(fullname);

	if (avatar_name.empty())
		// Request info for this object
		f->getObjectInfo(object_id);
	else
		f->setFromAvatar(object_id, avatar_name);

	// Need to deselect on close
	f->mDeselectOnClose = TRUE;

	f->openFloater();
}
Example #13
0
// static
//void LLFloaterReporter::showFromObject(const LLUUID& object_id)
LLFloaterReporter* LLFloaterReporter::showFromObject(const LLUUID& object_id, bool show)
{
	LLFloaterReporter* f = createNewAbuseReporter();
	f->center();
	f->setFocus(TRUE);

	// grab the user's name
	std::string fullname;
	gAgent.buildFullname(fullname);
	f->childSetText("reporter_field", fullname);

	// Request info for this object
	f->getObjectInfo(object_id);

	// Need to deselect on close
	f->mDeselectOnClose = TRUE;

	//f->open();		/* Flawfinder: ignore */
	if ( show )
	{
		f->open();		/* Flawfinder: ignore */
	}
	else
	{
		gDialogVisible = FALSE;
	}

	return f;
}
// static
void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
	LLUploadDialog::modalUploadFinished();

	LLResourceData* data = (LLResourceData*)user_data;

	if(result < 0)
	{
		LLSD args;
		args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
		LLNotificationsUtil::add("ErrorUploadingReportScreenshot", args);

		std::string err_msg("There was a problem uploading a report screenshot");
		err_msg += " due to the following reason: " + args["REASON"].asString();
		llwarns << err_msg << llendl;
		return;
	}

	EReportType report_type = UNKNOWN_REPORT;
	if (data->mPreferredLocation == LLResourceData::INVALID_LOCATION)
	{
		report_type = COMPLAINT_REPORT;
	}
	else 
	{
		llwarns << "Unknown report type : " << data->mPreferredLocation << llendl;
	}

	LLFloaterReporter *self = getInstance();
	if (self)
	{
		self->mScreenID = uuid;
		llinfos << "Got screen shot " << uuid << llendl;
		self->sendReportViaLegacy(self->gatherReport());
		self->close();
	}
}
Example #15
0
// static
void LLFloaterReporter::onClickSend(void *userdata)
{
	LLFloaterReporter *self = (LLFloaterReporter *)userdata;
	
	if (self->mPicking)
	{
		closePickTool(self);
	}

	if(self->validateReport())
	{
		// only show copyright alert for abuse reports
		if ( self->mReportType != BUG_REPORT )
		{
			if ( ! self->mCopyrightWarningSeen )
			{
				std::string details_lc = self->childGetText("details_edit");
				LLStringUtil::toLower( details_lc );
				std::string summary_lc = self->childGetText("summary_edit");
				LLStringUtil::toLower( summary_lc );
				if ( details_lc.find( "copyright" ) != std::string::npos ||
					summary_lc.find( "copyright" ) != std::string::npos )
				{
					gViewerWindow->alertXml("HelpReportAbuseContainsCopyright");
					self->mCopyrightWarningSeen = TRUE;
					return;
				};
			};
		};

		LLUploadDialog::modalUploadDialog("Uploading...\n\nReport");
		// *TODO don't upload image if checkbox isn't checked
		std::string url = gAgent.getRegion()->getCapability("SendUserReport");
		std::string sshot_url = gAgent.getRegion()->getCapability("SendUserReportWithScreenshot");
		if(!url.empty() || !sshot_url.empty())
		{
			self->sendReportViaCaps(url, sshot_url, self->gatherReport());
			self->close();
		}
		else
		{
			if(self->childGetValue("screen_check"))
			{
				self->childDisable("send_btn");
				self->childDisable("cancel_btn");
				// the callback from uploading the image calls sendReportViaLegacy()
				self->uploadImage();
			}
			else
			{
				self->sendReportViaLegacy(self->gatherReport());
				LLUploadDialog::modalUploadFinished();
				self->close();
			}
		}
	}
}
Example #16
0
// static
void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data)
{
	LLUUID id;

	U32 request_flags;
	LLUUID creator_id;
	LLUUID owner_id;
	LLUUID group_id;
	LLUUID extra_id;
	U32 base_mask, owner_mask, group_mask, everyone_mask, next_owner_mask;
	LLSaleInfo sale_info;
	LLCategory category;
	
	msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_RequestFlags,	request_flags );
	msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID,		id );
	msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID,		owner_id );
	msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID,		group_id );
	msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_BaseMask,		base_mask );
	msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_OwnerMask,		owner_mask );
	msg->getU32Fast(_PREHASH_ObjectData,_PREHASH_GroupMask,		group_mask );
	msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_EveryoneMask,	everyone_mask );
	msg->getU32Fast(_PREHASH_ObjectData, _PREHASH_NextOwnerMask, next_owner_mask);
	sale_info.unpackMessage(msg, _PREHASH_ObjectData);
	category.unpackMessage(msg, _PREHASH_ObjectData);

	LLUUID last_owner_id;
	msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id );

	// unpack name & desc
	std::string name;
	msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, name);

	std::string desc;
	msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc);

	// the reporter widget askes the server for info about picked objects
	if (request_flags & (COMPLAINT_REPORT_REQUEST | BUG_REPORT_REQUEST))
	{
		EReportType report_type = (COMPLAINT_REPORT_REQUEST & request_flags) ? COMPLAINT_REPORT : BUG_REPORT;
		LLFloaterReporter *reporterp = LLFloaterReporter::getReporter(report_type);
		if (reporterp)
		{
			std::string fullname;
			gCacheName->getFullName(owner_id, fullname);
			reporterp->setPickedObjectProperties(name, fullname, owner_id);
		}
	}
	else if (request_flags & OBJECT_PAY_REQUEST)
	{
		// check if the owner of the paid object is muted
		LLMuteList::getInstance()->autoRemove(owner_id, LLMuteList::AR_MONEY);
	}

	// Now look through all of the hovered nodes
	struct f : public LLSelectedNodeFunctor
	{
		LLUUID mID;
		f(const LLUUID& id) : mID(id) {}
		virtual bool apply(LLSelectNode* node)
		{
			return (node->getObject() && node->getObject()->mID == mID);
		}
	} func(id);
	LLSelectNode* node = LLSelectMgr::getInstance()->getHoverObjects()->getFirstNode(&func);

	if (node)
	{
		node->mValid = TRUE;
		node->mPermissions->init(LLUUID::null, owner_id,
								 last_owner_id, group_id);
		node->mPermissions->initMasks(base_mask, owner_mask, everyone_mask, group_mask, next_owner_mask);
		node->mSaleInfo = sale_info;
		node->mCategory = category;
		node->mName.assign(name);
		node->mDescription.assign(desc);
	}

	dialog_refresh_all();
}
// static
void LLFloaterReporter::onClickSend(void *userdata)
{
	LLFloaterReporter *self = (LLFloaterReporter *)userdata;
	
	if (self->mPicking)
	{
		closePickTool(self);
	}

	if(self->validateReport())
	{
		const int IP_CONTENT_REMOVAL = 66;
		const int IP_PERMISSONS_EXPLOIT = 37;
		LLComboBox* combo = self->getChild<LLComboBox>( "category_combo");
		int category_value = combo->getSelectedValue().asInteger();

		if ( ! self->mCopyrightWarningSeen )
		{
			std::string details_lc = self->getChild<LLUICtrl>("details_edit")->getValue().asString();
			LLStringUtil::toLower( details_lc );
			std::string summary_lc = self->getChild<LLUICtrl>("summary_edit")->getValue().asString();
			LLStringUtil::toLower( summary_lc );
			if ( details_lc.find( "copyright" ) != std::string::npos ||
				summary_lc.find( "copyright" ) != std::string::npos  ||
				category_value == IP_CONTENT_REMOVAL ||
				category_value == IP_PERMISSONS_EXPLOIT)
			{
				LLNotificationsUtil::add("HelpReportAbuseContainsCopyright");
				self->mCopyrightWarningSeen = TRUE;
				return;
			}
		}
		else if (category_value == IP_CONTENT_REMOVAL)
		{
			// IP_CONTENT_REMOVAL *always* shows the dialog -
			// ergo you can never send that abuse report type.
			LLNotificationsUtil::add("HelpReportAbuseContainsCopyright");
			return;
		}

		LLUploadDialog::modalUploadDialog(LLTrans::getString("uploading_abuse_report"));
		// *TODO don't upload image if checkbox isn't checked
		std::string url = gAgent.getRegion()->getCapability("SendUserReport");
		std::string sshot_url = gAgent.getRegion()->getCapability("SendUserReportWithScreenshot");
		if(!url.empty() || !sshot_url.empty())
		{
			self->sendReportViaCaps(url, sshot_url, self->gatherReport());
			self->close();
		}
		else
		{
			if(self->getChild<LLUICtrl>("screen_check")->getValue())
			{
				self->getChildView("send_btn")->setEnabled(FALSE);
				self->getChildView("cancel_btn")->setEnabled(FALSE);
				// the callback from uploading the image calls sendReportViaLegacy()
				self->uploadImage();
			}
			else
			{
				self->sendReportViaLegacy(self->gatherReport());
				LLUploadDialog::modalUploadFinished();
				self->close();
			}
		}
	}
}