SL-16119 Viewer should now direct IM 2 Email setting to web

meow-7.2.2
Mnikolenko Productengine 2021-10-01 14:09:12 +03:00 committed by Andrey Kleshchev
parent 850767eb21
commit ef0b48ce5a
7 changed files with 33 additions and 57 deletions

View File

@ -4636,23 +4636,19 @@ void LLAgent::requestAgentUserInfoCoro(std::string capurl)
return;
}
bool im_via_email;
bool is_verified_email;
std::string email;
std::string dir_visibility;
im_via_email = result["im_via_email"].asBoolean();
is_verified_email = result["is_verified"].asBoolean();
email = result["email"].asString();
dir_visibility = result["directory_visibility"].asString();
// TODO: This should probably be changed. I'm not entirely comfortable
// having LLAgent interact directly with the UI in this way.
LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, is_verified_email);
LLFloaterPreference::updateUserInfo(dir_visibility);
LLFloaterSnapshot::setAgentEmail(email);
}
void LLAgent::sendAgentUpdateUserInfo(bool im_via_email, const std::string& directory_visibility)
void LLAgent::sendAgentUpdateUserInfo(const std::string& directory_visibility)
{
std::string cap;
@ -4665,16 +4661,16 @@ void LLAgent::sendAgentUpdateUserInfo(bool im_via_email, const std::string& dire
if (!cap.empty())
{
LLCoros::instance().launch("updateAgentUserInfoCoro",
boost::bind(&LLAgent::updateAgentUserInfoCoro, this, cap, im_via_email, directory_visibility));
boost::bind(&LLAgent::updateAgentUserInfoCoro, this, cap, directory_visibility));
}
else
{
sendAgentUpdateUserInfoMessage(im_via_email, directory_visibility);
sendAgentUpdateUserInfoMessage(directory_visibility);
}
}
void LLAgent::updateAgentUserInfoCoro(std::string capurl, bool im_via_email, std::string directory_visibility)
void LLAgent::updateAgentUserInfoCoro(std::string capurl, std::string directory_visibility)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
@ -4685,8 +4681,8 @@ void LLAgent::updateAgentUserInfoCoro(std::string capurl, bool im_via_email, std
httpOpts->setFollowRedirects(true);
LLSD body(LLSDMap
("dir_visibility", LLSD::String(directory_visibility))
("im_via_email", LLSD::Boolean(im_via_email)));
("dir_visibility", LLSD::String(directory_visibility)));
LLSD result = httpAdapter->postAndSuspend(httpRequest, capurl, body, httpOpts, httpHeaders);
@ -4714,14 +4710,13 @@ void LLAgent::sendAgentUserInfoRequestMessage()
sendReliableMessage();
}
void LLAgent::sendAgentUpdateUserInfoMessage(bool im_via_email, const std::string& directory_visibility)
void LLAgent::sendAgentUpdateUserInfoMessage(const std::string& directory_visibility)
{
gMessageSystem->newMessageFast(_PREHASH_UpdateUserInfo);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_UserData);
gMessageSystem->addBOOLFast(_PREHASH_IMViaEMail, im_via_email);
gMessageSystem->addString("DirectoryVisibility", directory_visibility);
gAgent.sendReliableMessage();

View File

@ -928,14 +928,14 @@ public:
void sendAgentUserInfoRequest();
// IM to Email and Online visibility
void sendAgentUpdateUserInfo(bool im_to_email, const std::string& directory_visibility);
void sendAgentUpdateUserInfo(const std::string& directory_visibility);
private:
void requestAgentUserInfoCoro(std::string capurl);
void updateAgentUserInfoCoro(std::string capurl, bool im_via_email, std::string directory_visibility);
void updateAgentUserInfoCoro(std::string capurl, std::string directory_visibility);
// DEPRECATED: may be removed when User Info cap propagates
void sendAgentUserInfoRequestMessage();
void sendAgentUpdateUserInfoMessage(bool im_via_email, const std::string& directory_visibility);
void sendAgentUpdateUserInfoMessage(const std::string& directory_visibility);
//--------------------------------------------------------------------
// Receive

View File

