SL-16937 Replace sendAvatarPropertiesUpdate with profile cap in preferences
To avoid data loss, old api trims profile descriptionsmaster
parent
3f3b0e3b54
commit
39ab2fb3fe
|
|
@ -236,7 +236,7 @@ void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const LLAvatarData*
|
|||
return;
|
||||
}
|
||||
|
||||
LL_INFOS() << "Sending avatarinfo update" << LL_ENDL;
|
||||
LL_WARNS() << "Sending avatarinfo update. This trims profile descriptions!!!" << LL_ENDL;
|
||||
|
||||
// This value is required by sendAvatarPropertiesUpdate method.
|
||||
//A profile should never be mature. (From the original code)
|
||||
|
|
|
|||
|
|
@ -333,63 +333,59 @@ void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType t
|
|||
const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>( pData );
|
||||
if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null))
|
||||
{
|
||||
storeAvatarProperties( pAvatarData );
|
||||
processProfileProperties( pAvatarData );
|
||||
mAllowPublish = (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH);
|
||||
mAvatarDataInitialized = true;
|
||||
getChild<LLUICtrl>("online_searchresults")->setValue(mAllowPublish);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterPreference::storeAvatarProperties( const LLAvatarData* pAvatarData )
|
||||
{
|
||||
if (LLStartUp::getStartupState() == STATE_STARTED)
|
||||
{
|
||||
mAvatarProperties.avatar_id = pAvatarData->avatar_id;
|
||||
mAvatarProperties.image_id = pAvatarData->image_id;
|
||||
mAvatarProperties.fl_image_id = pAvatarData->fl_image_id;
|
||||
mAvatarProperties.about_text = pAvatarData->about_text;
|
||||
mAvatarProperties.fl_about_text = pAvatarData->fl_about_text;
|
||||
mAvatarProperties.profile_url = pAvatarData->profile_url;
|
||||
mAvatarProperties.flags = pAvatarData->flags;
|
||||
mAvatarProperties.allow_publish = pAvatarData->flags & AVATAR_ALLOW_PUBLISH;
|
||||
|
||||
mAvatarDataInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterPreference::processProfileProperties(const LLAvatarData* pAvatarData )
|
||||
{
|
||||
getChild<LLUICtrl>("online_searchresults")->setValue( (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH) );
|
||||
}
|
||||
|
||||
void LLFloaterPreference::saveAvatarProperties( void )
|
||||
{
|
||||
const BOOL allowPublish = getChild<LLUICtrl>("online_searchresults")->getValue();
|
||||
const bool allowPublish = getChild<LLUICtrl>("online_searchresults")->getValue();
|
||||
|
||||
if (allowPublish)
|
||||
{
|
||||
mAvatarProperties.flags |= AVATAR_ALLOW_PUBLISH;
|
||||
}
|
||||
if ((LLStartUp::getStartupState() == STATE_STARTED)
|
||||
&& mAvatarDataInitialized
|
||||
&& (allowPublish != mAllowPublish))
|
||||
{
|
||||
std::string cap_url = gAgent.getRegionCapability("AgentProfile");
|
||||
if (!cap_url.empty())
|
||||
{
|
||||
mAllowPublish = allowPublish;
|
||||
|
||||
//
|
||||
// NOTE: We really don't want to send the avatar properties unless we absolutely
|
||||
// need to so we can avoid the accidental profile reset bug, so, if we're
|
||||
// logged in, the avatar data has been initialized and we have a state change
|
||||
// for the "allow publish" flag, then set the flag to its new value and send
|
||||
// the properties update.
|
||||
//
|
||||
// NOTE: The only reason we can not remove this update altogether is because of the
|
||||
// "allow publish" flag, the last remaining profile setting in the viewer
|
||||
// that doesn't exist in the web profile.
|
||||
//
|
||||
LLCoros::instance().launch("requestAgentUserInfoCoro",
|
||||
boost::bind(saveAvatarPropertiesCoro, cap_url, allowPublish));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((LLStartUp::getStartupState() == STATE_STARTED) && mAvatarDataInitialized && (allowPublish != mAvatarProperties.allow_publish))
|
||||
{
|
||||
mAvatarProperties.allow_publish = allowPublish;
|
||||
void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bool allow_publish)
|
||||
{
|
||||
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
|
||||
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
|
||||
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("put_avatar_properties_coro", httpPolicy));
|
||||
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
|
||||
LLCore::HttpHeaders::ptr_t httpHeaders;
|
||||
|
||||
// TODO!!!: replace with an AgentProfile cap, once allow_publish works correctly
|
||||
// otherwise this will trim long descritions/reset profile
|
||||
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate( &mAvatarProperties );
|
||||
}
|
||||
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
|
||||
httpOpts->setFollowRedirects(true);
|
||||
|
||||
std::string finalUrl = cap_url + "/" + gAgentID.asString();
|
||||
LLSD data;
|
||||
data["allow_publish"] = allow_publish;
|
||||
|
||||
LLSD result = httpAdapter->putAndSuspend(httpRequest, finalUrl, data, httpOpts, httpHeaders);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
LL_WARNS("Preferences") << "Failed to put agent information " << data << " for id " << gAgentID << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
LL_DEBUGS("Preferences") << "Agent id: " << gAgentID << " Data: " << data << " Result: " << httpResults << LL_ENDL;
|
||||
}
|
||||
|
||||
BOOL LLFloaterPreference::postBuild()
|
||||
|
|
@ -941,7 +937,7 @@ void LLFloaterPreference::onBtnOK(const LLSD& userdata)
|
|||
else
|
||||
{
|
||||
// Show beep, pop up dialog, etc.
|
||||
LL_INFOS() << "Can't close preferences!" << LL_ENDL;
|
||||
LL_INFOS("Preferences") << "Can't close preferences!" << LL_ENDL;
|
||||
}
|
||||
|
||||
LLPanelLogin::updateLocationSelectorsVisibility();
|
||||
|
|
@ -1849,13 +1845,13 @@ bool LLFloaterPreference::loadFromFilename(const std::string& filename, std::map
|
|||
|
||||
if (!LLXMLNode::parseFile(filename, root, NULL))
|
||||
{
|
||||
LL_WARNS() << "Unable to parse file " << filename << LL_ENDL;
|
||||
LL_WARNS("Preferences") << "Unable to parse file " << filename << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!root->hasName("labels"))
|
||||
{
|
||||
LL_WARNS() << filename << " is not a valid definition file" << LL_ENDL;
|
||||
LL_WARNS("Preferences") << filename << " is not a valid definition file" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1875,7 +1871,7 @@ bool LLFloaterPreference::loadFromFilename(const std::string& filename, std::map
|
|||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << filename << " failed to load" << LL_ENDL;
|
||||
LL_WARNS("Preferences") << filename << " failed to load" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2781,7 +2777,7 @@ bool LLPanelPreferenceControls::addControlTableColumns(const std::string &filena
|
|||
LLScrollListCtrl::Contents contents;
|
||||
if (!LLUICtrlFactory::getLayeredXMLNode(filename, xmlNode))
|
||||
{
|
||||
LL_WARNS() << "Failed to load " << filename << LL_ENDL;
|
||||
LL_WARNS("Preferences") << "Failed to load " << filename << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
LLXUIParser parser;
|
||||
|
|
@ -2808,7 +2804,7 @@ bool LLPanelPreferenceControls::addControlTableRows(const std::string &filename)
|
|||
LLScrollListCtrl::Contents contents;
|
||||
if (!LLUICtrlFactory::getLayeredXMLNode(filename, xmlNode))
|
||||
{
|
||||
LL_WARNS() << "Failed to load " << filename << LL_ENDL;
|
||||
LL_WARNS("Preferences") << "Failed to load " << filename << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
LLXUIParser parser;
|
||||
|
|
@ -2914,7 +2910,7 @@ void LLPanelPreferenceControls::populateControlTable()
|
|||
{
|
||||
// Either unknown mode or MODE_SAVED_SETTINGS
|
||||
// It doesn't have UI or actual settings yet
|
||||
LL_WARNS() << "Unimplemented mode" << LL_ENDL;
|
||||
LL_WARNS("Preferences") << "Unimplemented mode" << LL_ENDL;
|
||||
|
||||
// Searchable columns were removed, mark searchables for an update
|
||||
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
|
||||
|
|
@ -2954,7 +2950,7 @@ void LLPanelPreferenceControls::populateControlTable()
|
|||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Unimplemented mode" << LL_ENDL;
|
||||
LL_WARNS("Preferences") << "Unimplemented mode" << LL_ENDL;
|
||||
}
|
||||
|
||||
// explicit update to make sure table is ready for llsearchableui
|
||||
|
|
|
|||
|
|
@ -100,9 +100,8 @@ public:
|
|||
static void updateShowFavoritesCheckbox(bool val);
|
||||
|
||||
void processProperties( void* pData, EAvatarProcessorType type );
|
||||
void processProfileProperties(const LLAvatarData* pAvatarData );
|
||||
void storeAvatarProperties( const LLAvatarData* pAvatarData );
|
||||
void saveAvatarProperties( void );
|
||||
static void saveAvatarPropertiesCoro(const std::string url, bool allow_publish);
|
||||
void selectPrivacyPanel();
|
||||
void selectChatPanel();
|
||||
void getControlNames(std::vector<std::string>& names);
|
||||
|
|
@ -213,7 +212,7 @@ private:
|
|||
bool mOriginalHideOnlineStatus;
|
||||
std::string mDirectoryVisibility;
|
||||
|
||||
LLAvatarData mAvatarProperties;
|
||||
bool mAllowPublish; // Allow showing agent in search
|
||||
std::string mSavedCameraPreset;
|
||||
std::string mSavedGraphicsPreset;
|
||||
LOG_CLASS(LLFloaterPreference);
|
||||
|
|
|
|||
Loading…
Reference in New Issue