summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-09-09 15:06:33 -0700
committerMerov Linden <merov@lindenlab.com>2012-09-09 15:06:33 -0700
commit4869e0c269deafa44874a0110cc1f06bdc310407 (patch)
tree3e8930e92ebb7d8eb7997c89d198d30eaafe6c2e
parent6df8c2b42066efad4d46a601ecaabbc9bf1dcd91 (diff)
parent42dbf23dc56e0ab6842dd14b5701ffdb359f8bb6 (diff)
Pull merge richard/viewer-chui
-rw-r--r--indra/newview/llconversationlog.cpp22
-rw-r--r--indra/newview/llconversationlog.h2
-rw-r--r--indra/newview/llimconversation.cpp42
-rw-r--r--indra/newview/llimconversation.h14
-rw-r--r--indra/newview/llimfloater.cpp39
-rw-r--r--indra/newview/llimfloater.h9
-rw-r--r--indra/newview/llimfloatercontainer.cpp24
-rw-r--r--indra/newview/llimfloatercontainer.h2
-rw-r--r--indra/newview/llnearbychat.cpp23
-rw-r--r--indra/newview/llnearbychat.h7
10 files changed, 102 insertions, 82 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index e80a709203..cc02e18698 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -30,6 +30,8 @@
#include "llconversationlog.h"
#include "lltrans.h"
+const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec
+
struct Conversation_params
{
Conversation_params(time_t time)
@@ -139,6 +141,14 @@ const std::string LLConversation::createTimestamp(const time_t& utc_time)
return timeStr;
}
+bool LLConversation::isOlderThan(U32 days) const
+{
+ time_t now = time_corrected();
+ U32 age = (U32)((now - mTime) / SEC_PER_DAY); // age of conversation in days
+
+ return age > days;
+}
+
void LLConversation::setListenIMFloaterOpened()
{
LLIMFloater* floater = LLIMFloater::findInstance(mSessionID);
@@ -394,10 +404,22 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
params.mHistoryFileName = std::string(history_file_name);
LLConversation conversation(params);
+
+ // CHUI-325
+ // The conversation log should be capped to the last 30 days. Conversations with the last utterance
+ // being over 30 days old should be purged from the conversation log text file on login.
+ if (conversation.isOlderThan(CONVERSATION_LIFETIME))
+ {
+ continue;
+ }
+
mConversations.push_back(conversation);
}
fclose(fp);
+ LLFile::remove(filename);
+ cache();
+
notifyObservers();
return true;
}
diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h
index 0d7f0080e5..16be37d67a 100644
--- a/indra/newview/llconversationlog.h
+++ b/indra/newview/llconversationlog.h
@@ -64,6 +64,8 @@ public:
void setIsPast (bool is_past) { mIsConversationPast = is_past; }
void setConverstionName(std::string conv_name) { mConversationName = conv_name; }
+ bool isOlderThan(U32 days) const;
+
/*
* Resets flag of unread offline message to false when im floater with this conversation is opened.
*/
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index 5a5196fb7e..d8c81a7849 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -31,6 +31,8 @@
#include "llchatentry.h"
#include "llchathistory.h"
+#include "llchiclet.h"
+#include "llchicletbar.h"
#include "lldraghandle.h"
#include "llfloaterreg.h"
#include "llimfloater.h"
@@ -53,6 +55,8 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id)
, mInputEditorTopPad(0)
, mRefreshTimer(new LLTimer())
{
+ mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
+
mCommitCallbackRegistrar.add("IMSession.Menu.Action",
boost::bind(&LLIMConversation::onIMSessionMenuItemClicked, this, _2));
mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem",
@@ -182,6 +186,44 @@ void LLIMConversation::draw()
}
}
+void LLIMConversation::enableDisableCallBtn()
+{
+ getChildView("voice_call_btn")->setEnabled(
+ mSessionID.notNull()
+ && mSession
+ && mSession->mSessionInitialized
+ && LLVoiceClient::getInstance()->voiceEnabled()
+ && LLVoiceClient::getInstance()->isVoiceWorking()
+ && mSession->mCallBackEnabled);
+}
+
+
+void LLIMConversation::onFocusReceived()
+{
+ setBackgroundOpaque(true);
+
+ if (mSessionID.notNull())
+ {
+ LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true);
+
+ if (getVisible())
+ {
+ // suppress corresponding toast only if this floater is visible and have focus
+ LLIMModel::getInstance()->setActiveSessionID(mSessionID);
+ LLIMModel::instance().sendNoUnreadMessages(mSessionID);
+ }
+ }
+
+ LLTransientDockableFloater::onFocusReceived();
+}
+
+void LLIMConversation::onFocusLost()
+{
+ setBackgroundOpaque(false);
+ LLTransientDockableFloater::onFocusLost();
+}
+
+
void LLIMConversation::buildParticipantList()
{
if (mIsNearbyChat)
diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h
index 26151ad1be..50feb12aed 100644
--- a/indra/newview/llimconversation.h
+++ b/indra/newview/llimconversation.h
@@ -33,6 +33,7 @@
#include "lltransientdockablefloater.h"
#include "llviewercontrol.h"
#include "lleventtimer.h"
+#include "llimview.h"
#include "llconversationmodel.h"
class LLPanelChatControlPanel;
@@ -87,9 +88,6 @@ protected:
// refresh a visual state of the Call button
void updateCallBtnState(bool callIsActive);
- // set the enable/disable state for the Call button
- virtual void enableDisableCallBtn() = 0;
-
void buildParticipantList();
void onSortMenuItemClicked(const LLSD& userdata);
@@ -99,9 +97,18 @@ protected:
/// Update floater header and toolbar buttons when hosted/torn off state is toggled.
void updateHeaderAndToolbar();
+ // set the enable/disable state for the Call button
+ virtual void enableDisableCallBtn();
+
+ // process focus events to set a currently active session
+ /* virtual */ void onFocusLost();
+ /* virtual */ void onFocusReceived();
+
bool mIsNearbyChat;
bool mIsP2PChat;
+ LLIMModel::LLIMSession* mSession;
+
LLLayoutPanel* mParticipantListPanel;
LLParticipantList* mParticipantList;
LLUUID mSessionID;
@@ -119,7 +126,6 @@ private:
/// Refreshes the floater at a constant rate.
virtual void refresh() = 0;
-
/**
* Adjusts chat history height to fit vertically with input chat field
* and avoid overlapping, since input chat field can be vertically expanded.
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index a601561c62..7b475c1e0b 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -92,24 +92,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
setDocked(true);
}
-void LLIMFloater::onFocusLost()
-{
- LLIMModel::getInstance()->resetActiveSessionID();
-
- LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false);
-}
-
-void LLIMFloater::onFocusReceived()
-{
- LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true);
-
- if (getVisible())
- {
- // suppress corresponding toast only if this floater is visible and have focus
- LLIMModel::getInstance()->setActiveSessionID(mSessionID);
- LLIMModel::instance().sendNoUnreadMessages(mSessionID);
- }
-}
// virtual
void LLIMFloater::refresh()
@@ -513,27 +495,6 @@ void LLIMFloater::boundVoiceChannel()
}
}
-void LLIMFloater::enableDisableCallBtn()
-{
- bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled()
- && LLVoiceClient::getInstance()->isVoiceWorking();
-
- if (mSession)
- {
- bool session_initialized = mSession->mSessionInitialized;
- bool callback_enabled = mSession->mCallBackEnabled;
-
- BOOL enable_connect =
- session_initialized && voice_enabled && callback_enabled;
- getChildView("voice_call_btn")->setEnabled(enable_connect);
- }
- else
- {
- getChildView("voice_call_btn")->setEnabled(false);
- }
-}
-
-
void LLIMFloater::onCallButtonClicked()
{
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 24a8f17feb..7b2c9e7aef 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -134,10 +134,6 @@ public:
private:
- // process focus events to set a currently active session
- /* virtual */ void onFocusLost();
- /* virtual */ void onFocusReceived();
-
/*virtual*/ void refresh();
/*virtual*/ void onClickCloseBtn();
@@ -169,9 +165,6 @@ private:
void onCallButtonClicked();
- // set the enable/disable state for the Call button
- virtual void enableDisableCallBtn();
-
void boundVoiceChannel();
// Add the "User is typing..." indicator.
@@ -184,8 +177,6 @@ private:
static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response);
-
- LLIMModel::LLIMSession* mSession;
S32 mLastMessageIndex;
EInstantMessage mDialog;
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 978b91b598..faca92e662 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -53,7 +53,8 @@
LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed)
: LLMultiFloater(seed),
mExpandCollapseBtn(NULL),
- mConversationsRoot(NULL)
+ mConversationsRoot(NULL),
+ mInitialized(false)
{
mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2));
@@ -142,6 +143,17 @@ BOOL LLIMFloaterContainer::postBuild()
LLAvatarNameCache::addUseDisplayNamesCallback(
boost::bind(&LLIMConversation::processChatHistoryStyleUpdate));
+ if (! mMessagesPane->isCollapsed())
+ {
+ S32 list_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth");
+ LLRect list_size = mConversationsPane->getRect();
+ S32 left_pad = mConversationsListPanel->getRect().mLeft;
+ list_size.mRight = list_size.mLeft + list_width - left_pad;
+
+ mConversationsPane->handleReshape(list_size, TRUE);
+ }
+ mInitialized = true;
+
// Add callback: we'll take care of view updates on idle
gIdleCallbacks.addFunction(idle, this);
@@ -527,6 +539,16 @@ void LLIMFloaterContainer::onCustomAction(const LLSD& userdata)
void LLIMFloaterContainer::repositioningWidgets()
{
+ if (!mInitialized)
+ {
+ return;
+ }
+
+ if (!mConversationsPane->isCollapsed())
+ {
+ S32 list_width = (mConversationsPane->getRect()).getWidth();
+ gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", list_width);
+ }
LLRect panel_rect = mConversationsListPanel->getRect();
S32 item_height = 16;
int index = 0;
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index c4dd386d7c..324adfcc11 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -112,6 +112,8 @@ private:
LLLayoutPanel* mConversationsPane;
LLLayoutStack* mConversationsStack;
+ bool mInitialized;
+
// Conversation list implementation
public:
void removeConversationListItem(const LLUUID& uuid, bool change_focus = true);
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 25bbc82fee..c2ad8cfda3 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -133,6 +133,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd)
setIsChrome(TRUE);
mKey = LLSD();
mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
+ mSessionID = LLUUID();
setName("nearby_chat");
setIsSingleInstance(TRUE);
}
@@ -216,21 +217,6 @@ bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata)
return false;
}
-////////////////////////////////////////////////////////////////////////////////
-//
-void LLNearbyChat::onFocusReceived()
-{
- setBackgroundOpaque(true);
- LLIMConversation::onFocusReceived();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-//
-void LLNearbyChat::onFocusLost()
-{
- setBackgroundOpaque(false);
- LLIMConversation::onFocusLost();
-}
BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask)
{
@@ -326,13 +312,6 @@ void LLNearbyChat::setVisible(BOOL visible)
}
-void LLNearbyChat::enableDisableCallBtn()
-{
- // bool btn_enabled = LLAgent::isActionAllowed("speak");
-
- getChildView("voice_call_btn")->setEnabled(false /*btn_enabled*/);
-}
-
void LLNearbyChat::onTearOffClicked()
{
LLIMConversation::onTearOffClicked();
diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h
index 4fc5cb7f76..1db7afc01f 100644
--- a/indra/newview/llnearbychat.h
+++ b/indra/newview/llnearbychat.h
@@ -51,10 +51,6 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
- // focus overrides
- /*virtual*/ void onFocusLost();
- /*virtual*/ void onFocusReceived();
-
/*virtual*/ void setVisible(BOOL visible);
void loadHistory();
@@ -102,9 +98,6 @@ protected:
void displaySpeakingIndicator();
- // set the enable/disable state for the Call button
- virtual void enableDisableCallBtn();
-
// Which non-zero channel did we last chat on?
static S32 sLastSpecialChatChannel;