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.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 0d773a7c54..1b07c7630f 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -162,6 +162,14 @@ bool LLIMModel::newSession(LLUUID session_id, std::string name, EInstantMessage
}
+bool LLIMModel::clearSession(LLUUID session_id)
+{
+ if (sSessionsMap.find(session_id) == sSessionsMap.end()) return false;
+ delete (sSessionsMap[session_id]);
+ sSessionsMap.erase(session_id);
+ return true;
+}
+
std::list<LLSD> LLIMModel::getMessages(LLUUID session_id, int start_index)
{
std::list<LLSD> return_list;
@@ -840,10 +848,9 @@ BOOL LLFloaterIM::postBuild()
// Class LLIncomingCallDialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) :
- LLModalDialog(payload, 240, 200),
+ LLModalDialog(payload),
mPayload(payload)
{
- LLUICtrlFactory::getInstance()->buildFloater(this, "floater_incoming_call.xml", NULL);
}
BOOL LLIncomingCallDialog::postBuild()
@@ -1134,6 +1141,13 @@ LLIMMgr::LLIMMgr() :
mFriendObserver(NULL),
mIMReceived(FALSE)
{
+ static bool registered_dialog = false;
+ if (!registered_dialog)
+ {
+ LLFloaterReg::add("incoming_call", "floater_incoming_call.xml.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIncomingCallDialog>);
+ registered_dialog = true;
+ }
+
mFriendObserver = new LLIMViewFriendObserver(this);
LLAvatarTracker::instance().addObserver(mFriendObserver);
@@ -1432,7 +1446,8 @@ LLUUID LLIMMgr::addSession(
}
// This removes the panel referenced by the uuid, and then restores
-// internal consistency. The internal pointer is not deleted.
+// internal consistency. The internal pointer is not deleted? Did you mean
+// a pointer to the corresponding LLIMSession? Session data is cleared now.
void LLIMMgr::removeSession(const LLUUID& session_id)
{
LLFloaterIMPanel* floater = findFloaterBySession(session_id);
@@ -1446,6 +1461,12 @@ void LLIMMgr::removeSession(const LLUUID& session_id)
clearPendingAgentListUpdates(session_id);
}
notifyObserverSessionRemoved(session_id);
+
+ //if we don't clear session data on removing the session
+ //we can't use LLBottomTray as observer of session creation/delettion and
+ //creating chiclets only on session created even, we need to handle chiclets creation
+ //the same way as LLFloaterIMPanels were managed.
+ LLIMModel::getInstance()->clearSession(session_id);
}
void LLIMMgr::inviteToSession(
@@ -1535,8 +1556,7 @@ void LLIMMgr::inviteToSession(
{
if (notify_box_type == "VoiceInviteP2P" || notify_box_type == "VoiceInviteAdHoc")
{
- LLIncomingCallDialog *dialog = new LLIncomingCallDialog(payload);
- dialog->startModal();
+ LLFloaterReg::showInstance("incoming_call", payload, TRUE);
}
else
{
@@ -1544,10 +1564,7 @@ void LLIMMgr::inviteToSession(
args["NAME"] = caller_name;
args["GROUP"] = session_name;
- LLNotifications::instance().add(notify_box_type,
- args,
- payload,
- &inviteUserResponse);
+ LLNotifications::instance().add(notify_box_type, args, payload, &inviteUserResponse);
}
}
mPendingInvitations[session_id.asString()] = LLSD();
@@ -1563,8 +1580,7 @@ void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::stri
if (notify_box_type == "VoiceInviteP2P" || notify_box_type == "VoiceInviteAdHoc")
{
- LLIncomingCallDialog *dialog = new LLIncomingCallDialog(payload);
- dialog->startModal();
+ LLFloaterReg::showInstance("incoming_call", payload, TRUE);
}
else
{