aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2010-08-21 00:32:26 +0100
committerMelanie2010-08-21 00:32:26 +0100
commitf8ff98577ef3e576326c6eea28cb12ebb4e0bdc4 (patch)
tree3ef10e646ddda95929142eb2c3774b42d0923b3b /OpenSim/Region
parentForward-port a small improvement to the land out connector (diff)
parentForward-port a small improvement to the land out connector (diff)
downloadopensim-SC_OLD-f8ff98577ef3e576326c6eea28cb12ebb4e0bdc4.zip
opensim-SC_OLD-f8ff98577ef3e576326c6eea28cb12ebb4e0bdc4.tar.gz
opensim-SC_OLD-f8ff98577ef3e576326c6eea28cb12ebb4e0bdc4.tar.bz2
opensim-SC_OLD-f8ff98577ef3e576326c6eea28cb12ebb4e0bdc4.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs65
-rw-r--r--OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs465
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs95
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs9
7 files changed, 347 insertions, 319 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index bbc42e6..072e4d3 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -308,8 +308,13 @@ namespace OpenSim
308 "Persist objects to the database now", RunCommand); 308 "Persist objects to the database now", RunCommand);
309 309
310 m_console.Commands.AddCommand("region", false, "create region", 310 m_console.Commands.AddCommand("region", false, "create region",
311 "create region", 311 "create region [\"region name\"] <region_file.ini>",
312 "Create a new region", HandleCreateRegion); 312 "Create a new region.",
313 "The settings for \"region name\" are read from <region_file.ini>."
314 + " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
315 + "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
316 + "If <region_file.ini> does not exist, it will be created.",
317 HandleCreateRegion);
313 318
314 m_console.Commands.AddCommand("region", false, "restart", 319 m_console.Commands.AddCommand("region", false, "restart",
315 "restart", 320 "restart",
@@ -513,47 +518,47 @@ namespace OpenSim
513 /// Creates a new region based on the parameters specified. This will ask the user questions on the console 518 /// Creates a new region based on the parameters specified. This will ask the user questions on the console
514 /// </summary> 519 /// </summary>
515 /// <param name="module"></param> 520 /// <param name="module"></param>
516 /// <param name="cmd">0,1,region name, region XML file</param> 521 /// <param name="cmd">0,1,region name, region ini or XML file</param>
517 private void HandleCreateRegion(string module, string[] cmd) 522 private void HandleCreateRegion(string module, string[] cmd)
518 { 523 {
519 if (cmd.Length < 4) 524 string regionName = string.Empty;
525 string regionFile = string.Empty;
526 if (cmd.Length == 3)
520 { 527 {
521 MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); 528 regionFile = cmd[2];
529 }
530 else if (cmd.Length > 3)
531 {
532 regionName = cmd[2];
533 regionFile = cmd[3];
534 }
535 string extension = Path.GetExtension(regionFile).ToLower();
536 bool isXml = extension.Equals(".xml");
537 bool isIni = extension.Equals(".ini");
538 if (!isXml && !isIni)
539 {
540 MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>");
522 return; 541 return;
523 } 542 }
524 if (cmd[3].EndsWith(".xml")) 543 if (!Path.IsPathRooted(regionFile))
525 { 544 {
526 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); 545 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
527 string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]); 546 regionFile = Path.Combine(regionsDir, regionFile);
528 // Allow absolute and relative specifiers
529 if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
530 regionFile = cmd[3];
531
532 IScene scene;
533 RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source);
534 PopulateRegionEstateInfo(regInfo);
535 CreateRegion(regInfo, true, out scene);
536 regInfo.EstateSettings.Save();
537 } 547 }
538 else if (cmd[3].EndsWith(".ini")) 548
549 RegionInfo regInfo;
550 if (isXml)
539 { 551 {
540 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); 552 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
541 string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]);
542 // Allow absolute and relative specifiers
543 if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
544 regionFile = cmd[3];
545
546 IScene scene;
547 RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]);
548 PopulateRegionEstateInfo(regInfo);
549 CreateRegion(regInfo, true, out scene);
550 regInfo.EstateSettings.Save();
551 } 553 }
552 else 554 else
553 { 555 {
554 MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); 556 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
555 return;
556 } 557 }
558 IScene scene;
559 PopulateRegionEstateInfo(regInfo);
560 CreateRegion(regInfo, true, out scene);
561 regInfo.EstateSettings.Save();
557 } 562 }
558 563
559 /// <summary> 564 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
index a6f5d97..c023a6f 100644
--- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
@@ -109,9 +109,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
109 Caps caps 109 Caps caps
110 = new Caps(m_scene, 110 = new Caps(m_scene,
111 m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, 111 m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
112 MainServer.Instance.Port, 112 (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
113 capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); 113 capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName);
114 114
115 caps.RegisterHandlers(); 115 caps.RegisterHandlers();
116 116
117 m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); 117 m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
@@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
121 caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset; 121 caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset;
122 caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS; 122 caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS;
123 caps.GetClient = m_scene.SceneContents.GetControllingClient; 123 caps.GetClient = m_scene.SceneContents.GetControllingClient;
124 124
125 m_capsHandlers[agentId] = caps; 125 m_capsHandlers[agentId] = caps;
126 } 126 }
127 127
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 1498dba..a514a83 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -1,223 +1,242 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35 35
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40namespace OpenSim.Region.CoreModules.Avatar.Dialog 40namespace OpenSim.Region.CoreModules.Avatar.Dialog
41{ 41{
42 public class DialogModule : IRegionModule, IDialogModule 42 public class DialogModule : IRegionModule, IDialogModule
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 protected Scene m_scene; 46 protected Scene m_scene;
47 47
48 public void Initialise(Scene scene, IConfigSource source) 48 public void Initialise(Scene scene, IConfigSource source)
49 { 49 {
50 m_scene = scene; 50 m_scene = scene;
51 m_scene.RegisterModuleInterface<IDialogModule>(this); 51 m_scene.RegisterModuleInterface<IDialogModule>(this);
52 52
53 m_scene.AddCommand( 53 m_scene.AddCommand(
54 this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand); 54 this, "alert", "alert <first> <last> <message>",
55 55 "Send an alert to a user",
56 m_scene.AddCommand( 56 HandleAlertConsoleCommand);
57 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand); 57
58 58 m_scene.AddCommand(
59 m_scene.AddCommand( 59 this, "alert general", "alert [general] <message>",
60 this, "alert dialog", "alert dialog <message>", "Send a dialog alert to everyone", HandleAlertConsoleCommand); 60 "Send an alert to everyone",
61 61 "If keyword 'general' is omitted, then <message> must be surrounded by quotation marks.",
62 62 HandleAlertConsoleCommand);
63 } 63 }
64 64
65 public void PostInitialise() {} 65 public void PostInitialise() {}
66 public void Close() {} 66 public void Close() {}
67 public string Name { get { return "Dialog Module"; } } 67 public string Name { get { return "Dialog Module"; } }
68 public bool IsSharedModule { get { return false; } } 68 public bool IsSharedModule { get { return false; } }
69 69
70 public void SendAlertToUser(IClientAPI client, string message) 70 public void SendAlertToUser(IClientAPI client, string message)
71 { 71 {
72 SendAlertToUser(client, message, false); 72 SendAlertToUser(client, message, false);
73 } 73 }
74 74
75 public void SendAlertToUser(IClientAPI client, string message, bool modal) 75 public void SendAlertToUser(IClientAPI client, string message, bool modal)
76 { 76 {
77 client.SendAgentAlertMessage(message, modal); 77 client.SendAgentAlertMessage(message, modal);
78 } 78 }
79 79
80 public void SendAlertToUser(UUID agentID, string message) 80 public void SendAlertToUser(UUID agentID, string message)
81 { 81 {
82 SendAlertToUser(agentID, message, false); 82 SendAlertToUser(agentID, message, false);
83 } 83 }
84 84
85 public void SendAlertToUser(UUID agentID, string message, bool modal) 85 public void SendAlertToUser(UUID agentID, string message, bool modal)
86 { 86 {
87 ScenePresence sp = m_scene.GetScenePresence(agentID); 87 ScenePresence sp = m_scene.GetScenePresence(agentID);
88 88
89 if (sp != null) 89 if (sp != null)
90 sp.ControllingClient.SendAgentAlertMessage(message, modal); 90 sp.ControllingClient.SendAgentAlertMessage(message, modal);
91 } 91 }
92 92
93 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 93 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
94 { 94 {
95 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); 95 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
96 if (presence != null) 96 if (presence != null)
97 presence.ControllingClient.SendAgentAlertMessage(message, modal); 97 presence.ControllingClient.SendAgentAlertMessage(message, modal);
98 } 98 }
99 99
100 public void SendGeneralAlert(string message) 100 public void SendGeneralAlert(string message)
101 { 101 {
102 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 102 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
103 { 103 {
104 if (!presence.IsChildAgent) 104 if (!presence.IsChildAgent)
105 { 105 presence.ControllingClient.SendAlertMessage(message);
106 presence.ControllingClient.SendAlertMessage(message); 106 });
107 } 107 }
108 }); 108
109 } 109 public void SendDialogToUser(
110 110 UUID avatarID, string objectName, UUID objectID, UUID ownerID,
111 public void SendDialogToUser( 111 string message, UUID textureID, int ch, string[] buttonlabels)
112 UUID avatarID, string objectName, UUID objectID, UUID ownerID, 112 {
113 string message, UUID textureID, int ch, string[] buttonlabels) 113 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID);
114 { 114 string ownerFirstName, ownerLastName;
115 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); 115 if (account != null)
116 string ownerFirstName, ownerLastName; 116 {
117 if (account != null) 117 ownerFirstName = account.FirstName;
118 { 118 ownerLastName = account.LastName;
119 ownerFirstName = account.FirstName; 119 }
120 ownerLastName = account.LastName; 120 else
121 } 121 {
122 else 122 ownerFirstName = "(unknown";
123 { 123 ownerLastName = "user)";
124 ownerFirstName = "(unknown"; 124 }
125 ownerLastName = "user)"; 125
126 } 126 ScenePresence sp = m_scene.GetScenePresence(avatarID);
127 127 if (sp != null)
128 ScenePresence sp = m_scene.GetScenePresence(avatarID); 128 sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels);
129 if (sp != null) 129 }
130 sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); 130
131 } 131 public void SendUrlToUser(
132 132 UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url)
133 public void SendUrlToUser( 133 {
134 UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) 134 ScenePresence sp = m_scene.GetScenePresence(avatarID);
135 { 135
136 ScenePresence sp = m_scene.GetScenePresence(avatarID); 136 if (sp != null)
137 137 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url);
138 if (sp != null) 138 }
139 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); 139
140 } 140 public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid)
141 141 {
142 public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) 142 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid);
143 { 143 string ownerFirstName, ownerLastName;
144 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); 144 if (account != null)
145 string ownerFirstName, ownerLastName; 145 {
146 if (account != null) 146 ownerFirstName = account.FirstName;
147 { 147 ownerLastName = account.LastName;
148 ownerFirstName = account.FirstName; 148 }
149 ownerLastName = account.LastName; 149 else
150 } 150 {
151 else 151 ownerFirstName = "(unknown";
152 { 152 ownerLastName = "user)";
153 ownerFirstName = "(unknown"; 153 }
154 ownerLastName = "user)"; 154
155 } 155 ScenePresence sp = m_scene.GetScenePresence(avatarid);
156 156
157 ScenePresence sp = m_scene.GetScenePresence(avatarid); 157 if (sp != null)
158 158 sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid);
159 if (sp != null) 159 }
160 sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid); 160
161 } 161 public void SendNotificationToUsersInRegion(
162 162 UUID fromAvatarID, string fromAvatarName, string message)
163 public void SendNotificationToUsersInRegion( 163 {
164 UUID fromAvatarID, string fromAvatarName, string message) 164 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
165 { 165 {
166 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 166 if (!presence.IsChildAgent)
167 { 167 presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
168 if (!presence.IsChildAgent) 168 });
169 presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); 169 }
170 }); 170
171 } 171 /// <summary>
172 172 /// Handle an alert command from the console.
173 /// <summary> 173 /// </summary>
174 /// Handle an alert command from the console. 174 /// <param name="module"></param>
175 /// </summary> 175 /// <param name="cmdparams"></param>
176 /// <param name="module"></param> 176 public void HandleAlertConsoleCommand(string module, string[] cmdparams)
177 /// <param name="cmdparams"></param> 177 {
178 public void HandleAlertConsoleCommand(string module, string[] cmdparams) 178 if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene)
179 { 179 return;
180 if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) 180
181 return; 181 bool isGeneral = false;
182 182 string firstName = string.Empty;
183 if (cmdparams[1] == "general") 183 string lastName = string.Empty;
184 { 184 string message = string.Empty;
185 string message = CombineParams(cmdparams, 2); 185
186 186 if (cmdparams.Length > 1)
187 m_log.InfoFormat( 187 {
188 "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); 188 firstName = cmdparams[1];
189 SendGeneralAlert(message); 189 isGeneral = firstName.ToLower().Equals("general");
190 } 190 }
191 else if (cmdparams[1] == "dialog") 191 if (cmdparams.Length == 2 && !isGeneral)
192 { 192 {
193 string message = CombineParams(cmdparams, 2); 193 // alert "message"
194 194 message = cmdparams[1];
195 m_log.InfoFormat( 195 isGeneral = true;
196 "[DIALOG]: Sending dialog alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); 196 }
197 SendNotificationToUsersInRegion(UUID.Zero, "System", message); 197 else if (cmdparams.Length > 2 && isGeneral)
198 } 198 {
199 else 199 // alert general <message>
200 { 200 message = CombineParams(cmdparams, 2);
201 string firstName = cmdparams[1]; 201 }
202 string lastName = cmdparams[2]; 202 else if (cmdparams.Length > 3)
203 string message = CombineParams(cmdparams, 3); 203 {
204 204 // alert <first> <last> <message>
205 m_log.InfoFormat( 205 lastName = cmdparams[2];
206 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", 206 message = CombineParams(cmdparams, 3);
207 m_scene.RegionInfo.RegionName, firstName, lastName, message); 207 }
208 SendAlertToUser(firstName, lastName, message, false); 208 else
209 } 209 {
210 } 210 OpenSim.Framework.Console.MainConsole.Instance.Output(
211 211 "Usage: alert \"message\" | alert general <message> | alert <first> <last> <message>");
212 private string CombineParams(string[] commandParams, int pos) 212 return;
213 { 213 }
214 string result = string.Empty; 214
215 for (int i = pos; i < commandParams.Length; i++) 215 if (isGeneral)
216 { 216 {
217 result += commandParams[i] + " "; 217 m_log.InfoFormat(
218 } 218 "[DIALOG]: Sending general alert in region {0} with message {1}",
219 219 m_scene.RegionInfo.RegionName, message);
220 return result; 220 SendGeneralAlert(message);
221 } 221 }
222 } 222 else
223} 223 {
224 m_log.InfoFormat(
225 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
226 m_scene.RegionInfo.RegionName, firstName, lastName, message);
227 SendAlertToUser(firstName, lastName, message, false);
228 }
229 }
230
231 private string CombineParams(string[] commandParams, int pos)
232 {
233 string result = string.Empty;
234 for (int i = pos; i < commandParams.Length; i++)
235 {
236 result += commandParams[i] + " ";
237 }
238
239 return result;
240 }
241 }
242}
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index 87a0a8d..fd0e879 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
100 bool enabled = false; 100 bool enabled = false;
101 IConfig cfg = null; 101 IConfig cfg = null;
102 IConfig httpcfg = null; 102 IConfig httpcfg = null;
103 IConfig startupcfg = null; 103// IConfig startupcfg = null;
104 try 104 try
105 { 105 {
106 cfg = config.Configs["OpenGridProtocol"]; 106 cfg = config.Configs["OpenGridProtocol"];
@@ -117,14 +117,14 @@ namespace OpenSim.Region.CoreModules.InterGrid
117 { 117 {
118 118
119 } 119 }
120 try 120// try
121 { 121// {
122 startupcfg = config.Configs["Startup"]; 122// startupcfg = config.Configs["Startup"];
123 } 123// }
124 catch (NullReferenceException) 124// catch (NullReferenceException)
125 { 125// {
126 126//
127 } 127// }
128 128
129// if (startupcfg != null) 129// if (startupcfg != null)
130// { 130// {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 98c46bd..32211c4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2584,18 +2584,25 @@ namespace OpenSim.Region.Framework.Scenes
2584 /// <param name="client"></param> 2584 /// <param name="client"></param>
2585 public override void AddNewClient(IClientAPI client) 2585 public override void AddNewClient(IClientAPI client)
2586 { 2586 {
2587 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2587 bool vialogin = false; 2588 bool vialogin = false;
2588 2589
2589 m_clientManager.Add(client); 2590 if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
2591 return;
2592
2593 vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
2594 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
2590 2595
2591 CheckHeartbeat(); 2596 CheckHeartbeat();
2592 SubscribeToClientEvents(client);
2593 ScenePresence presence; 2597 ScenePresence presence;
2594 2598
2595 if (m_restorePresences.ContainsKey(client.AgentId)) 2599 if (m_restorePresences.ContainsKey(client.AgentId))
2596 { 2600 {
2597 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); 2601 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
2598 2602
2603 m_clientManager.Add(client);
2604 SubscribeToClientEvents(client);
2605
2599 presence = m_restorePresences[client.AgentId]; 2606 presence = m_restorePresences[client.AgentId];
2600 m_restorePresences.Remove(client.AgentId); 2607 m_restorePresences.Remove(client.AgentId);
2601 2608
@@ -2618,49 +2625,35 @@ namespace OpenSim.Region.Framework.Scenes
2618 } 2625 }
2619 else 2626 else
2620 { 2627 {
2621 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2628 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
2622
2623 // Do the verification here
2624 System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP();
2625 if (aCircuit != null)
2626 { 2629 {
2627 if (!VerifyClient(aCircuit, ep, out vialogin)) 2630 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2628 {
2629 // uh-oh, this is fishy
2630 m_log.WarnFormat("[SCENE]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
2631 client.AgentId, client.SessionId, ep.ToString());
2632 try
2633 {
2634 client.Close();
2635 }
2636 catch (Exception e)
2637 {
2638 m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace);
2639 }
2640 return;
2641 }
2642 }
2643 2631
2644 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); 2632 m_clientManager.Add(client);
2633 SubscribeToClientEvents(client);
2645 2634
2646 ScenePresence sp = CreateAndAddScenePresence(client); 2635 ScenePresence sp = CreateAndAddScenePresence(client);
2647 if (aCircuit != null) 2636 if (aCircuit != null)
2648 sp.Appearance = aCircuit.Appearance; 2637 sp.Appearance = aCircuit.Appearance;
2649 2638
2650 // HERE!!! Do the initial attachments right here 2639 // HERE!!! Do the initial attachments right here
2651 // first agent upon login is a root agent by design. 2640 // first agent upon login is a root agent by design.
2652 // All other AddNewClient calls find aCircuit.child to be true 2641 // All other AddNewClient calls find aCircuit.child to be true
2653 if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) 2642 if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
2654 { 2643 {
2655 sp.IsChildAgent = false; 2644 sp.IsChildAgent = false;
2656 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); 2645 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2646 }
2657 } 2647 }
2658 } 2648 }
2659 2649
2660 m_LastLogin = Util.EnvironmentTickCount(); 2650 if (GetScenePresence(client.AgentId) != null)
2661 EventManager.TriggerOnNewClient(client); 2651 {
2662 if (vialogin) 2652 m_LastLogin = Util.EnvironmentTickCount();
2663 EventManager.TriggerOnClientLogin(client); 2653 EventManager.TriggerOnNewClient(client);
2654 if (vialogin)
2655 EventManager.TriggerOnClientLogin(client);
2656 }
2664 } 2657 }
2665 2658
2666 private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) 2659 private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin)
@@ -2668,16 +2661,14 @@ namespace OpenSim.Region.Framework.Scenes
2668 vialogin = false; 2661 vialogin = false;
2669 2662
2670 // Do the verification here 2663 // Do the verification here
2671 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) 2664 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
2672 { 2665 {
2673 m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2666 m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via HG login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2674 vialogin = true; 2667 vialogin = true;
2675 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); 2668 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
2676 if (userVerification != null && ep != null) 2669 if (userVerification != null && ep != null)
2677 { 2670 {
2678 System.Net.IPAddress addr = NetworkUtil.GetExternalIPOf(ep.Address); 2671 if (!userVerification.VerifyClient(aCircuit, ep.Address.ToString()))
2679
2680 if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString()))
2681 { 2672 {
2682 // uh-oh, this is fishy 2673 // uh-oh, this is fishy
2683 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2674 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
@@ -2688,6 +2679,13 @@ namespace OpenSim.Region.Framework.Scenes
2688 } 2679 }
2689 } 2680 }
2690 2681
2682 else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
2683 {
2684 m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.",
2685 aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2686 vialogin = true;
2687 }
2688
2691 return true; 2689 return true;
2692 } 2690 }
2693 2691
@@ -3343,7 +3341,8 @@ namespace OpenSim.Region.Framework.Scenes
3343 /// also return a reason.</returns> 3341 /// also return a reason.</returns>
3344 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) 3342 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
3345 { 3343 {
3346 TeleportFlags tp = (TeleportFlags)teleportFlags; 3344 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
3345 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
3347 reason = String.Empty; 3346 reason = String.Empty;
3348 3347
3349 //Teleport flags: 3348 //Teleport flags:
@@ -3380,7 +3379,7 @@ namespace OpenSim.Region.Framework.Scenes
3380 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); 3379 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3381 3380
3382 //On login test land permisions 3381 //On login test land permisions
3383 if (tp == TeleportFlags.ViaLogin) 3382 if (vialogin)
3384 { 3383 {
3385 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3384 if (land != null && !TestLandRestrictions(agent, land, out reason))
3386 { 3385 {
@@ -3440,7 +3439,7 @@ namespace OpenSim.Region.Framework.Scenes
3440 agent.teleportFlags = teleportFlags; 3439 agent.teleportFlags = teleportFlags;
3441 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3440 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3442 3441
3443 if (tp == TeleportFlags.ViaLogin) 3442 if (vialogin)
3444 { 3443 {
3445 if (TestBorderCross(agent.startpos, Cardinals.E)) 3444 if (TestBorderCross(agent.startpos, Cardinals.E))
3446 { 3445 {
@@ -3561,7 +3560,7 @@ namespace OpenSim.Region.Framework.Scenes
3561 IPresenceService presence = RequestModuleInterface<IPresenceService>(); 3560 IPresenceService presence = RequestModuleInterface<IPresenceService>();
3562 if (presence == null) 3561 if (presence == null)
3563 { 3562 {
3564 reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName); 3563 reason = String.Format("Failed to verify user presence in the grid for {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
3565 return false; 3564 return false;
3566 } 3565 }
3567 3566
@@ -3569,7 +3568,7 @@ namespace OpenSim.Region.Framework.Scenes
3569 3568
3570 if (pinfo == null) 3569 if (pinfo == null)
3571 { 3570 {
3572 reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName); 3571 reason = String.Format("Failed to verify user presence in the grid for {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
3573 return false; 3572 return false;
3574 } 3573 }
3575 3574
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index d4f9f18..54b3260 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -130,11 +130,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
130 { 130 {
131 TestHelper.InMethod(); 131 TestHelper.InMethod();
132 //log4net.Config.XmlConfigurator.Configure(); 132 //log4net.Config.XmlConfigurator.Configure();
133 133
134 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 134 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
135 135
136 TestScene scene = SceneSetupHelpers.SetupScene(); 136 TestScene scene = SceneSetupHelpers.SetupScene();
137 137
138 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 138 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
139 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 139 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
140 sogd.Enabled = false; 140 sogd.Enabled = false;
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
147 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 147 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
148 148
149 Assert.That(retrievedPart, Is.Not.Null); 149 Assert.That(retrievedPart, Is.Not.Null);
150 150
151 sogd.InventoryDeQueueAndDelete(); 151 sogd.InventoryDeQueueAndDelete();
152 152
153 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); 153 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index 501207e..e39a362 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -104,8 +104,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
104 agent.AgentID = agent1; 104 agent.AgentID = agent1;
105 agent.firstname = firstName; 105 agent.firstname = firstName;
106 agent.lastname = "testlastname"; 106 agent.lastname = "testlastname";
107 agent.SessionID = UUID.Zero; 107 agent.SessionID = UUID.Random();
108 agent.SecureSessionID = UUID.Zero; 108 agent.SecureSessionID = UUID.Random();
109 agent.circuitcode = 123; 109 agent.circuitcode = 123;
110 agent.BaseFolder = UUID.Zero; 110 agent.BaseFolder = UUID.Zero;
111 agent.InventoryFolder = UUID.Zero; 111 agent.InventoryFolder = UUID.Zero;
@@ -114,6 +114,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
114 agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); 114 agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
115 agent.child = true; 115 agent.child = true;
116 116
117 if (scene.PresenceService == null)
118 Console.WriteLine("Presence Service is null");
119
120 scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
121
117 string reason; 122 string reason;
118 scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); 123 scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
119 testclient = new TestClient(agent, scene); 124 testclient = new TestClient(agent, scene);