aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-01-29 18:59:41 -0800
committerDiva Canto2010-01-29 18:59:41 -0800
commit5001f61c08fea2ebfcb2590be69073d04d129d70 (patch)
tree08a0470b0b566f814209bfb803fbcc0959333bcd /OpenSim
parentWorks for grid login. (diff)
downloadopensim-SC-5001f61c08fea2ebfcb2590be69073d04d129d70.zip
opensim-SC-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.gz
opensim-SC-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.bz2
opensim-SC-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.xz
* HGGridConnector is no longer necessary.
* Handle logout properly. This needed an addition to IClientAPI, because of how the logout packet is currently being handled -- the agent is being removed from the scene before the different event handlers are executed, which is broken.
Diffstat (limited to '')
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs24
-rw-r--r--OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs23
-rw-r--r--OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs24
-rw-r--r--OpenSim/Framework/IClientAPI.cs13
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs3
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs257
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs24
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs24
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs23
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs22
14 files changed, 138 insertions, 344 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
index 2d80d83..3143b6d 100644
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
@@ -160,6 +160,12 @@ namespace OpenSim.Client.MXP.ClientStack
160 } 160 }
161 } 161 }
162 162
163 public bool IsLoggingOut
164 {
165 get { return false ; }
166 set { }
167 }
168
163 #endregion 169 #endregion
164 170
165 #region Constructors 171 #region Constructors
@@ -1688,15 +1694,15 @@ namespace OpenSim.Client.MXP.ClientStack
1688 } 1694 }
1689 1695
1690 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1696 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1691 { 1697 {
1692 } 1698 }
1693 1699
1694 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) 1700 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1695 { 1701 {
1696 } 1702 }
1697 1703
1698 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) 1704 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1699 { 1705 {
1700 } 1706 }
1701 } 1707 }
1702} 1708}
diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
index 30d1575..dda95a1 100644
--- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
+++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
@@ -192,6 +192,11 @@ namespace OpenSim.Client.Sirikata.ClientStack
192 get { return isActive; } 192 get { return isActive; }
193 set { isActive = value; } 193 set { isActive = value; }
194 } 194 }
195 public bool IsLoggingOut
196 {
197 get { return false; }
198 set { }
199 }
195 200
196 public bool SendLogoutPacketWhenClosing 201 public bool SendLogoutPacketWhenClosing
197 { 202 {
@@ -1177,15 +1182,15 @@ namespace OpenSim.Client.Sirikata.ClientStack
1177 } 1182 }
1178 1183
1179 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1184 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1180 { 1185 {
1181 } 1186 }
1182 1187
1183 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) 1188 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1184 { 1189 {
1185 } 1190 }
1186 1191
1187 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) 1192 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1188 { 1193 {
1189 } 1194 }
1190 1195
1191 #endregion 1196 #endregion
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
index 6a119bd..613da56 100644
--- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
+++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
@@ -196,7 +196,11 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
196 get { throw new System.NotImplementedException(); } 196 get { throw new System.NotImplementedException(); }
197 set { throw new System.NotImplementedException(); } 197 set { throw new System.NotImplementedException(); }
198 } 198 }
199 199 public bool IsLoggingOut
200 {
201 get { throw new System.NotImplementedException(); }
202 set { throw new System.NotImplementedException(); }
203 }
200 public bool SendLogoutPacketWhenClosing 204 public bool SendLogoutPacketWhenClosing
201 { 205 {
202 set { throw new System.NotImplementedException(); } 206 set { throw new System.NotImplementedException(); }
@@ -1194,15 +1198,15 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
1194 } 1198 }
1195 1199
1196 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1200 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1197 { 1201 {
1198 } 1202 }
1199 1203
1200 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) 1204 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1201 { 1205 {
1202 } 1206 }
1203 1207
1204 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) 1208 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1205 { 1209 {
1206 } 1210 }
1207 } 1211 }
1208} 1212}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 3489af1..062659c 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -826,6 +826,11 @@ namespace OpenSim.Framework
826 /// </value> 826 /// </value>
827 bool IsActive { get; set; } 827 bool IsActive { get; set; }
828 828
829 /// <value>
830 /// Determines whether the client is logging out or not.
831 /// </value>
832 bool IsLoggingOut { get; set; }
833
829 bool SendLogoutPacketWhenClosing { set; } 834 bool SendLogoutPacketWhenClosing { set; }
830 835
831 // [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")] 836 // [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")]
@@ -1447,10 +1452,10 @@ namespace OpenSim.Framework
1447 1452
1448 void SendUseCachedMuteList(); 1453 void SendUseCachedMuteList();
1449 1454
1450 void SendMuteListUpdate(string filename); 1455 void SendMuteListUpdate(string filename);
1451 1456
1452 void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals); 1457 void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals);
1453 1458
1454 void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes); 1459 void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes);
1455 1460
1456 void KillEndDone(); 1461 void KillEndDone();
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index ae0bd79..79bea26 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -351,6 +351,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
351 private bool m_SendLogoutPacketWhenClosing = true; 351 private bool m_SendLogoutPacketWhenClosing = true;
352 private AgentUpdateArgs lastarg; 352 private AgentUpdateArgs lastarg;
353 private bool m_IsActive = true; 353 private bool m_IsActive = true;
354 private bool m_IsLoggingOut = false;
354 355
355 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); 356 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
356 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers 357 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
@@ -414,6 +415,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
414 get { return m_IsActive; } 415 get { return m_IsActive; }
415 set { m_IsActive = value; } 416 set { m_IsActive = value; }
416 } 417 }
418 public bool IsLoggingOut
419 {
420 get { return m_IsLoggingOut; }
421 set { m_IsLoggingOut = value; }
422 }
423
417 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } 424 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
418 425
419 #endregion Properties 426 #endregion Properties
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 3c4fa72..2d956fa 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -919,7 +919,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
919 // Remove this client from the scene 919 // Remove this client from the scene
920 IClientAPI client; 920 IClientAPI client;
921 if (m_scene.TryGetClient(udpClient.AgentID, out client)) 921 if (m_scene.TryGetClient(udpClient.AgentID, out client))
922 {
923 client.IsLoggingOut = true;
922 client.Close(); 924 client.Close();
925 }
923 } 926 }
924 927
925 private void IncomingPacketHandler() 928 private void IncomingPacketHandler()
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ee6cb04..53de269 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -268,7 +268,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
268 if (sp.ParentID != (uint)0) 268 if (sp.ParentID != (uint)0)
269 sp.StandUp(); 269 sp.StandUp();
270 270
271 m_log.Debug("XXX HERE 1");
272 if (!sp.ValidateAttachments()) 271 if (!sp.ValidateAttachments())
273 { 272 {
274 sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); 273 sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state");
@@ -351,7 +350,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
351 // ES makes the client send a UseCircuitCode message to the destination, 350 // ES makes the client send a UseCircuitCode message to the destination,
352 // which triggers a bunch of things there. 351 // which triggers a bunch of things there.
353 // So let's wait 352 // So let's wait
354 Thread.Sleep(2000); 353 Thread.Sleep(200);
355 354
356 eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); 355 eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
357 356
@@ -428,13 +427,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
428 return; 427 return;
429 } 428 }
430 429
431 KillEntity(sp.Scene, sp.LocalId);
432
433 sp.MakeChildAgent();
434 430
435 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 431 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
436 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 432 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
437 433
434 KillEntity(sp.Scene, sp.LocalId);
435
436 sp.MakeChildAgent();
438 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 437 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
439 438
440 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 439 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index fbf8be9..28593fc 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -81,16 +81,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
81 if (m_Enabled) 81 if (m_Enabled)
82 { 82 {
83 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); 83 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
84 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(OnNewClient);
85 } 84 }
86 } 85 }
87 86
88 protected override void OnNewClient(IClientAPI client) 87 protected override void OnNewClient(IClientAPI client)
89 { 88 {
90 base.OnNewClient(client); 89 client.OnTeleportHomeRequest += TeleportHome;
91 client.OnLogout += new Action<IClientAPI>(OnLogout); 90 client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
92 } 91 }
93 92
93
94 public override void RegionLoaded(Scene scene) 94 public override void RegionLoaded(Scene scene)
95 { 95 {
96 base.RegionLoaded(scene); 96 base.RegionLoaded(scene);
@@ -234,18 +234,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
234 return false; 234 return false;
235 } 235 }
236 236
237 void OnLogout(IClientAPI obj) 237 void OnConnectionClosed(IClientAPI obj)
238 { 238 {
239 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: client {0} logged out in {1}", obj.AgentId, obj.Scene.RegionInfo.RegionName); 239 if (obj.IsLoggingOut)
240 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
241
242 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
243 { 240 {
244 string url = aCircuit.ServiceURLs["HomeURI"].ToString(); 241 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
245 IUserAgentService security = new UserAgentServiceConnector(url);
246 security.LogoutAgent(obj.AgentId, obj.SessionId);
247 }
248 242
243 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
244 {
245 string url = aCircuit.ServiceURLs["HomeURI"].ToString();
246 IUserAgentService security = new UserAgentServiceConnector(url);
247 security.LogoutAgent(obj.AgentId, obj.SessionId);
248 //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url);
249 }
250 else
251 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId);
252 }
249 } 253 }
250 254
251 #endregion 255 #endregion
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 0e3739a..e10fa60 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -50,7 +50,6 @@
50 <RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" /> 50 <RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" />
51 <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" /> 51 <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" />
52 <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" /> 52 <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" />
53 <RegionModule id="HGGridConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.HGGridConnector" />
54 <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" /> 53 <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" />
55 <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" /> 54 <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" />
56 <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.LocalUserAccountServicesConnector" /> 55 <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.LocalUserAccountServicesConnector" />
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
deleted file mode 100644
index 67eae87..0000000
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ /dev/null
@@ -1,257 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32using System.Xml;
33
34
35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Region.Framework.Scenes.Hypergrid;
39using OpenSim.Services.Interfaces;
40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
42using OpenSim.Server.Base;
43using OpenSim.Framework.Console;
44
45using OpenMetaverse;
46using log4net;
47using Nini.Config;
48
49namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
50{
51 public class HGGridConnector : ISharedRegionModule, IGridService
52 {
53 private static readonly ILog m_log =
54 LogManager.GetLogger(
55 MethodBase.GetCurrentMethod().DeclaringType);
56
57 private bool m_Enabled = false;
58 private bool m_Initialized = false;
59
60 private Scene m_aScene;
61 private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
62
63 private IGridService m_GridServiceConnector;
64
65 #region ISharedRegionModule
66
67 public Type ReplaceableInterface
68 {
69 get { return null; }
70 }
71
72 public string Name
73 {
74 get { return "HGGridServicesConnector"; }
75 }
76
77 public void Initialise(IConfigSource source)
78 {
79 IConfig moduleConfig = source.Configs["Modules"];
80 if (moduleConfig != null)
81 {
82 string name = moduleConfig.GetString("GridServices", "");
83 if (name == Name)
84 {
85 IConfig gridConfig = source.Configs["GridService"];
86 if (gridConfig == null)
87 {
88 m_log.Error("[HGGRID CONNECTOR]: GridService missing from OpenSim.ini");
89 return;
90 }
91
92
93 InitialiseConnectorModule(source);
94
95 m_Enabled = true;
96 m_log.Info("[HGGRID CONNECTOR]: HG grid enabled");
97 }
98 }
99 }
100
101 private void InitialiseConnectorModule(IConfigSource source)
102 {
103 IConfig gridConfig = source.Configs["GridService"];
104 if (gridConfig == null)
105 {
106 m_log.Error("[HGGRID CONNECTOR]: GridService missing from OpenSim.ini");
107 throw new Exception("Grid connector init error");
108 }
109
110 string module = gridConfig.GetString("GridServiceConnectorModule", String.Empty);
111 if (module == String.Empty)
112 {
113 m_log.Error("[HGGRID CONNECTOR]: No GridServiceConnectorModule named in section GridService");
114 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
115 }
116
117 Object[] args = new Object[] { source };
118 m_GridServiceConnector = ServerUtils.LoadPlugin<IGridService>(module, args);
119
120 }
121
122 public void PostInitialise()
123 {
124 if (m_Enabled)
125 ((ISharedRegionModule)m_GridServiceConnector).PostInitialise();
126 }
127
128 public void Close()
129 {
130 }
131
132 public void AddRegion(Scene scene)
133 {
134 if (!m_Enabled)
135 return;
136
137 m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
138 scene.RegisterModuleInterface<IGridService>(this);
139
140 ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
141
142 }
143
144 public void RemoveRegion(Scene scene)
145 {
146 if (m_Enabled)
147 {
148 m_LocalScenes.Remove(scene.RegionInfo.RegionHandle);
149 scene.UnregisterModuleInterface<IGridService>(this);
150 ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene);
151 }
152 }
153
154 public void RegionLoaded(Scene scene)
155 {
156 if (!m_Enabled)
157 return;
158
159 if (!m_Initialized)
160 {
161 m_aScene = scene;
162
163 m_Initialized = true;
164 }
165 }
166
167 #endregion
168
169 #region IGridService
170
171 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
172 {
173 return m_GridServiceConnector.RegisterRegion(scopeID, regionInfo);
174 }
175
176 public bool DeregisterRegion(UUID regionID)
177 {
178 return m_GridServiceConnector.DeregisterRegion(regionID);
179 }
180
181 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
182 {
183 // No serving neighbours on hyperliked regions.
184 // Just the regular regions.
185 return m_GridServiceConnector.GetNeighbours(scopeID, regionID);
186 }
187
188 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
189 {
190 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
191 //if (region != null)
192 // return region;
193
194 //region = m_HypergridService.GetRegionByUUID(regionID);
195
196 //return region;
197 }
198
199 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
200 {
201 int snapX = (int) (x / Constants.RegionSize) * (int)Constants.RegionSize;
202 int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize;
203
204 GridRegion region = m_GridServiceConnector.GetRegionByPosition(scopeID, x, y);
205 //if (region != null)
206 // return region;
207
208 //region = m_HypergridService.GetRegionByPosition(snapX, snapY);
209
210 return region;
211 }
212
213 public GridRegion GetRegionByName(UUID scopeID, string regionName)
214 {
215 // Try normal grid first
216 GridRegion region = m_GridServiceConnector.GetRegionByName(scopeID, regionName);
217 if (region != null)
218 return region;
219
220 //region = m_HypergridService.GetRegionByName(regionName);
221
222 return region;
223 }
224
225 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
226 {
227 if (name == string.Empty)
228 return new List<GridRegion>();
229
230 return m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber);
231 }
232
233 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
234 {
235 return m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
236 }
237
238 public List<GridRegion> GetDefaultRegions(UUID scopeID)
239 {
240 return m_GridServiceConnector.GetDefaultRegions(scopeID);
241 }
242
243 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
244 {
245 return m_GridServiceConnector.GetFallbackRegions(scopeID, x, y);
246 }
247
248 public int GetRegionFlags(UUID scopeID, UUID regionID)
249 {
250 return m_GridServiceConnector.GetRegionFlags(scopeID, regionID);
251 }
252
253 #endregion
254
255
256 }
257}
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 1dfa1b1..fb29353 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -351,7 +351,11 @@ namespace OpenSim.Region.Examples.SimpleModule
351 get { return true; } 351 get { return true; }
352 set { } 352 set { }
353 } 353 }
354 354 public bool IsLoggingOut
355 {
356 get { return false; }
357 set { }
358 }
355 public UUID ActiveGroupId 359 public UUID ActiveGroupId
356 { 360 {
357 get { return UUID.Zero; } 361 get { return UUID.Zero; }
@@ -1133,15 +1137,15 @@ namespace OpenSim.Region.Examples.SimpleModule
1133 } 1137 }
1134 1138
1135 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1139 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1136 { 1140 {
1137 } 1141 }
1138 1142
1139 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) 1143 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1140 { 1144 {
1141 } 1145 }
1142 1146
1143 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) 1147 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1144 { 1148 {
1145 } 1149 }
1146 } 1150 }
1147} 1151}
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 6785c08..a781a1d 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -627,6 +627,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
627 set { if (!value) Disconnect("IsActive Disconnected?"); } 627 set { if (!value) Disconnect("IsActive Disconnected?"); }
628 } 628 }
629 629
630 public bool IsLoggingOut
631 {
632 get { return false; }
633 set { }
634 }
635
630 public bool SendLogoutPacketWhenClosing 636 public bool SendLogoutPacketWhenClosing
631 { 637 {
632 set { } 638 set { }
@@ -1657,15 +1663,15 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1657 } 1663 }
1658 1664
1659 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1665 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1660 { 1666 {
1661 } 1667 }
1662 1668
1663 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) 1669 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1664 { 1670 {
1665 } 1671 }
1666 1672
1667 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) 1673 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1668 { 1674 {
1669 } 1675 }
1670 } 1676 }
1671} 1677}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 4a4c515..57ab6ad 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -455,6 +455,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
455 set { } 455 set { }
456 } 456 }
457 457
458 public bool IsLoggingOut
459 {
460 get { return false; }
461 set { }
462 }
458 public UUID ActiveGroupId 463 public UUID ActiveGroupId
459 { 464 {
460 get { return UUID.Zero; } 465 get { return UUID.Zero; }
@@ -1138,15 +1143,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1138 } 1143 }
1139 1144
1140 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1145 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1141 { 1146 {
1142 } 1147 }
1143 1148
1144 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) 1149 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1145 { 1150 {
1146 } 1151 }
1147 1152
1148 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) 1153 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1149 { 1154 {
1150 } 1155 }
1151 } 1156 }
1152} 1157}
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 8b79502..0e32950 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -365,7 +365,11 @@ namespace OpenSim.Tests.Common.Mock
365 get { return true; } 365 get { return true; }
366 set { } 366 set { }
367 } 367 }
368 368 public bool IsLoggingOut
369 {
370 get { return false; }
371 set { }
372 }
369 public UUID ActiveGroupId 373 public UUID ActiveGroupId
370 { 374 {
371 get { return UUID.Zero; } 375 get { return UUID.Zero; }
@@ -1194,14 +1198,14 @@ namespace OpenSim.Tests.Common.Mock
1194 1198
1195 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1199 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1196 { 1200 {
1197 } 1201 }
1198 1202
1199 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) 1203 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1200 { 1204 {
1201 } 1205 }
1202 1206
1203 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) 1207 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1204 { 1208 {
1205 } 1209 }
1206 } 1210 }
1207} 1211}