Merge viewer-neko

master
Ansariel 2017-10-11 22:32:13 +02:00
commit 4e997f9eef
15 changed files with 257 additions and 69 deletions

View File

@ -40,6 +40,10 @@
#include "stringize.h"
#include "llexception.h"
#if LL_WINDOWS
#include <excpt.h>
#endif
namespace {
void no_op() {}
} // anonymous namespace
@ -272,6 +276,43 @@ void LLCoros::setStackSize(S32 stacksize)
mStackSize = stacksize;
}
#if LL_WINDOWS
static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop)
{
if (code == STATUS_MSC_EXCEPTION)
{
// C++ exception, go on
return EXCEPTION_CONTINUE_SEARCH;
}
else
{
// handle it
return EXCEPTION_EXECUTE_HANDLER;
}
}
void LLCoros::winlevel(const callable_t& callable)
{
__try
{
callable();
}
__except (exception_filter(GetExceptionCode(), GetExceptionInformation()))
{
// convert to C++ styled exception
// Note: it might be better to use _se_set_translator
// if you want exception to inherit full callstack
char integer_string[32];
sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode());
throw std::exception(integer_string);
}
}
#endif
// Top-level wrapper around caller's coroutine callable. This function accepts
// the coroutine library's implicit coro::self& parameter and saves it, but
// does not pass it down to the caller's callable.
@ -282,7 +323,11 @@ void LLCoros::toplevel(coro::self& self, CoroData* data, const callable_t& calla
// run the code the caller actually wants in the coroutine
try
{
#if LL_WINDOWS
winlevel(callable);
#else
callable();
#endif
}
catch (const LLContinueError&)
{

View File

@ -182,6 +182,9 @@ private:
bool cleanup(const LLSD&);
struct CoroData;
static void no_cleanup(CoroData*);
#if LL_WINDOWS
static void winlevel(const callable_t& callable);
#endif
static void toplevel(coro::self& self, CoroData* data, const callable_t& callable);
static CoroData& get_CoroData(const std::string& caller);

View File

@ -47,7 +47,9 @@
#include "llfloatercamera.h"
#include "llfloaterimcontainer.h"
#include "llfloaterperms.h"
#include "llfloaterpreference.h"
#include "llfloaterreg.h"
#include "llfloatersnapshot.h"
#include "llfloatertools.h"
#include "llgroupactions.h"
#include "llgroupmgr.h"
@ -5190,15 +5192,148 @@ void LLAgent::sendAgentDataUpdateRequest()
void LLAgent::sendAgentUserInfoRequest()
{
if(getID().isNull())
return; // not logged in
gMessageSystem->newMessageFast(_PREHASH_UserInfoRequest);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, getSessionID());
sendReliableMessage();
std::string cap;
if (getID().isNull())
return; // not logged in
if (mRegionp)
cap = mRegionp->getCapability("UserInfo");
if (!cap.empty())
{
LLCoros::instance().launch("requestAgentUserInfoCoro",
boost::bind(&LLAgent::requestAgentUserInfoCoro, this, cap));
}
else
{
sendAgentUserInfoRequestMessage();
}
}
void LLAgent::requestAgentUserInfoCoro(std::string capurl)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestAgentUserInfoCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
LLCore::HttpHeaders::ptr_t httpHeaders;
httpOpts->setFollowRedirects(true);
LLSD result = httpAdapter->getAndSuspend(httpRequest, capurl, httpOpts, httpHeaders);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
LL_WARNS("UserInfo") << "Failed to get user information." << LL_ENDL;
return;
}
else if (!result["success"].asBoolean())
{
LL_WARNS("UserInfo") << "Failed to get user information: " << result["message"] << LL_ENDL;
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.
// <FS:Ansariel> Show email address in preferences (FIRE-1071)
//LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, is_verified_email);
LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, is_verified_email, email);
// </FS:Ansariel>
LLFloaterSnapshot::setAgentEmail(email);
}
void LLAgent::sendAgentUpdateUserInfo(bool im_via_email, const std::string& directory_visibility)
{
std::string cap;
if (getID().isNull())
return; // not logged in
if (mRegionp)
cap = mRegionp->getCapability("UserInfo");
if (!cap.empty())
{
LLCoros::instance().launch("updateAgentUserInfoCoro",
boost::bind(&LLAgent::updateAgentUserInfoCoro, this, cap, im_via_email, directory_visibility));
}
else
{
sendAgentUpdateUserInfoMessage(im_via_email, directory_visibility);
}
}
void LLAgent::updateAgentUserInfoCoro(std::string capurl, bool im_via_email, std::string directory_visibility)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestAgentUserInfoCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
LLCore::HttpHeaders::ptr_t httpHeaders;
httpOpts->setFollowRedirects(true);
LLSD body(LLSDMap
("dir_visibility", LLSD::String(directory_visibility))
("im_via_email", LLSD::Boolean(im_via_email)));
LLSD result = httpAdapter->postAndSuspend(httpRequest, capurl, body, httpOpts, httpHeaders);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
LL_WARNS("UserInfo") << "Failed to set user information." << LL_ENDL;
}
else if (!result["success"].asBoolean())
{
LL_WARNS("UserInfo") << "Failed to set user information: " << result["message"] << LL_ENDL;
}
}
// deprecated:
// May be removed when UserInfo cap propagates to all simhosts in grid
void LLAgent::sendAgentUserInfoRequestMessage()
{
gMessageSystem->newMessageFast(_PREHASH_UserInfoRequest);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, getSessionID());
sendReliableMessage();
}
void LLAgent::sendAgentUpdateUserInfoMessage(bool im_via_email, 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();
}
// end deprecated
//------
void LLAgent::observeFriends()
{
if(!mFriendObserver)
@ -5266,18 +5401,6 @@ const void LLAgent::getTeleportSourceSLURL(LLSLURL& slurl) const
slurl = *mTeleportSourceSLURL;
}
void LLAgent::sendAgentUpdateUserInfo(bool im_via_email, 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();
}
// static
void LLAgent::dumpGroupInfo()
{

View File

@ -1023,13 +1023,21 @@ public:
void sendReliableMessage();
void sendAgentDataUpdateRequest();
void sendAgentUserInfoRequest();
// IM to Email and Online visibility
// IM to Email and Online visibility
void sendAgentUpdateUserInfo(bool im_to_email, const std::string& directory_visibility);
// <FS:Ansariel> [Legacy Bake]
void dumpSentAppearance(const std::string& dump_prefix);
void sendAgentSetAppearance();
// </FS:Ansariel> [Legacy Bake]
private:
void requestAgentUserInfoCoro(std::string capurl);
void updateAgentUserInfoCoro(std::string capurl, bool im_via_email, 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);
//--------------------------------------------------------------------
// Receive
//--------------------------------------------------------------------

View File

@ -769,8 +769,6 @@ LLAppViewer::LLAppViewer()
mSavePerAccountSettings(false), // don't save settings on logout unless login succeeded.
mQuitRequested(false),
mLogoutRequestSent(false),
// <FS:Ansariel> MaxFPS Viewer-Chui merge error
//mYieldTime(-1),
mLastAgentControlFlags(0),
mLastAgentForceUpdate(0),
mMainloopTimeout(NULL),
@ -1720,20 +1718,12 @@ bool LLAppViewer::frame()
LL_RECORD_BLOCK_TIME(FTM_SLEEP);
// yield some time to the os based on command line option
// <FS:Ansariel> MaxFPS Viewer-Chui merge error
//if(mYieldTime >= 0)
//{
// LLFastTimer t(FTM_YIELD);
// ms_sleep(mYieldTime);
//}
//S32 yield_time = gSavedSettings.getS32("YieldTime");
static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime");
static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1);
if(yield_time >= 0)
{
LL_RECORD_BLOCK_TIME(FTM_YIELD);
ms_sleep(yield_time);
}
// </FS:Ansariel> MaxFPS Viewer-Chui merge error
// yield cooperatively when not running as foreground window
if ( (gViewerWindow && !gViewerWindow->getWindow()->getVisible())
@ -3263,8 +3253,6 @@ bool LLAppViewer::initConfiguration()
}
}
// <FS:Ansariel> MaxFPS Viewer-Chui merge error
//mYieldTime = gSavedSettings.getS32("YieldTime");
// Display splash screen. Must be after above check for previous
// crash as this dialog is always frontmost.

