summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2009-11-24 23:21:57 -0600
committerDave Parks <davep@lindenlab.com>2009-11-24 23:21:57 -0600
commite264f00c833805e1f813bc1d0b2cfd7a1bf7b272 (patch)
tree1a64a520502d2ed2c7dadc2316e543ae9e9a91d2 /indra/newview/llimview.cpp
parentc9e153c182dae9472a2b87cddfec8c47b30b06b9 (diff)
parent5b5354c933aa7b1ceeb307853c24fba28d4e31bf (diff)
Merge
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp184
1 files changed, 143 insertions, 41 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 8fb7027e82..ffa943092f 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -46,8 +46,10 @@
#include "llagent.h"
#include "llavatariconctrl.h"
+#include "llbottomtray.h"
#include "llcallingcard.h"
#include "llchat.h"
+#include "llchiclet.h"
#include "llresmgr.h"
#include "llfloaterchat.h"
#include "llfloaterchatterbox.h"
@@ -69,10 +71,12 @@
#include "llviewermessage.h"
#include "llviewerwindow.h"
#include "llnotify.h"
+#include "llnearbychat.h"
#include "llviewerregion.h"
#include "llvoicechannel.h"
#include "lltrans.h"
#include "llrecentpeople.h"
+#include "llsyswellwindow.h"
#include "llfirstuse.h"
#include "llagentui.h"
@@ -392,21 +396,15 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from,
bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text)
{
- S32 im_log_option = gSavedPerAccountSettings.getS32("IMLogOptions");
- if (im_log_option != LOG_CHAT)
+ if (gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
{
- if(im_log_option == LOG_BOTH_TOGETHER)
- {
- LLLogChat::saveHistory(std::string("chat"), from, from_id, utf8_text);
- return true;
- }
- else
- {
- LLLogChat::saveHistory(LLIMModel::getInstance()->getName(session_id), from, from_id, utf8_text);
- return true;
- }
+ LLLogChat::saveHistory(LLIMModel::getInstance()->getName(session_id), from, from_id, utf8_text);
+ return true;
+ }
+ else
+ {
+ return false;
}
- return false;
}
bool LLIMModel::proccessOnlineOfflineNotification(
@@ -439,8 +437,7 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
addToHistory(session_id, from, from_id, utf8_text);
if (log2file) logToFile(session_id, from, from_id, utf8_text);
- //we do not count system messages
- if (from_id.notNull()) session->mNumUnread++;
+ session->mNumUnread++;
// notify listeners
LLSD arg;
@@ -651,22 +648,10 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
//local echo for the legacy communicate panel
std::string history_echo;
- std::string utf8_copy = utf8_text;
LLAgentUI::buildFullname(history_echo);
- // Look for IRC-style emotes here.
+ history_echo += ": " + utf8_text;
- std::string prefix = utf8_copy.substr(0, 4);
- if (prefix == "/me " || prefix == "/me'")
- {
- utf8_copy.replace(0,3,"");
- }
- else
- {
- history_echo += ": ";
- }
- history_echo += utf8_copy;
-
LLFloaterIMPanel* floater = gIMMgr->findFloaterBySession(im_session_id);
if (floater) floater->addHistoryLine(history_echo, LLUIColorTable::instance().getColor("IMChatColor"), true, gAgent.getID());
@@ -862,7 +847,17 @@ bool LLIMModel::sendStartSession(
return false;
}
-
+// static
+void LLIMModel::sendSessionInitialized(const LLUUID &session_id)
+{
+ LLIMSession* session = getInstance()->findIMSession(session_id);
+ if (session)
+ {
+ LLSD arg;
+ arg["session_id"] = session_id;
+ getInstance()->mSessionInitializedSignal(arg);
+ }
+}
//
// Helper Functions
@@ -1090,16 +1085,91 @@ LLIMMgr::onConfirmForceCloseError(
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLOutgoingCallDialog
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) :
+ LLDockableFloater(NULL, false, payload),
+ mPayload(payload)
+{
+}
+
+void LLOutgoingCallDialog::getAllowedRect(LLRect& rect)
+{
+ rect = gViewerWindow->getWorldViewRectScaled();
+}
+
+void LLOutgoingCallDialog::onOpen(const LLSD& key)
+{
+ // tell the user which voice channel they are leaving
+ if (!mPayload["old_channel_name"].asString().empty())
+ {
+ childSetTextArg("leaving", "[CURRENT_CHAT]", mPayload["old_channel_name"].asString());
+ }
+ else
+ {
+ childSetTextArg("leaving", "[CURRENT_CHAT]", getString("localchat"));
+ }
+
+ std::string callee_name = mPayload["session_name"].asString();
+ if (callee_name == "anonymous")
+ {
+ callee_name = getString("anonymous");
+ }
+
+ setTitle(callee_name);
+
+ LLSD callee_id = mPayload["other_user_id"];
+ childSetTextArg("calling", "[CALLEE_NAME]", callee_name);
+ childSetTextArg("connecting", "[CALLEE_NAME]", callee_name);
+ LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
+ icon->setValue(callee_id);
+}
+
+
+//static
+void LLOutgoingCallDialog::onCancel(void* user_data)
+{
+ LLOutgoingCallDialog* self = (LLOutgoingCallDialog*)user_data;
+
+ if (!gIMMgr)
+ return;
+
+ LLUUID session_id = self->mPayload["session_id"].asUUID();
+ gIMMgr->endCall(session_id);
+
+ self->closeFloater();
+}
+
+
+BOOL LLOutgoingCallDialog::postBuild()
+{
+ BOOL success = LLDockableFloater::postBuild();
+
+ childSetAction("Cancel", onCancel, this);
+
+ // dock the dialog to the sys well, where other sys messages appear
+ setDockControl(new LLDockControl(LLBottomTray::getInstance()->getSysWell(),
+ this, getDockTongue(), LLDockControl::TOP,
+ boost::bind(&LLOutgoingCallDialog::getAllowedRect, this, _1)));
+
+ return success;
+}
+
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLIncomingCallDialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) :
- LLModalDialog(payload),
+ LLDockableFloater(NULL, false, payload),
mPayload(payload)
{
}
BOOL LLIncomingCallDialog::postBuild()
{
+ LLDockableFloater::postBuild();
+
LLSD caller_id = mPayload["caller_id"];
EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger();
@@ -1118,6 +1188,11 @@ BOOL LLIncomingCallDialog::postBuild()
call_type = getString("VoiceInviteAdHoc");
}
+ // check to see if this is an Avaline call
+ LLUUID session_id = mPayload["session_id"].asUUID();
+ bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
+ childSetVisible("Start IM", is_avatar); // no IM for avaline
+
LLUICtrl* caller_name_widget = getChild<LLUICtrl>("caller name");
caller_name_widget->setValue(caller_name + " " + call_type);
LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
@@ -1131,6 +1206,30 @@ BOOL LLIncomingCallDialog::postBuild()
return TRUE;
}
+void LLIncomingCallDialog::getAllowedRect(LLRect& rect)
+{
+ rect = gViewerWindow->getWorldViewRectScaled();
+}
+
+void LLIncomingCallDialog::onOpen(const LLSD& key)
+{
+ // tell the user which voice channel they would be leaving
+ LLVoiceChannel *voice = LLVoiceChannel::getCurrentVoiceChannel();
+ if (voice && !voice->getSessionName().empty())
+ {
+ childSetTextArg("question", "[CURRENT_CHAT]", voice->getSessionName());
+ }
+ else
+ {
+ childSetTextArg("question", "[CURRENT_CHAT]", getString("localchat"));
+ }
+
+ // dock the dialog to the sys well, where other sys messages appear
+ setDockControl(new LLDockControl(LLBottomTray::getInstance()->getSysWell(),
+ this, getDockTongue(), LLDockControl::TOP,
+ boost::bind(&LLIncomingCallDialog::getAllowedRect, this, _1)));
+}
+
//static
void LLIncomingCallDialog::onAccept(void* user_data)
{
@@ -1157,6 +1256,9 @@ void LLIncomingCallDialog::onStartIM(void* user_data)
void LLIncomingCallDialog::processCallResponse(S32 response)
{
+ if (!gIMMgr)
+ return;
+
LLUUID session_id = mPayload["session_id"].asUUID();
EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger();
LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)mPayload["inv_type"].asInteger();
@@ -1254,6 +1356,9 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
bool inviteUserResponse(const LLSD& notification, const LLSD& response)
{
+ if (!gIMMgr)
+ return false;
+
const LLSD& payload = notification["payload"];
LLUUID session_id = payload["session_id"].asUUID();
EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
@@ -1507,6 +1612,12 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess
LLChat chat(message);
chat.mSourceType = CHAT_SOURCE_SYSTEM;
LLFloaterChat::addChatHistory(chat);
+
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
+ if(nearby_chat)
+ {
+ nearby_chat->addMessage(chat);
+ }
}
else // going to IM session
{
@@ -2331,15 +2442,6 @@ public:
BOOL is_linden = LLMuteList::getInstance()->isLinden(name);
std::string separator_string(": ");
- int message_offset=0;
-
- //Handle IRC styled /me messages.
- std::string prefix = message.substr(0, 4);
- if (prefix == "/me " || prefix == "/me'")
- {
- separator_string = "";
- message_offset = 3;
- }
chat.mMuted = is_muted && !is_linden;
chat.mFromID = from_id;
@@ -2356,7 +2458,7 @@ public:
{
saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str());
}
- std::string buffer = saved + message.substr(message_offset);
+ std::string buffer = saved + message;
BOOL is_this_agent = FALSE;
if(from_id == gAgentID)
@@ -2375,7 +2477,7 @@ public:
ll_vector3_from_sd(message_params["position"]),
true);
- chat.mText = std::string("IM: ") + name + separator_string + saved + message.substr(message_offset);
+ chat.mText = std::string("IM: ") + name + separator_string + saved + message;
LLFloaterChat::addChat(chat, TRUE, is_this_agent);
//K now we want to accept the invitation