// 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)) { LLNotificationsUtil::add("PromptRecipientEmail"); return; } if (from.empty() || !boost::regex_match(from, emailFormat)) { LLNotificationsUtil::add("PromptSelfEmail"); return; } std::string subject(self->childGetValue("subject_form").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"); } } }
// 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::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)); LLNotificationsUtil::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->getChild<LLUICtrl>("to_form")->getValue().asString()); msg->addString("From", self->getChild<LLUICtrl>("from_form")->getValue().asString()); msg->addString("Name", self->getChild<LLUICtrl>("name_form")->getValue().asString()); msg->addString("Subject", self->getChild<LLUICtrl>("subject_form")->getValue().asString()); msg->addString("Msg", self->getChild<LLUICtrl>("msg_form")->getValue().asString()); msg->addBOOL("AllowPublish", FALSE); msg->addBOOL("MaturePublish", FALSE); gAgent.sendReliableMessage(); } self->closeFloater(); }
// 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) { LLStringBase<char>::format_map_t args; args["[REASON]"] = std::string(LLAssetStorage::getErrorString(result)); gViewerWindow->alertXml("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", self->childGetValue("allow_publish_check").asBoolean()); msg->addBOOL("MaturePublish", self->childGetValue("mature_check").asBoolean()); gAgent.sendReliableMessage(); } self->close(); }