View File

@ -310,8 +310,6 @@ private:
bool mQuitRequested; // User wants to quit, may have modified documents open.
bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim.
// <FS:Ansariel> MaxFPS Viewer-Chui merge error
//S32 mYieldTime;
U32 mLastAgentControlFlags;
F32 mLastAgentForceUpdate;
struct SettingsFiles* mSettingsLocationList;

View File

@ -206,8 +206,6 @@ LLConversationLog::LLConversationLog() :
keep_log_ctrlp->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2));
if (log_mode > 0)
{
loadFromFile(getFileName());
enableLogging(log_mode);
}
}
@ -501,16 +499,15 @@ bool LLConversationLog::saveToFile(const std::string& filename)
// examples of two file entries
// [1343221177] 0 1 0 John Doe| 7e4ec5be-783f-49f5-71dz-16c58c64c145 4ec62a74-c246-0d25-2af6-846beac2aa55 john.doe|
// [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a|
fprintf(fp, "[%lld] %d %d %d %s| %s %s %s|\n",
(S64)conv_it->getTime().value(),
(S32)conv_it->getConversationType(),
(S32)0,
(S32)conv_it->hasOfflineMessages(),
conv_it->getConversationName().c_str(),
conv_it->getConversationName().c_str(),
participant_id.c_str(),
conversation_id.c_str(),
conv_it->getHistoryFileName().c_str());
LLURI::escape(conv_it->getHistoryFileName()).c_str());
}
fclose(fp);
return true;
@ -537,6 +534,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL;
return false;
}
bool purge_required = false;
char buffer[MAX_STRING];
char conv_name_buffer[MAX_STRING];
@ -572,7 +570,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
.conversation_name(conv_name_buffer)
.participant_id(LLUUID(part_id_buffer))
.session_id(LLUUID(conv_id_buffer))
.history_filename(history_file_name);
.history_filename(LLURI::unescape(history_file_name));
LLConversation conversation(params);
@ -583,6 +581,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
U32 CONVERSATION_LIFETIME = gSavedSettings.getU32("FSConversationLogLifetime");
if (conversation.isOlderThan( U32Days(CONVERSATION_LIFETIME) ) )
{
purge_required = true;
continue;
}
@ -590,8 +589,11 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
}
fclose(fp);
LLFile::remove(filename);
cache();
if(purge_required)
{
LLFile::remove(filename);
cache();
}
notifyObservers();
return true;

