29 using System.Collections.Generic;
30 using System.Reflection;
34 using OpenSim.Framework;
37 using OpenSim.Region.Framework.Interfaces;
38 using OpenSim.Region.Framework.Scenes;
39 using OpenSim.Services.Interfaces;
43 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"DialogModule")]
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 public Type ReplaceableInterface {
get {
return null; } }
66 "Users",
this,
"alert",
"alert <message>",
67 "Send an alert to everyone",
68 HandleAlertConsoleCommand);
71 "Users",
this,
"alert-user",
72 "alert-user <first> <last> <message>",
73 "Send an alert to a user",
74 HandleAlertConsoleCommand);
86 public string Name {
get {
return "Dialog Module"; } }
90 SendAlertToUser(client, message,
false);
96 client.SendAgentAlertMessage(message, modal);
101 SendAlertToUser(agentID, message,
false);
109 sp.ControllingClient.SendAgentAlertMessage(message, modal);
113 string message,
bool modal)
117 if (presence != null)
119 presence.ControllingClient.SendAgentAlertMessage(message,
126 m_scene.ForEachRootClient(delegate(
IClientAPI client)
128 client.SendAlertMessage(message);
133 UUID objectID, UUID ownerID,
string message, UUID textureID,
134 int ch,
string[] buttonlabels)
136 string username = m_scene.UserManagementModule.GetUserName(ownerID);
137 string ownerFirstName, ownerLastName = String.Empty;
138 if (!
String.IsNullOrEmpty(username))
140 string[] parts = username.Split(
' ');
141 ownerFirstName = parts[0];
142 if (parts.Length > 1)
143 ownerLastName = username.Split(
' ')[1];
147 ownerFirstName =
"(unknown";
148 ownerLastName =
"user)";
154 sp.ControllingClient.SendDialog(objectName, objectID, ownerID,
155 ownerFirstName, ownerLastName, message, textureID, ch,
161 UUID objectID, UUID ownerID,
bool groupOwned,
string message,
168 sp.ControllingClient.SendLoadURL(objectName, objectID,
169 ownerID, groupOwned, message, url);
174 int chatChannel,
string name, UUID objectid, UUID ownerID)
176 string username = m_scene.UserManagementModule.GetUserName(ownerID);
177 string ownerFirstName, ownerLastName = String.Empty;
178 if (!
String.IsNullOrEmpty(username))
180 string[] parts = username.Split(
' ');
181 ownerFirstName = parts[0];
182 if (parts.Length > 1)
183 ownerLastName = username.Split(
' ')[1];
187 ownerFirstName =
"(unknown";
188 ownerLastName =
"user)";
195 sp.ControllingClient.SendTextBoxRequest(message, chatChannel,
196 name, ownerID, ownerFirstName, ownerLastName,
202 string fromAvatarName,
string message)
204 m_scene.ForEachRootClient(delegate(
IClientAPI client)
206 client.SendAgentAlertMessage(
219 if (m_scene.ConsoleScene() != null &&
220 m_scene.ConsoleScene() != m_scene)
225 string message = string.Empty;
227 if (cmdparams[0].ToLower().Equals(
"alert"))
229 message = CombineParams(cmdparams, 1);
230 m_log.InfoFormat(
"[DIALOG]: Sending general alert in region {0} with message {1}",
231 m_scene.RegionInfo.RegionName, message);
232 SendGeneralAlert(message);
234 else if (cmdparams.Length > 3)
236 string firstName = cmdparams[1];
237 string lastName = cmdparams[2];
238 message = CombineParams(cmdparams, 3);
239 m_log.InfoFormat(
"[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
240 m_scene.RegionInfo.RegionName, firstName, lastName,
242 SendAlertToUser(firstName, lastName, message,
false);
246 MainConsole.Instance.Output(
247 "Usage: alert <message> | alert-user <first> <last> <message>");
252 private string CombineParams(
string[] commandParams,
int pos)
254 string result = string.Empty;
255 for (
int i = pos; i < commandParams.Length; i++)
257 result += commandParams[i] +
" ";
void SendAlertToUser(UUID agentID, string message)
Send a non-modal alert message to a particular user.
void HandleAlertConsoleCommand(string module, string[] cmdparams)
Handle an alert command from the console.
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void SendDialogToUser(UUID avatarID, string objectName, UUID objectID, UUID ownerID, string message, UUID textureID, int ch, string[] buttonlabels)
Send a dialog box to a particular user.
void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerID)
Send a textbox entry for the client to respond to
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void SendUrlToUser(UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url)
Send a url to a particular user.
void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message)
Send a notification to all users in the scene. This notification should remain around until the user ...
void SendAlertToUser(IClientAPI client, string message, bool modal)
Send an alert message to a particular user.
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void SendAlertToUser(IClientAPI client, string message)
Send a non-modal alert message to a particular user. This can disappear from the user's view after a ...
void SendGeneralAlert(string message)
Send an alert message to all users in the scene.
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void SendAlertToUser(UUID agentID, string message, bool modal)
Send an alert message to a particular user.
void SendAlertToUser(string firstName, string lastName, string message, bool modal)
Send an alert message to a particular user.
Interactive OpenSim region server
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...