summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llimfloater.cpp14
-rw-r--r--indra/newview/llimview.cpp61
-rw-r--r--indra/newview/llimview.h2
3 files changed, 68 insertions, 9 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 40ae112e4b..47a168e354 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -90,8 +90,20 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
case IM_SESSION_CONFERENCE_START:
mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this);
break;
- default:
+ case IM_SESSION_GROUP_START:
mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this);
+ break;
+ case IM_SESSION_INVITE:
+ if (gAgent.isInGroup(mSessionID))
+ {
+ mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this);
+ }
+ else
+ {
+ mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this);
+ }
+ break;
+ default: break;
}
}
}
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 6a9853913a..fd1fb38914 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -88,6 +88,9 @@ const static std::string IM_TEXT("message");
const static std::string IM_FROM("from");
const static std::string IM_FROM_ID("from_id");
+const static std::string NO_SESSION("(IM Session Doesn't Exist)");
+const static std::string ADHOC_NAME_SUFFIX(" Conference");
+
std::string LLCallDialogManager::sPreviousSessionlName = "";
std::string LLCallDialogManager::sCurrentSessionlName = "";
LLIMModel::LLIMSession* LLCallDialogManager::sSession = NULL;
@@ -451,10 +454,16 @@ void LLIMModel::testMessages()
addMessage(bot2_session_id, from, bot2_id, "Test Message: OMGWTFBBQ.");
}
-
+//session name should not be empty
bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,
const LLUUID& other_participant_id, const std::vector<LLUUID>& ids)
{
+ if (name.empty())
+ {
+ llwarns << "Attempt to create a new session with empty name; id = " << session_id << llendl;
+ return false;
+ }
+
if (findIMSession(session_id))
{
llwarns << "IM Session " << session_id << " already exists" << llendl;
@@ -611,7 +620,7 @@ const std::string& LLIMModel::getName(const LLUUID& session_id) const
if (!session)
{
llwarns << "session " << session_id << "does not exist " << llendl;
- return LLStringUtil::null;
+ return NO_SESSION;
}
return session->mName;
@@ -1558,6 +1567,8 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
return;
LLUUID session_id = mPayload["session_id"].asUUID();
+ LLUUID caller_id = mPayload["caller_id"].asUUID();
+ std::string session_name = mPayload["session_name"].asString();
EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger();
LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)mPayload["inv_type"].asInteger();
bool voice = true;
@@ -1574,8 +1585,8 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
{
// create a normal IM session
session_id = gIMMgr->addP2PSession(
- mPayload["session_name"].asString(),
- mPayload["caller_id"].asUUID(),
+ session_name,
+ caller_id,
mPayload["session_handle"].asString(),
mPayload["session_uri"].asString());
@@ -1593,10 +1604,38 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
}
else
{
- LLUUID new_session_id = gIMMgr->addSession(
- mPayload["session_name"].asString(),
- type,
- session_id);
+ //session name should not be empty, but it can contain spaces so we don't trim
+ std::string correct_session_name = session_name;
+ if (session_name.empty())
+ {
+ llwarns << "Received an empty session name from a server" << llendl;
+
+ switch(type){
+ case IM_SESSION_CONFERENCE_START:
+ case IM_SESSION_GROUP_START:
+ case IM_SESSION_INVITE:
+ if (gAgent.isInGroup(session_id))
+ {
+ LLGroupData data;
+ if (!gAgent.getGroupData(session_id, data)) break;
+ correct_session_name = data.mName;
+ }
+ else
+ {
+ if (gCacheName->getFullName(caller_id, correct_session_name))
+ {
+ correct_session_name.append(ADHOC_NAME_SUFFIX);
+ }
+ }
+ llinfos << "Corrected session name is " << correct_session_name << llendl;
+ break;
+ default:
+ llwarning("Received an empty session name from a server and failed to generate a new proper session name", 0);
+ break;
+ }
+ }
+
+ LLUUID new_session_id = gIMMgr->addSession(correct_session_name, type, session_id);
if (new_session_id != LLUUID::null)
{
LLIMFloater::show(new_session_id);
@@ -2023,6 +2062,12 @@ LLUUID LLIMMgr::addSession(
return LLUUID::null;
}
+ if (name.empty())
+ {
+ llwarning("Session name cannot be null!", 0);
+ return LLUUID::null;
+ }
+
LLUUID session_id = computeSessionID(dialog,other_participant_id);
bool new_session = !LLIMModel::getInstance()->findIMSession(session_id);
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index d85a4cda82..3fc1a00868 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -142,6 +142,7 @@ public:
/**
* Create new session object in a model
+ * @param name session name should not be empty, will return false if empty
*/
bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id,
const std::vector<LLUUID>& ids = std::vector<LLUUID>());
@@ -298,6 +299,7 @@ public:
/**
* Creates a P2P session with the requisite handle for responding to voice calls.
*
+ * @param name session name, cannot be null
* @param caller_uri - sip URI of caller. It should be always be passed into the method to avoid
* incorrect working of LLVoiceChannel instances. See EXT-2985.
*/