View File

@ -1560,15 +1560,15 @@ void LLFloaterPreference::onBtnCancel(const LLSD& userdata)
// static
// <FS:Ansariel> Show email address in preferences (FIRE-1071)
//void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email)
void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email)
//void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email)
void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email, const std::string& email)
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
// <FS:Ansariel> Show email address in preferences (FIRE-1071)
//instance->setPersonalInfo(visibility, im_via_email);
instance->setPersonalInfo(visibility, im_via_email, email);
//instance->setPersonalInfo(visibility, im_via_email, is_verified_email);
instance->setPersonalInfo(visibility, im_via_email, is_verified_email, email);
}
}
@ -2969,8 +2969,8 @@ bool LLFloaterPreference::moveTranscriptsAndLog()
}
// <FS:Ansariel> Show email address in preferences (FIRE-1071)
//void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email)
void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email)
//void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email)
void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email, const std::string& email)
// </FS:Ansariel> Show email address in preferences (FIRE-1071)
{
mGotPersonalInfo = true;
@ -2996,8 +2996,16 @@ 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(TRUE);
getChild<LLUICtrl>("send_im_to_email")->setValue(im_via_email);
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); // <FS:Ansariel> Does not exist as of 12-09-2014
getChildView("chat_font_size")->setEnabled(TRUE);

View File

