diff options
| -rw-r--r-- | indra/newview/llfloaterimnearbychathandler.cpp | 50 | ||||
| -rw-r--r-- | indra/newview/llimview.cpp | 104 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_chat.xml | 20 | 
3 files changed, 116 insertions, 58 deletions
diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index ab81b85d04..2d8a6d46fe 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -41,6 +41,7 @@  #include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance  #include "llviewerwindow.h"//for screen channel position  #include "llfloaterimnearbychat.h" +#include "llfloaterimcontainer.h"  #include "llrootview.h"  #include "lllayoutstack.h" @@ -283,12 +284,6 @@ bool	LLFloaterIMNearbyChatScreenChannel::createPoolToast()  void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat)  { -    //Ignore Nearby Toasts -    if(gSavedSettings.getString("NotificationNearbyChatOptions") != "toast") -    { -        return; -    } -  	//look in pool. if there is any message  	if(mStopProcessing)  		return; @@ -606,19 +601,36 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,  			toast_msg = chat_msg.mText;  		} -		// Add a nearby chat toast. -		LLUUID id; -		id.generate(); -		chat["id"] = id; -		std::string r_color_name = "White"; -		F32 r_color_alpha = 1.0f;  -		LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); -		 -		chat["text_color"] = r_color_name; -		chat["color_alpha"] = r_color_alpha; -		chat["font_size"] = (S32)LLViewerChat::getChatFontSize() ; -		chat["message"] = toast_msg; -		channel->addChat(chat);	 + +        //Will show toast when chat preference is set         +        if(gSavedSettings.getString("NotificationNearbyChatOptions") == "toast") +        { +            // Add a nearby chat toast. +            LLUUID id; +            id.generate(); +            chat["id"] = id; +            std::string r_color_name = "White"; +            F32 r_color_alpha = 1.0f;  +            LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); + +            chat["text_color"] = r_color_name; +            chat["color_alpha"] = r_color_alpha; +            chat["font_size"] = (S32)LLViewerChat::getChatFontSize() ; +            chat["message"] = toast_msg; +            channel->addChat(chat);	 +        } +        //Will show Conversations floater when chat preference is set +        else if(gSavedSettings.getString("NotificationNearbyChatOptions") == "openconversations") +        { +            LLFloaterIMContainer * floaterIMContainer = LLFloaterIMContainer::getInstance(); + +            if(floaterIMContainer) +            { +                floaterIMContainer->setVisible(TRUE); +                floaterIMContainer->setFrontmost(TRUE); +            } +        } +  	}  } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e2b678626b..2d2bd1f92e 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -113,6 +113,55 @@ 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()));  } +//Will return true if the preference is allowed (user configures these preferences via 'Chat Preference' Dialog +bool ignoreNotification(const LLSD& msg, const char * preferenceString) +{ +    //Get the session so we can find out the type of session +    LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( +        msg["session_id"]); + +    const LLRelationship * relationship; + +    // Skip system messages +    if (msg["from_id"].asUUID() == LLUUID::null) +    { +        return true; +    } + +    //Ignore P2P Friend/Non-Friend Notification +    if(session->isP2PSessionType()) +    { +        relationship = LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]); + +        //Ignores non-friends +        if(relationship == NULL +            && (gSavedSettings.getString("NotificationNonFriendIMOptions") != preferenceString)) +        { +            return true; +        } +        //Ignores friends +        else if(relationship  +            && gSavedSettings.getString("NotificationFriendIMOptions") != preferenceString) +        { +            return true; +        } +    } +    //Ignore Ad Hoc Notification +    else if(session->isAdHocSessionType()  +        && (gSavedSettings.getString("NotificationConferenceIMOptions") != preferenceString)) +    { +        return true; +    } +    //Ignore Group Notification +    else if(session->isGroupSessionType()  +        && (gSavedSettings.getString("NotificationGroupChatOptions") != preferenceString)) +    { +        return true; +    } + +    return false; +} +  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"]) @@ -134,55 +183,32 @@ void toast_callback(const LLSD& msg){          return;      } -	// 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()) -    { -        //Ignores non-friends -        if((LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL)  -            && (gSavedSettings.getString("NotificationNonFriendIMOptions") != "toast")) -        { -            return; -        } -        //Ignores friends -        else if(gSavedSettings.getString("NotificationFriendIMOptions") != "toast") -        { -            return; -        } -    } -    //Ignore Ad Hoc Toasts -    else if(session->isAdHocSessionType()  -            && (gSavedSettings.getString("NotificationConferenceIMOptions") != "toast")) +    //Show toast +    if(ignoreNotification(msg, "toast") == false)      { -        return; +        LLAvatarNameCache::get(msg["from_id"].asUUID(), +            boost::bind(&on_avatar_name_cache_toast, +            _1, _2, msg));      } -    //Ignore Group Toasts -    else if(session->isGroupSessionType()  -            && (gSavedSettings.getString("NotificationGroupChatOptions") != "toast")) +} + +void open_conversations_callback(const LLSD& msg) +{ +    LLFloaterIMContainer * floaterIMContainer = LLFloaterIMContainer::getInstance(); + +    if(floaterIMContainer +        && ignoreNotification(msg, "openconversations") == false)      { -        return; +        floaterIMContainer->setVisible(TRUE); +        floaterIMContainer->setFrontmost(TRUE);      } - -    //Show toast -	LLAvatarNameCache::get(msg["from_id"].asUUID(), -		boost::bind(&on_avatar_name_cache_toast, -			_1, _2, msg));  }  LLIMModel::LLIMModel()   {  	addNewMsgCallback(boost::bind(&LLFloaterIMSession::newIMCallback, _1));  	addNewMsgCallback(boost::bind(&toast_callback, _1)); +    addNewMsgCallback(boost::bind(&open_conversations_callback, _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) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 712e8bff7f..0c94b6b223 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -135,6 +135,10 @@          name="FriendIMOptions"          width="223">        <combo_box.item +          label="Open Conversations window" +          name="OpenConversationsWindow" +          value="openconversations"/>       +      <combo_box.item            label="Pop up the message"            name="PopUpMessage"            value="toast"/> @@ -166,6 +170,10 @@          name="NonFriendIMOptions"          width="223">        <combo_box.item +          label="Open Conversations window" +          name="OpenConversationsWindow" +          value="openconversations"/> +      <combo_box.item            label="Pop up the message"            name="PopUpMessage"            value="toast"/> @@ -197,6 +205,10 @@          name="ConferenceIMOptions"          width="223">        <combo_box.item +          label="Open Conversations window" +          name="OpenConversationsWindow" +          value="openconversations"/> +      <combo_box.item            label="Pop up the message"            name="PopUpMessage"            value="toast"/> @@ -228,6 +240,10 @@          name="GroupChatOptions"          width="223">        <combo_box.item +          label="Open Conversations window" +          name="OpenConversationsWindow" +          value="openconversations"/> +      <combo_box.item            label="Pop up the message"            name="PopUpMessage"            value="toast"/> @@ -259,6 +275,10 @@          name="NearbyChatOptions"          width="223">        <combo_box.item +          label="Open Conversations window" +          name="OpenConversationsWindow" +          value="openconversations"/> +      <combo_box.item            label="Pop up the message"            name="PopUpMessage"            value="toast"/>  | 
