summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorIgor Borovkov <iborovkov@productengine.com>2010-01-29 18:03:23 +0200
committerIgor Borovkov <iborovkov@productengine.com>2010-01-29 18:03:23 +0200
commit159c788918c410eb384dcfce1555c8a7d01b69c4 (patch)
tree57e103276b5fa35bc274397d332b290ab6a1f42c /indra
parent81451696f1de85e235818517c01b8d255d1bb661 (diff)
parent86609394caf1ebb20dd90de37b9af1471ae8aa20 (diff)
merge
--HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llchat.h2
-rw-r--r--indra/llui/llnotificationsutil.cpp5
-rw-r--r--indra/llui/llnotificationsutil.h2
-rw-r--r--indra/newview/llchathistory.cpp35
-rw-r--r--indra/newview/llimfloater.cpp19
-rw-r--r--indra/newview/llimfloater.h1
-rw-r--r--indra/newview/llnotificationhandler.h22
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp78
-rw-r--r--indra/newview/llnotificationofferhandler.cpp19
-rw-r--r--indra/newview/lltoastnotifypanel.cpp5
-rw-r--r--indra/newview/llviewermessage.cpp1
-rw-r--r--indra/newview/skins/default/xui/en/floater_im_session.xml10
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml7
13 files changed, 183 insertions, 23 deletions
diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h
index 46456882ba..a77bd211f3 100644
--- a/indra/llcommon/llchat.h
+++ b/indra/llcommon/llchat.h
@@ -79,6 +79,7 @@ public:
: mText(text),
mFromName(),
mFromID(),
+ mNotifId(),
mSourceType(CHAT_SOURCE_AGENT),
mChatType(CHAT_TYPE_NORMAL),
mAudible(CHAT_AUDIBLE_FULLY),
@@ -94,6 +95,7 @@ public:
std::string mText; // UTF-8 line of text
std::string mFromName; // agent or object name
LLUUID mFromID; // agent id or object id
+ LLUUID mNotifId;
EChatSourceType mSourceType;
EChatType mChatType;
EChatAudible mAudible;
diff --git a/indra/llui/llnotificationsutil.cpp b/indra/llui/llnotificationsutil.cpp
index f343d27cb4..54bdb4bd66 100644
--- a/indra/llui/llnotificationsutil.cpp
+++ b/indra/llui/llnotificationsutil.cpp
@@ -94,3 +94,8 @@ void LLNotificationsUtil::cancel(LLNotificationPtr pNotif)
{
LLNotifications::instance().cancel(pNotif);
}
+
+LLNotificationPtr LLNotificationsUtil::find(LLUUID uuid)
+{
+ return LLNotifications::instance().find(uuid);
+}
diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h
index d552fa915b..338204924a 100644
--- a/indra/llui/llnotificationsutil.h
+++ b/indra/llui/llnotificationsutil.h
@@ -65,6 +65,8 @@ namespace LLNotificationsUtil
S32 getSelectedOption(const LLSD& notification, const LLSD& response);
void cancel(LLNotificationPtr pNotif);
+
+ LLNotificationPtr find(LLUUID uuid);
}
#endif
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 8cfcca31ce..a570862675 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -51,9 +51,12 @@
#include "llslurl.h"
#include "lllayoutstack.h"
#include "llagent.h"
+#include "llnotificationsutil.h"
+#include "lltoastnotifypanel.h"
#include "llviewerregion.h"
#include "llworld.h"
+
#include "llsidetray.h"//for blocked objects panel
static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history");
@@ -654,8 +657,36 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
mLastMessageTimeStr = chat.mTimeStr;
}
- std::string message = irc_me ? chat.mText.substr(3) : chat.mText;
- mEditor->appendText(message, FALSE, style_params);
+ if (chat.mNotifId.notNull())
+ {
+ LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId);
+ if (notification != NULL)
+ {
+ LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(
+ notification);
+ notify_box->setFollowsLeft();
+ notify_box->setFollowsRight();
+ //Prepare the rect for the view
+ LLRect target_rect = mEditor->getDocumentView()->getRect();
+ // squeeze down the widget by subtracting padding off left and right
+ target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
+ target_rect.mRight -= mRightWidgetPad;
+ notify_box->reshape(target_rect.getWidth(),
+ notify_box->getRect().getHeight());
+ notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom);
+
+ LLInlineViewSegment::Params params;
+ params.view = notify_box;
+ params.left_pad = mLeftWidgetPad;
+ params.right_pad = mRightWidgetPad;
+ mEditor->appendWidget(params, "\n", false);
+ }
+ }
+ else
+ {
+ std::string message = irc_me ? chat.mText.substr(3) : chat.mText;
+ mEditor->appendText(message, FALSE, style_params);
+ }
mEditor->blockUndo();
// automatically scroll to end when receiving chat from myself
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index c0f22fcea2..c2bcb1cdf9 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -601,8 +601,18 @@ void LLIMFloater::updateMessages()
chat.mFromID = from_id;
chat.mSessionID = mSessionID;
chat.mFromName = from;
- chat.mText = message;
chat.mTimeStr = time;
+
+ // process offer notification
+ if (msg.has("notifiaction_id"))
+ {
+ chat.mNotifId = msg["notifiaction_id"].asUUID();
+ }
+ //process text message
+ else
+ {
+ chat.mText = message;
+ }
mChatHistory->appendMessage(chat, use_plain_text_chat_history);
mLastMessageIndex = msg["index"].asInteger();
@@ -610,6 +620,13 @@ void LLIMFloater::updateMessages()
}
}
+void LLIMFloater::reloadMessages()
+{
+ mChatHistory->clear();
+ mLastMessageIndex = -1;
+ updateMessages();
+}
+
// static
void LLIMFloater::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata )
{
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 0ca0325451..9552b30737 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -80,6 +80,7 @@ public:
// get new messages from LLIMModel
void updateMessages();
+ void reloadMessages();
static void onSendMsg( LLUICtrl*, void*);
void sendMsg();
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index e57674d31c..5f4768e321 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -277,6 +277,11 @@ public:
static bool canSpawnIMSession(const LLNotificationPtr& notification);
/**
+ * Checks sufficient conditions to add notification toast panel IM floater.
+ */
+ static bool canAddNotifPanelToIM(const LLNotificationPtr& notification);
+
+ /**
* Checks if passed notification can create IM session and be written into it.
*
* This method uses canLogToIM() & canSpawnIMSession().
@@ -297,6 +302,11 @@ public:
static void logToIMP2P(const LLNotificationPtr& notification);
/**
+ * Writes notification message to IM p2p session.
+ */
+ static void logToIMP2P(const LLNotificationPtr& notification, bool to_file_only);
+
+ /**
* Writes group notice notification message to IM group session.
*/
static void logGroupNoticeToIMGroup(const LLNotificationPtr& notification);
@@ -309,7 +319,7 @@ public:
/**
* Spawns IM session.
*/
- static void spawnIMSession(const std::string& name, const LLUUID& from_id);
+ static LLUUID spawnIMSession(const std::string& name, const LLUUID& from_id);
/**
* Returns name from the notification's substitution.
@@ -319,6 +329,16 @@ public:
* @param notification - Notification which substitution's name will be returned.
*/
static std::string getSubstitutionName(const LLNotificationPtr& notification);
+
+ /**
+ * Adds notification panel to the IM floater.
+ */
+ static void addNotifPanelToIM(const LLNotificationPtr& notification);
+
+ /**
+ * Reloads IM floater messages.
+ */
+ static void reloadIMFloaterMessages(const LLNotificationPtr& notification);
};
}
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 02f948eca9..f9b3b7187a 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -39,6 +39,7 @@
#include "llagent.h"
#include "llfloaterreg.h"
#include "llnearbychat.h"
+#include "llimfloater.h"
using namespace LLNotificationsUI;
@@ -91,6 +92,13 @@ bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification)
}
// static
+bool LLHandlerUtil::canAddNotifPanelToIM(const LLNotificationPtr& notification)
+{
+ return OFFER_FRIENDSHIP == notification->getName();
+}
+
+
+// static
bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notification)
{
return canLogToIM(notification) && canSpawnIMSession(notification);
@@ -137,6 +145,12 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
// static
void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification)
{
+ logToIMP2P(notification, false);
+}
+
+// static
+void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only)
+{
const std::string name = LLHandlerUtil::getSubstitutionName(notification);
const std::string session_name = notification->getPayload().has(
@@ -148,8 +162,16 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification)
{
LLUUID from_id = notification->getPayload()["from_id"];
- logToIM(IM_NOTHING_SPECIAL, session_name, name, notification->getMessage(),
- from_id, from_id);
+ if(to_file_only)
+ {
+ logToIM(IM_NOTHING_SPECIAL, session_name, name, notification->getMessage(),
+ LLUUID(), LLUUID());
+ }
+ else
+ {
+ logToIM(IM_NOTHING_SPECIAL, session_name, name, notification->getMessage(),
+ from_id, from_id);
+ }
}
}
@@ -191,7 +213,7 @@ void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChat
}
// static
-void LLHandlerUtil::spawnIMSession(const std::string& name, const LLUUID& from_id)
+LLUUID LLHandlerUtil::spawnIMSession(const std::string& name, const LLUUID& from_id)
{
LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
@@ -199,8 +221,10 @@ void LLHandlerUtil::spawnIMSession(const std::string& name, const LLUUID& from_i
session_id);
if (session == NULL)
{
- LLIMMgr::instance().addSession(name, IM_NOTHING_SPECIAL, from_id);
+ session_id = LLIMMgr::instance().addSession(name, IM_NOTHING_SPECIAL, from_id);
}
+
+ return session_id;
}
// static
@@ -210,3 +234,49 @@ std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notifica
? notification->getSubstitutions()["NAME"]
: notification->getSubstitutions()["[NAME]"];
}
+
+// static
+void LLHandlerUtil::addNotifPanelToIM(const LLNotificationPtr& notification)
+{
+ const std::string name = LLHandlerUtil::getSubstitutionName(notification);
+ LLUUID from_id = notification->getPayload()["from_id"];
+
+ LLUUID session_id = spawnIMSession(name, from_id);
+ // add offer to session
+ LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession(
+ session_id);
+ llassert_always(session != NULL);
+
+ LLSD offer;
+ offer["notifiaction_id"] = notification->getID();
+ offer["from_id"] = notification->getPayload()["from_id"];
+ offer["from"] = name;
+ offer["time"] = LLLogChat::timestamp(true);
+ session->mMsgs.push_front(offer);
+
+ LLIMFloater::show(session_id);
+}
+
+// static
+void LLHandlerUtil::reloadIMFloaterMessages(
+ const LLNotificationPtr& notification)
+{
+ LLUUID from_id = notification->getPayload()["from_id"];
+ LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
+ LLIMFloater* im_floater = LLFloaterReg::findTypedInstance<LLIMFloater>(
+ "impanel", session_id);
+ if (im_floater != NULL)
+ {
+ LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession(
+ session_id);
+ if(session != NULL)
+ {
+ session->mMsgs.clear();
+ std::list<LLSD> chat_history;
+ LLLogChat::loadAllHistory(session->mHistoryFileName, chat_history);
+ session->addMessagesFromHistory(chat_history);
+ }
+
+ im_floater->reloadMessages();
+ }
+}
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index fad0c6a91e..8c13b0fafa 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -93,7 +93,7 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
{
- LLHandlerUtil::logToIMP2P(notification);
+
if( notification->getPayload().has("give_inventory_notification")
&& !notification->getPayload()["give_inventory_notification"] )
@@ -103,18 +103,25 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
}
else
{
+ LLUUID session_id;
if (LLHandlerUtil::canSpawnIMSession(notification))
{
const std::string name = LLHandlerUtil::getSubstitutionName(notification);
LLUUID from_id = notification->getPayload()["from_id"];
- LLHandlerUtil::spawnIMSession(name, from_id);
+ session_id = LLHandlerUtil::spawnIMSession(name, from_id);
}
- if (notification->getPayload().has("SUPPRESS_TOAST")
+ if (LLHandlerUtil::canAddNotifPanelToIM(notification))
+ {
+ LLHandlerUtil::addNotifPanelToIM(notification);
+ LLHandlerUtil::logToIMP2P(notification, true);
+ }
+ else if (notification->getPayload().has("SUPPRESS_TOAST")
&& notification->getPayload()["SUPPRESS_TOAST"])
{
+ LLHandlerUtil::logToIMP2P(notification);
LLNotificationsUtil::cancel(notification);
}
else
@@ -131,6 +138,8 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
if(channel)
channel->addToast(p);
+ LLHandlerUtil::logToIMP2P(notification);
+
// send a signal to the counter manager
mNewNotificationSignal();
}
@@ -146,6 +155,10 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
}
else
{
+ if (LLHandlerUtil::canAddNotifPanelToIM(notification))
+ {
+ LLHandlerUtil::reloadIMFloaterMessages(notification);
+ }
mChannel->killToastByNotificationID(notification->getID());
}
}
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 94acb2ae8c..4d741456c4 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -43,6 +43,7 @@
#include "lluiconstants.h"
#include "llrect.h"
#include "lltrans.h"
+#include "llnotificationsutil.h"
const S32 BOTTOM_PAD = VPAD * 3;
S32 BUTTON_WIDTH = 90;
@@ -235,6 +236,10 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt
LLToastNotifyPanel::~LLToastNotifyPanel()
{
std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer());
+ if (LLNotificationsUtil::find(mNotification->getID()) != NULL)
+ {
+ LLNotifications::getInstance()->cancel(mNotification);
+ }
}
void LLToastNotifyPanel::updateButtonsLayout(const std::vector<index_button_pair_t>& buttons, S32 left_pad, S32 top)
{
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 55b0d6fa8b..9240833632 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -630,7 +630,6 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
delete_context_data = FALSE;
LLSD args;
args["NAME"] = name;
- args["INVITE"] = message;
LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification["payload"]);
}
}
diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml
index d2e5473157..9aaa660574 100644
--- a/indra/newview/skins/default/xui/en/floater_im_session.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_session.xml
@@ -12,7 +12,7 @@
can_minimize="true"
can_close="true"
visible="false"
- width="360"
+ width="440"
can_resize="true"
min_width="250"
min_height="190">
@@ -20,7 +20,7 @@
animate="false"
follows="all"
height="320"
- width="360"
+ width="440"
layout="topleft"
orientation="horizontal"
name="im_panels"
@@ -38,7 +38,7 @@
left="0"
top="0"
height="200"
- width="245"
+ width="325"
user_resize="true">
<button
height="20"
@@ -65,7 +65,7 @@
parse_highlights="true"
allow_html="true"
left="1"
- width="240">
+ width="320">
</chat_history>
<line_editor
bottom="0"
@@ -75,7 +75,7 @@
label="To"
layout="bottomleft"
name="chat_editor"
- width="240">
+ width="320">
</line_editor>
</layout_panel>
</layout_stack>
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index fc535205f1..2adee19ef6 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -2941,7 +2941,6 @@ Chat and instant messages will be hidden. Instant messages will get your Busy mo
type="alert">
You have reached your maximum number of groups. Please leave another group before joining this one, or decline the offer.
[NAME] has invited you to join a group as a member.
-[INVITE]
<usetemplate
name="okcancelbuttons"
notext="Decline"
@@ -5157,7 +5156,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
<notification
icon="notify.tga"
name="OfferFriendship"
- type="alertmodal">
+ type="offer">
[NAME] is offering friendship.
[MESSAGE]
@@ -5172,10 +5171,6 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
index="1"
name="Decline"
text="Decline"/>
- <button
- index="2"
- name="Send IM"
- text="Send IM"/>
</form>
</notification>