* refactor: Make some direct IClientAPI calls go through the dialog module instead

0.6.2-post-fixes
Justin Clarke Casey 2009-01-07 20:46:28 +00:00
parent 1aa9e63428
commit b97a51d7d0
3 changed files with 36 additions and 10 deletions

View File

@ -27,11 +27,27 @@
using System; using System;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IDialogModule public interface IDialogModule
{ {
/// <summary>
/// Send a non-modal alert message to a particular user.
/// </summary>
/// <param name="client"></param>
/// <param name="message"></param>
void SendAlertToUser(IClientAPI client, string message);
/// <summary>
/// Send an alert message to a particular user.
/// </summary>
/// <param name="client"></param>
/// <param name="message"></param>
/// <param name="modal"></param>
void SendAlertToUser(IClientAPI client, string message, bool modal);
/// <summary> /// <summary>
/// Send a non-modal alert message to a particular user. /// Send a non-modal alert message to a particular user.
/// </summary> /// </summary>

View File

@ -53,6 +53,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Dialog
public string Name { get { return "Dialog Module"; } } public string Name { get { return "Dialog Module"; } }
public bool IsSharedModule { get { return false; } } public bool IsSharedModule { get { return false; } }
public void SendAlertToUser(IClientAPI client, string message)
{
SendAlertToUser(client, message, false);
}
public void SendAlertToUser(IClientAPI client, string message, bool modal)
{
client.SendAgentAlertMessage(message, modal);
}
public void SendAlertToUser(UUID agentID, string message) public void SendAlertToUser(UUID agentID, string message)
{ {
SendAlertToUser(agentID, message, false); SendAlertToUser(agentID, message, false);
@ -64,7 +74,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Dialog
if (sp != null) if (sp != null)
sp.ControllingClient.SendAgentAlertMessage(message, modal); sp.ControllingClient.SendAgentAlertMessage(message, modal);
} }
public void SendAlertToUser(string firstName, string lastName, string message, bool modal) public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
{ {

View File

@ -2506,11 +2506,11 @@ namespace OpenSim.Region.Environment.Scenes
CommsManager.UserService.UpdateUserProfile(UserProfile); CommsManager.UserService.UpdateUserProfile(UserProfile);
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
remoteClient.SendAgentAlertMessage("Home position set.",false); m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
} }
else else
{ {
remoteClient.SendAgentAlertMessage("Set Home request Failed",false); m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
} }
} }
@ -3469,7 +3469,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
m_scenePresences[agentID].ControllingClient.SendAgentAlertMessage("Request for god powers denied", false); m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied");
} }
} }
} }
@ -3567,8 +3567,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
if (m_scenePresences.ContainsKey(godID)) m_dialogModule.SendAlertToUser(godID, "Kick request denied");
m_scenePresences[godID].ControllingClient.SendAgentAlertMessage("Kick request denied", false);
} }
} }
} }
@ -4209,7 +4208,7 @@ namespace OpenSim.Region.Environment.Scenes
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
{ {
remoteClient.SendAgentAlertMessage("This item doesn't appear to be for sale", false); m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
return false; return false;
} }
@ -4250,7 +4249,7 @@ namespace OpenSim.Region.Environment.Scenes
if ((perms & (uint)PermissionMask.Transfer) == 0) if ((perms & (uint)PermissionMask.Transfer) == 0)
{ {
remoteClient.SendAgentAlertMessage("This item doesn't appear to be for sale", false); m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
return false; return false;
} }
@ -4296,7 +4295,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
remoteClient.SendAgentAlertMessage("Cannot buy now. Your inventory is unavailable", false); m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
return false; return false;
} }
break; break;
@ -4319,7 +4318,8 @@ namespace OpenSim.Region.Environment.Scenes
if (!okToSell) if (!okToSell)
{ {
remoteClient.SendAgentAlertMessage("This item's inventory doesn't appear to be for sale", false); m_dialogModule.SendAlertToUser(
remoteClient, "This item's inventory doesn't appear to be for sale");
return false; return false;
} }