@ -87,8 +87,8 @@ public:
// static data update, called from message handler
// <FS:Ansariel> Show email address in preferences (FIRE-1071)
//static void updateUserInfo(const std::string& visibility, bool im_via_email);
static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email);
//static void updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email);
static void updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email, const std::string& email);
// refresh all the graphics preferences menus
static void refreshEnabledGraphics();
@ -211,8 +211,8 @@ public:
void onClickResetLogPath();
void enableHistory();
// <FS:Ansariel> Show email address in preferences (FIRE-1071)
//void setPersonalInfo(const std::string& visibility, bool im_via_email);
void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email);
//void setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email);
void setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_email, const std::string& email);
// </FS:Ansariel> Show email address in preferences (FIRE-1071)
void refreshEnabledState();
// <FS:Ansariel> Improved graphics preferences

View File

@ -1911,24 +1911,27 @@ S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, Entry& entry)
S32 LLTextureCache::setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize)
{
mHeaderMutex.lock();
S32 idx = openAndReadEntry(id, entry, true);
S32 idx = openAndReadEntry(id, entry, true); // read or create
mHeaderMutex.unlock();
if(idx < 0) // retry once
{
readHeaderCache(); // We couldn't write an entry, so refresh the LRU
mHeaderMutex.lock();
idx = openAndReadEntry(id, entry, true);
mHeaderMutex.unlock();
}
if (idx >= 0)
{
updateEntry(idx, entry, imagesize, datasize);
}
if(idx < 0) // retry
else
{
readHeaderCache(); // We couldn't write an entry, so refresh the LRU
mHeaderMutex.lock();
llassert_always(!mLRU.empty() || mHeaderEntriesInfo.mEntries < sCacheMaxEntries);
mHeaderMutex.unlock();
idx = setHeaderCacheEntry(id, entry, imagesize, datasize); // assert above ensures no inf. recursion
LL_WARNS() << "Failed to set cache entry for image: " << id << LL_ENDL;
}
return idx;
}

View File

@ -501,6 +501,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gAgent.setTeleportMessage(
LLAgent::sTeleportProgressMessages["requesting"]);
gViewerWindow->setProgressString(LLAgent::sTeleportProgressMessages["requesting"]);
gViewerWindow->setProgressMessage(gAgent.mMOTD);
break;
case LLAgent::TELEPORT_REQUESTED:
@ -582,6 +583,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
}
gViewerWindow->setProgressPercent( percent_done );
gViewerWindow->setProgressMessage(std::string());
}
else
if (gRestoreGL)
@ -603,6 +605,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gViewerWindow->setProgressPercent( percent_done );
}
gViewerWindow->setProgressMessage(std::string());
}
// <FS::Ansariel> Draw Distance stepping; originally based on SpeedRez by Henri Beauchamp, licensed under LGPL

View File

@ -9322,7 +9322,7 @@ void send_places_query(const LLUUID& query_id,
gAgent.sendReliableMessage();
}
// Deprecated in favor of cap "UserInfo"
void process_user_info_reply(LLMessageSystem* msg, void**)
{
LLUUID agent_id;
@ -9340,9 +9340,10 @@ void process_user_info_reply(LLMessageSystem* msg, void**)
std::string dir_visibility;
msg->getString( "UserData", "DirectoryVisibility", dir_visibility);
// For Message based user info information the is_verified is assumed to be false.
// <FS:Ansariel> Show email address in preferences (FIRE-1071)
//LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email);
LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, email);
//LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, false);
LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, !LLGridManager::instance().isInSecondLife(), email); // Assume verified in OpenSim
// </FS:Ansariel> Show email address in preferences (FIRE-1071)
LLFloaterSnapshot::setAgentEmail(email);
}

View File

@ -3095,6 +3095,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("UpdateScriptAgent");
capabilityNames.append("UpdateScriptTask");
capabilityNames.append("UploadBakedTexture");
capabilityNames.append("UserInfo");
capabilityNames.append("ViewerAsset");
capabilityNames.append("ViewerMetrics");
capabilityNames.append("ViewerStartAuction");

View File

@ -7819,7 +7819,7 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse
record["elapsed"] = elapsed;
record["completed"] = completed;
U32 grid_x(0), grid_y(0);
if (getRegion())
if (getRegion() && LLWorld::instance().isRegionListed(getRegion()))
{
record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion());
grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y);

View File

@ -11,6 +11,11 @@
single_instance="true"
title="Preferences"
width="662">
<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>
<floater.string name="LoginToChange">
Login to change