summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llfloaterpreference.cpp21
-rw-r--r--indra/newview/llimfloater.cpp85
-rw-r--r--indra/newview/llimfloater.h14
-rw-r--r--indra/newview/llimview.cpp18
-rw-r--r--indra/newview/llimview.h14
-rw-r--r--indra/newview/llnearbychat.cpp104
-rw-r--r--indra/newview/llnearbychat.h8
7 files changed, 140 insertions, 124 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 1c29323594..3ed575086c 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -423,13 +423,13 @@ void LLFloaterPreference::saveAvatarProperties( void )
BOOL LLFloaterPreference::postBuild()
{
- gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2));
+ gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate));
- gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate, _2));
+ gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate));
- gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2));
+ gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate));
- gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate, _2));
+ gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate));
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged));
@@ -457,14 +457,11 @@ BOOL LLFloaterPreference::postBuild()
void LLFloaterPreference::onBusyResponseChanged()
{
// set "BusyResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
- if (LLTrans::getString("BusyModeResponseDefault") != getChild<LLUICtrl>("busy_response")->getValue().asString())
- {
- gSavedPerAccountSettings.setBOOL("BusyResponseChanged", TRUE );
- }
- else
- {
- gSavedPerAccountSettings.setBOOL("BusyResponseChanged", FALSE );
- }
+ bool busy_flag =
+ LLTrans::getString("BusyModeResponseDefault")
+ != getChild<LLUICtrl>("busy_response")->getValue().asString();
+
+ gSavedPerAccountSettings.setBOOL("BusyResponseChanged", busy_flag );
}
LLFloaterPreference::~LLFloaterPreference()
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 051bb39540..c6608337c8 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -44,6 +44,7 @@
#include "lllayoutstack.h"
#include "lllineeditor.h"
#include "lllogchat.h"
+#include "llnearbychat.h"
#include "llpanelimcontrolpanel.h"
#include "llscreenchannel.h"
#include "llsyswellwindow.h"
@@ -63,13 +64,14 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
mSessionID(session_id),
mLastMessageIndex(-1),
mDialog(IM_NOTHING_SPECIAL),
- mChatHistory(NULL),
mInputEditor(NULL),
mExpandCollapseBtn(NULL),
mTearOffBtn(NULL),
mSavedTitle(),
mTypingStart(),
+ mIsP2PChat(false),
mShouldSendTypingState(false),
+ mChatHistory(NULL),
mMeTyping(false),
mOtherTyping(false),
mTypingTimer(),
@@ -77,12 +79,14 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
mPositioned(false),
mSessionInitialized(false)
{
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID);
- if (im_session)
+ mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
+
+ if (mSession)
{
- mSessionInitialized = im_session->mSessionInitialized;
+ mIsP2PChat = mSession->isP2PSessionType();
+ mSessionInitialized = mSession->mSessionInitialized;
- mDialog = im_session->mType;
+ mDialog = mSession->mType;
switch (mDialog)
{
case IM_SESSION_CONFERENCE_START:
@@ -101,8 +105,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this);
}
break;
- case IM_NOTHING_SPECIAL:
- case IM_SESSION_P2P_INVITE:
default:
break;
}
@@ -135,14 +137,13 @@ bool LLIMFloater::onIMShowModesMenuItemCheck(const LLSD& userdata)
return gSavedSettings.getBOOL(userdata.asString());
}
+// enable/disable states for the "show time" and "show names" items of the show-modes menu
bool LLIMFloater::onIMShowModesMenuItemEnable(const LLSD& userdata)
{
std::string item = userdata.asString();
bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory");
bool is_not_names = (item != "IMShowNamesForP2PConv");
- LLIMModel::LLIMSession* im_session = LLIMModel::instance().findIMSession(mSessionID);
- bool is_p2p_chat = im_session && im_session->isP2PSessionType();
- return (plain_text && (is_not_names || is_p2p_chat));
+ return (plain_text && (is_not_names || mIsP2PChat));
}
void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata)
@@ -159,7 +160,8 @@ void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata)
gSavedSettings.setBOOL(item, !prev_value);
}
- reloadMessages();
+ LLIMFloater::processChatHistoryStyleUpdate();
+ LLNearbyChat::processChatHistoryStyleUpdate();
}
void LLIMFloater::onFocusLost()
@@ -353,18 +355,16 @@ BOOL LLIMFloater::postBuild()
mTypingStart = LLTrans::getString("IM_typing_start_string");
// Disable input editor if session cannot accept text
- LLIMModel::LLIMSession* im_session =
- LLIMModel::instance().findIMSession(mSessionID);
- if ( im_session && !im_session->mTextIMPossible )
+ if ( mSession && !mSession->mTextIMPossible )
{
mInputEditor->setEnabled(FALSE);
mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label"));
}
- if (im_session && im_session->isP2PSessionType())
+ if (mIsP2PChat)
{
// look up display name for window title
- LLAvatarNameCache::get(im_session->mOtherParticipantID,
+ LLAvatarNameCache::get(mSession->mOtherParticipantID,
boost::bind(&LLIMFloater::onAvatarNameCache,
this, _1, _2));
}
@@ -424,16 +424,14 @@ void LLIMFloater::enableDisableCallBtn()
bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled()
&& LLVoiceClient::getInstance()->isVoiceWorking();
- LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionID);
-
- if (!session)
+ if (!mSession)
{
getChildView("voice_call_btn")->setEnabled(false);
return;
}
- bool session_initialized = session->mSessionInitialized;
- bool callback_enabled = session->mCallBackEnabled;
+ bool session_initialized = mSession->mSessionInitialized;
+ bool callback_enabled = mSession->mCallBackEnabled;
BOOL enable_connect = session_initialized
&& voice_enabled
@@ -763,12 +761,16 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id)
if (mSessionID != im_session_id)
{
mSessionID = im_session_id;
+
setKey(im_session_id);
if (mControlPanel)
{
mControlPanel->setSessionId(im_session_id);
}
boundVoiceChannel();
+
+ mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
+ mIsP2PChat = mSession && mSession->isP2PSessionType();
}
//*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB)
@@ -785,30 +787,35 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id)
}
}
-void LLIMFloater::updateMessages()
+void LLIMFloater::appendMessage(const LLChat& chat, const LLSD &args)
{
- bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory");
+ LLChat& tmp_chat = const_cast<LLChat&>(chat);
+
+ if (!chat.mMuted)
+ {
+ tmp_chat.mFromName = chat.mFromName;
+ LLSD chat_args;
+ if (args) chat_args = args;
+ chat_args["use_plain_text_chat_history"] =
+ gSavedSettings.getBOOL("PlainTextChatHistory");
+ chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
+ chat_args["show_names_for_p2p_conv"] = !mIsP2PChat
+ || gSavedSettings.getBOOL("IMShowNamesForP2PConv");
+ mChatHistory->appendMessage(chat, chat_args);
+ }
+}
+
+void LLIMFloater::updateMessages()
+{
std::list<LLSD> messages;
// we shouldn't reset unread message counters if IM floater doesn't have focus
- if (hasFocus())
- {
- LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex + 1);
- }
- else
- {
- LLIMModel::instance().getMessagesSilently(mSessionID, messages, mLastMessageIndex + 1);
- }
+ LLIMModel::instance().getMessages(
+ mSessionID, messages, mLastMessageIndex + 1, hasFocus());
if (messages.size())
{
- bool is_p2p_chat = (mDialog == IM_SESSION_P2P_INVITE || mDialog == IM_NOTHING_SPECIAL);
- LLSD chat_args;
- chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history;
- chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
- chat_args["show_names_for_p2p_conv"] = (!is_p2p_chat) || gSavedSettings.getBOOL("IMShowNamesForP2PConv");
-
std::ostringstream message;
std::list<LLSD>::const_reverse_iterator iter = messages.rbegin();
std::list<LLSD>::const_reverse_iterator iter_end = messages.rend();
@@ -858,7 +865,7 @@ void LLIMFloater::updateMessages()
chat.mText = message;
}
- mChatHistory->appendMessage(chat, chat_args);
+ appendMessage(chat);
mLastMessageIndex = msg["index"].asInteger();
// if it is a notification - next message is a notification history log, so skip it
@@ -1014,7 +1021,7 @@ void LLIMFloater::processAgentListUpdates(const LLSD& body)
}
}
-void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue)
+void LLIMFloater::processChatHistoryStyleUpdate()
{
LLFontGL* font = LLViewerChat::getChatFont();
LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 03f52fb316..4cbdaccea5 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -27,12 +27,13 @@
#ifndef LL_IMFLOATER_H
#define LL_IMFLOATER_H
+#include "llimview.h"
#include "llinstantmessage.h"
#include "lllogchat.h"
#include "lltooldraganddrop.h"
-#include "lltransientdockablefloater.h"
#include "llvoicechannel.h"
#include "llvoiceclient.h"
+#include "lltransientdockablefloater.h"
class LLAvatarName;
class LLButton;
@@ -47,7 +48,7 @@ class LLInventoryCategory;
* optionally "docked" to the bottom tray.
*/
class LLIMFloater
- : public LLTransientDockableFloater
+ : public LLTransientDockableFloater
, public LLVoiceClientStatusObserver
{
LOG_CLASS(LLIMFloater);
@@ -109,7 +110,7 @@ public:
void processAgentListUpdates(const LLSD& body);
void processSessionUpdate(const LLSD& session_update);
- static void processChatHistoryStyleUpdate(const LLSD& newvalue);
+ static void processChatHistoryStyleUpdate();
BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop, EDragAndDropType cargo_type,
@@ -153,7 +154,7 @@ private:
BOOL isInviteAllowed() const;
BOOL inviteToSession(const uuid_vec_t& agent_ids);
-
+ void appendMessage(const LLChat& chat, const LLSD &args = 0);
static void onInputEditorFocusReceived( LLFocusableElement* caller,void* userdata );
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
@@ -186,11 +187,13 @@ private:
LLPanelChatControlPanel* mControlPanel;
LLUUID mSessionID;
+ LLIMModel::LLIMSession* mSession;
S32 mLastMessageIndex;
+ LLChatHistory* mChatHistory;
+
EInstantMessage mDialog;
LLUUID mOtherParticipantUUID;
- LLChatHistory* mChatHistory;
LLLineEditor* mInputEditor;
bool mPositioned;
@@ -199,6 +202,7 @@ private:
bool mMeTyping;
bool mOtherTyping;
bool mShouldSendTypingState;
+ bool mIsP2PChat;
LLFrameTimer mTypingTimer;
LLFrameTimer mTypingTimeoutTimer;
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index a7c4618fa4..18d39b7aa4 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -716,6 +716,16 @@ bool LLIMModel::clearSession(const LLUUID& session_id)
return true;
}
+void LLIMModel::getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index, const bool sendNoUnreadMsgs)
+{
+ getMessagesSilently(session_id, messages, start_index);
+
+ if (sendNoUnreadMsgs)
+ {
+ sendNoUnreadMessages(session_id);
+ }
+}
+
void LLIMModel::getMessagesSilently(const LLUUID& session_id, std::list<LLSD>& messages, int start_index)
{
LLIMSession* session = findIMSession(session_id);
@@ -757,13 +767,6 @@ void LLIMModel::sendNoUnreadMessages(const LLUUID& session_id)
mNoUnreadMsgsSignal(arg);
}
-void LLIMModel::getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index)
-{
- getMessagesSilently(session_id, messages, start_index);
-
- sendNoUnreadMessages(session_id);
-}
-
bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) {
LLIMSession* session = findIMSession(session_id);
@@ -2497,6 +2500,7 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess
gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString());
}
// log message to file
+
else
{
std::string session_name;
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 7c2cd03d97..9d19af4b62 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -192,12 +192,6 @@ public:
bool clearSession(const LLUUID& session_id);
/**
- * Populate supplied std::list with messages starting from index specified by start_index without
- * emitting no unread messages signal.
- */
- void getMessagesSilently(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0);
-
- /**
* Sends no unread messages signal.
*/
void sendNoUnreadMessages(const LLUUID& session_id);
@@ -205,7 +199,7 @@ public:
/**
* Populate supplied std::list with messages starting from index specified by start_index
*/
- void getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0);
+ void getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0, const bool sendNoUnreadMsgs = true);
/**
* Add a message to an IM Model - the message is saved in a message store associated with a session specified by session_id
@@ -288,6 +282,12 @@ public:
private:
/**
+ * Populate supplied std::list with messages starting from index specified by start_index without
+ * emitting no unread messages signal.
+ */
+ void getMessagesSilently(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0);
+
+ /**
* Add message to a list of message associated with session specified by session_id
*/
bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text);
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 3a43750408..3c4b0b9aae 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -25,7 +25,6 @@
*/
#include "llviewerprecompiledheaders.h"
-
#include "llnearbychat.h"
#include "llviewercontrol.h"
#include "llviewerwindow.h"
@@ -55,8 +54,42 @@
#include "llfloaterreg.h"
#include "lltrans.h"
-static const S32 RESIZE_BAR_THICKNESS = 3;
+// --- 2 functions in the global namespace :( ---
+bool isWordsName(const std::string& name)
+{
+ // checking to see if it's display name plus username in parentheses
+ S32 open_paren = name.find(" (", 0);
+ S32 close_paren = name.find(')', 0);
+
+ if (open_paren != std::string::npos &&
+ close_paren == name.length()-1)
+ {
+ return true;
+ }
+ else
+ {
+ //checking for a single space
+ S32 pos = name.find(' ', 0);
+ return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos;
+ }
+}
+
+std::string appendTime()
+{
+ time_t utc_time;
+ utc_time = time_corrected();
+ std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
+ +LLTrans::getString("TimeMin")+"]";
+
+ LLSD substitution;
+
+ substitution["datetime"] = (S32) utc_time;
+ LLStringUtil::format (timeStr, substitution);
+ return timeStr;
+}
+
+static const S32 RESIZE_BAR_THICKNESS = 3;
static LLRegisterPanelClassWrapper<LLNearbyChat> t_panel_nearby_chat("panel_nearby_chat");
@@ -90,41 +123,32 @@ BOOL LLNearbyChat::postBuild()
return true;
}
-std::string appendTime()
-{
- time_t utc_time;
- utc_time = time_corrected();
- std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
- +LLTrans::getString("TimeMin")+"]";
-
- LLSD substitution;
-
- substitution["datetime"] = (S32) utc_time;
- LLStringUtil::format (timeStr, substitution);
-
- return timeStr;
-}
-
-void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
+void LLNearbyChat::appendMessage(const LLChat& chat, const LLSD &args)
{
LLChat& tmp_chat = const_cast<LLChat&>(chat);
if(tmp_chat.mTimeStr.empty())
tmp_chat.mTimeStr = appendTime();
- bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory");
-
if (!chat.mMuted)
{
tmp_chat.mFromName = chat.mFromName;
- LLSD chat_args = args;
- chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history;
- chat_args["show_time"] = true;
- chat_args["show_names_for_p2p_conv"] = true;
+ LLSD chat_args;
+ if (args) chat_args = args;
+ chat_args["use_plain_text_chat_history"] =
+ gSavedSettings.getBOOL("PlainTextChatHistory");
+ chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
+ chat_args["show_names_for_p2p_conv"] = false
+ || gSavedSettings.getBOOL("IMShowNamesForP2PConv");
mChatHistory->appendMessage(chat, chat_args);
}
+}
+
+void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
+{
+ appendMessage(chat, args);
if(archive)
{
@@ -133,12 +157,9 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
mMessageArchive.erase(mMessageArchive.begin());
}
- if (args["do_not_log"].asBoolean())
- {
- return;
- }
-
- if (gSavedPerAccountSettings.getBOOL("LogNearbyChat"))
+ // logging
+ if (!args["do_not_log"].asBoolean()
+ && gSavedPerAccountSettings.getBOOL("LogNearbyChat"))
{
std::string from_name = chat.mFromName;
@@ -165,10 +186,10 @@ void LLNearbyChat::onNearbySpeakers()
LLFloaterSidePanelContainer::showPanel("people", "panel_people", param);
}
-
void LLNearbyChat::onNearbyChatContextMenuItemClicked(const LLSD& userdata)
{
}
+
bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata)
{
std::string str = userdata.asString();
@@ -216,7 +237,7 @@ void LLNearbyChat::updateChatHistoryStyle()
}
//static
-void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue)
+void LLNearbyChat::processChatHistoryStyleUpdate()
{
LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar");
LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat");
@@ -224,25 +245,6 @@ void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue)
nearby_chat->updateChatHistoryStyle();
}
-bool isWordsName(const std::string& name)
-{
- // checking to see if it's display name plus username in parentheses
- S32 open_paren = name.find(" (", 0);
- S32 close_paren = name.find(')', 0);
-
- if (open_paren != std::string::npos &&
- close_paren == name.length()-1)
- {
- return true;
- }
- else
- {
- //checking for a single space
- S32 pos = name.find(' ', 0);
- return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos;
- }
-}
-
void LLNearbyChat::loadHistory()
{
LLSD do_not_log;
diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h
index 7c5975cbc5..47f4de1c6d 100644
--- a/indra/newview/llnearbychat.h
+++ b/indra/newview/llnearbychat.h
@@ -34,7 +34,8 @@
class LLResizeBar;
class LLChatHistory;
-class LLNearbyChat: public LLPanel
+class LLNearbyChat
+: public LLPanel
{
public:
LLNearbyChat(const Params& p = LLPanel::getDefaultParams());
@@ -57,7 +58,7 @@ public:
virtual void updateChatHistoryStyle();
- static void processChatHistoryStyleUpdate(const LLSD& newvalue);
+ static void processChatHistoryStyleUpdate();
void loadHistory();
@@ -67,7 +68,8 @@ public:
private:
void getAllowedRect (LLRect& rect);
-
+ // prepare chat's params and out one message to chatHistory
+ void appendMessage(const LLChat& chat, const LLSD &args = 0);
void onNearbySpeakers ();