Exemple #1
0
void LLFloaterPostcard::missingSubjMsgAlertCallback(S32 option, void* data)
{
	if(data)
	{
		LLFloaterPostcard* self = static_cast<LLFloaterPostcard*>(data);
		if(0 == option)
		{
			// User clicked OK
			if((self->childGetValue("subject_form").asString()).empty())
			{
				// Stuff the subject back into the form.
				self->childSetValue("subject_form", self->childGetText("default_subject"));
			}

			if(!self->mHasFirstMsgFocus)
			{
				// The user never switched focus to the messagee window. 
				// Using the default string.
				self->childSetValue("msg_form", self->childGetText("default_message"));
			}

			self->sendPostcard();
		}
	}
}
// static
void LLFloaterPostcard::onClickSend(void* data)
{
	if (data)
	{
		LLFloaterPostcard *self = (LLFloaterPostcard *)data;

		std::string from(self->childGetValue("from_form").asString());
		std::string to(self->childGetValue("to_form").asString());
		
		boost::regex emailFormat("[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}(,[ \t]*[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})*");
		
		if (to.empty() || !boost::regex_match(to, emailFormat))
		{
			LLNotifications::instance().add("PromptRecipientEmail");
			return;
		}

		if (from.empty() || !boost::regex_match(from, emailFormat))
		{
			LLNotifications::instance().add("PromptSelfEmail");
			return;
		}

		std::string subject(self->childGetValue("subject_form").asString());
		if(subject.empty() || !self->mHasFirstMsgFocus)
		{
			LLNotifications::instance().add("PromptMissingSubjMsg", LLSD(), LLSD(), boost::bind(&LLFloaterPostcard::missingSubjMsgAlertCallback, self, _1, _2));
			return;
		}

		if (self->mJPEGImage.notNull())
		{
			self->sendPostcard();
		}
		else
		{
			LLNotifications::instance().add("ErrorProcessingSnapshot");
		}
	}
}
Exemple #3
0
// static
void LLFloaterPostcard::onClickSend(void* data)
{
	if (data)
	{
		LLFloaterPostcard *self = (LLFloaterPostcard *)data;

		LLString from(self->childGetValue("from_form").asString().c_str());
		LLString to(self->childGetValue("to_form").asString().c_str());

		if (to.empty() || to.find('@') == std::string::npos)
		{
			gViewerWindow->alertXml("PromptRecipientEmail");
			return;
		}

		if (from.empty() || from.find('@') == std::string::npos)
		{
			gViewerWindow->alertXml("PromptSelfEmail");
			return;
		}

		LLString subject(self->childGetValue("subject_form").asString().c_str());
		if(subject.empty() || !self->mHasFirstMsgFocus)
		{
			gViewerWindow->alertXml("PromptMissingSubjMsg", missingSubjMsgAlertCallback, self);
			return;
		}

		if (self->mJPEGImage.notNull())
		{
			self->sendPostcard();
		}
		else
		{
			gViewerWindow->alertXml("ErrorProcessingSnapshot");
		}
	}
}
// static
void LLFloaterPostcard::updateUserInfo(const std::string& email)
{
	for (instance_list_t::iterator iter = sInstances.begin();
		 iter != sInstances.end(); ++iter)
	{
		LLFloaterPostcard *instance = *iter;
		const std::string& text = instance->childGetValue("from_form").asString();
		if (text.empty())
		{
			// there's no text in this field yet, pre-populate
			instance->childSetValue("from_form", LLSD(email));
		}
	}
}
// static
void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
	LLFloaterPostcard *self = (LLFloaterPostcard *)user_data;
	
	LLUploadDialog::modalUploadFinished();
	
	if (result)
	{
		LLSD args;
		args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
		LLNotifications::instance().add("ErrorUploadingPostcard", args);
	}
	else
	{
		// only create the postcard once the upload succeeds

		// request the postcard
		LLMessageSystem* msg = gMessageSystem;
		msg->newMessage("SendPostcard");
		msg->nextBlock("AgentData");
		msg->addUUID("AgentID", gAgent.getID());
		msg->addUUID("SessionID", gAgent.getSessionID());
		msg->addUUID("AssetID", self->mAssetID);
		msg->addVector3d("PosGlobal", self->mPosTakenGlobal);
		msg->addString("To", self->childGetValue("to_form").asString());
		msg->addString("From", self->childGetValue("from_form").asString());
		msg->addString("Name", self->childGetValue("name_form").asString());
		msg->addString("Subject", self->childGetValue("subject_form").asString());
		msg->addString("Msg", self->childGetValue("msg_form").asString());
		msg->addBOOL("AllowPublish", FALSE);
		msg->addBOOL("MaturePublish", FALSE);
		gAgent.sendReliableMessage();
	}

	self->close();
}
Exemple #6
0
// static
void LLFloaterPostcard::updateUserInfo(const char *email)
{
	LLFloaterPostcard *instance;

	sInstances.resetList();
	while ((instance = sInstances.getNextData()))
	{
		const LLString& text = instance->childGetValue("from_form").asString();
		if (text.empty())
		{
			// there's no text in this field yet, pre-populate
			instance->childSetValue("from_form", LLSD(email));
		}
	}
}