diff --git a/indra/newview/fsfloaterprimfeed.cpp b/indra/newview/fsfloaterprimfeed.cpp index 0dbae3e256..a6fc205f7a 100644 --- a/indra/newview/fsfloaterprimfeed.cpp +++ b/indra/newview/fsfloaterprimfeed.cpp @@ -540,6 +540,8 @@ void FSPrimfeedPhotoPanel::onOpen(const LLSD& key) { // Reauthorise if necessary. FSPrimfeedAuth::initiateAuthRequest(); + LLSD dummy; + onPrimfeedConnectStateChange(dummy); } } @@ -662,15 +664,14 @@ bool FSPrimfeedAccountPanel::postBuild() void FSPrimfeedAccountPanel::draw() { FSPrimfeedConnect::EConnectionState connection_state = FSPrimfeedConnect::instance().getConnectionState(); + static FSPrimfeedConnect::EConnectionState last_state = FSPrimfeedConnect::PRIMFEED_DISCONNECTED; - // Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress - bool disconnecting = connection_state == FSPrimfeedConnect::PRIMFEED_DISCONNECTING; - mDisconnectButton->setEnabled(!disconnecting); - - // Disable the 'connect' button when a connection is in progress - bool connecting = - (connection_state == FSPrimfeedConnect::PRIMFEED_CONNECTING || connection_state == FSPrimfeedConnect::PRIMFEED_CONNECTED); - mConnectButton->setEnabled(!connecting); + // Update the connection state if it has changed + if (connection_state != last_state) + { + onPrimfeedConnectStateChange(LLSD()); + last_state = connection_state; + } LLPanel::draw(); } @@ -703,7 +704,7 @@ void FSPrimfeedAccountPanel::onVisibilityChange(bool visible) bool FSPrimfeedAccountPanel::onPrimfeedConnectStateChange(const LLSD&) { - if (FSPrimfeedAuth::isAuthorized()) + if (FSPrimfeedAuth::isAuthorized() || FSPrimfeedConnect::instance().getConnectionState() == FSPrimfeedConnect::PRIMFEED_CONNECTING) { showConnectedLayout(); } @@ -770,11 +771,15 @@ void FSPrimfeedAccountPanel::showConnectedLayout() void FSPrimfeedAccountPanel::onConnect() { FSPrimfeedAuth::initiateAuthRequest(); + LLSD dummy; + onPrimfeedConnectStateChange(dummy); } void FSPrimfeedAccountPanel::onDisconnect() { FSPrimfeedAuth::resetAuthStatus(); + LLSD dummy; + onPrimfeedConnectStateChange(dummy); } //////////////////////// diff --git a/indra/newview/fsprimfeedauth.cpp b/indra/newview/fsprimfeedauth.cpp index 37dbc0fe59..c264c3b8dc 100644 --- a/indra/newview/fsprimfeedauth.cpp +++ b/indra/newview/fsprimfeedauth.cpp @@ -131,6 +131,7 @@ void FSPrimfeedAuth::initiateAuthRequest() sPrimfeedAuth.reset(); } ); + FSPrimfeedConnect::instance().setConnectionState(FSPrimfeedConnect::PRIMFEED_CONNECTING); } else { @@ -149,20 +150,16 @@ void FSPrimfeedAuth::resetAuthStatus() event_data["status"] = "reset"; event_data["success"] = "false"; sPrimfeedAuthPump->post(event_data); + FSPrimfeedConnect::instance().setConnectionState(FSPrimfeedConnect::PRIMFEED_DISCONNECTED); } FSPrimfeedAuth::FSPrimfeedAuth(authorized_callback_t callback) - : mCallback(callback), mAuthenticating(false) + : mCallback(callback) { - mInstantMessageConnection = LLIMModel::instance().addNewMsgCallback( - [this](const LLSD &message) { - LL_DEBUGS("FSPrimfeedAuth") << "Received chat message: " << message["message"].asString() << LL_ENDL; - this->onChatMessage(message); - }); mChatMessageConnection = LLNotificationsUI::LLNotificationManager::instance().getChatHandler()->addNewChatCallback( [this](const LLSD &message) { - LL_DEBUGS("FSPrimfeedAuth") << "Received instant message: " << message["message"].asString() << LL_ENDL; + LL_DEBUGS("FSPrimfeedAuth") << "Received chat message: " << message["message"].asString() << LL_ENDL; this->onChatMessage(message); }); } @@ -184,21 +181,6 @@ FSPrimfeedAuth::~FSPrimfeedAuth() LL_WARNS("FSPrimfeedAuth") << "Unknown exception during chat connection disconnect." << LL_ENDL; } } - if (mInstantMessageConnection.connected()) - { - try - { - mInstantMessageConnection.disconnect(); - } - catch (const std::exception& e) - { - LL_WARNS("FSPrimfeedAuth") << "Exception during instant message disconnect: " << e.what() << LL_ENDL; - } - catch (...) - { - LL_WARNS("FSPrimfeedAuth") << "Unknown exception during instant message disconnect." << LL_ENDL; - } - } } // Factory method to create a shared pointer to FSPrimfeedAuth. @@ -216,7 +198,7 @@ std::shared_ptr FSPrimfeedAuth::create(authorized_callback_t cal return nullptr; } - auth->mAuthenticating = true; + FSPrimfeedConnect::instance().setConnectionState(FSPrimfeedConnect::PRIMFEED_CONNECTING); // If no token stored, begin the login request; otherwise check user status. if (gSavedPerAccountSettings.getString("FSPrimfeedOAuthToken").empty()) @@ -453,7 +435,6 @@ void FSPrimfeedAuth::gotUserStatus(bool success, const LLSD &response) if (success && response.has("plan")) { gSavedPerAccountSettings.setString("FSPrimfeedOAuthToken", mOauthToken); - gSavedPerAccountSettings.setString("FSPrimfeedRequestId", mRequestId); gSavedPerAccountSettings.setString("FSPrimfeedPlan", response["plan"].asString()); gSavedPerAccountSettings.setString("FSPrimfeedProfileLink", response["link"].asString()); gSavedPerAccountSettings.setString("FSPrimfeedUsername", response["username"].asString()); diff --git a/indra/newview/fsprimfeedauth.h b/indra/newview/fsprimfeedauth.h index a3e07ca6eb..43fc36a937 100644 --- a/indra/newview/fsprimfeedauth.h +++ b/indra/newview/fsprimfeedauth.h @@ -69,7 +69,6 @@ private: explicit FSPrimfeedAuth(authorized_callback_t callback); authorized_callback_t mCallback; - bool mAuthenticating; std::string mOauthToken; std::string mRequestId; diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 4dc711fbe6..7c81fda4ec 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -670,7 +670,14 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, } } - + // Hide Primfeed OAuth message from chat to prevent accidental leak of secret. + const std::string primfeed_oauth = "#PRIMFEED_OAUTH: "; + if( chat_msg.mText.compare(0, primfeed_oauth.length(), primfeed_oauth) == 0 && chat_msg.mChatType == CHAT_TYPE_IM && chat_msg.mSourceType == CHAT_SOURCE_OBJECT ) + { + // Don't show the message in chat. + return; + } + // nearby_chat->addMessage(chat_msg, true, args); if (chat_msg.mSourceType == CHAT_SOURCE_AGENT diff --git a/indra/newview/skins/default/xui/en/panel_primfeed_photo.xml b/indra/newview/skins/default/xui/en/panel_primfeed_photo.xml index adce659736..061b206e0d 100644 --- a/indra/newview/skins/default/xui/en/panel_primfeed_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_primfeed_photo.xml @@ -214,7 +214,7 @@ left="10" length="1" top_pad="0" - max_length="700" + max_length="5000" name="photo_description" spellcheck="true" type="string"