master
Ansariel 2022-05-10 17:27:06 +02:00
commit c6443ee2bf
10 changed files with 90 additions and 77 deletions

View File

@ -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)

View File

@ -558,63 +558,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 (gAgent.isInitialized() && (gAgent.getID() != LLUUID::null) && (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()
@ -1524,7 +1520,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;
}
// <FS:Ansariel> [FS Login Panel]
@ -2933,13 +2929,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;
}
@ -2959,7 +2955,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;
}
@ -4217,7 +4213,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;
@ -4244,7 +4240,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;
@ -4350,7 +4346,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");
@ -4390,7 +4386,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

View File

@ -111,9 +111,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);
@ -315,7 +314,7 @@ private:
bool mOriginalHideOnlineStatus;
std::string mDirectoryVisibility;
LLAvatarData mAvatarProperties;
bool mAllowPublish; // Allow showing agent in search
std::string mSavedGraphicsPreset;
LOG_CLASS(LLFloaterPreference);

View File

@ -260,6 +260,10 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
{
panel_notes->processProperties(&avatar_notes);
}
if (panel_sl)
{
panel_sl->processNotesProperties(&avatar_notes);
}
}
//TODO: changes take two minutes to propagate!
@ -837,6 +841,7 @@ BOOL LLPanelProfileSecondLife::postBuild()
mSecondLifePic = getChild<LLIconCtrl>("2nd_life_pic");
mSecondLifePicLayout = getChild<LLPanel>("image_stack");
mDescriptionEdit = getChild<LLTextEditor>("sl_description_edit");
mNotesSnippet = getChild<LLTextEditor>("notes_snippet");
mAgentActionMenuButton = getChild<LLMenuButton>("agent_actions_menu");
mSaveDescriptionChanges = getChild<LLButton>("save_description_changes");
mDiscardDescriptionChanges = getChild<LLButton>("discard_description_changes");
@ -994,6 +999,11 @@ void LLPanelProfileSecondLife::processGroupProperties(const LLAvatarGroups* avat
mGroupList->setGroups(mGroups);
}
void LLPanelProfileSecondLife::processNotesProperties(LLAvatarNotes* avatar_notes)
{
mNotesSnippet->setValue(avatar_notes->notes);
}
void LLPanelProfileSecondLife::openGroupProfile()
{
LLUUID group_id = mGroupList->getSelectedUUID();
@ -1645,14 +1655,15 @@ void LLPanelProfileSecondLife::onSetDescriptionDirty()
void LLPanelProfileSecondLife::onShowInSearchCallback()
{
if (mAllowPublish == mShowInSearchCombo->getValue().asBoolean())
S32 value = mShowInSearchCombo->getValue().asInteger();
if (mAllowPublish == (bool)value)
{
return;
}
std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP);
if (!cap_url.empty())
{
mAllowPublish = mShowInSearchCombo->getValue().asBoolean();
mAllowPublish = value;
LLSD data;
data["allow_publish"] = mAllowPublish;
LLCoros::instance().launch("putAgentUserInfoCoro",

View File

@ -116,6 +116,11 @@ protected:
*/
void processGroupProperties(const LLAvatarGroups* avatar_groups);
/**
* Processes notes related data received from server.
*/
void processNotesProperties(LLAvatarNotes* avatar_notes);
/**
* Fills common for Avatar profile and My Profile fields.
*/
@ -184,6 +189,7 @@ private:
LLIconCtrl* mSecondLifePic;
LLPanel* mSecondLifePicLayout;
LLTextEditor* mDescriptionEdit;
LLTextEditor* mNotesSnippet;
LLMenuButton* mAgentActionMenuButton;
LLButton* mSaveDescriptionChanges;
LLButton* mDiscardDescriptionChanges;

View File

@ -212,7 +212,7 @@ LLPanelProfileClassifieds::~LLPanelProfileClassifieds()
void LLPanelProfileClassifieds::onOpen(const LLSD& key)
{
LLPanelProfileTab::onOpen(key);
LLPanelProfilePropertiesProcessorTab::onOpen(key);
resetData();
@ -626,7 +626,7 @@ void LLPanelProfileClassified::onOpen(const LLSD& key)
if(is_new)
{
LLPanelProfileTab::setAvatarId(gAgent.getID());
LLPanelProfilePropertiesProcessorTab::setAvatarId(gAgent.getID());
setPosGlobal(gAgent.getPositionGlobal());
@ -668,7 +668,7 @@ void LLPanelProfileClassified::onOpen(const LLSD& key)
{
return;
}
LLPanelProfileTab::setAvatarId(avatar_id);
LLPanelProfilePropertiesProcessorTab::setAvatarId(avatar_id);
setClassifiedId(key["classified_id"]);
setClassifiedName(key["classified_name"]);

View File

@ -140,7 +140,7 @@ LLPanelProfilePicks::~LLPanelProfilePicks()
void LLPanelProfilePicks::onOpen(const LLSD& key)
{
LLPanelProfileTab::onOpen(key);
LLPanelProfilePropertiesProcessorTab::onOpen(key);
resetData();
@ -438,7 +438,7 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id)
{
return;
}
LLPanelProfileTab::setAvatarId(avatar_id);
LLPanelProfilePropertiesProcessorTab::setAvatarId(avatar_id);
// creating new Pick
if (getPickId().isNull() && getSelfProfile())

View File

@ -18,8 +18,8 @@
name="pick_snapshot"
top="10"
left="10"
height="180"
width="290"
height="161"
width="260"
follows="left|top"
layout="topleft"
fallback_image="default_land_picture.j2c"
@ -41,7 +41,7 @@
enabled="false"
top_pad="8"
left="10"
height="70"
height="102"
width="290"
follows="all"
layout="topleft"
@ -68,10 +68,10 @@
<button
name="teleport_btn"
label="Teleport"
bottom="-40"
bottom="-27"
left="10"
height="20"
width="80"
width="100"
follows="left|bottom"
layout="topleft"
/>
@ -79,7 +79,7 @@
name="show_on_map_btn"
label="Show on Map"
bottom_delta="0"
left_pad="5"
left_pad="7"
height="20"
width="100"
follows="left|bottom"
@ -89,8 +89,8 @@
name="set_to_curr_location_btn"
label="Set Location"
tool_tip="Set to Current Location"
bottom_delta="0"
left_pad="5"
bottom="-3"
left="10"
height="20"
width="100"
follows="left|bottom"
@ -100,8 +100,8 @@
<button
name="save_changes_btn"
label="Save Pick"
bottom="-15"
left="10"
bottom_delta="0"
left_pad="7"
height="20"
width="100"
follows="left|bottom"

View File

@ -66,6 +66,7 @@
bottom="-5"
left="4"
right="-4"
tab_width="150"
follows="all"
layout="topleft"
halign="left"

View File

@ -414,7 +414,7 @@ Account: [ACCTTYPE]
border_visible="true"
font="SansSerifSmall"
h_pad="2"
max_length="65000"
max_length="1000"
parse_urls="true"
word_wrap="true"/>
</layout_panel>