コード例 #1
0
ファイル: llfloaterpostcard.cpp プロジェクト: Boy/netbook
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();
		}
	}
}
コード例 #2
0
// static
void LLFloaterPostcard::onClickSend(void* data)
{
	if (data)
	{
		LLFloaterPostcard *self = (LLFloaterPostcard *)data;

		std::string from(self->getChild<LLUICtrl>("from_form")->getValue().asString());
		std::string to(self->getChild<LLUICtrl>("to_form")->getValue().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))
		{
			LLNotificationsUtil::add("PromptRecipientEmail");
			return;
		}

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

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

		if (self->mJPEGImage.notNull())
		{
			self->sendPostcard();
		}
		else
		{
			LLNotificationsUtil::add("ErrorProcessingSnapshot");
		}
	}
}
コード例 #3
0
ファイル: llfloaterpostcard.cpp プロジェクト: Boy/netbook
// 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");
		}
	}
}