summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp140
1 files changed, 71 insertions, 69 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index e2b678626b..db52a50aa1 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -29,6 +29,7 @@
#include "llimview.h"
#include "llavatarnamecache.h" // IDEVO
+#include "llavataractions.h"
#include "llfloaterreg.h"
#include "llfontgl.h"
#include "llgl.h"
@@ -113,76 +114,87 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id,
LLNotificationsUtil::add("IMToast", args, LLSD(), boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
}
-void toast_callback(const LLSD& msg){
- // do not show toast in do not disturb mode or it goes from agent
- if (gAgent.isDoNotDisturb() || gAgent.getID() == msg["from_id"])
- {
- return;
- }
+void on_new_message(const LLSD& msg)
+{
+ std::string action;
+ LLUUID participant_id = msg["from_id"].asUUID();
+ LLUUID session_id = msg["session_id"].asUUID();
+ LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
- // Skip toasting if we have open window of IM with this session id
- LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(msg["session_id"]);
- if (
- open_im_floater
- && open_im_floater->isInVisibleChain()
- && open_im_floater->hasFocus()
- && !open_im_floater->isMinimized()
- && !(open_im_floater->getHost()
- && open_im_floater->getHost()->isMinimized())
- )
+ // determine action for this session
+
+ if (session_id.isNull())
{
- return;
+ action = gSavedSettings.getString("NotificationNearbyChatOptions");
}
-
- // Skip toasting for system messages
- if (msg["from_id"].asUUID() == LLUUID::null)
- {
- return;
- }
-
- // *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea
- LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
- msg["session_id"]);
-
-
- //Ignore P2P Friend/Non-Friend toasts
- if(session->isP2PSessionType())
+ else if(session->isP2PSessionType())
{
- //Ignores non-friends
- if((LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL)
- && (gSavedSettings.getString("NotificationNonFriendIMOptions") != "toast"))
+ if (LLAvatarTracker::instance().isBuddy(participant_id))
{
- return;
+ action = gSavedSettings.getString("NotificationFriendIMOptions");
}
- //Ignores friends
- else if(gSavedSettings.getString("NotificationFriendIMOptions") != "toast")
+ else
{
- return;
+ action = gSavedSettings.getString("NotificationNonFriendIMOptions");
}
}
- //Ignore Ad Hoc Toasts
- else if(session->isAdHocSessionType()
- && (gSavedSettings.getString("NotificationConferenceIMOptions") != "toast"))
+ else if(session->isAdHocSessionType())
{
- return;
+ action = gSavedSettings.getString("NotificationConferenceIMOptions");
}
- //Ignore Group Toasts
- else if(session->isGroupSessionType()
- && (gSavedSettings.getString("NotificationGroupChatOptions") != "toast"))
+ else if(session->isGroupSessionType())
{
- return;
+ action = gSavedSettings.getString("NotificationGroupChatOptions");
}
- //Show toast
- LLAvatarNameCache::get(msg["from_id"].asUUID(),
- boost::bind(&on_avatar_name_cache_toast,
- _1, _2, msg));
+ // do not show notification in "do not disturb" mode or it goes from agent
+ if (gAgent.isDoNotDisturb() || gAgent.getID() == participant_id)
+ {
+ return;
+ }
+
+ // execution of the action
+
+ if ("toast" == action)
+ {
+ // Skip toasting if we have open window of IM with this session id
+ LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(session_id);
+ if (
+ open_im_floater
+ && open_im_floater->isInVisibleChain()
+ && open_im_floater->hasFocus()
+ && !open_im_floater->isMinimized()
+ && !(open_im_floater->getHost()
+ && open_im_floater->getHost()->isMinimized())
+ )
+ {
+ return;
+ }
+
+ // Skip toasting for system messages
+ if (participant_id.isNull())
+ {
+ return;
+ }
+
+ //Show toast
+ LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
+ }
+ else if ("flash" == action)
+ {
+ LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ if (im_box)
+ {
+ im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item
+ }
+ gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat"
+ }
}
LLIMModel::LLIMModel()
{
addNewMsgCallback(boost::bind(&LLFloaterIMSession::newIMCallback, _1));
- addNewMsgCallback(boost::bind(&toast_callback, _1));
+ addNewMsgCallback(boost::bind(&on_new_message, _1));
}
LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg)
@@ -1713,7 +1725,7 @@ BOOL LLCallDialog::postBuild()
return FALSE;
dockToToolbarButton("speak");
-
+
return TRUE;
}
@@ -2110,7 +2122,6 @@ BOOL LLIncomingCallDialog::postBuild()
getChildView("Start IM")->setVisible( is_avatar && notify_box_type != "VoiceInviteAdHoc" && notify_box_type != "VoiceInviteGroup");
setCanDrag(FALSE);
-
return TRUE;
}
@@ -2118,7 +2129,6 @@ void LLIncomingCallDialog::setCallerName(const std::string& ui_title,
const std::string& ui_label,
const std::string& call_type)
{
- setTitle(ui_title);
// call_type may be a string like " is calling."
LLUICtrl* caller_name_widget = getChild<LLUICtrl>("caller name");
@@ -2130,13 +2140,13 @@ void LLIncomingCallDialog::onAvatarNameCache(const LLUUID& agent_id,
const std::string& call_type)
{
std::string title = av_name.getCompleteName();
- setCallerName(title, av_name.mDisplayName, call_type);
+ setCallerName(title, av_name.getCompleteName(), call_type);
}
void LLIncomingCallDialog::onOpen(const LLSD& key)
{
LLCallDialog::onOpen(key);
-
+ make_ui_sound("UISndStartIM");
LLStringUtil::format_map_t args;
LLGroupData data;
// if it's a group call, retrieve group name to use it in question
@@ -2144,18 +2154,6 @@ void LLIncomingCallDialog::onOpen(const LLSD& key)
{
args["[GROUP]"] = data.mName;
}
- // tell the user which voice channel they would be leaving
- LLVoiceChannel *voice = LLVoiceChannel::getCurrentVoiceChannel();
- if (voice && !voice->getSessionName().empty())
- {
- args["[CURRENT_CHAT]"] = voice->getSessionName();
- getChild<LLUICtrl>("question")->setValue(getString(key["question_type"].asString(), args));
- }
- else
- {
- args["[CURRENT_CHAT]"] = getString("localchat");
- getChild<LLUICtrl>("question")->setValue(getString(key["question_type"].asString(), args));
- }
}
//static
@@ -2216,6 +2214,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
{
gIMMgr->startCall(session_id, LLVoiceChannel::INCOMING_CALL);
}
+ else
+ {
+ LLAvatarActions::startIM(caller_id);
+ }
gIMMgr->clearPendingAgentListUpdates(session_id);
gIMMgr->clearPendingInvitation(session_id);
@@ -2808,7 +2810,7 @@ void LLIMMgr::inviteToSession(
{
bool isRejectGroupCall = (gSavedSettings.getBOOL("VoiceCallsRejectGroup") && (notify_box_type == "VoiceInviteGroup"));
bool isRejectNonFriendCall = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL));
- bool isRejectDoNotDisturb = gAgent.isDoNotDisturb();
+ bool isRejectDoNotDisturb = (gAgent.isDoNotDisturb() && !hasSession(session_id));
if (isRejectGroupCall || isRejectNonFriendCall || isRejectDoNotDisturb)
{
if (isRejectDoNotDisturb && !isRejectGroupCall && !isRejectNonFriendCall)