From e7bb27b5bd9ae459096f1c2282a558ee872bc0c5 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Thu, 8 Jan 2009 19:14:52 +0000
Subject: * refactor: move code to send a dialog to a user from scene to
DialogModule
---
OpenSim/Region/Environment/Interfaces/IDialogModule.cs | 15 +++++++++++++++
.../Environment/Modules/Avatar/Dialog/DialogModule.cs | 10 ++++++++++
OpenSim/Region/Environment/Scenes/Scene.cs | 12 ------------
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 ++++++++++-
4 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/OpenSim/Region/Environment/Interfaces/IDialogModule.cs b/OpenSim/Region/Environment/Interfaces/IDialogModule.cs
index b55ba26..45c62bd 100644
--- a/OpenSim/Region/Environment/Interfaces/IDialogModule.cs
+++ b/OpenSim/Region/Environment/Interfaces/IDialogModule.cs
@@ -80,6 +80,21 @@ namespace OpenSim.Region.Environment.Interfaces
void SendGeneralAlert(string message);
///
+ /// Send a dialog box to a particular user.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ void SendDialogToUser(
+ UUID avatarID, string objectName, UUID objectID, UUID ownerID,
+ string message, UUID textureID, int ch, string[] buttonlabels);
+
+ ///
/// Send a notification to all users in the scene. This notification should remain around until the
/// user explicitly dismisses it.
///
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs
index 014c536..8fbe77f 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs
@@ -101,6 +101,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Dialog
}
}
+ public void SendDialogToUser(
+ UUID avatarID, string objectName, UUID objectID, UUID ownerID,
+ string message, UUID textureID, int ch, string[] buttonlabels)
+ {
+ ScenePresence sp = m_scene.GetScenePresence(avatarID);
+
+ if (sp != null)
+ sp.ControllingClient.SendDialog(objectName, objectID, ownerID, message, textureID, ch, buttonlabels);
+ }
+
public void SendNotificationToUsersInEstate(
UUID fromAvatarID, string fromAvatarName, string message)
{
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 134946b..e73d4d2 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -3377,18 +3377,6 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- public void SendDialogToUser(UUID avatarID, string objectName, UUID objectID, UUID ownerID, string message, UUID TextureID, int ch, string[] buttonlabels)
- {
- lock (m_scenePresences)
- {
- if (m_scenePresences.ContainsKey(avatarID))
- {
- m_scenePresences[avatarID].ControllingClient.SendDialog(
- objectName, objectID, ownerID, message, TextureID, ch, buttonlabels);
- }
- }
- }
-
public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms)
{
m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1afa08d..f2a8474 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5722,6 +5722,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
{
+ IDialogModule dm = World.RequestModuleInterface();
+
+ if (dm == null)
+ return;
+
m_host.AddScriptLPS(1);
UUID av = new UUID();
if (!UUID.TryParse(avatar,out av))
@@ -5749,7 +5754,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
buts[i] = buttons.Data[i].ToString();
}
- World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
+
+ dm.SendDialogToUser(
+ av, m_host.Name, m_host.UUID, m_host.OwnerID,
+ message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
+
// ScriptSleep(1000);
}
--
cgit v1.1