void KVFloaterFlickrUpload::confirmToken(bool success, const LLSD &response) { if(!success) { LLNotificationsUtil::add("KittyFlickrHTTPFail"); closeFloater(false); return; } if(response["stat"].asString() == "ok") { // Just in case the username changed. This can happen. std::string username = response["auth"]["user"]["username"]; gSavedPerAccountSettings.setString("KittyFlickrUsername", username); childSetValue("account_name", username); childSetEnabled("upload_btn", true); } else { // Uh oh. if(response["code"].asInteger() == 98) // Invalid auth token { // Mark the account as invalid childSetValue("account_name", getString("no_account")); // Need to authenticate. gSavedPerAccountSettings.setString("KittyFlickrToken", ""); gSavedPerAccountSettings.setString("KittyFlickrUsername", ""); gSavedPerAccountSettings.setString("KittyFlickrNSID", ""); KVFloaterFlickrAuth *floater = KVFloaterFlickrAuth::showFloater(boost::bind(&KVFloaterFlickrUpload::authCallback, this, _1)); // Link it to us to protect it from freeze frame mode, if need be. if(floater && getDependee()) // (if we're depending on something, so should it) { gFloaterView->removeChild(floater); gSnapshotFloaterView->addChild(floater); // Even though we don't really want this to depend on the snapshot view // being open, if we manipulate it after closing the snapshot view, // it will crash. getDependee()->addDependentFloater(floater, false); } LLNotificationsUtil::add("KittyFlickrTokenRejected"); } else { LLSD args; args["CODE"] = response["code"]; args["ERROR"] = response["message"]; LLNotificationsUtil::add("KittyFlickrGenericFail", args); } } }
void LLFloaterFeed::onClickPost() { if (mPNGImage.notNull()) { static LLCachedControl<bool> add_location("SnapshotFeedAddLocation"); const std::string caption = childGetValue("caption").asString(); LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::saveFeedDone, _1, mPNGImage)); LLWebProfile::uploadImage(mPNGImage, caption, add_location); // give user feedback of the event gViewerWindow->playSnapshotAnimAndSound(); // don't destroy the window until the upload is done // this way we keep the information in the form setVisible(FALSE); // remove any dependency on snapshot floater // so we outlive it during the upload. LLFloater* dependee = getDependee(); if (dependee) { dependee->removeDependentFloater(this); } } else { LLNotificationsUtil::add("ErrorProcessingSnapshot"); } }
void LLFloaterPostcard::sendPostcard() { mTransactionID.generate(); mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); LLVFile::writeFile(mJPEGImage->getData(), mJPEGImage->getDataSize(), gVFS, mAssetID, LLAssetType::AT_IMAGE_JPEG); // upload the image std::string url = gAgent.getRegion()->getCapability("SendPostcard"); if(!url.empty()) { llinfos << "Send Postcard via capability" << llendl; LLSD body = LLSD::emptyMap(); // the capability already encodes: agent ID, region ID body["pos-global"] = mPosTakenGlobal.getValue(); body["to"] = getChild<LLUICtrl>("to_form")->getValue().asString(); body["from"] = getChild<LLUICtrl>("from_form")->getValue().asString(); body["name"] = getChild<LLUICtrl>("name_form")->getValue().asString(); body["subject"] = getChild<LLUICtrl>("subject_form")->getValue().asString(); body["msg"] = getChild<LLUICtrl>("msg_form")->getValue().asString(); LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG)); } else { gAssetStorage->storeAssetData(mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)this, FALSE); } // give user feedback of the event gViewerWindow->playSnapshotAnimAndSound(); LLUploadDialog::modalUploadDialog(getString("upload_message")); // don't destroy the window until the upload is done // this way we keep the information in the form setVisible(FALSE); // also remove any dependency on another floater // so that we can be sure to outlive it while we // need to. LLFloater* dependee = getDependee(); if (dependee) dependee->removeDependentFloater(this); }