Add option "Add to Conference" to Conference chats and Instant Messages

Sync code from upstream for inviting people to conference via Avatar Picker
This commit is contained in:
Lirusaito
2019-01-08 11:27:51 -05:00
parent adba4cf1fa
commit 022fba2ba4
16 changed files with 150 additions and 9 deletions

View File

@@ -42,6 +42,7 @@
#include "llavatarnamecache.h"
#include "llbutton.h"
#include "llcombobox.h"
#include "llfloateravatarpicker.h"
#include "llfloaterchat.h"
#include "llfloaterinventory.h"
#include "llfloaterwebcontent.h" // For web browser display of logs
@@ -980,6 +981,96 @@ bool LLFloaterIMPanel::isInviteAllowed() const
return mSessionType == ADHOC_SESSION;
}
void LLFloaterIMPanel::onAddButtonClicked()
{
LLView * button = findChild<LLButton>("instant_message_flyout");
LLFloater* root_floater = gFloaterView->getParentFloater(this);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMPanel::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button);
if (!picker)
{
return;
}
// Need to disable 'ok' button when selected users are already in conversation.
picker->setOkBtnEnableCb(boost::bind(&LLFloaterIMPanel::canAddSelectedToChat, this, _1));
if (root_floater)
{
root_floater->addDependentFloater(picker);
}
}
bool LLFloaterIMPanel::canAddSelectedToChat(const uuid_vec_t& uuids) const
{
switch (mSessionType)
{
case P2P_SESSION: return true; // Don't bother blocking self or peer
case ADHOC_SESSION:
{
// For a conference session we need to check against the list from LLSpeakerMgr,
// because this list may change when participants join or leave the session.
LLSpeakerMgr::speaker_list_t speaker_list;
LLIMSpeakerMgr* speaker_mgr = getSpeakerManager();
if (speaker_mgr)
{
speaker_mgr->getSpeakerList(&speaker_list, true);
}
for (const auto& id : uuids)
for (const LLPointer<LLSpeaker>& speaker : speaker_list)
if (id == speaker->mID)
return false;
}
return true;
default: return false;
}
}
void LLFloaterIMPanel::addSessionParticipants(const uuid_vec_t& uuids)
{
if (mSessionType == P2P_SESSION)
{
LLSD payload;
LLSD args;
LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload,
boost::bind(&LLFloaterIMPanel::addP2PSessionParticipants, this, _1, _2, uuids));
}
else inviteToSession(uuids);
}
void LLFloaterIMPanel::addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option != 0)
{
return;
}
LLVoiceChannel* voice_channel = LLActiveSpeakerMgr::getInstance()->getVoiceChannel();
// first check whether this is a voice session
bool is_voice_call = voice_channel != nullptr && voice_channel->getSessionID() == mSessionUUID && voice_channel->isActive();
uuid_vec_t temp_ids;
// Add the initial participant of a P2P session
temp_ids.push_back(mOtherParticipantUUID);
temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end());
// Start a new ad hoc voice call if we invite new participants to a P2P call,
// or start a text chat otherwise.
if (is_voice_call)
{
LLAvatarActions::startAdhocCall(temp_ids);
}
else
{
LLAvatarActions::startConference(temp_ids);
}
}
void LLFloaterIMPanel::removeDynamics(LLComboBox* flyout)
{
flyout->remove(mDing ? getString("ding on") : getString("ding off"));
@@ -1012,8 +1103,12 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
{
if (value.isUndefined() || value.asInteger() == 0)
{
LLAvatarActions::showProfile(mOtherParticipantUUID);
return;
switch (mSessionType)
{
case GROUP_SESSION: LLGroupActions::show(mOtherParticipantUUID); return;
case P2P_SESSION: LLAvatarActions::showProfile(mOtherParticipantUUID); return;
default: onClickHistory(); return; // If there's no profile for this type, we should be the history button.
}
}
switch (int option = value.asInteger())
@@ -1026,6 +1121,7 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
case -1: copy_profile_uri(mOtherParticipantUUID); break;
case -2: LLAvatarActions::showOnMap(mOtherParticipantUUID); break;
case -3: gAgentCamera.lookAtObject(mOtherParticipantUUID); break;
case -4: onAddButtonClicked(); break;
default: // Options >= 6 use dynamic items
{
// First remove them all

View File

@@ -165,6 +165,11 @@ private:
// test if local agent can add agents.
bool isInviteAllowed() const;
void onAddButtonClicked();
void addSessionParticipants(const uuid_vec_t& uuids);
void addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids);
bool canAddSelectedToChat(const uuid_vec_t& uuids) const;
// Called whenever the user starts or stops typing.
// Sends the typing state to the other user if necessary.
void setTyping(bool typing);

View File

@@ -10,7 +10,7 @@
<string name="default_text_label">Für Instant Message hier klicken.</string>
<layout_stack name="panels">
<layout_panel name="im_contents_panel">
<button label="Verlauf" name="history_btn"/>
<flyout_button label="Verlauf" name="instant_message_flyout"/>
<button label="Anrufen" name="start_call_btn"/>
<button label="Anruf beenden" name="end_call_btn"/>
<button label="&lt; &lt;" label_selected="&gt; &gt;" name="toggle_active_speakers_btn" tool_tip="Klicken Sie hier um eine Liste der aktiven Teilnehmer dieser IM-Sitzung anzuzeigen."/>

View File

@@ -8,7 +8,7 @@
<string name="typing_start_string">[NAME] tippt...</string>
<string name="session_start_string">Beginne Sitzung mit [NAME], bitte warten.</string>
<string name="default_text_label">Für Instant Message hier klicken.</string>
<button label="Verlauf" name="history_btn"/>
<flyout_button label="Verlauf" name="instant_message_flyout"/>
<button label="Anrufen" name="start_call_btn"/>
<button label="Anruf beenden" name="end_call_btn"/>
<button label="&lt; &lt;" label_selected="&gt; &gt;" name="toggle_active_speakers_btn" tool_tip="Klicken Sie hier um eine Liste der aktiven Teilnehmer dieser IM-Sitzung anzuzeigen."/>

View File

@@ -1580,6 +1580,10 @@ Inventarobjekt(e) verschieben?<usetemplate name="okcancelignore" yestext="OK"/><
<notification name="NoSupportUrl">Das Grid hat keinen Supportlink.</notification>
<notification name="ConfirmAddingChatParticipants">
Wenn Sie eine Person zu einer vorhandenen Unterhaltung hinzufügen, wird eine neue Unterhaltung erstellt. Alle Teilnehmer erhalten neue Unterhaltungsbenachrichtigungen.
<usetemplate ignoretext="Hinzufügen von Chat-Teilnehmern bestätigen" name="okcancelignore" notext="Abbrechen" yestext="OK"/>
</notification>
<notification name="ConfirmQuit">Wirklich beenden?<usetemplate name="okcancelignore" yestext="Beenden"/></notification>
<notification name="HelpReportAbuseEmailLL">Verwenden Sie dieses Tool, um Verletzungen der Servicebedingungen und Community-Standards zu melden. Siehe:

View File

@@ -15,6 +15,7 @@
<flyout_button_item label="Request Teleport" name="request_teleport_item" value="3"/>
<flyout_button_item label="Invite To Group" name="group_invite_item" value="5"/>
<flyout_button_item label="Copy SLURL" name="copy_slurl_item" value="-1"/>
<flyout_button_item label="Add to Conference" name="conference" value="-4"/>
</flyout_button>
<string name="find on map" value="Find on Map"/>
<string name="ding on" value="Ding on new messages (On)"/>

View File

@@ -10,7 +10,9 @@
<string name="default_text_label">Click here to instant message.</string>
<layout_stack border="false" bottom="0" follows="left|top|right|bottom" height="180" left="0" orientation="horizontal" tab_group="1" width="496" name="panels">
<layout_panel border="false" bottom="0" default_tab_group="1" follows="left|top|bottom|right" height="195" left="0" min_width="115" name="im_contents_panel" width="495">
<button bottom="-20" follows="left|top" height="20" label="History" left="5" name="history_btn" width="80"/>
<flyout_button bottom="-20" follows="left|top" halign="center" height="20" label="History" left="5" name="instant_message_flyout" width="80" list_position="below">
<flyout_button_item label="Add to Conference" name="conference" value="-4"/>
</flyout_button>
<button bottom_delta="0" follows="left|top" height="20" left_delta="80" width="50" toggle="true" name="ding_btn" label="Ding">
<button.commit_callback function="FlipDing"/>
</button>

View File

@@ -8,7 +8,9 @@
<string name="typing_start_string">[NAME] is typing...</string>
<string name="session_start_string">Starting session with [NAME], please wait.</string>
<string name="default_text_label">Click here to instant message.</string>
<button bottom="-20" follows="right|top" height="20" label="History" right="-210" name="history_btn" width="80"/>
<flyout_button bottom="-20" follows="right|top" halign="center" height="20" label="History" right="-210" name="instant_message_flyout" width="80" list_position="below">
<flyout_button_item label="Add to Conference" name="conference" value="-4"/>
</flyout_button>
<button bottom_delta="0" follows="right|top" height="20" left_delta="80" width="50" toggle="true" name="ding_btn" label="Ding">
<button.commit_callback function="FlipDing"/>
</button>

View File

@@ -19,6 +19,7 @@
<flyout_button_item label="Pay" name="pay_item" value="4"/>
<flyout_button_item label="Invite To Group" name="group_invite_item" value="5"/>
<flyout_button_item label="Copy SLURL" name="copy_slurl_item" value="-1"/>
<flyout_button_item label="Add to Conference" name="conference" value="-4"/>
</flyout_button>
<string name="find on map" value="Find on Map"/>
<string name="ding on" value="Ding on new messages (On)"/>

View File

@@ -5362,6 +5362,20 @@ Visit the [SECOND_LIFE] Support Web site?
type="alertmodal">
This grid has no link for support.
</notification>
<notification
icon="alertmodal.tga"
name="ConfirmAddingChatParticipants"
type="alertmodal">
<unique/>
When you add a person to an existing conversation, a new conversation will be created. All participants will receive new conversation notifications.
<tag>confirm</tag>
<usetemplate
ignoretext="Confirm adding chat paticipants"
name="okcancelignore"
notext="Cancel"
yestext="Ok"/>
</notification>
<notification
icon="alertmodal.tga"

View File

@@ -26,7 +26,7 @@
</string>
<layout_stack name="panels">
<layout_panel name="im_contents_panel">
<button label="Historial" name="history_btn"/>
<flyout_button label="Historial" name="instant_message_flyout"/>
<button name="ding_btn" label="Timbre"/>
<button label="Llamar" name="start_call_btn"/>
<button label="Colgar" name="end_call_btn"/>

View File

@@ -21,7 +21,7 @@
<string name="default_text_label">
Pulsa aquí para un Mensaje Instantáneo.
</string>
<button label="Historial" name="history_btn"/>
<flyout_button label="Historial" name="instant_message_flyout"/>
<button name="ding_btn" label="Timbre"/>
<button label="Llamar" name="start_call_btn"/>
<button label="Colgar" name="end_call_btn" width="90"/>

View File

@@ -2867,7 +2867,10 @@ Dado que estos objetos tienen scripts, moverlos a tu inventario puede provocar u
<notification name="NoSupportUrl">
Este grid no tiene enlace para consultar por Soporte.
</notification>
<notification name="ConfirmAddingChatParticipants">
Si agregas una persona a una conversación en curso, se creará una conversación nueva. Todos los participantes recibirán notificaciones de la nueva conversación.
<usetemplate ignoretext="Confirmar agregar participantes al chat" name="okcancelignore" notext="Cancelar" yestext="Aceptar"/>
</notification>
<notification name="ConfirmQuit">
¿Estás seguro de que quieres salir?
<usetemplate ignoretext="Cuando esté saliendo de [APP_NAME]." name="okcancelignore" notext="Continuar" yestext="Salir"/>

View File

@@ -2349,6 +2349,11 @@ Visiter les pages d'aide de Second Life.
<usetemplate ignoretext="Lors de la visite des pages d'aide de Second Life" name="okcancelignore" notext="Annuler" yestext="Aller"/>
</notification>
<notification name="ConfirmAddingChatParticipants">
Quand vous ajoutez une personne à une conversation existante, une nouvelle conversation est créée. Tous les participants recevront les notifications de nouvelle conversation.
<usetemplate ignoretext="Confirmer l&apos;ajout de participants au chat" name="okcancelignore" notext="Annuler" yestext="OK"/>
</notification>
<notification name="ConfirmQuit">
Etes-vous certain(e) de vouloir quitter ?
<usetemplate ignoretext="Lorsque vous quittez [APP_NAME]" name="okcancelignore" notext="Continuer" yestext="Quitter"/>

View File

@@ -2010,6 +2010,10 @@ Trasferisci gli elementi nell&apos;inventario?
Visita il sito di supporto di Second Life?
<usetemplate ignoretext="Quando visiti il sito del supporto di Second Life." name="okcancelignore" notext="Annulla" yestext="Vai"/>
</notification>
<notification name="ConfirmAddingChatParticipants">
Quando aggiungi una persona a una conversazione esistente, viene creata una nuova conversazione. Tutti i partecipanti riceveranno notifiche per la nuova conversazione.
<usetemplate ignoretext="Conferma l&apos;aggiunta dei partecipanti alla chat" name="okcancelignore" notext="Annulla" yestext="Ok"/>
</notification>
<notification name="ConfirmQuit">
Confermi di voler uscire?
<usetemplate ignoretext="Quando esci da Second Life." name="okcancelignore" notext="Continua" yestext="Esci"/>

View File

@@ -2597,6 +2597,10 @@ Mover para o inventário o(s) item(s)?
<usetemplate ignoretext="Quando visitando o website de Suporte do Second Life" name="okcancelignore" notext="Cancelar" yestext="Ir"/>
</notification>
<notification name="ConfirmAddingChatParticipants">
Quando você adiciona uma pessoa a uma conversa existente, uma nova conversa é criada. Todos os participantes recebem notificações sobre a nova conversa.
<usetemplate ignoretext="Confirme a inclusão de participantes no bate-papo" name="okcancelignore" notext="Cancelar" yestext="Ok"/>
</notification>
<notification name="ConfirmQuit">
Tem certeza que deseja sair?
<usetemplate ignoretext="Quando Saindo do [APP_NAME]." name="okcancelignore" notext="Continuar" yestext="Sair"/>