@ -261,7 +261,6 @@ std::string LLFloaterPreference::sSkin = "";
LLFloaterPreference::LLFloaterPreference(const LLSD& key)
: LLFloater(key),
mGotPersonalInfo(false),
mOriginalIMViaEmail(false),
mLanguageChanged(false),
mAvatarDataInitialized(false),
mSearchDataDirty(true)
@ -557,11 +556,9 @@ void LLFloaterPreference::apply()
if (mGotPersonalInfo)
{
bool new_im_via_email = getChild<LLUICtrl>("send_im_to_email")->getValue().asBoolean();
bool new_hide_online = getChild<LLUICtrl>("online_visibility")->getValue().asBoolean();
if ((new_im_via_email != mOriginalIMViaEmail)
||(new_hide_online != mOriginalHideOnlineStatus))
if (new_hide_online != mOriginalHideOnlineStatus)
{
// This hack is because we are representing several different
// possible strings with a single checkbox. Since most users
@ -575,7 +572,7 @@ void LLFloaterPreference::apply()
//Update showonline value, otherwise multiple applys won't work
mOriginalHideOnlineStatus = new_hide_online;
}
gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility);
gAgent.sendAgentUpdateUserInfo(mDirectoryVisibility);
}
}
@ -980,12 +977,12 @@ void LLFloaterPreference::onBtnCancel(const LLSD& userdata)
}
// static
void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email)
void LLFloaterPreference::updateUserInfo(const std::string& visibility)
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->setPersonalInfo(visibility, im_via_email, is_verified_email);
instance->setPersonalInfo(visibility);
}
}
@ -1694,10 +1691,9 @@ bool LLFloaterPreference::moveTranscriptsAndLog()
return true;
}
void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email)
void LLFloaterPreference::setPersonalInfo(const std::string& visibility)
{
mGotPersonalInfo = true;
mOriginalIMViaEmail = im_via_email;
mDirectoryVisibility = visibility;
if (visibility == VISIBILITY_DEFAULT)
@ -1719,16 +1715,7 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im
getChildView("friends_online_notify_checkbox")->setEnabled(TRUE);
getChild<LLUICtrl>("online_visibility")->setValue(mOriginalHideOnlineStatus);
getChild<LLUICtrl>("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility);
getChildView("send_im_to_email")->setEnabled(is_verified_email);
std::string tooltip;
if (!is_verified_email)
tooltip = getString("email_unverified_tooltip");
getChildView("send_im_to_email")->setToolTip(tooltip);
// *TODO: Show or hide verify email text here based on is_verified_email
getChild<LLUICtrl>("send_im_to_email")->setValue(im_via_email);
getChildView("favorites_on_login_check")->setEnabled(TRUE);
getChildView("log_path_button")->setEnabled(TRUE);
getChildView("chat_font_size")->setEnabled(TRUE);

View File

@ -88,7 +88,7 @@ public:
/*virtual*/ void changed(const LLUUID& session_id, U32 mask) {};
// static data update, called from message handler
static void updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email);
static void updateUserInfo(const std::string& visibility);
// refresh all the graphics preferences menus
static void refreshEnabledGraphics();
@ -160,7 +160,7 @@ public:
void changeLogPath(const std::vector<std::string>& filenames, std::string proposed_name);
bool moveTranscriptsAndLog();
void enableHistory();
void setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email);
void setPersonalInfo(const std::string& visibility);
void refreshEnabledState();
void onCommitWindowedMode();
void refresh(); // Refresh enable/disable
@ -206,7 +206,6 @@ private:
static std::string sSkin;
notifications_map mNotificationOptions;
bool mGotPersonalInfo;
bool mOriginalIMViaEmail;
bool mLanguageChanged;
bool mAvatarDataInitialized;
std::string mPriorInstantMessageLogPath;

View File

@ -6430,15 +6430,12 @@ void process_user_info_reply(LLMessageSystem* msg, void**)
<< "wrong agent id." << LL_ENDL;
}
BOOL im_via_email;
msg->getBOOLFast(_PREHASH_UserData, _PREHASH_IMViaEMail, im_via_email);
std::string email;
msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, email);
std::string dir_visibility;
msg->getString( "UserData", "DirectoryVisibility", dir_visibility);
// For Message based user info information the is_verified is assumed to be false.
LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, false);
LLFloaterPreference::updateUserInfo(dir_visibility);
LLFloaterSnapshot::setAgentEmail(email);
}

View File

@ -11,12 +11,6 @@
single_instance="true"
title="PREFERENCES"
width="658">
<floater.string
name="email_unverified_tooltip">
Please verify your email to enable IM to Email by visiting
https://accounts.secondlife.com/change_email/
</floater.string>
<button
follows="right|bottom"
height="23"

View File

@ -41,16 +41,6 @@
width="330">
</check_box>
<check_box
enabled="false"
height="16"
label="Email me IMs when I'm offline"
layout="topleft"
name="send_im_to_email"
top_pad="6"
width="330">
</check_box>
<check_box
enabled="false"
height="16"
@ -61,6 +51,20 @@
width="350">
</check_box>
<text
font="SansSerifSmall"
height="16"
layout="topleft"
length="1"
name="email_settings"
skip_link_underline="true"
top_pad="6"
left_delta="2"
type="string"
width="350">
[https://accounts.secondlife.com/change_email Open email notification settings]
</text>
<text
layout="topleft"
left="345"