aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-01-16 00:05:08 +0000
committerMelanie2010-01-16 00:05:08 +0000
commit10f8c2ea9b67158c32b361f9652d503ea48de292 (patch)
treebe0d88bc4b6df3825a0d27f62a08170d7c7ad262 /OpenSim
parentMerge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff)
parentAdd "create user" instructions to README.txt (diff)
downloadopensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.zip
opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.gz
opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.bz2
opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.xz
Merge branch 'master' into presence-refactor
This merge was very conflicted. I think I got them all, but I can't be sure. I had to merge to master or risk divergence to the point of unmergeability.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs32
-rw-r--r--OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs32
-rw-r--r--OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs32
-rw-r--r--OpenSim/ConsoleClient/ConsoleClient.cs8
-rw-r--r--OpenSim/Data/SQLite/SQLiteFramework.cs83
-rw-r--r--OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs253
-rw-r--r--OpenSim/Data/SQLite/SQLiteXInventoryData.cs156
-rw-r--r--OpenSim/Framework/AgentUpdateArgs.cs8
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs8
-rw-r--r--OpenSim/Framework/Console/LocalConsole.cs106
-rw-r--r--OpenSim/Framework/Constants.cs8
-rw-r--r--OpenSim/Framework/EstateSettings.cs28
-rw-r--r--OpenSim/Framework/GroupData.cs26
-rw-r--r--OpenSim/Framework/IClientAPI.cs31
-rw-r--r--OpenSim/Framework/ILoginServiceToRegionsConnector.cs1
-rw-r--r--OpenSim/Framework/MainServer.cs4
-rw-r--r--OpenSim/Region/Application/OpenSim.cs63
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs31
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs161
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs157
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs244
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs5
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs32
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs124
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs202
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs32
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs10
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs83
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs7
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs16
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs456
-rw-r--r--OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs18
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs535
-rw-r--r--OpenSim/Services/GridService/GridService.cs37
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs2
-rw-r--r--OpenSim/Tests/Clients/Grid/GridClient.cs17
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs30
51 files changed, 2803 insertions, 500 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
index a31e0c0..2d80d83 100644
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
@@ -756,25 +756,25 @@ namespace OpenSim.Client.MXP.ClientStack
756 public event AvatarNotesUpdate OnAvatarNotesUpdate; 756 public event AvatarNotesUpdate OnAvatarNotesUpdate;
757 public event MuteListRequest OnMuteListRequest; 757 public event MuteListRequest OnMuteListRequest;
758 public event AvatarInterestUpdate OnAvatarInterestUpdate; 758 public event AvatarInterestUpdate OnAvatarInterestUpdate;
759 public event FindAgentUpdate OnFindAgentEvent; 759 public event FindAgentUpdate OnFindAgent;
760 public event TrackAgentUpdate OnTrackAgentEvent; 760 public event TrackAgentUpdate OnTrackAgent;
761 public event NewUserReport OnUserReportEvent; 761 public event NewUserReport OnUserReport;
762 public event SaveStateHandler OnSaveStateEvent; 762 public event SaveStateHandler OnSaveState;
763 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; 763 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
764 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; 764 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
765 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; 765 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
766 public event FreezeUserUpdate OnParcelFreezeUserEvent; 766 public event FreezeUserUpdate OnParcelFreezeUser;
767 public event EjectUserUpdate OnParcelEjectUserEvent; 767 public event EjectUserUpdate OnParcelEjectUser;
768 public event ParcelBuyPass OnParcelBuyPass; 768 public event ParcelBuyPass OnParcelBuyPass;
769 public event ParcelGodMark OnParcelGodMark; 769 public event ParcelGodMark OnParcelGodMark;
770 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; 770 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
771 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 771 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
772 public event SimWideDeletesDelegate OnSimWideDeletes; 772 public event SimWideDeletesDelegate OnSimWideDeletes;
773 public event SendPostcard OnSendPostcard; 773 public event SendPostcard OnSendPostcard;
774 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; 774 public event MuteListEntryUpdate OnUpdateMuteListEntry;
775 public event MuteListEntryRemove OnRemoveMuteListEntryEvent; 775 public event MuteListEntryRemove OnRemoveMuteListEntry;
776 public event GodlikeMessage onGodlikeMessageEvent; 776 public event GodlikeMessage onGodlikeMessage;
777 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; 777 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
778 778
779 public event PlacesQuery OnPlacesQuery; 779 public event PlacesQuery OnPlacesQuery;
780 780
@@ -1217,7 +1217,7 @@ namespace OpenSim.Client.MXP.ClientStack
1217 // Need to translate to MXP somehow 1217 // Need to translate to MXP somehow
1218 } 1218 }
1219 1219
1220 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) 1220 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
1221 { 1221 {
1222 // Need to translate to MXP somehow 1222 // Need to translate to MXP somehow
1223 } 1223 }
@@ -1688,7 +1688,15 @@ namespace OpenSim.Client.MXP.ClientStack
1688 } 1688 }
1689 1689
1690 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1690 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1691 { 1691 {
1692 }
1693
1694 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1695 {
1696 }
1697
1698 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1699 {
1692 } 1700 }
1693 } 1701 }
1694} 1702}
diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
index 66c0eb2..30d1575 100644
--- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
+++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
@@ -401,25 +401,25 @@ namespace OpenSim.Client.Sirikata.ClientStack
401 public event GrantUserFriendRights OnGrantUserRights; 401 public event GrantUserFriendRights OnGrantUserRights;
402 public event MuteListRequest OnMuteListRequest; 402 public event MuteListRequest OnMuteListRequest;
403 public event PlacesQuery OnPlacesQuery; 403 public event PlacesQuery OnPlacesQuery;
404 public event FindAgentUpdate OnFindAgentEvent; 404 public event FindAgentUpdate OnFindAgent;
405 public event TrackAgentUpdate OnTrackAgentEvent; 405 public event TrackAgentUpdate OnTrackAgent;
406 public event NewUserReport OnUserReportEvent; 406 public event NewUserReport OnUserReport;
407 public event SaveStateHandler OnSaveStateEvent; 407 public event SaveStateHandler OnSaveState;
408 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; 408 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
409 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; 409 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
410 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; 410 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
411 public event FreezeUserUpdate OnParcelFreezeUserEvent; 411 public event FreezeUserUpdate OnParcelFreezeUser;
412 public event EjectUserUpdate OnParcelEjectUserEvent; 412 public event EjectUserUpdate OnParcelEjectUser;
413 public event ParcelBuyPass OnParcelBuyPass; 413 public event ParcelBuyPass OnParcelBuyPass;
414 public event ParcelGodMark OnParcelGodMark; 414 public event ParcelGodMark OnParcelGodMark;
415 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; 415 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
416 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 416 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
417 public event SimWideDeletesDelegate OnSimWideDeletes; 417 public event SimWideDeletesDelegate OnSimWideDeletes;
418 public event SendPostcard OnSendPostcard; 418 public event SendPostcard OnSendPostcard;
419 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; 419 public event MuteListEntryUpdate OnUpdateMuteListEntry;
420 public event MuteListEntryRemove OnRemoveMuteListEntryEvent; 420 public event MuteListEntryRemove OnRemoveMuteListEntry;
421 public event GodlikeMessage onGodlikeMessageEvent; 421 public event GodlikeMessage onGodlikeMessage;
422 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; 422 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
423 public void SetDebugPacketLevel(int newDebug) 423 public void SetDebugPacketLevel(int newDebug)
424 { 424 {
425 throw new System.NotImplementedException(); 425 throw new System.NotImplementedException();
@@ -760,7 +760,7 @@ namespace OpenSim.Client.Sirikata.ClientStack
760 throw new System.NotImplementedException(); 760 throw new System.NotImplementedException();
761 } 761 }
762 762
763 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) 763 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
764 { 764 {
765 throw new System.NotImplementedException(); 765 throw new System.NotImplementedException();
766 } 766 }
@@ -1177,7 +1177,15 @@ namespace OpenSim.Client.Sirikata.ClientStack
1177 } 1177 }
1178 1178
1179 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1179 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1180 { 1180 {
1181 }
1182
1183 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1184 {
1185 }
1186
1187 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1188 {
1181 } 1189 }
1182 1190
1183 #endregion 1191 #endregion
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
index 6f6d231..6a119bd 100644
--- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
+++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
@@ -405,25 +405,25 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
405 public event MuteListRequest OnMuteListRequest = delegate { }; 405 public event MuteListRequest OnMuteListRequest = delegate { };
406 public event AvatarInterestUpdate OnAvatarInterestUpdate = delegate { }; 406 public event AvatarInterestUpdate OnAvatarInterestUpdate = delegate { };
407 public event PlacesQuery OnPlacesQuery = delegate { }; 407 public event PlacesQuery OnPlacesQuery = delegate { };
408 public event FindAgentUpdate OnFindAgentEvent = delegate { }; 408 public event FindAgentUpdate OnFindAgent = delegate { };
409 public event TrackAgentUpdate OnTrackAgentEvent = delegate { }; 409 public event TrackAgentUpdate OnTrackAgent = delegate { };
410 public event NewUserReport OnUserReportEvent = delegate { }; 410 public event NewUserReport OnUserReport = delegate { };
411 public event SaveStateHandler OnSaveStateEvent = delegate { }; 411 public event SaveStateHandler OnSaveState = delegate { };
412 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest = delegate { }; 412 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest = delegate { };
413 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest = delegate { }; 413 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest = delegate { };
414 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest = delegate { }; 414 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest = delegate { };
415 public event FreezeUserUpdate OnParcelFreezeUserEvent = delegate { }; 415 public event FreezeUserUpdate OnParcelFreezeUser = delegate { };
416 public event EjectUserUpdate OnParcelEjectUserEvent = delegate { }; 416 public event EjectUserUpdate OnParcelEjectUser = delegate { };
417 public event ParcelBuyPass OnParcelBuyPass = delegate { }; 417 public event ParcelBuyPass OnParcelBuyPass = delegate { };
418 public event ParcelGodMark OnParcelGodMark = delegate { }; 418 public event ParcelGodMark OnParcelGodMark = delegate { };
419 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest = delegate { }; 419 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest = delegate { };
420 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest = delegate { }; 420 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest = delegate { };
421 public event SimWideDeletesDelegate OnSimWideDeletes = delegate { }; 421 public event SimWideDeletesDelegate OnSimWideDeletes = delegate { };
422 public event SendPostcard OnSendPostcard = delegate { }; 422 public event SendPostcard OnSendPostcard = delegate { };
423 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent = delegate { }; 423 public event MuteListEntryUpdate OnUpdateMuteListEntry = delegate { };
424 public event MuteListEntryRemove OnRemoveMuteListEntryEvent = delegate { }; 424 public event MuteListEntryRemove OnRemoveMuteListEntry = delegate { };
425 public event GodlikeMessage onGodlikeMessageEvent = delegate { }; 425 public event GodlikeMessage onGodlikeMessage = delegate { };
426 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent = delegate { }; 426 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate = delegate { };
427 427
428 428
429 429
@@ -767,7 +767,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
767 throw new System.NotImplementedException(); 767 throw new System.NotImplementedException();
768 } 768 }
769 769
770 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) 770 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
771 { 771 {
772 throw new System.NotImplementedException(); 772 throw new System.NotImplementedException();
773 } 773 }
@@ -1194,7 +1194,15 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
1194 } 1194 }
1195 1195
1196 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1196 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1197 { 1197 {
1198 }
1199
1200 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1201 {
1202 }
1203
1204 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1205 {
1198 } 1206 }
1199 } 1207 }
1200} 1208}
diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs
index 783adef..d195d25 100644
--- a/OpenSim/ConsoleClient/ConsoleClient.cs
+++ b/OpenSim/ConsoleClient/ConsoleClient.cs
@@ -82,7 +82,13 @@ namespace OpenSim.ConsoleClient
82 82
83 private static void SendCommand(string module, string[] cmd) 83 private static void SendCommand(string module, string[] cmd)
84 { 84 {
85 string sendCmd = String.Join(" ", cmd); 85 string sendCmd = cmd[0];
86 if (cmd.Length > 1)
87 {
88 Array.Copy(cmd, 1, cmd, 0, cmd.Length-1);
89 Array.Resize(ref cmd, cmd.Length-1);
90 sendCmd += "\"" + String.Join("\" \"", cmd) + "\"";
91 }
86 92
87 Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply); 93 Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply);
88 } 94 }
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs
new file mode 100644
index 0000000..12b2750
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteFramework.cs
@@ -0,0 +1,83 @@
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;
30using System.Collections.Generic;
31using System.Data;
32using OpenMetaverse;
33using OpenSim.Framework;
34using Mono.Data.SqliteClient;
35
36namespace OpenSim.Data.SQLite
37{
38 /// <summary>
39 /// A database interface class to a user profile storage system
40 /// </summary>
41 public class SQLiteFramework
42 {
43 protected SqliteConnection m_Connection;
44
45 protected SQLiteFramework(string connectionString)
46 {
47 m_Connection = new SqliteConnection(connectionString);
48 m_Connection.Open();
49 }
50
51 //////////////////////////////////////////////////////////////
52 //
53 // All non queries are funneled through one connection
54 // to increase performance a little
55 //
56 protected int ExecuteNonQuery(SqliteCommand cmd)
57 {
58 lock (m_Connection)
59 {
60 cmd.Connection = m_Connection;
61
62 return cmd.ExecuteNonQuery();
63 }
64 }
65
66 protected IDataReader ExecuteReader(SqliteCommand cmd)
67 {
68 SqliteConnection newConnection =
69 (SqliteConnection)((ICloneable)m_Connection).Clone();
70 newConnection.Open();
71
72 cmd.Connection = newConnection;
73 return cmd.ExecuteReader();
74 }
75
76 protected void CloseReaderCommand(SqliteCommand cmd)
77 {
78 cmd.Connection.Close();
79 cmd.Connection.Dispose();
80 cmd.Dispose();
81 }
82 }
83}
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
new file mode 100644
index 0000000..6b67ec6
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
@@ -0,0 +1,253 @@
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.Data;
31using System.Reflection;
32using log4net;
33using Mono.Data.SqliteClient;
34using OpenMetaverse;
35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces;
37
38namespace OpenSim.Data.SQLite
39{
40 public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new()
41 {
42 private static readonly ILog m_log =
43 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
45
46 protected Dictionary<string, FieldInfo> m_Fields =
47 new Dictionary<string, FieldInfo>();
48
49 protected List<string> m_ColumnNames = null;
50 protected string m_Realm;
51 protected FieldInfo m_DataField = null;
52
53 public SQLiteGenericTableHandler(string connectionString,
54 string realm, string storeName) : base(connectionString)
55 {
56 m_Realm = realm;
57 if (storeName != String.Empty)
58 {
59 Assembly assem = GetType().Assembly;
60
61 Migration m = new Migration(m_Connection, assem, storeName);
62 m.Update();
63 }
64
65 Type t = typeof(T);
66 FieldInfo[] fields = t.GetFields(BindingFlags.Public |
67 BindingFlags.Instance |
68 BindingFlags.DeclaredOnly);
69
70 if (fields.Length == 0)
71 return;
72
73 foreach (FieldInfo f in fields)
74 {
75 if (f.Name != "Data")
76 m_Fields[f.Name] = f;
77 else
78 m_DataField = f;
79 }
80 }
81
82 private void CheckColumnNames(IDataReader reader)
83 {
84 if (m_ColumnNames != null)
85 return;
86
87 m_ColumnNames = new List<string>();
88
89 DataTable schemaTable = reader.GetSchemaTable();
90 foreach (DataRow row in schemaTable.Rows)
91 {
92 if (row["ColumnName"] != null &&
93 (!m_Fields.ContainsKey(row["ColumnName"].ToString())))
94 m_ColumnNames.Add(row["ColumnName"].ToString());
95 }
96 }
97
98 public T[] Get(string field, string key)
99 {
100 return Get(new string[] { field }, new string[] { key });
101 }
102
103 public T[] Get(string[] fields, string[] keys)
104 {
105 if (fields.Length != keys.Length)
106 return new T[0];
107
108 List<string> terms = new List<string>();
109
110 SqliteCommand cmd = new SqliteCommand();
111
112 for (int i = 0 ; i < fields.Length ; i++)
113 {
114 cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
115 terms.Add("`" + fields[i] + "` = :" + fields[i]);
116 }
117
118 string where = String.Join(" and ", terms.ToArray());
119
120 string query = String.Format("select * from {0} where {1}",
121 m_Realm, where);
122
123 cmd.CommandText = query;
124
125 return DoQuery(cmd);
126 }
127
128 protected T[] DoQuery(SqliteCommand cmd)
129 {
130 IDataReader reader = ExecuteReader(cmd);
131 if (reader == null)
132 return new T[0];
133
134 CheckColumnNames(reader);
135
136 List<T> result = new List<T>();
137
138 while (reader.Read())
139 {
140 T row = new T();
141
142 foreach (string name in m_Fields.Keys)
143 {
144 if (m_Fields[name].GetValue(row) is bool)
145 {
146 int v = Convert.ToInt32(reader[name]);
147 m_Fields[name].SetValue(row, v != 0 ? true : false);
148 }
149 else if (m_Fields[name].GetValue(row) is UUID)
150 {
151 UUID uuid = UUID.Zero;
152
153 UUID.TryParse(reader[name].ToString(), out uuid);
154 m_Fields[name].SetValue(row, uuid);
155 }
156 else if (m_Fields[name].GetValue(row) is int)
157 {
158 int v = Convert.ToInt32(reader[name]);
159 m_Fields[name].SetValue(row, v);
160 }
161 else
162 {
163 m_Fields[name].SetValue(row, reader[name]);
164 }
165 }
166
167 if (m_DataField != null)
168 {
169 Dictionary<string, string> data =
170 new Dictionary<string, string>();
171
172 foreach (string col in m_ColumnNames)
173 {
174 data[col] = reader[col].ToString();
175 if (data[col] == null)
176 data[col] = String.Empty;
177 }
178
179 m_DataField.SetValue(row, data);
180 }
181
182 result.Add(row);
183 }
184
185 CloseReaderCommand(cmd);
186
187 return result.ToArray();
188 }
189
190 public T[] Get(string where)
191 {
192 SqliteCommand cmd = new SqliteCommand();
193
194 string query = String.Format("select * from {0} where {1}",
195 m_Realm, where);
196
197 cmd.CommandText = query;
198
199 return DoQuery(cmd);
200 }
201
202 public bool Store(T row)
203 {
204 SqliteCommand cmd = new SqliteCommand();
205
206 string query = "";
207 List<String> names = new List<String>();
208 List<String> values = new List<String>();
209
210 foreach (FieldInfo fi in m_Fields.Values)
211 {
212 names.Add(fi.Name);
213 values.Add(":" + fi.Name);
214 cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString()));
215 }
216
217 if (m_DataField != null)
218 {
219 Dictionary<string, string> data =
220 (Dictionary<string, string>)m_DataField.GetValue(row);
221
222 foreach (KeyValuePair<string, string> kvp in data)
223 {
224 names.Add(kvp.Key);
225 values.Add(":" + kvp.Key);
226 cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value));
227 }
228 }
229
230 query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
231
232 cmd.CommandText = query;
233
234 if (ExecuteNonQuery(cmd) > 0)
235 return true;
236
237 return false;
238 }
239
240 public bool Delete(string field, string val)
241 {
242 SqliteCommand cmd = new SqliteCommand();
243
244 cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field);
245 cmd.Parameters.Add(new SqliteParameter(field, val));
246
247 if (ExecuteNonQuery(cmd) > 0)
248 return true;
249
250 return false;
251 }
252 }
253}
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
new file mode 100644
index 0000000..97625a7
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
@@ -0,0 +1,156 @@
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.Data;
30using System.Reflection;
31using System.Collections.Generic;
32using Mono.Data.SqliteClient;
33using log4net;
34using OpenMetaverse;
35using OpenSim.Framework;
36
37namespace OpenSim.Data.SQLite
38{
39 /// <summary>
40 /// A MySQL Interface for the Asset Server
41 /// </summary>
42 public class SQLiteXInventoryData : IXInventoryData
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(
45 MethodBase.GetCurrentMethod().DeclaringType);
46
47 private SQLiteGenericTableHandler<XInventoryFolder> m_Folders;
48 private SqliteItemHandler m_Items;
49
50 public SQLiteXInventoryData(string conn, string realm)
51 {
52 m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>(
53 conn, "inventoryfolders", "InventoryStore");
54 m_Items = new SqliteItemHandler(
55 conn, "inventoryitems", String.Empty);
56 }
57
58 public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
59 {
60 return m_Folders.Get(fields, vals);
61 }
62
63 public XInventoryItem[] GetItems(string[] fields, string[] vals)
64 {
65 return m_Items.Get(fields, vals);
66 }
67
68 public bool StoreFolder(XInventoryFolder folder)
69 {
70 return m_Folders.Store(folder);
71 }
72
73 public bool StoreItem(XInventoryItem item)
74 {
75 return m_Items.Store(item);
76 }
77
78 public bool DeleteFolders(string field, string val)
79 {
80 return m_Folders.Delete(field, val);
81 }
82
83 public bool DeleteItems(string field, string val)
84 {
85 return m_Items.Delete(field, val);
86 }
87
88 public bool MoveItem(string id, string newParent)
89 {
90 return m_Items.MoveItem(id, newParent);
91 }
92
93 public XInventoryItem[] GetActiveGestures(UUID principalID)
94 {
95 return m_Items.GetActiveGestures(principalID);
96 }
97
98 public int GetAssetPermissions(UUID principalID, UUID assetID)
99 {
100 return m_Items.GetAssetPermissions(principalID, assetID);
101 }
102 }
103
104 public class SqliteItemHandler : SQLiteGenericTableHandler<XInventoryItem>
105 {
106 public SqliteItemHandler(string c, string t, string m) :
107 base(c, t, m)
108 {
109 }
110
111 public bool MoveItem(string id, string newParent)
112 {
113 SqliteCommand cmd = new SqliteCommand();
114
115 cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm);
116 cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent));
117 cmd.Parameters.Add(new SqliteParameter(":InventoryID", id));
118
119 return ExecuteNonQuery(cmd) == 0 ? false : true;
120 }
121
122 public XInventoryItem[] GetActiveGestures(UUID principalID)
123 {
124 SqliteCommand cmd = new SqliteCommand();
125 cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm);
126
127 cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString()));
128 cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture));
129
130 return DoQuery(cmd);
131 }
132
133 public int GetAssetPermissions(UUID principalID, UUID assetID)
134 {
135 SqliteCommand cmd = new SqliteCommand();
136
137 cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm);
138 cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
139 cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString()));
140
141 IDataReader reader = ExecuteReader(cmd);
142
143 int perms = 0;
144
145 while (reader.Read())
146 {
147 perms |= Convert.ToInt32(reader["inventoryCurrentPermissions"]);
148 }
149
150 reader.Close();
151 CloseReaderCommand(cmd);
152
153 return perms;
154 }
155 }
156}
diff --git a/OpenSim/Framework/AgentUpdateArgs.cs b/OpenSim/Framework/AgentUpdateArgs.cs
index 7b9ec68..660bc32 100644
--- a/OpenSim/Framework/AgentUpdateArgs.cs
+++ b/OpenSim/Framework/AgentUpdateArgs.cs
@@ -78,5 +78,13 @@ namespace OpenSim.Framework
78 /// </summary> 78 /// </summary>
79 public UUID SessionID; 79 public UUID SessionID;
80 public byte State; 80 public byte State;
81
82 public Vector3 ClientAgentPosition;
83 public bool UseClientAgentPosition;
84
85 public AgentUpdateArgs()
86 {
87 UseClientAgentPosition = false;
88 }
81 } 89 }
82} 90}
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index 9671bc2..66f483c 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -552,8 +552,9 @@ namespace OpenSim.Framework.Console
552 } 552 }
553 } 553 }
554 554
555 // A console that processes commands internally 555 /// <summary>
556 // 556 /// A console that processes commands internally
557 /// </summary>
557 public class CommandConsole : ConsoleBase 558 public class CommandConsole : ConsoleBase
558 { 559 {
559 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 560 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -574,6 +575,9 @@ namespace OpenSim.Framework.Console
574 Output(s); 575 Output(s);
575 } 576 }
576 577
578 /// <summary>
579 /// Display a command prompt on the console and wait for user input
580 /// </summary>
577 public void Prompt() 581 public void Prompt()
578 { 582 {
579 string line = ReadLine(m_defaultPrompt + "# ", true, true); 583 string line = ReadLine(m_defaultPrompt + "# ", true, true);
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs
index 39edd2a..b7e191b 100644
--- a/OpenSim/Framework/Console/LocalConsole.cs
+++ b/OpenSim/Framework/Console/LocalConsole.cs
@@ -36,8 +36,9 @@ using log4net;
36 36
37namespace OpenSim.Framework.Console 37namespace OpenSim.Framework.Console
38{ 38{
39 // A console that uses cursor control and color 39 /// <summary>
40 // 40 /// A console that uses cursor control and color
41 /// </summary>
41 public class LocalConsole : CommandConsole 42 public class LocalConsole : CommandConsole
42 { 43 {
43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -85,30 +86,70 @@ namespace OpenSim.Framework.Console
85 history.Add(text); 86 history.Add(text);
86 } 87 }
87 88
89 /// <summary>
90 /// Set the cursor row.
91 /// </summary>
92 ///
93 /// <param name="top">
94 /// Row to set. If this is below 0, then the row is set to 0. If it is equal to the buffer height or greater
95 /// then it is set to one less than the height.
96 /// </param>
97 /// <returns>
98 /// The new cursor row.
99 /// </returns>
88 private int SetCursorTop(int top) 100 private int SetCursorTop(int top)
89 { 101 {
90 if (top >= 0 && top < System.Console.BufferHeight) 102 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
91 { 103 // to set a cursor row position with a currently invalid column, mono will throw an exception.
92 System.Console.CursorTop = top; 104 // Therefore, we need to make sure that the column position is valid first.
93 return top; 105 int left = System.Console.CursorLeft;
94 } 106
95 else 107 if (left < 0)
96 { 108 System.Console.CursorLeft = 0;
97 return System.Console.CursorTop; 109 else if (left >= System.Console.BufferWidth)
98 } 110 System.Console.CursorLeft = System.Console.BufferWidth - 1;
111
112 if (top < 0)
113 top = 0;
114 if (top >= System.Console.BufferHeight)
115 top = System.Console.BufferHeight - 1;
116
117 System.Console.CursorTop = top;
118
119 return top;
99 } 120 }
100 121
122 /// <summary>
123 /// Set the cursor column.
124 /// </summary>
125 ///
126 /// <param name="left">
127 /// Column to set. If this is below 0, then the column is set to 0. If it is equal to the buffer width or greater
128 /// then it is set to one less than the width.
129 /// </param>
130 /// <returns>
131 /// The new cursor column.
132 /// </returns>
101 private int SetCursorLeft(int left) 133 private int SetCursorLeft(int left)
102 { 134 {
103 if (left >= 0 && left < System.Console.BufferWidth) 135 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
104 { 136 // to set a cursor column position with a currently invalid row, mono will throw an exception.
105 System.Console.CursorLeft = left; 137 // Therefore, we need to make sure that the row position is valid first.
106 return left; 138 int top = System.Console.CursorTop;
107 } 139
108 else 140 if (top < 0)
109 { 141 System.Console.CursorTop = 0;
110 return System.Console.CursorLeft; 142 else if (top >= System.Console.BufferHeight)
111 } 143 System.Console.CursorTop = System.Console.BufferHeight - 1;
144
145 if (left < 0)
146 left = 0;
147 if (left >= System.Console.BufferWidth)
148 left = System.Console.BufferWidth - 1;
149
150 System.Console.CursorLeft = left;
151
152 return left;
112 } 153 }
113 154
114 private void Show() 155 private void Show()
@@ -128,21 +169,21 @@ namespace OpenSim.Framework.Console
128 { 169 {
129 y--; 170 y--;
130 new_y--; 171 new_y--;
131 System.Console.CursorLeft = 0; 172 SetCursorLeft(0);
132 System.Console.CursorTop = System.Console.BufferHeight-1; 173 SetCursorTop(System.Console.BufferHeight - 1);
133 System.Console.WriteLine(" "); 174 System.Console.WriteLine(" ");
134 } 175 }
135 176
136 y=SetCursorTop(y); 177 y = SetCursorTop(y);
137 System.Console.CursorLeft = 0; 178 SetCursorLeft(0);
138 179
139 if (echo) 180 if (echo)
140 System.Console.Write("{0}{1}", prompt, cmdline); 181 System.Console.Write("{0}{1}", prompt, cmdline);
141 else 182 else
142 System.Console.Write("{0}", prompt); 183 System.Console.Write("{0}", prompt);
143 184
144 SetCursorLeft(new_x);
145 SetCursorTop(new_y); 185 SetCursorTop(new_y);
186 SetCursorLeft(new_x);
146 } 187 }
147 } 188 }
148 189
@@ -162,8 +203,7 @@ namespace OpenSim.Framework.Console
162 System.Console.Write(" "); 203 System.Console.Write(" ");
163 204
164 y = SetCursorTop(y); 205 y = SetCursorTop(y);
165 System.Console.CursorLeft = 0; 206 SetCursorLeft(0);
166
167 } 207 }
168 } 208 }
169 catch (Exception) 209 catch (Exception)
@@ -252,7 +292,7 @@ namespace OpenSim.Framework.Console
252 } 292 }
253 293
254 y = SetCursorTop(y); 294 y = SetCursorTop(y);
255 System.Console.CursorLeft = 0; 295 SetCursorLeft(0);
256 296
257 int count = cmdline.Length + prompt.Length; 297 int count = cmdline.Length + prompt.Length;
258 298
@@ -260,7 +300,7 @@ namespace OpenSim.Framework.Console
260 System.Console.Write(" "); 300 System.Console.Write(" ");
261 301
262 y = SetCursorTop(y); 302 y = SetCursorTop(y);
263 System.Console.CursorLeft = 0; 303 SetCursorLeft(0);
264 304
265 WriteLocalText(text, level); 305 WriteLocalText(text, level);
266 306
@@ -299,7 +339,7 @@ namespace OpenSim.Framework.Console
299 echo = e; 339 echo = e;
300 int historyLine = history.Count; 340 int historyLine = history.Count;
301 341
302 System.Console.CursorLeft = 0; // Needed for mono 342 SetCursorLeft(0); // Needed for mono
303 System.Console.Write(" "); // Needed for mono 343 System.Console.Write(" "); // Needed for mono
304 344
305 lock (cmdline) 345 lock (cmdline)
@@ -339,7 +379,7 @@ namespace OpenSim.Framework.Console
339 cmdline.Remove(cp-1, 1); 379 cmdline.Remove(cp-1, 1);
340 cp--; 380 cp--;
341 381
342 System.Console.CursorLeft = 0; 382 SetCursorLeft(0);
343 y = SetCursorTop(y); 383 y = SetCursorTop(y);
344 384
345 System.Console.Write("{0}{1} ", prompt, cmdline); 385 System.Console.Write("{0}{1} ", prompt, cmdline);
@@ -387,7 +427,7 @@ namespace OpenSim.Framework.Console
387 cp++; 427 cp++;
388 break; 428 break;
389 case ConsoleKey.Enter: 429 case ConsoleKey.Enter:
390 System.Console.CursorLeft = 0; 430 SetCursorLeft(0);
391 y = SetCursorTop(y); 431 y = SetCursorTop(y);
392 432
393 System.Console.WriteLine("{0}{1}", prompt, cmdline); 433 System.Console.WriteLine("{0}{1}", prompt, cmdline);
@@ -424,4 +464,4 @@ namespace OpenSim.Framework.Console
424 } 464 }
425 } 465 }
426 } 466 }
427} 467} \ No newline at end of file
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs
index 632431f..5757061 100644
--- a/OpenSim/Framework/Constants.cs
+++ b/OpenSim/Framework/Constants.cs
@@ -36,10 +36,10 @@ namespace OpenSim.Framework
36 36
37 public enum EstateAccessCodex : uint 37 public enum EstateAccessCodex : uint
38 { 38 {
39 AccessOptions = 17, 39 AccessOptions = 1,
40 AllowedGroups = 18, 40 AllowedGroups = 2,
41 EstateBans = 20, 41 EstateBans = 4,
42 EstateManagers = 24 42 EstateManagers = 8
43 } 43 }
44 44
45 [Flags]public enum TeleportFlags : uint 45 [Flags]public enum TeleportFlags : uint
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index deced98..b4b5808 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -300,6 +300,34 @@ namespace OpenSim.Framework
300 OnSave(this); 300 OnSave(this);
301 } 301 }
302 302
303 public void AddEstateUser(UUID avatarID)
304 {
305 if (avatarID == UUID.Zero)
306 return;
307 if (!l_EstateAccess.Contains(avatarID))
308 l_EstateAccess.Add(avatarID);
309 }
310
311 public void RemoveEstateUser(UUID avatarID)
312 {
313 if (l_EstateAccess.Contains(avatarID))
314 l_EstateAccess.Remove(avatarID);
315 }
316
317 public void AddEstateGroup(UUID avatarID)
318 {
319 if (avatarID == UUID.Zero)
320 return;
321 if (!l_EstateGroups.Contains(avatarID))
322 l_EstateGroups.Add(avatarID);
323 }
324
325 public void RemoveEstateGroup(UUID avatarID)
326 {
327 if (l_EstateGroups.Contains(avatarID))
328 l_EstateGroups.Remove(avatarID);
329 }
330
303 public void AddEstateManager(UUID avatarID) 331 public void AddEstateManager(UUID avatarID)
304 { 332 {
305 if (avatarID == UUID.Zero) 333 if (avatarID == UUID.Zero)
diff --git a/OpenSim/Framework/GroupData.cs b/OpenSim/Framework/GroupData.cs
index 247420e..e3b8626 100644
--- a/OpenSim/Framework/GroupData.cs
+++ b/OpenSim/Framework/GroupData.cs
@@ -135,4 +135,30 @@ namespace OpenSim.Framework
135 public bool HasAttachment; 135 public bool HasAttachment;
136 public byte AssetType; 136 public byte AssetType;
137 } 137 }
138
139 public struct GroupVoteHistory
140 {
141 public string VoteID;
142 public string VoteInitiator;
143 public string Majority;
144 public string Quorum;
145 public string TerseDateID;
146 public string StartDateTime;
147 public string EndDateTime;
148 public string VoteType;
149 public string VoteResult;
150 public string ProposalText;
151 }
152
153 public struct GroupActiveProposals
154 {
155 public string VoteID;
156 public string VoteInitiator;
157 public string Majority;
158 public string Quorum;
159 public string TerseDateID;
160 public string StartDateTime;
161 public string EndDateTime;
162 public string ProposalText;
163 }
138} 164}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 60c1ac7..3489af1 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -467,7 +467,7 @@ namespace OpenSim.Framework
467 467
468 public delegate void EjectUserUpdate(IClientAPI client, UUID parcelowner,uint flags, UUID target); 468 public delegate void EjectUserUpdate(IClientAPI client, UUID parcelowner,uint flags, UUID target);
469 469
470 public delegate void NewUserReport(IClientAPI client, string regionName,UUID abuserID, byte catagory, byte checkflags, string details, UUID objectID, Vector3 postion, byte reportType ,UUID screenshotID, string summery, UUID reporter); 470 public delegate void NewUserReport(IClientAPI client, string regionName,UUID abuserID, byte catagory, byte checkflags, string details, UUID objectID, Vector3 postion, byte reportType ,UUID screenshotID, string Summary, UUID reporter);
471 471
472 public delegate void GodUpdateRegionInfoUpdate(IClientAPI client, float BillableFactor, ulong EstateID, ulong RegionFlags, byte[] SimName,int RedirectX, int RedirectY); 472 public delegate void GodUpdateRegionInfoUpdate(IClientAPI client, float BillableFactor, ulong EstateID, ulong RegionFlags, byte[] SimName,int RedirectX, int RedirectY);
473 473
@@ -1069,25 +1069,25 @@ namespace OpenSim.Framework
1069 1069
1070 event PlacesQuery OnPlacesQuery; 1070 event PlacesQuery OnPlacesQuery;
1071 1071
1072 event FindAgentUpdate OnFindAgentEvent; 1072 event FindAgentUpdate OnFindAgent;
1073 event TrackAgentUpdate OnTrackAgentEvent; 1073 event TrackAgentUpdate OnTrackAgent;
1074 event NewUserReport OnUserReportEvent; 1074 event NewUserReport OnUserReport;
1075 event SaveStateHandler OnSaveStateEvent; 1075 event SaveStateHandler OnSaveState;
1076 event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; 1076 event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
1077 event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; 1077 event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
1078 event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; 1078 event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
1079 event FreezeUserUpdate OnParcelFreezeUserEvent; 1079 event FreezeUserUpdate OnParcelFreezeUser;
1080 event EjectUserUpdate OnParcelEjectUserEvent; 1080 event EjectUserUpdate OnParcelEjectUser;
1081 event ParcelBuyPass OnParcelBuyPass; 1081 event ParcelBuyPass OnParcelBuyPass;
1082 event ParcelGodMark OnParcelGodMark; 1082 event ParcelGodMark OnParcelGodMark;
1083 event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; 1083 event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
1084 event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 1084 event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
1085 event SimWideDeletesDelegate OnSimWideDeletes; 1085 event SimWideDeletesDelegate OnSimWideDeletes;
1086 event SendPostcard OnSendPostcard; 1086 event SendPostcard OnSendPostcard;
1087 event MuteListEntryUpdate OnUpdateMuteListEntryEvent; 1087 event MuteListEntryUpdate OnUpdateMuteListEntry;
1088 event MuteListEntryRemove OnRemoveMuteListEntryEvent; 1088 event MuteListEntryRemove OnRemoveMuteListEntry;
1089 event GodlikeMessage onGodlikeMessageEvent; 1089 event GodlikeMessage onGodlikeMessage;
1090 event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; 1090 event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
1091 1091
1092 /// <summary> 1092 /// <summary>
1093 /// Set the debug level at which packet output should be printed to console. 1093 /// Set the debug level at which packet output should be printed to console.
@@ -1271,7 +1271,7 @@ namespace OpenSim.Framework
1271 void SendHealth(float health); 1271 void SendHealth(float health);
1272 1272
1273 1273
1274 void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID); 1274 void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID);
1275 1275
1276 void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID); 1276 void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID);
1277 1277
@@ -1446,7 +1446,12 @@ namespace OpenSim.Framework
1446 void SendUserInfoReply(bool imViaEmail, bool visible, string email); 1446 void SendUserInfoReply(bool imViaEmail, bool visible, string email);
1447 1447
1448 void SendUseCachedMuteList(); 1448 void SendUseCachedMuteList();
1449 void SendMuteListUpdate(string filename); 1449
1450 void SendMuteListUpdate(string filename);
1451
1452 void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals);
1453
1454 void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes);
1450 1455
1451 void KillEndDone(); 1456 void KillEndDone();
1452 1457
diff --git a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs
index 2aee88e..5a155c1 100644
--- a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs
+++ b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs
@@ -32,7 +32,6 @@ namespace OpenSim.Framework
32{ 32{
33 public interface ILoginServiceToRegionsConnector 33 public interface ILoginServiceToRegionsConnector
34 { 34 {
35 bool RegionLoginsEnabled { get; }
36 void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message); 35 void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message);
37 bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason); 36 bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason);
38 RegionInfo RequestClosestRegion(string region); 37 RegionInfo RequestClosestRegion(string region);
diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs
index 7da4893..84cc05e 100644
--- a/OpenSim/Framework/MainServer.cs
+++ b/OpenSim/Framework/MainServer.cs
@@ -32,7 +32,7 @@ namespace OpenSim.Framework
32{ 32{
33 public class MainServer 33 public class MainServer
34 { 34 {
35 private static BaseHttpServer instance; 35 private static BaseHttpServer instance = null;
36 private static Dictionary<uint, BaseHttpServer> m_Servers = 36 private static Dictionary<uint, BaseHttpServer> m_Servers =
37 new Dictionary<uint, BaseHttpServer>(); 37 new Dictionary<uint, BaseHttpServer>();
38 38
@@ -46,7 +46,7 @@ namespace OpenSim.Framework
46 { 46 {
47 if (port == 0) 47 if (port == 0)
48 return Instance; 48 return Instance;
49 if (port == Instance.Port) 49 if (instance != null && port == Instance.Port)
50 return Instance; 50 return Instance;
51 51
52 if (m_Servers.ContainsKey(port)) 52 if (m_Servers.ContainsKey(port))
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 546a1d1..299f519 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -53,6 +53,7 @@ namespace OpenSim
53 protected string m_shutdownCommandsFile; 53 protected string m_shutdownCommandsFile;
54 protected bool m_gui = false; 54 protected bool m_gui = false;
55 protected string m_consoleType = "local"; 55 protected string m_consoleType = "local";
56 protected uint m_consolePort = 0;
56 57
57 private string m_timedScript = "disabled"; 58 private string m_timedScript = "disabled";
58 private Timer m_scriptTimer; 59 private Timer m_scriptTimer;
@@ -66,6 +67,7 @@ namespace OpenSim
66 base.ReadExtraConfigSettings(); 67 base.ReadExtraConfigSettings();
67 68
68 IConfig startupConfig = m_config.Source.Configs["Startup"]; 69 IConfig startupConfig = m_config.Source.Configs["Startup"];
70 IConfig networkConfig = m_config.Source.Configs["Network"];
69 71
70 int stpMaxThreads = 15; 72 int stpMaxThreads = 15;
71 73
@@ -79,6 +81,8 @@ namespace OpenSim
79 else 81 else
80 m_consoleType= startupConfig.GetString("console", String.Empty); 82 m_consoleType= startupConfig.GetString("console", String.Empty);
81 83
84 if (networkConfig != null)
85 m_consolePort = (uint)networkConfig.GetInt("console_port", 0);
82 m_timedScript = startupConfig.GetString("timer_Script", "disabled"); 86 m_timedScript = startupConfig.GetString("timer_Script", "disabled");
83 if (m_logFileAppender != null) 87 if (m_logFileAppender != null)
84 { 88 {
@@ -156,7 +160,16 @@ namespace OpenSim
156 MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); 160 MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this));
157 161
158 if (m_console is RemoteConsole) 162 if (m_console is RemoteConsole)
159 ((RemoteConsole)m_console).SetServer(m_httpServer); 163 {
164 if (m_consolePort == 0)
165 {
166 ((RemoteConsole)m_console).SetServer(m_httpServer);
167 }
168 else
169 {
170 ((RemoteConsole)m_console).SetServer(MainServer.GetHttpServer(m_consolePort));
171 }
172 }
160 173
161 //Run Startup Commands 174 //Run Startup Commands
162 if (String.IsNullOrEmpty(m_startupCommandsFile)) 175 if (String.IsNullOrEmpty(m_startupCommandsFile))
@@ -292,18 +305,6 @@ namespace OpenSim
292 "create region", 305 "create region",
293 "Create a new region", HandleCreateRegion); 306 "Create a new region", HandleCreateRegion);
294 307
295 m_console.Commands.AddCommand("region", false, "login enable",
296 "login enable",
297 "Enable logins to the simulator", HandleLoginEnable);
298
299 m_console.Commands.AddCommand("region", false, "login disable",
300 "login disable",
301 "Disable logins to the simulator", HandleLoginDisable);
302
303 m_console.Commands.AddCommand("region", false, "login status",
304 "login status",
305 "Display status of logins", HandleLoginStatus);
306
307 m_console.Commands.AddCommand("region", false, "restart", 308 m_console.Commands.AddCommand("region", false, "restart",
308 "restart", 309 "restart",
309 "Restart all sims in this instance", RunCommand); 310 "Restart all sims in this instance", RunCommand);
@@ -554,42 +555,6 @@ namespace OpenSim
554 } 555 }
555 556
556 /// <summary> 557 /// <summary>
557 /// Enable logins
558 /// </summary>
559 /// <param name="module"></param>
560 /// <param name="cmd"></param>
561 private void HandleLoginEnable(string module, string[] cmd)
562 {
563 ProcessLogin(true);
564 }
565
566
567 /// <summary>
568 /// Disable logins
569 /// </summary>
570 /// <param name="module"></param>
571 /// <param name="cmd"></param>
572 private void HandleLoginDisable(string module, string[] cmd)
573 {
574 ProcessLogin(false);
575 }
576
577 /// <summary>
578 /// Log login status to the console
579 /// </summary>
580 /// <param name="module"></param>
581 /// <param name="cmd"></param>
582 private void HandleLoginStatus(string module, string[] cmd)
583 {
584 if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false)
585
586 m_log.Info("[ Login ] Login are disabled ");
587 else
588 m_log.Info("[ Login ] Login are enabled");
589 }
590
591
592 /// <summary>
593 /// Change and load configuration file data. 558 /// Change and load configuration file data.
594 /// </summary> 559 /// </summary>
595 /// <param name="module"></param> 560 /// <param name="module"></param>
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index f3f715a..f265769 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -200,12 +200,6 @@ namespace OpenSim
200 plugin.PostInitialise(); 200 plugin.PostInitialise();
201 } 201 }
202 202
203 // Only enable logins to the regions once we have completely finished starting up (apart from scripts)
204 if ((SceneManager.CurrentOrFirstScene != null) && (SceneManager.CurrentOrFirstScene.SceneGridService != null))
205 {
206 SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
207 }
208
209 AddPluginCommands(); 203 AddPluginCommands();
210 } 204 }
211 205
@@ -276,31 +270,6 @@ namespace OpenSim
276 } 270 }
277 271
278 /// <summary> 272 /// <summary>
279 /// Initialises the asset cache. This supports legacy configuration values
280 /// to ensure consistent operation, but values outside of that namespace
281 /// are handled by the more generic resolution mechanism provided by
282 /// the ResolveAssetServer virtual method. If extended resolution fails,
283 /// then the normal default action is taken.
284 /// Creation of the AssetCache is handled by ResolveAssetCache. This
285 /// function accepts a reference to the instantiated AssetServer and
286 /// returns an IAssetCache implementation, if possible. This is a virtual
287 /// method.
288 /// </summary>
289 public void ProcessLogin(bool LoginEnabled)
290 {
291 if (LoginEnabled)
292 {
293 m_log.Info("[LOGIN]: Login is now enabled.");
294 SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
295 }
296 else
297 {
298 m_log.Info("[LOGIN]: Login is now disabled.");
299 SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = false;
300 }
301 }
302
303 /// <summary>
304 /// Execute the region creation process. This includes setting up scene infrastructure. 273 /// Execute the region creation process. This includes setting up scene infrastructure.
305 /// </summary> 274 /// </summary>
306 /// <param name="regionInfo"></param> 275 /// <param name="regionInfo"></param>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index b937226..ae0bd79 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -298,25 +298,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
298 public event AvatarInterestUpdate OnAvatarInterestUpdate; 298 public event AvatarInterestUpdate OnAvatarInterestUpdate;
299 public event PlacesQuery OnPlacesQuery; 299 public event PlacesQuery OnPlacesQuery;
300 public event AgentFOV OnAgentFOV; 300 public event AgentFOV OnAgentFOV;
301 public event FindAgentUpdate OnFindAgentEvent; 301 public event FindAgentUpdate OnFindAgent;
302 public event TrackAgentUpdate OnTrackAgentEvent; 302 public event TrackAgentUpdate OnTrackAgent;
303 public event NewUserReport OnUserReportEvent; 303 public event NewUserReport OnUserReport;
304 public event SaveStateHandler OnSaveStateEvent; 304 public event SaveStateHandler OnSaveState;
305 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; 305 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
306 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; 306 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
307 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; 307 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
308 public event FreezeUserUpdate OnParcelFreezeUserEvent; 308 public event FreezeUserUpdate OnParcelFreezeUser;
309 public event EjectUserUpdate OnParcelEjectUserEvent; 309 public event EjectUserUpdate OnParcelEjectUser;
310 public event ParcelBuyPass OnParcelBuyPass; 310 public event ParcelBuyPass OnParcelBuyPass;
311 public event ParcelGodMark OnParcelGodMark; 311 public event ParcelGodMark OnParcelGodMark;
312 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; 312 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
313 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 313 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
314 public event SimWideDeletesDelegate OnSimWideDeletes; 314 public event SimWideDeletesDelegate OnSimWideDeletes;
315 public event SendPostcard OnSendPostcard; 315 public event SendPostcard OnSendPostcard;
316 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; 316 public event MuteListEntryUpdate OnUpdateMuteListEntry;
317 public event MuteListEntryRemove OnRemoveMuteListEntryEvent; 317 public event MuteListEntryRemove OnRemoveMuteListEntry;
318 public event GodlikeMessage onGodlikeMessageEvent; 318 public event GodlikeMessage onGodlikeMessage;
319 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; 319 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
320 320
321 321
322 #endregion Events 322 #endregion Events
@@ -825,37 +825,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP
825 } 825 }
826 OutPacket(gmp, ThrottleOutPacketType.Task); 826 OutPacket(gmp, ThrottleOutPacketType.Task);
827 } 827 }
828 828
829 public void SendGroupActiveProposals(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, Dictionary<int, string> VoteID, Dictionary<int, string> VoteInitiator, Dictionary<int, string> Majority, Dictionary<int, string> Quorum, Dictionary<int, string> TerseDateID, Dictionary<int, string> StartDateTime, Dictionary<int, string> EndDateTime, Dictionary<int, string> ProposalText) 829 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
830 { 830 {
831 foreach (KeyValuePair<int, string> Blank in VoteID) 831 int i = 0;
832 foreach (GroupActiveProposals Proposal in Proposals)
832 { 833 {
833 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); 834 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
834 835
835 GAPIRP.AgentData.AgentID = agentID; 836 GAPIRP.AgentData.AgentID = AgentId;
836 GAPIRP.AgentData.GroupID = groupID; 837 GAPIRP.AgentData.GroupID = groupID;
837 GAPIRP.TransactionData.TransactionID = transactionID; 838 GAPIRP.TransactionData.TransactionID = transactionID;
838 GAPIRP.TransactionData.TotalNumItems = 1; 839 GAPIRP.TransactionData.TotalNumItems = ((uint)i+1);
839 GroupActiveProposalItemReplyPacket.ProposalDataBlock ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock(); 840 GroupActiveProposalItemReplyPacket.ProposalDataBlock ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock();
840 GAPIRP.ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock[1]; 841 GAPIRP.ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock[1];
841 ProposalData.VoteCast = Utils.StringToBytes("false"); 842 ProposalData.VoteCast = Utils.StringToBytes("false");
842 ProposalData.VoteID = new UUID(VoteID[Blank.Key]); 843 ProposalData.VoteID = new UUID(Proposal.VoteID);
843 ProposalData.VoteInitiator = new UUID(VoteInitiator[Blank.Key]); 844 ProposalData.VoteInitiator = new UUID(Proposal.VoteInitiator);
844 ProposalData.Majority = (float)Convert.ToInt32(Majority[Blank.Key]); 845 ProposalData.Majority = (float)Convert.ToInt32(Proposal.Majority);
845 ProposalData.Quorum = Convert.ToInt32(Quorum[Blank.Key]); 846 ProposalData.Quorum = Convert.ToInt32(Proposal.Quorum);
846 ProposalData.TerseDateID = Utils.StringToBytes(TerseDateID[Blank.Key]); 847 ProposalData.TerseDateID = Utils.StringToBytes(Proposal.TerseDateID);
847 ProposalData.StartDateTime = Utils.StringToBytes(StartDateTime[Blank.Key]); 848 ProposalData.StartDateTime = Utils.StringToBytes(Proposal.StartDateTime);
848 ProposalData.EndDateTime = Utils.StringToBytes(EndDateTime[Blank.Key]); 849 ProposalData.EndDateTime = Utils.StringToBytes(Proposal.EndDateTime);
849 ProposalData.ProposalText = Utils.StringToBytes(ProposalText[Blank.Key]); 850 ProposalData.ProposalText = Utils.StringToBytes(Proposal.ProposalText);
850 ProposalData.AlreadyVoted = false; 851 ProposalData.AlreadyVoted = false;
851 GAPIRP.ProposalData[0] = ProposalData; 852 GAPIRP.ProposalData[i] = ProposalData;
852 OutPacket(GAPIRP, ThrottleOutPacketType.Task); 853 OutPacket(GAPIRP, ThrottleOutPacketType.Task);
854 i++;
853 } 855 }
854 if (VoteID.Count == 0) 856 if (Proposals.Length == 0)
855 { 857 {
856 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); 858 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
857 859
858 GAPIRP.AgentData.AgentID = agentID; 860 GAPIRP.AgentData.AgentID = AgentId;
859 GAPIRP.AgentData.GroupID = groupID; 861 GAPIRP.AgentData.GroupID = groupID;
860 GAPIRP.TransactionData.TransactionID = transactionID; 862 GAPIRP.TransactionData.TransactionID = transactionID;
861 GAPIRP.TransactionData.TotalNumItems = 1; 863 GAPIRP.TransactionData.TotalNumItems = 1;
@@ -875,40 +877,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
875 OutPacket(GAPIRP, ThrottleOutPacketType.Task); 877 OutPacket(GAPIRP, ThrottleOutPacketType.Task);
876 } 878 }
877 } 879 }
878 880
879 public void SendGroupVoteHistory(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, Dictionary<int, string> VoteID, Dictionary<int, string> VoteInitiator, Dictionary<int, string> Majority, Dictionary<int, string> Quorum, Dictionary<int, string> TerseDateID, Dictionary<int, string> StartDateTime, Dictionary<int, string> EndDateTime, Dictionary<int, string> VoteType, Dictionary<int, string> VoteResult, Dictionary<int, string> ProposalText) 881 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
880 { 882 {
881 foreach (KeyValuePair<int, string> Blank in VoteID) 883 int i = 0;
884 foreach (GroupVoteHistory Vote in Votes)
882 { 885 {
883 GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); 886 GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
884 887
885 GVHIRP.AgentData.AgentID = agentID; 888 GVHIRP.AgentData.AgentID = AgentId;
886 GVHIRP.AgentData.GroupID = groupID; 889 GVHIRP.AgentData.GroupID = groupID;
887 GVHIRP.TransactionData.TransactionID = transactionID; 890 GVHIRP.TransactionData.TransactionID = transactionID;
888 GVHIRP.TransactionData.TotalNumItems = 1; 891 GVHIRP.TransactionData.TotalNumItems = ((uint)i+1);
889 GVHIRP.HistoryItemData.VoteID = new UUID(VoteID[Blank.Key]); 892 GVHIRP.HistoryItemData.VoteID = new UUID(Vote.VoteID);
890 GVHIRP.HistoryItemData.VoteInitiator = new UUID(VoteInitiator[Blank.Key]); 893 GVHIRP.HistoryItemData.VoteInitiator = new UUID(Vote.VoteInitiator);
891 GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Majority[Blank.Key]); 894 GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Vote.Majority);
892 GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Quorum[Blank.Key]); 895 GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Vote.Quorum);
893 GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(TerseDateID[Blank.Key]); 896 GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(Vote.TerseDateID);
894 GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(StartDateTime[Blank.Key]); 897 GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(Vote.StartDateTime);
895 GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(EndDateTime[Blank.Key]); 898 GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(Vote.EndDateTime);
896 GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(VoteType[Blank.Key]); 899 GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(Vote.VoteType);
897 GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(VoteResult[Blank.Key]); 900 GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(Vote.VoteResult);
898 GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(ProposalText[Blank.Key]); 901 GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(Vote.ProposalText);
899 GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock(); 902 GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock();
900 GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1]; 903 GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1];
901 VoteItem.CandidateID = UUID.Zero; 904 VoteItem.CandidateID = UUID.Zero;
902 VoteItem.NumVotes = 0; //TODO: FIX THIS!!! 905 VoteItem.NumVotes = 0; //TODO: FIX THIS!!!
903 VoteItem.VoteCast = Utils.StringToBytes("Yes"); 906 VoteItem.VoteCast = Utils.StringToBytes("Yes");
904 GVHIRP.VoteItem[0] = VoteItem; 907 GVHIRP.VoteItem[i] = VoteItem;
905 OutPacket(GVHIRP, ThrottleOutPacketType.Task); 908 OutPacket(GVHIRP, ThrottleOutPacketType.Task);
906 } 909 i++;
907 if (VoteID.Count == 0) 910 }
911 if (Votes.Length == 0)
908 { 912 {
909 GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); 913 GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
910 914
911 GVHIRP.AgentData.AgentID = agentID; 915 GVHIRP.AgentData.AgentID = AgentId;
912 GVHIRP.AgentData.GroupID = groupID; 916 GVHIRP.AgentData.GroupID = groupID;
913 GVHIRP.TransactionData.TransactionID = transactionID; 917 GVHIRP.TransactionData.TransactionID = transactionID;
914 GVHIRP.TransactionData.TotalNumItems = 0; 918 GVHIRP.TransactionData.TotalNumItems = 0;
@@ -3908,7 +3912,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3908 return false; 3912 return false;
3909 } 3913 }
3910 3914
3911 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) 3915 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
3916
3912 { 3917 {
3913 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 3918 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
3914 packet.AgentData.TransactionID = UUID.Random(); 3919 packet.AgentData.TransactionID = UUID.Random();
@@ -3917,26 +3922,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3917 packet.MethodData.Invoice = invoice; 3922 packet.MethodData.Invoice = invoice;
3918 packet.MethodData.Method = Utils.StringToBytes("setaccess"); 3923 packet.MethodData.Method = Utils.StringToBytes("setaccess");
3919 3924
3920 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length]; 3925 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + Data.Length];
3921 3926
3922 for (int i = 0; i < (6 + EstateManagers.Length); i++) 3927 for (int i = 0; i < (6 + Data.Length); i++)
3923 { 3928 {
3924 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); 3929 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
3925 } 3930 }
3926 int j = 0; 3931 int j = 0;
3927 3932
3928 returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; 3933 returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
3929 returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateManagers).ToString()); j++; 3934 returnblock[j].Parameter = Utils.StringToBytes(code.ToString()); j++;
3935 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
3930 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 3936 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
3931 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 3937 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
3932 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 3938 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
3933 returnblock[j].Parameter = Utils.StringToBytes(EstateManagers.Length.ToString()); j++; 3939
3934 for (int i = 0; i < EstateManagers.Length; i++) 3940 j = 2; // Agents
3941 if ((code & 2) != 0)
3942 j = 3; // Groups
3943 if ((code & 8) != 0)
3944 j = 5; // Managers
3945
3946 returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString());
3947 j = 6;
3948
3949 for (int i = 0; i < Data.Length; i++)
3935 { 3950 {
3936 returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++; 3951 returnblock[j].Parameter = Data[i].GetBytes(); j++;
3937 } 3952 }
3938 packet.ParamList = returnblock; 3953 packet.ParamList = returnblock;
3939 packet.Header.Reliable = false; 3954 packet.Header.Reliable = true;
3940 OutPacket(packet, ThrottleOutPacketType.Task); 3955 OutPacket(packet, ThrottleOutPacketType.Task);
3941 } 3956 }
3942 3957
@@ -4887,7 +4902,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4887 { 4902 {
4888 FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet; 4903 FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet;
4889 4904
4890 FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUserEvent; 4905 FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser;
4891 if (FreezeUserHandler != null) 4906 if (FreezeUserHandler != null)
4892 { 4907 {
4893 FreezeUserHandler(this, 4908 FreezeUserHandler(this,
@@ -4904,7 +4919,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4904 EjectUserPacket EjectUser = 4919 EjectUserPacket EjectUser =
4905 (EjectUserPacket)Packet; 4920 (EjectUserPacket)Packet;
4906 4921
4907 EjectUserUpdate EjectUserHandler = OnParcelEjectUserEvent; 4922 EjectUserUpdate EjectUserHandler = OnParcelEjectUser;
4908 if (EjectUserHandler != null) 4923 if (EjectUserHandler != null)
4909 { 4924 {
4910 EjectUserHandler(this, 4925 EjectUserHandler(this,
@@ -5303,7 +5318,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5303 FindAgentPacket FindAgent = 5318 FindAgentPacket FindAgent =
5304 (FindAgentPacket)Packet; 5319 (FindAgentPacket)Packet;
5305 5320
5306 FindAgentUpdate FindAgentHandler = OnFindAgentEvent; 5321 FindAgentUpdate FindAgentHandler = OnFindAgent;
5307 if (FindAgentHandler != null) 5322 if (FindAgentHandler != null)
5308 { 5323 {
5309 FindAgentHandler(this,FindAgent.AgentBlock.Hunter,FindAgent.AgentBlock.Prey); 5324 FindAgentHandler(this,FindAgent.AgentBlock.Hunter,FindAgent.AgentBlock.Prey);
@@ -5317,7 +5332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5317 TrackAgentPacket TrackAgent = 5332 TrackAgentPacket TrackAgent =
5318 (TrackAgentPacket)Packet; 5333 (TrackAgentPacket)Packet;
5319 5334
5320 TrackAgentUpdate TrackAgentHandler = OnTrackAgentEvent; 5335 TrackAgentUpdate TrackAgentHandler = OnTrackAgent;
5321 if (TrackAgentHandler != null) 5336 if (TrackAgentHandler != null)
5322 { 5337 {
5323 TrackAgentHandler(this, 5338 TrackAgentHandler(this,
@@ -8606,7 +8621,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8606 GodUpdateRegionInfoPacket GodUpdateRegionInfo = 8621 GodUpdateRegionInfoPacket GodUpdateRegionInfo =
8607 (GodUpdateRegionInfoPacket)Packet; 8622 (GodUpdateRegionInfoPacket)Packet;
8608 8623
8609 GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdateEvent; 8624 GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdate;
8610 if (handlerGodUpdateRegionInfo != null) 8625 if (handlerGodUpdateRegionInfo != null)
8611 { 8626 {
8612 handlerGodUpdateRegionInfo(this, 8627 handlerGodUpdateRegionInfo(this,
@@ -8639,7 +8654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8639 GodlikeMessagePacket GodlikeMessage = 8654 GodlikeMessagePacket GodlikeMessage =
8640 (GodlikeMessagePacket)Packet; 8655 (GodlikeMessagePacket)Packet;
8641 8656
8642 GodlikeMessage handlerGodlikeMessage = onGodlikeMessageEvent; 8657 GodlikeMessage handlerGodlikeMessage = onGodlikeMessage;
8643 if (handlerGodlikeMessage != null) 8658 if (handlerGodlikeMessage != null)
8644 { 8659 {
8645 handlerGodlikeMessage(this, 8660 handlerGodlikeMessage(this,
@@ -8655,7 +8670,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8655 { 8670 {
8656 StateSavePacket SaveStateMessage = 8671 StateSavePacket SaveStateMessage =
8657 (StateSavePacket)Packet; 8672 (StateSavePacket)Packet;
8658 SaveStateHandler handlerSaveStatePacket = OnSaveStateEvent; 8673 SaveStateHandler handlerSaveStatePacket = OnSaveState;
8659 if (handlerSaveStatePacket != null) 8674 if (handlerSaveStatePacket != null)
8660 { 8675 {
8661 handlerSaveStatePacket(this,SaveStateMessage.AgentData.AgentID); 8676 handlerSaveStatePacket(this,SaveStateMessage.AgentData.AgentID);
@@ -9019,7 +9034,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9019 { 9034 {
9020 UpdateMuteListEntryPacket UpdateMuteListEntry = 9035 UpdateMuteListEntryPacket UpdateMuteListEntry =
9021 (UpdateMuteListEntryPacket)Packet; 9036 (UpdateMuteListEntryPacket)Packet;
9022 MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntryEvent; 9037 MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntry;
9023 if (handlerUpdateMuteListEntry != null) 9038 if (handlerUpdateMuteListEntry != null)
9024 { 9039 {
9025 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, 9040 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID,
@@ -9035,7 +9050,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9035 { 9050 {
9036 RemoveMuteListEntryPacket RemoveMuteListEntry = 9051 RemoveMuteListEntryPacket RemoveMuteListEntry =
9037 (RemoveMuteListEntryPacket)Packet; 9052 (RemoveMuteListEntryPacket)Packet;
9038 MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntryEvent; 9053 MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntry;
9039 if (handlerRemoveMuteListEntry != null) 9054 if (handlerRemoveMuteListEntry != null)
9040 { 9055 {
9041 handlerRemoveMuteListEntry(this, 9056 handlerRemoveMuteListEntry(this,
@@ -9052,7 +9067,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9052 UserReportPacket UserReport = 9067 UserReportPacket UserReport =
9053 (UserReportPacket)Packet; 9068 (UserReportPacket)Packet;
9054 9069
9055 NewUserReport handlerUserReport = OnUserReportEvent; 9070 NewUserReport handlerUserReport = OnUserReport;
9056 if (handlerUserReport != null) 9071 if (handlerUserReport != null)
9057 { 9072 {
9058 handlerUserReport(this, 9073 handlerUserReport(this,
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index a835c52..e48b078 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
48 private List<Scene> m_SceneList = new List<Scene>(); 48 private List<Scene> m_SceneList = new List<Scene>();
49 private string m_RestURL = String.Empty; 49 private string m_RestURL = String.Empty;
50 IMessageTransferModule m_TransferModule = null; 50 IMessageTransferModule m_TransferModule = null;
51 private bool m_ForwardOfflineGroupMessages = true;
51 52
52 public void Initialise(IConfigSource config) 53 public void Initialise(IConfigSource config)
53 { 54 {
@@ -71,6 +72,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
71 enabled = false; 72 enabled = false;
72 return; 73 return;
73 } 74 }
75
76 m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
74 } 77 }
75 78
76 public void AddRegion(Scene scene) 79 public void AddRegion(Scene scene)
@@ -192,7 +195,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
192 195
193 private void UndeliveredMessage(GridInstantMessage im) 196 private void UndeliveredMessage(GridInstantMessage im)
194 { 197 {
195 if (im.offline != 0) 198 if ((im.offline != 0)
199 && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
196 { 200 {
197 bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( 201 bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
198 "POST", m_RestURL+"/SaveMessage/", im); 202 "POST", m_RestURL+"/SaveMessage/", im);
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index f980c24..106e87c 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -65,6 +65,7 @@
65 <RegionModule id="LLLoginServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Login.LLLoginServiceInConnectorModule" /> \ 65 <RegionModule id="LLLoginServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Login.LLLoginServiceInConnectorModule" /> \
66 <RegionModule id="SimulationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation.SimulationServiceInConnectorModule" /> \ 66 <RegionModule id="SimulationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation.SimulationServiceInConnectorModule" /> \
67 <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \ 67 <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \
68 <RegionModule id="AccessModule" type="OpenSim.Region.CoreModules.World.AccessModule" /> \
68 69
69 </Extension> 70 </Extension>
70 71
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index fa705be..274de2a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
195 195
196 #region IGridService 196 #region IGridService
197 197
198 public bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 198 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
199 { 199 {
200 // Region doesn't exist here. Trying to link remote region 200 // Region doesn't exist here. Trying to link remote region
201 if (regionInfo.RegionID.Equals(UUID.Zero)) 201 if (regionInfo.RegionID.Equals(UUID.Zero))
@@ -210,12 +210,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
210 210
211 // Try get the map image 211 // Try get the map image
212 m_HypergridServiceConnector.GetMapImage(regionInfo); 212 m_HypergridServiceConnector.GetMapImage(regionInfo);
213 return true; 213 return String.Empty;
214 } 214 }
215 else 215 else
216 { 216 {
217 m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")"); 217 m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")");
218 return false; 218 return "No such region";
219 } 219 }
220 // Note that these remote regions aren't registered in localBackend, so return null, no local listeners 220 // Note that these remote regions aren't registered in localBackend, so return null, no local listeners
221 } 221 }
@@ -465,7 +465,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
465 } 465 }
466 466
467 // Finally, link it 467 // Finally, link it
468 if (!RegisterRegion(UUID.Zero, regInfo)) 468 if (RegisterRegion(UUID.Zero, regInfo) != String.Empty)
469 { 469 {
470 m_log.Warn("[HGrid]: Unable to link region"); 470 m_log.Warn("[HGrid]: Unable to link region");
471 return false; 471 return false;
@@ -705,8 +705,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
705 public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome) 705 public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome)
706 { 706 {
707 comingHome = false; 707 comingHome = false;
708 if (!m_aScene.SceneGridService.RegionLoginsEnabled)
709 return false;
710 708
711 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID); 709 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID);
712 if (account != null) 710 if (account != null)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index f0081fc..86a8c13 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
169 169
170 #region IGridService 170 #region IGridService
171 171
172 public bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 172 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
173 { 173 {
174 return m_GridService.RegisterRegion(scopeID, regionInfo); 174 return m_GridService.RegisterRegion(scopeID, regionInfo);
175 } 175 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 72c00fc..391e7c8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -135,12 +135,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
135 135
136 #region IGridService 136 #region IGridService
137 137
138 public override bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 138 public override string RegisterRegion(UUID scopeID, GridRegion regionInfo)
139 { 139 {
140 if (m_LocalGridService.RegisterRegion(scopeID, regionInfo)) 140 string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo);
141
142 if (msg == String.Empty)
141 return base.RegisterRegion(scopeID, regionInfo); 143 return base.RegisterRegion(scopeID, regionInfo);
142 144
143 return false; 145 return msg;
144 } 146 }
145 147
146 public override bool DeregisterRegion(UUID regionID) 148 public override bool DeregisterRegion(UUID regionID)
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
new file mode 100644
index 0000000..8b5a413
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -0,0 +1,157 @@
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.Reflection;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces;
39
40namespace OpenSim.Region.CoreModules.World
41{
42 public class AccessModule : ISharedRegionModule
43 {
44 private static readonly ILog m_log =
45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType);
47
48 private List<Scene> m_SceneList = new List<Scene>();
49
50 public void Initialise(IConfigSource config)
51 {
52 MainConsole.Instance.Commands.AddCommand("access", true,
53 "login enable",
54 "login enable",
55 "Enable simulator logins",
56 String.Empty,
57 HandleLoginCommand);
58
59 MainConsole.Instance.Commands.AddCommand("access", true,
60 "login disable",
61 "login disable",
62 "Disable simulator logins",
63 String.Empty,
64 HandleLoginCommand);
65
66 MainConsole.Instance.Commands.AddCommand("access", true,
67 "login status",
68 "login status",
69 "Show login status",
70 String.Empty,
71 HandleLoginCommand);
72 }
73
74 public void PostInitialise()
75 {
76 }
77
78 public void Close()
79 {
80 }
81
82 public string Name
83 {
84 get { return "AccessModule"; }
85 }
86
87 public Type ReplaceableInterface
88 {
89 get { return null; }
90 }
91
92 public void AddRegion(Scene scene)
93 {
94 if (!m_SceneList.Contains(scene))
95 m_SceneList.Add(scene);
96 }
97
98 public void RemoveRegion(Scene scene)
99 {
100 m_SceneList.Remove(scene);
101 }
102
103 public void RegionLoaded(Scene scene)
104 {
105 }
106
107 public void HandleLoginCommand(string module, string[] cmd)
108 {
109 if ((Scene)MainConsole.Instance.ConsoleScene == null)
110 {
111 foreach (Scene s in m_SceneList)
112 {
113 if(!ProcessCommand(s, cmd))
114 break;
115 }
116 }
117 else
118 {
119 ProcessCommand((Scene)MainConsole.Instance.ConsoleScene, cmd);
120 }
121 }
122
123 bool ProcessCommand(Scene scene, string[] cmd)
124 {
125 if (cmd.Length < 2)
126 {
127 MainConsole.Instance.Output("Syntax: login enable|disable|status");
128 return false;
129 }
130
131 switch (cmd[1])
132 {
133 case "enable":
134 if (scene.LoginsDisabled)
135 MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName));
136 scene.LoginsDisabled = false;
137 break;
138 case "disable":
139 if (!scene.LoginsDisabled)
140 MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName));
141 scene.LoginsDisabled = true;
142 break;
143 case "status":
144 if (scene.LoginsDisabled)
145 MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
146 else
147 MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName));
148 break;
149 default:
150 MainConsole.Instance.Output("Syntax: login enable|disable|status");
151 return false;
152 }
153
154 return true;
155 }
156 }
157}
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 2109336..189efdc 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -72,10 +72,21 @@ namespace OpenSim.Region.CoreModules.World.Estate
72 m_scene.RegionInfo.EstateSettings.AbuseEmail, 72 m_scene.RegionInfo.EstateSettings.AbuseEmail,
73 estateOwner); 73 estateOwner);
74 74
75 remote_client.SendEstateManagersList(invoice, 75 remote_client.SendEstateList(invoice,
76 (int)Constants.EstateAccessCodex.EstateManagers,
76 m_scene.RegionInfo.EstateSettings.EstateManagers, 77 m_scene.RegionInfo.EstateSettings.EstateManagers,
77 m_scene.RegionInfo.EstateSettings.EstateID); 78 m_scene.RegionInfo.EstateSettings.EstateID);
78 79
80 remote_client.SendEstateList(invoice,
81 (int)Constants.EstateAccessCodex.AccessOptions,
82 m_scene.RegionInfo.EstateSettings.EstateAccess,
83 m_scene.RegionInfo.EstateSettings.EstateID);
84
85 remote_client.SendEstateList(invoice,
86 (int)Constants.EstateAccessCodex.AllowedGroups,
87 m_scene.RegionInfo.EstateSettings.EstateGroups,
88 m_scene.RegionInfo.EstateSettings.EstateID);
89
79 remote_client.SendBannedUserList(invoice, 90 remote_client.SendBannedUserList(invoice,
80 m_scene.RegionInfo.EstateSettings.EstateBans, 91 m_scene.RegionInfo.EstateSettings.EstateBans,
81 m_scene.RegionInfo.EstateSettings.EstateID); 92 m_scene.RegionInfo.EstateSettings.EstateID);
@@ -228,127 +239,176 @@ namespace OpenSim.Region.CoreModules.World.Estate
228 if (user == m_scene.RegionInfo.EstateSettings.EstateOwner) 239 if (user == m_scene.RegionInfo.EstateSettings.EstateOwner)
229 return; // never process EO 240 return; // never process EO
230 241
231 switch (estateAccessType) 242 if ((estateAccessType & 4) != 0) // User add
232 { 243 {
233 case 64: 244 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
234 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) 245 {
235 { 246 m_scene.RegionInfo.EstateSettings.AddEstateUser(user);
236 EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; 247 m_scene.RegionInfo.EstateSettings.Save();
237 248 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
238 bool alreadyInList = false; 249 }
239 250 else
240 for (int i = 0; i < banlistcheck.Length; i++) 251 {
241 { 252 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
242 if (user == banlistcheck[i].BannedUserID) 253 }
243 {
244 alreadyInList = true;
245 break;
246 }
247
248 }
249 if (!alreadyInList)
250 {
251 254
252 EstateBan item = new EstateBan(); 255 }
256 if ((estateAccessType & 8) != 0) // User remove
257 {
258 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
259 {
260 m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
261 m_scene.RegionInfo.EstateSettings.Save();
253 262
254 item.BannedUserID = user; 263 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
255 item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; 264 }
256 item.BannedHostAddress = "0.0.0.0"; 265 else
257 item.BannedHostIPMask = "0.0.0.0"; 266 {
267 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
268 }
269 }
270 if ((estateAccessType & 16) != 0) // Group add
271 {
272 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
273 {
274 m_scene.RegionInfo.EstateSettings.AddEstateGroup(user);
275 m_scene.RegionInfo.EstateSettings.Save();
276 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID);
277 }
278 else
279 {
280 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
281 }
282 }
283 if ((estateAccessType & 32) != 0) // Group remove
284 {
285 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
286 {
287 m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
288 m_scene.RegionInfo.EstateSettings.Save();
258 289
259 m_scene.RegionInfo.EstateSettings.AddBan(item); 290 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID);
260 m_scene.RegionInfo.EstateSettings.Save(); 291 }
292 else
293 {
294 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
295 }
296 }
297 if ((estateAccessType & 64) != 0) // Ban add
298 {
299 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
300 {
301 EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
261 302
262 ScenePresence s = m_scene.GetScenePresence(user); 303 bool alreadyInList = false;
263 if (s != null)
264 {
265 if (!s.IsChildAgent)
266 {
267 s.ControllingClient.SendTeleportLocationStart();
268 m_scene.TeleportClientHome(user, s.ControllingClient);
269 }
270 }
271 304
272 } 305 for (int i = 0; i < banlistcheck.Length; i++)
273 else 306 {
307 if (user == banlistcheck[i].BannedUserID)
274 { 308 {
275 remote_client.SendAlertMessage("User is already on the region ban list"); 309 alreadyInList = true;
310 break;
276 } 311 }
277 //m_scene.RegionInfo.regionBanlist.Add(Manager(user); 312
278 remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);
279 }
280 else
281 {
282 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
283 } 313 }
284 break; 314 if (!alreadyInList)
285 case 128:
286 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
287 { 315 {
288 EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
289 316
290 bool alreadyInList = false; 317 EstateBan item = new EstateBan();
291 EstateBan listitem = null; 318
319 item.BannedUserID = user;
320 item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID;
321 item.BannedHostAddress = "0.0.0.0";
322 item.BannedHostIPMask = "0.0.0.0";
292 323
293 for (int i = 0; i < banlistcheck.Length; i++) 324 m_scene.RegionInfo.EstateSettings.AddBan(item);
325 m_scene.RegionInfo.EstateSettings.Save();
326
327 ScenePresence s = m_scene.GetScenePresence(user);
328 if (s != null)
294 { 329 {
295 if (user == banlistcheck[i].BannedUserID) 330 if (!s.IsChildAgent)
296 { 331 {
297 alreadyInList = true; 332 s.ControllingClient.SendTeleportLocationStart();
298 listitem = banlistcheck[i]; 333 m_scene.TeleportClientHome(user, s.ControllingClient);
299 break;
300 } 334 }
301
302 } 335 }
303 if (alreadyInList && listitem != null) 336
304 {
305 m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
306 m_scene.RegionInfo.EstateSettings.Save();
307 }
308 else
309 {
310 remote_client.SendAlertMessage("User is not on the region ban list");
311 }
312 //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
313 remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);
314 } 337 }
315 else 338 else
316 { 339 {
317 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 340 remote_client.SendAlertMessage("User is already on the region ban list");
318 } 341 }
319 break; 342 //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
320 case 256: 343 remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);
344 }
345 else
346 {
347 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
348 }
349 }
350 if ((estateAccessType & 128) != 0) // Ban remove
351 {
352 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
353 {
354 EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
321 355
322 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 356 bool alreadyInList = false;
323 { 357 EstateBan listitem = null;
324 m_scene.RegionInfo.EstateSettings.AddEstateManager(user); 358
325 m_scene.RegionInfo.EstateSettings.Save(); 359 for (int i = 0; i < banlistcheck.Length; i++)
326 remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
327 }
328 else
329 { 360 {
330 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 361 if (user == banlistcheck[i].BannedUserID)
331 } 362 {
363 alreadyInList = true;
364 listitem = banlistcheck[i];
365 break;
366 }
332 367
333 break; 368 }
334 case 512: 369 if (alreadyInList && listitem != null)
335 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
336 { 370 {
337 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); 371 m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
338 m_scene.RegionInfo.EstateSettings.Save(); 372 m_scene.RegionInfo.EstateSettings.Save();
339
340 remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
341 } 373 }
342 else 374 else
343 { 375 {
344 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 376 remote_client.SendAlertMessage("User is not on the region ban list");
345 } 377 }
346 break; 378 //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
347 379 remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);
348 default: 380 }
381 else
382 {
383 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
384 }
385 }
386 if ((estateAccessType & 256) != 0) // Manager add
387 {
388 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
389 {
390 m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
391 m_scene.RegionInfo.EstateSettings.Save();
392 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
393 }
394 else
395 {
396 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
397 }
398 }
399 if ((estateAccessType & 512) != 0) // Manager remove
400 {
401 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
402 {
403 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
404 m_scene.RegionInfo.EstateSettings.Save();
349 405
350 m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString()); 406 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
351 break; 407 }
408 else
409 {
410 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
411 }
352 } 412 }
353 } 413 }
354 414
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 3d7516d..8fa0c65 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -607,7 +607,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
607 return objectOwnerMask; 607 return objectOwnerMask;
608 608
609 // Estate users should be able to edit anything in the sim 609 // Estate users should be able to edit anything in the sim
610 if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner)) 610 if (IsEstateManager(user) && m_RegionOwnerIsGod && (!IsAdministrator(objectOwner)) || objectOwner == user)
611 return objectOwnerMask; 611 return objectOwnerMask;
612 612
613 // Admin should be able to edit anything in the sim (including admin objects) 613 // Admin should be able to edit anything in the sim (including admin objects)
@@ -899,6 +899,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
899 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 899 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
900 if (m_bypassPermissions) return m_bypassPermissionsValue; 900 if (m_bypassPermissions) return m_bypassPermissionsValue;
901 901
902 if (IsEstateManager(user) && m_RegionOwnerIsGod)
903 return true;
904
902 return IsAdministrator(user); 905 return IsAdministrator(user);
903 } 906 }
904 907
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 27fad61..1dfa1b1 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -274,25 +274,25 @@ namespace OpenSim.Region.Examples.SimpleModule
274 274
275 public event PlacesQuery OnPlacesQuery; 275 public event PlacesQuery OnPlacesQuery;
276 276
277 public event FindAgentUpdate OnFindAgentEvent; 277 public event FindAgentUpdate OnFindAgent;
278 public event TrackAgentUpdate OnTrackAgentEvent; 278 public event TrackAgentUpdate OnTrackAgent;
279 public event NewUserReport OnUserReportEvent; 279 public event NewUserReport OnUserReport;
280 public event SaveStateHandler OnSaveStateEvent; 280 public event SaveStateHandler OnSaveState;
281 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; 281 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
282 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; 282 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
283 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; 283 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
284 public event FreezeUserUpdate OnParcelFreezeUserEvent; 284 public event FreezeUserUpdate OnParcelFreezeUser;
285 public event EjectUserUpdate OnParcelEjectUserEvent; 285 public event EjectUserUpdate OnParcelEjectUser;
286 public event ParcelBuyPass OnParcelBuyPass; 286 public event ParcelBuyPass OnParcelBuyPass;
287 public event ParcelGodMark OnParcelGodMark; 287 public event ParcelGodMark OnParcelGodMark;
288 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; 288 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
289 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 289 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
290 public event SimWideDeletesDelegate OnSimWideDeletes; 290 public event SimWideDeletesDelegate OnSimWideDeletes;
291 public event SendPostcard OnSendPostcard; 291 public event SendPostcard OnSendPostcard;
292 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; 292 public event MuteListEntryUpdate OnUpdateMuteListEntry;
293 public event MuteListEntryRemove OnRemoveMuteListEntryEvent; 293 public event MuteListEntryRemove OnRemoveMuteListEntry;
294 public event GodlikeMessage onGodlikeMessageEvent; 294 public event GodlikeMessage onGodlikeMessage;
295 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; 295 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
296 296
297#pragma warning restore 67 297#pragma warning restore 67
298 298
@@ -879,7 +879,7 @@ namespace OpenSim.Region.Examples.SimpleModule
879 { 879 {
880 } 880 }
881 881
882 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) 882 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
883 { 883 {
884 } 884 }
885 885
@@ -1133,7 +1133,15 @@ namespace OpenSim.Region.Examples.SimpleModule
1133 } 1133 }
1134 1134
1135 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1135 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1136 { 1136 {
1137 }
1138
1139 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1140 {
1141 }
1142
1143 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1144 {
1137 } 1145 }
1138 } 1146 }
1139} 1147}
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
index 5cdf191..d7fa316 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -32,13 +32,29 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); 33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k);
34 34
35 /// <summary>
36 /// Interface for communication between OpenSim modules and in-world scripts
37 /// </summary>
38 ///
39 /// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages
40 /// from scripts in OpenSim modules.
35 public interface IScriptModuleComms 41 public interface IScriptModuleComms
36 { 42 {
43 /// <summary>
44 /// Modules can subscribe to this event to receive command invocations from in-world scripts
45 /// </summary>
37 event ScriptCommand OnScriptCommand; 46 event ScriptCommand OnScriptCommand;
38 47
39 void DispatchReply(UUID script, int code, string text, string k); 48 /// <summary>
49 /// Send a link_message event to an in-world script
50 /// </summary>
51 /// <param name="scriptId"></param>
52 /// <param name="code"></param>
53 /// <param name="text"></param>
54 /// <param name="key"></param>
55 void DispatchReply(UUID scriptId, int code, string text, string key);
40 56
41 // For use ONLY by the script API 57 // For use ONLY by the script API
42 void RaiseEvent(UUID script, string id, string module, string command, string k); 58 void RaiseEvent(UUID script, string id, string module, string command, string key);
43 } 59 }
44} 60}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 753344d..399379e 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -183,12 +183,24 @@ namespace OpenSim.Region.Framework.Scenes
183 183
184 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; 184 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
185 185
186 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
187
188 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
189
190 public delegate void ScriptNotAtRotTargetEvent(uint localID);
191
192 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
193
186 public delegate void ScriptColliding(uint localID, ColliderArgs colliders); 194 public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
187 195
188 public event ScriptColliding OnScriptColliderStart; 196 public event ScriptColliding OnScriptColliderStart;
189 public event ScriptColliding OnScriptColliding; 197 public event ScriptColliding OnScriptColliding;
190 public event ScriptColliding OnScriptCollidingEnd; 198 public event ScriptColliding OnScriptCollidingEnd;
191 199
200 public event ScriptColliding OnScriptLandColliderStart;
201 public event ScriptColliding OnScriptLandColliding;
202 public event ScriptColliding OnScriptLandColliderEnd;
203
192 public delegate void OnMakeChildAgentDelegate(ScenePresence presence); 204 public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
193 public event OnMakeChildAgentDelegate OnMakeChildAgent; 205 public event OnMakeChildAgentDelegate OnMakeChildAgent;
194 206
@@ -380,6 +392,8 @@ namespace OpenSim.Region.Framework.Scenes
380 private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; 392 private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
381 private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; 393 private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
382 private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; 394 private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
395 private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null;
396 private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null;
383 private ClientMovement handlerClientMovement = null; //OnClientMovement; 397 private ClientMovement handlerClientMovement = null; //OnClientMovement;
384 private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; 398 private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
385 private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole; 399 private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
@@ -439,6 +453,9 @@ namespace OpenSim.Region.Framework.Scenes
439 private ScriptColliding handlerCollidingStart = null; 453 private ScriptColliding handlerCollidingStart = null;
440 private ScriptColliding handlerColliding = null; 454 private ScriptColliding handlerColliding = null;
441 private ScriptColliding handlerCollidingEnd = null; 455 private ScriptColliding handlerCollidingEnd = null;
456 private ScriptColliding handlerLandCollidingStart = null;
457 private ScriptColliding handlerLandColliding = null;
458 private ScriptColliding handlerLandCollidingEnd = null;
442 private GetScriptRunning handlerGetScriptRunning = null; 459 private GetScriptRunning handlerGetScriptRunning = null;
443 460
444 private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; 461 private SunLindenHour handlerCurrentTimeAsLindenSunHour = null;
@@ -844,6 +861,24 @@ namespace OpenSim.Region.Framework.Scenes
844 } 861 }
845 } 862 }
846 863
864 public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
865 {
866 handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
867 if (handlerScriptAtRotTargetEvent != null)
868 {
869 handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot);
870 }
871 }
872
873 public void TriggerNotAtRotTargetEvent(uint localID)
874 {
875 handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent;
876 if (handlerScriptNotAtRotTargetEvent != null)
877 {
878 handlerScriptNotAtRotTargetEvent(localID);
879 }
880 }
881
847 public void TriggerRequestChangeWaterHeight(float height) 882 public void TriggerRequestChangeWaterHeight(float height)
848 { 883 {
849 handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; 884 handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
@@ -1034,6 +1069,27 @@ namespace OpenSim.Region.Framework.Scenes
1034 handlerCollidingEnd(localId, colliders); 1069 handlerCollidingEnd(localId, colliders);
1035 } 1070 }
1036 1071
1072 public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
1073 {
1074 handlerLandCollidingStart = OnScriptLandColliderStart;
1075 if (handlerLandCollidingStart != null)
1076 handlerLandCollidingStart(localId, colliders);
1077 }
1078
1079 public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
1080 {
1081 handlerLandColliding = OnScriptLandColliding;
1082 if (handlerLandColliding != null)
1083 handlerLandColliding(localId, colliders);
1084 }
1085
1086 public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
1087 {
1088 handlerLandCollidingEnd = OnScriptLandColliderEnd;
1089 if (handlerLandCollidingEnd != null)
1090 handlerLandCollidingEnd(localId, colliders);
1091 }
1092
1037 public void TriggerSetRootAgentScene(UUID agentID, Scene scene) 1093 public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
1038 { 1094 {
1039 handlerSetRootAgentScene = OnSetRootAgentScene; 1095 handlerSetRootAgentScene = OnSetRootAgentScene;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index dcbbe08..bf40d82 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
142 protected AgentCircuitManager m_authenticateHandler; 142 protected AgentCircuitManager m_authenticateHandler;
143 143
144 protected SceneCommunicationService m_sceneGridService; 144 protected SceneCommunicationService m_sceneGridService;
145 public bool loginsdisabled = true; 145 public bool LoginsDisabled = true;
146 146
147 public new float TimeDilation 147 public new float TimeDilation
148 { 148 {
@@ -1366,15 +1366,19 @@ namespace OpenSim.Region.Framework.Scenes
1366 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); 1366 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1367 } 1367 }
1368 1368
1369 if (loginsdisabled && m_frame > 20) 1369 if (LoginsDisabled && m_frame == 20)
1370 { 1370 {
1371 // In 99.9% of cases it is a bad idea to manually force garbage collection. However, 1371 // In 99.9% of cases it is a bad idea to manually force garbage collection. However,
1372 // this is a rare case where we know we have just went through a long cycle of heap 1372 // this is a rare case where we know we have just went through a long cycle of heap
1373 // allocations, and there is no more work to be done until someone logs in 1373 // allocations, and there is no more work to be done until someone logs in
1374 GC.Collect(); 1374 GC.Collect();
1375 1375
1376 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); 1376 IConfig startupConfig = m_config.Configs["Startup"];
1377 loginsdisabled = false; 1377 if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
1378 {
1379 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1380 LoginsDisabled = false;
1381 }
1378 } 1382 }
1379 } 1383 }
1380 catch (NotImplementedException) 1384 catch (NotImplementedException)
@@ -1649,9 +1653,9 @@ namespace OpenSim.Region.Framework.Scenes
1649 //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); 1653 //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
1650 1654
1651 GridRegion region = new GridRegion(RegionInfo); 1655 GridRegion region = new GridRegion(RegionInfo);
1652 bool success = GridService.RegisterRegion(RegionInfo.ScopeID, region); 1656 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1653 if (!success) 1657 if (error != String.Empty)
1654 throw new Exception("Can't register with grid"); 1658 throw new Exception(error);
1655 1659
1656 m_sceneGridService.SetScene(this); 1660 m_sceneGridService.SetScene(this);
1657 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1661 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
@@ -3404,7 +3408,7 @@ namespace OpenSim.Region.Framework.Scenes
3404 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport 3408 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
3405 3409
3406 3410
3407 if (loginsdisabled) 3411 if (LoginsDisabled)
3408 { 3412 {
3409 reason = "Logins Disabled"; 3413 reason = "Logins Disabled";
3410 return false; 3414 return false;
@@ -3577,8 +3581,35 @@ namespace OpenSim.Region.Framework.Scenes
3577 return false; 3581 return false;
3578 } 3582 }
3579 3583
3584 IGroupsModule groupsModule =
3585 RequestModuleInterface<IGroupsModule>();
3586
3587 List<UUID> agentGroups = new List<UUID>();
3588
3589 if (groupsModule != null)
3590 {
3591 GroupMembershipData[] GroupMembership =
3592 groupsModule.GetMembershipData(agent.AgentID);
3593
3594 for (int i = 0; i < GroupMembership.Length; i++)
3595 agentGroups.Add(GroupMembership[i].GroupID);
3596 }
3597
3598 bool groupAccess = false;
3599 UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups;
3600
3601 foreach (UUID group in estateGroups)
3602 {
3603 if (agentGroups.Contains(group))
3604 {
3605 groupAccess = true;
3606 break;
3607 }
3608 }
3609
3580 if (!m_regInfo.EstateSettings.PublicAccess && 3610 if (!m_regInfo.EstateSettings.PublicAccess &&
3581 !m_regInfo.EstateSettings.HasAccess(agent.AgentID)) 3611 !m_regInfo.EstateSettings.HasAccess(agent.AgentID) &&
3612 !groupAccess)
3582 { 3613 {
3583 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", 3614 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
3584 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3615 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index a67b42a..f1813a5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -60,12 +60,7 @@ namespace OpenSim.Region.Framework.Scenes
60 60
61 protected RegionCommsListener regionCommsHost; 61 protected RegionCommsListener regionCommsHost;
62 62
63 public bool RegionLoginsEnabled 63 protected List<UUID> m_agentsInTransit;
64 {
65 get { return m_regionLoginsEnabled; }
66 set { m_regionLoginsEnabled = value; }
67 }
68 private bool m_regionLoginsEnabled = false;
69 64
70 /// <summary> 65 /// <summary>
71 /// An agent is crossing into this region 66 /// An agent is crossing into this region
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 34d8b49..ec41ac7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Framework.Scenes
57 land_collision_end = 4096, 57 land_collision_end = 4096,
58 land_collision_start = 8192, 58 land_collision_start = 8192,
59 at_target = 16384, 59 at_target = 16384,
60 at_rot_target = 16777216,
60 listen = 32768, 61 listen = 32768,
61 money = 65536, 62 money = 65536,
62 moving_end = 131072, 63 moving_end = 131072,
@@ -81,6 +82,13 @@ namespace OpenSim.Region.Framework.Scenes
81 public uint handle; 82 public uint handle;
82 } 83 }
83 84
85 struct scriptRotTarget
86 {
87 public Quaternion targetRot;
88 public float tolerance;
89 public uint handle;
90 }
91
84 public delegate void PrimCountTaintedDelegate(); 92 public delegate void PrimCountTaintedDelegate();
85 93
86 /// <summary> 94 /// <summary>
@@ -166,10 +174,14 @@ namespace OpenSim.Region.Framework.Scenes
166 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); 174 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
167 175
168 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>(); 176 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
177 private Dictionary<uint, scriptRotTarget> m_rotTargets = new Dictionary<uint, scriptRotTarget>();
169 178
170 private bool m_scriptListens_atTarget = false; 179 private bool m_scriptListens_atTarget = false;
171 private bool m_scriptListens_notAtTarget = false; 180 private bool m_scriptListens_notAtTarget = false;
172 181
182 private bool m_scriptListens_atRotTarget = false;
183 private bool m_scriptListens_notAtRotTarget = false;
184
173 internal Dictionary<UUID, string> m_savedScriptState = null; 185 internal Dictionary<UUID, string> m_savedScriptState = null;
174 186
175 #region Properties 187 #region Properties
@@ -1262,6 +1274,15 @@ namespace OpenSim.Region.Framework.Scenes
1262 m_targets.Clear(); 1274 m_targets.Clear();
1263 m_scene.RemoveGroupTarget(this); 1275 m_scene.RemoveGroupTarget(this);
1264 } 1276 }
1277 m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0);
1278 m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0);
1279
1280 if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget)
1281 {
1282 lock (m_rotTargets)
1283 m_rotTargets.Clear();
1284 m_scene.RemoveGroupTarget(this);
1285 }
1265 1286
1266 ScheduleGroupForFullUpdate(); 1287 ScheduleGroupForFullUpdate();
1267 } 1288 }
@@ -3158,6 +3179,30 @@ namespace OpenSim.Region.Framework.Scenes
3158 3179
3159 } 3180 }
3160 } 3181 }
3182 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
3183 {
3184 scriptRotTarget waypoint = new scriptRotTarget();
3185 waypoint.targetRot = target;
3186 waypoint.tolerance = tolerance;
3187 uint handle = m_scene.AllocateLocalId();
3188 waypoint.handle = handle;
3189 lock (m_rotTargets)
3190 {
3191 m_rotTargets.Add(handle, waypoint);
3192 }
3193 m_scene.AddGroupTarget(this);
3194 return (int)handle;
3195 }
3196
3197 public void unregisterRotTargetWaypoint(int handle)
3198 {
3199 lock (m_targets)
3200 {
3201 m_rotTargets.Remove((uint)handle);
3202 if (m_targets.Count == 0)
3203 m_scene.RemoveGroupTarget(this);
3204 }
3205 }
3161 3206
3162 public int registerTargetWaypoint(Vector3 target, float tolerance) 3207 public int registerTargetWaypoint(Vector3 target, float tolerance)
3163 { 3208 {
@@ -3264,6 +3309,85 @@ namespace OpenSim.Region.Framework.Scenes
3264 } 3309 }
3265 } 3310 }
3266 } 3311 }
3312 if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget)
3313 {
3314 if (m_rotTargets.Count > 0)
3315 {
3316 bool at_Rottarget = false;
3317 Dictionary<uint, scriptRotTarget> atRotTargets = new Dictionary<uint, scriptRotTarget>();
3318 lock (m_rotTargets)
3319 {
3320 foreach (uint idx in m_rotTargets.Keys)
3321 {
3322 scriptRotTarget target = m_rotTargets[idx];
3323 double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2;
3324 if (angle < 0) angle = -angle;
3325 if (angle > Math.PI) angle = (Math.PI * 2 - angle);
3326 if (angle <= target.tolerance)
3327 {
3328 // trigger at_rot_target
3329 if (m_scriptListens_atRotTarget)
3330 {
3331 at_Rottarget = true;
3332 scriptRotTarget att = new scriptRotTarget();
3333 att.targetRot = target.targetRot;
3334 att.tolerance = target.tolerance;
3335 att.handle = target.handle;
3336 atRotTargets.Add(idx, att);
3337 }
3338 }
3339 }
3340 }
3341
3342 if (atRotTargets.Count > 0)
3343 {
3344 uint[] localids = new uint[0];
3345 lock (m_parts)
3346 {
3347 localids = new uint[m_parts.Count];
3348 int cntr = 0;
3349 foreach (SceneObjectPart part in m_parts.Values)
3350 {
3351 localids[cntr] = part.LocalId;
3352 cntr++;
3353 }
3354 }
3355
3356 for (int ctr = 0; ctr < localids.Length; ctr++)
3357 {
3358 foreach (uint target in atRotTargets.Keys)
3359 {
3360 scriptRotTarget att = atRotTargets[target];
3361 m_scene.EventManager.TriggerAtRotTargetEvent(
3362 localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset);
3363 }
3364 }
3365
3366 return;
3367 }
3368
3369 if (m_scriptListens_notAtRotTarget && !at_Rottarget)
3370 {
3371 //trigger not_at_target
3372 uint[] localids = new uint[0];
3373 lock (m_parts)
3374 {
3375 localids = new uint[m_parts.Count];
3376 int cntr = 0;
3377 foreach (SceneObjectPart part in m_parts.Values)
3378 {
3379 localids[cntr] = part.LocalId;
3380 cntr++;
3381 }
3382 }
3383
3384 for (int ctr = 0; ctr < localids.Length; ctr++)
3385 {
3386 m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]);
3387 }
3388 }
3389 }
3390 }
3267 } 3391 }
3268 3392
3269 public float GetMass() 3393 public float GetMass()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 22a8ca1..56b2f13 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -140,6 +140,15 @@ namespace OpenSim.Region.Framework.Scenes
140 140
141 [XmlIgnore] 141 [XmlIgnore]
142 public UUID FromItemID; 142 public UUID FromItemID;
143
144 [XmlIgnore]
145 public int STATUS_ROTATE_X;
146
147 [XmlIgnore]
148 public int STATUS_ROTATE_Y;
149
150 [XmlIgnore]
151 public int STATUS_ROTATE_Z;
143 152
144 [XmlIgnore] 153 [XmlIgnore]
145 private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); 154 private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>();
@@ -1673,6 +1682,19 @@ namespace OpenSim.Region.Framework.Scenes
1673 return m_parentGroup.RootPart.DIE_AT_EDGE; 1682 return m_parentGroup.RootPart.DIE_AT_EDGE;
1674 } 1683 }
1675 1684
1685 public int GetAxisRotation(int axis)
1686 {
1687 //Cannot use ScriptBaseClass constants as no referance to it currently.
1688 if (axis == 2)//STATUS_ROTATE_X
1689 return STATUS_ROTATE_X;
1690 if (axis == 4)//STATUS_ROTATE_Y
1691 return STATUS_ROTATE_Y;
1692 if (axis == 8)//STATUS_ROTATE_Z
1693 return STATUS_ROTATE_Z;
1694
1695 return 0;
1696 }
1697
1676 public double GetDistanceTo(Vector3 a, Vector3 b) 1698 public double GetDistanceTo(Vector3 a, Vector3 b)
1677 { 1699 {
1678 float dx = a.X - b.X; 1700 float dx = a.X - b.X;
@@ -1831,16 +1853,12 @@ namespace OpenSim.Region.Framework.Scenes
1831 // and build up list of colliders this time 1853 // and build up list of colliders this time
1832 foreach (uint localid in collissionswith.Keys) 1854 foreach (uint localid in collissionswith.Keys)
1833 { 1855 {
1834 if (localid != 0) 1856 thisHitColliders.Add(localid);
1857 if (!m_lastColliders.Contains(localid))
1835 { 1858 {
1836 thisHitColliders.Add(localid); 1859 startedColliders.Add(localid);
1837 if (!m_lastColliders.Contains(localid))
1838 {
1839 startedColliders.Add(localid);
1840 }
1841
1842 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1843 } 1860 }
1861 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1844 } 1862 }
1845 1863
1846 // calculate things that ended colliding 1864 // calculate things that ended colliding
@@ -1882,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes
1882 List<DetectedObject> colliding = new List<DetectedObject>(); 1900 List<DetectedObject> colliding = new List<DetectedObject>();
1883 foreach (uint localId in startedColliders) 1901 foreach (uint localId in startedColliders)
1884 { 1902 {
1903 if (localId == 0)
1904 return;
1885 // always running this check because if the user deletes the object it would return a null reference. 1905 // always running this check because if the user deletes the object it would return a null reference.
1886 if (m_parentGroup == null) 1906 if (m_parentGroup == null)
1887 return; 1907 return;
@@ -1919,7 +1939,7 @@ namespace OpenSim.Region.Framework.Scenes
1919 { 1939 {
1920 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1940 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1921 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 1941 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
1922 if (found) 1942 if (!found)
1923 { 1943 {
1924 DetectedObject detobj = new DetectedObject(); 1944 DetectedObject detobj = new DetectedObject();
1925 detobj.keyUUID = obj.UUID; 1945 detobj.keyUUID = obj.UUID;
@@ -1944,7 +1964,7 @@ namespace OpenSim.Region.Framework.Scenes
1944 1964
1945 if (av.LocalId == localId) 1965 if (av.LocalId == localId)
1946 { 1966 {
1947 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 1967 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
1948 { 1968 {
1949 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1969 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1950 //If it is 1, it is to accept ONLY collisions from this avatar 1970 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -1970,7 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
1970 { 1990 {
1971 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1991 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1972 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work 1992 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
1973 if (found) 1993 if (!found)
1974 { 1994 {
1975 DetectedObject detobj = new DetectedObject(); 1995 DetectedObject detobj = new DetectedObject();
1976 detobj.keyUUID = av.UUID; 1996 detobj.keyUUID = av.UUID;
@@ -2017,7 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes
2017 { 2037 {
2018 // always running this check because if the user deletes the object it would return a null reference. 2038 // always running this check because if the user deletes the object it would return a null reference.
2019 if (localId == 0) 2039 if (localId == 0)
2020 continue; 2040 return;
2021 2041
2022 if (m_parentGroup == null) 2042 if (m_parentGroup == null)
2023 return; 2043 return;
@@ -2055,7 +2075,7 @@ namespace OpenSim.Region.Framework.Scenes
2055 { 2075 {
2056 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2076 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2057 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 2077 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2058 if (found) 2078 if (!found)
2059 { 2079 {
2060 DetectedObject detobj = new DetectedObject(); 2080 DetectedObject detobj = new DetectedObject();
2061 detobj.keyUUID = obj.UUID; 2081 detobj.keyUUID = obj.UUID;
@@ -2080,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes
2080 2100
2081 if (av.LocalId == localId) 2101 if (av.LocalId == localId)
2082 { 2102 {
2083 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 2103 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2084 { 2104 {
2085 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2105 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2086 //If it is 1, it is to accept ONLY collisions from this avatar 2106 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2106,7 +2126,7 @@ namespace OpenSim.Region.Framework.Scenes
2106 { 2126 {
2107 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2127 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2108 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work 2128 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2109 if (found) 2129 if (!found)
2110 { 2130 {
2111 DetectedObject detobj = new DetectedObject(); 2131 DetectedObject detobj = new DetectedObject();
2112 detobj.keyUUID = av.UUID; 2132 detobj.keyUUID = av.UUID;
@@ -2149,7 +2169,7 @@ namespace OpenSim.Region.Framework.Scenes
2149 foreach (uint localId in endedColliders) 2169 foreach (uint localId in endedColliders)
2150 { 2170 {
2151 if (localId == 0) 2171 if (localId == 0)
2152 continue; 2172 return;
2153 2173
2154 // always running this check because if the user deletes the object it would return a null reference. 2174 // always running this check because if the user deletes the object it would return a null reference.
2155 if (m_parentGroup == null) 2175 if (m_parentGroup == null)
@@ -2186,7 +2206,7 @@ namespace OpenSim.Region.Framework.Scenes
2186 { 2206 {
2187 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2207 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2188 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 2208 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2189 if (found) 2209 if (!found)
2190 { 2210 {
2191 DetectedObject detobj = new DetectedObject(); 2211 DetectedObject detobj = new DetectedObject();
2192 detobj.keyUUID = obj.UUID; 2212 detobj.keyUUID = obj.UUID;
@@ -2211,7 +2231,7 @@ namespace OpenSim.Region.Framework.Scenes
2211 2231
2212 if (av.LocalId == localId) 2232 if (av.LocalId == localId)
2213 { 2233 {
2214 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 2234 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2215 { 2235 {
2216 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2236 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2217 //If it is 1, it is to accept ONLY collisions from this avatar 2237 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2237,7 +2257,7 @@ namespace OpenSim.Region.Framework.Scenes
2237 { 2257 {
2238 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2258 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2239 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work 2259 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2240 if (found) 2260 if (!found)
2241 { 2261 {
2242 DetectedObject detobj = new DetectedObject(); 2262 DetectedObject detobj = new DetectedObject();
2243 detobj.keyUUID = av.UUID; 2263 detobj.keyUUID = av.UUID;
@@ -2271,6 +2291,120 @@ namespace OpenSim.Region.Framework.Scenes
2271 } 2291 }
2272 } 2292 }
2273 } 2293 }
2294 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
2295 {
2296 if (startedColliders.Count > 0)
2297 {
2298 ColliderArgs LandStartCollidingMessage = new ColliderArgs();
2299 List<DetectedObject> colliding = new List<DetectedObject>();
2300 foreach (uint localId in startedColliders)
2301 {
2302 if (localId == 0)
2303 {
2304 //Hope that all is left is ground!
2305 DetectedObject detobj = new DetectedObject();
2306 detobj.keyUUID = UUID.Zero;
2307 detobj.nameStr = "";
2308 detobj.ownerUUID = UUID.Zero;
2309 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2310 detobj.rotQuat = Quaternion.Identity;
2311 detobj.velVector = Vector3.Zero;
2312 detobj.colliderType = 0;
2313 detobj.groupUUID = UUID.Zero;
2314 colliding.Add(detobj);
2315 }
2316 }
2317
2318 if (colliding.Count > 0)
2319 {
2320 LandStartCollidingMessage.Colliders = colliding;
2321 // always running this check because if the user deletes the object it would return a null reference.
2322 if (m_parentGroup == null)
2323 return;
2324
2325 if (m_parentGroup.Scene == null)
2326 return;
2327
2328 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage);
2329 }
2330 }
2331 }
2332 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
2333 {
2334 if (m_lastColliders.Count > 0)
2335 {
2336 ColliderArgs LandCollidingMessage = new ColliderArgs();
2337 List<DetectedObject> colliding = new List<DetectedObject>();
2338 foreach (uint localId in startedColliders)
2339 {
2340 if (localId == 0)
2341 {
2342 //Hope that all is left is ground!
2343 DetectedObject detobj = new DetectedObject();
2344 detobj.keyUUID = UUID.Zero;
2345 detobj.nameStr = "";
2346 detobj.ownerUUID = UUID.Zero;
2347 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2348 detobj.rotQuat = Quaternion.Identity;
2349 detobj.velVector = Vector3.Zero;
2350 detobj.colliderType = 0;
2351 detobj.groupUUID = UUID.Zero;
2352 colliding.Add(detobj);
2353 }
2354 }
2355
2356 if (colliding.Count > 0)
2357 {
2358 LandCollidingMessage.Colliders = colliding;
2359 // always running this check because if the user deletes the object it would return a null reference.
2360 if (m_parentGroup == null)
2361 return;
2362
2363 if (m_parentGroup.Scene == null)
2364 return;
2365
2366 m_parentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage);
2367 }
2368 }
2369 }
2370 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
2371 {
2372 if (endedColliders.Count > 0)
2373 {
2374 ColliderArgs LandEndCollidingMessage = new ColliderArgs();
2375 List<DetectedObject> colliding = new List<DetectedObject>();
2376 foreach (uint localId in startedColliders)
2377 {
2378 if (localId == 0)
2379 {
2380 //Hope that all is left is ground!
2381 DetectedObject detobj = new DetectedObject();
2382 detobj.keyUUID = UUID.Zero;
2383 detobj.nameStr = "";
2384 detobj.ownerUUID = UUID.Zero;
2385 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2386 detobj.rotQuat = Quaternion.Identity;
2387 detobj.velVector = Vector3.Zero;
2388 detobj.colliderType = 0;
2389 detobj.groupUUID = UUID.Zero;
2390 colliding.Add(detobj);
2391 }
2392 }
2393
2394 if (colliding.Count > 0)
2395 {
2396 LandEndCollidingMessage.Colliders = colliding;
2397 // always running this check because if the user deletes the object it would return a null reference.
2398 if (m_parentGroup == null)
2399 return;
2400
2401 if (m_parentGroup.Scene == null)
2402 return;
2403
2404 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage);
2405 }
2406 }
2407 }
2274 } 2408 }
2275 2409
2276 public void PhysicsOutOfBounds(Vector3 pos) 2410 public void PhysicsOutOfBounds(Vector3 pos)
@@ -2737,6 +2871,13 @@ namespace OpenSim.Region.Framework.Scenes
2737 { 2871 {
2738 m_parentGroup.SetAxisRotation(axis, rotate); 2872 m_parentGroup.SetAxisRotation(axis, rotate);
2739 } 2873 }
2874 //Cannot use ScriptBaseClass constants as no referance to it currently.
2875 if (axis == 2)//STATUS_ROTATE_X
2876 STATUS_ROTATE_X = rotate;
2877 if (axis == 4)//STATUS_ROTATE_Y
2878 STATUS_ROTATE_Y = rotate;
2879 if (axis == 8)//STATUS_ROTATE_Z
2880 STATUS_ROTATE_Z = rotate;
2740 } 2881 }
2741 2882
2742 public void SetBuoyancy(float fvalue) 2883 public void SetBuoyancy(float fvalue)
@@ -3669,6 +3810,9 @@ namespace OpenSim.Region.Framework.Scenes
3669 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 3810 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3670 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 3811 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3671 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 3812 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
3813 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
3814 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
3815 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3672 (CollisionSound != UUID.Zero) 3816 (CollisionSound != UUID.Zero)
3673 ) 3817 )
3674 { 3818 {
@@ -3873,6 +4017,9 @@ namespace OpenSim.Region.Framework.Scenes
3873 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4017 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3874 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4018 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3875 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 4019 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4020 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4021 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4022 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3876 (CollisionSound != UUID.Zero) 4023 (CollisionSound != UUID.Zero)
3877 ) 4024 )
3878 { 4025 {
@@ -3933,6 +4080,23 @@ namespace OpenSim.Region.Framework.Scenes
3933 } 4080 }
3934 } 4081 }
3935 4082
4083 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
4084 {
4085 if (m_parentGroup != null)
4086 {
4087 return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
4088 }
4089 return 0;
4090 }
4091
4092 public void unregisterRotTargetWaypoint(int handle)
4093 {
4094 if (m_parentGroup != null)
4095 {
4096 m_parentGroup.unregisterRotTargetWaypoint(handle);
4097 }
4098 }
4099
3936 public void SetCameraAtOffset(Vector3 v) 4100 public void SetCameraAtOffset(Vector3 v)
3937 { 4101 {
3938 m_cameraAtOffset = v; 4102 m_cameraAtOffset = v;
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 5d97a12..6785c08 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -836,25 +836,25 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
836 public event MuteListRequest OnMuteListRequest; 836 public event MuteListRequest OnMuteListRequest;
837 public event AvatarInterestUpdate OnAvatarInterestUpdate; 837 public event AvatarInterestUpdate OnAvatarInterestUpdate;
838 public event PlacesQuery OnPlacesQuery; 838 public event PlacesQuery OnPlacesQuery;
839 public event FindAgentUpdate OnFindAgentEvent; 839 public event FindAgentUpdate OnFindAgent;
840 public event TrackAgentUpdate OnTrackAgentEvent; 840 public event TrackAgentUpdate OnTrackAgent;
841 public event NewUserReport OnUserReportEvent; 841 public event NewUserReport OnUserReport;
842 public event SaveStateHandler OnSaveStateEvent; 842 public event SaveStateHandler OnSaveState;
843 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; 843 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
844 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; 844 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
845 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; 845 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
846 public event FreezeUserUpdate OnParcelFreezeUserEvent; 846 public event FreezeUserUpdate OnParcelFreezeUser;
847 public event EjectUserUpdate OnParcelEjectUserEvent; 847 public event EjectUserUpdate OnParcelEjectUser;
848 public event ParcelBuyPass OnParcelBuyPass; 848 public event ParcelBuyPass OnParcelBuyPass;
849 public event ParcelGodMark OnParcelGodMark; 849 public event ParcelGodMark OnParcelGodMark;
850 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; 850 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
851 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 851 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
852 public event SimWideDeletesDelegate OnSimWideDeletes; 852 public event SimWideDeletesDelegate OnSimWideDeletes;
853 public event SendPostcard OnSendPostcard; 853 public event SendPostcard OnSendPostcard;
854 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; 854 public event MuteListEntryUpdate OnUpdateMuteListEntry;
855 public event MuteListEntryRemove OnRemoveMuteListEntryEvent; 855 public event MuteListEntryRemove OnRemoveMuteListEntry;
856 public event GodlikeMessage onGodlikeMessageEvent; 856 public event GodlikeMessage onGodlikeMessage;
857 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; 857 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
858 858
859#pragma warning restore 67 859#pragma warning restore 67
860 860
@@ -1220,7 +1220,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1220 1220
1221 } 1221 }
1222 1222
1223 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) 1223 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
1224 { 1224 {
1225 1225
1226 } 1226 }
@@ -1657,7 +1657,15 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1657 } 1657 }
1658 1658
1659 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1659 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1660 { 1660 {
1661 }
1662
1663 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1664 {
1665 }
1666
1667 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1668 {
1661 } 1669 }
1662 } 1670 }
1663} 1671}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
index e11cbd7..66265d8 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
@@ -220,8 +220,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
220 220
221 // Fail if fundamental information is still missing 221 // Fail if fundamental information is still missing
222 222
223 if (cs.Server == null || cs.IrcChannel == null || cs.BaseNickname == null || cs.User == null) 223 if (cs.Server == null)
224 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}", cs.idn, rs.Region)); 224 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: server missing", cs.idn, rs.Region));
225 else if (cs.IrcChannel == null)
226 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: channel missing", cs.idn, rs.Region));
227 else if (cs.BaseNickname == null)
228 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: nick missing", cs.idn, rs.Region));
229 else if (cs.User == null)
230 throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: user missing", cs.idn, rs.Region));
225 231
226 m_log.InfoFormat("[IRC-Channel-{0}] Configuration for Region {1} is valid", cs.idn, rs.Region); 232 m_log.InfoFormat("[IRC-Channel-{0}] Configuration for Region {1} is valid", cs.idn, rs.Region);
227 m_log.InfoFormat("[IRC-Channel-{0}] Server = {1}", cs.idn, cs.Server); 233 m_log.InfoFormat("[IRC-Channel-{0}] Server = {1}", cs.idn, cs.Server);
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index e3392c8..4a4c515 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -380,25 +380,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC
380 380
381 public event PlacesQuery OnPlacesQuery; 381 public event PlacesQuery OnPlacesQuery;
382 382
383 public event FindAgentUpdate OnFindAgentEvent; 383 public event FindAgentUpdate OnFindAgent;
384 public event TrackAgentUpdate OnTrackAgentEvent; 384 public event TrackAgentUpdate OnTrackAgent;
385 public event NewUserReport OnUserReportEvent; 385 public event NewUserReport OnUserReport;
386 public event SaveStateHandler OnSaveStateEvent; 386 public event SaveStateHandler OnSaveState;
387 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; 387 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
388 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; 388 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
389 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; 389 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
390 public event FreezeUserUpdate OnParcelFreezeUserEvent; 390 public event FreezeUserUpdate OnParcelFreezeUser;
391 public event EjectUserUpdate OnParcelEjectUserEvent; 391 public event EjectUserUpdate OnParcelEjectUser;
392 public event ParcelBuyPass OnParcelBuyPass; 392 public event ParcelBuyPass OnParcelBuyPass;
393 public event ParcelGodMark OnParcelGodMark; 393 public event ParcelGodMark OnParcelGodMark;
394 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; 394 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
395 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 395 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
396 public event SimWideDeletesDelegate OnSimWideDeletes; 396 public event SimWideDeletesDelegate OnSimWideDeletes;
397 public event SendPostcard OnSendPostcard; 397 public event SendPostcard OnSendPostcard;
398 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; 398 public event MuteListEntryUpdate OnUpdateMuteListEntry;
399 public event MuteListEntryRemove OnRemoveMuteListEntryEvent; 399 public event MuteListEntryRemove OnRemoveMuteListEntry;
400 public event GodlikeMessage onGodlikeMessageEvent; 400 public event GodlikeMessage onGodlikeMessage;
401 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; 401 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
402 402
403#pragma warning restore 67 403#pragma warning restore 67
404 404
@@ -897,7 +897,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
897 { 897 {
898 } 898 }
899 899
900 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) 900 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
901 { 901 {
902 } 902 }
903 903
@@ -1138,7 +1138,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1138 } 1138 }
1139 1139
1140 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1140 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1141 { 1141 {
1142 }
1143
1144 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1145 {
1146 }
1147
1148 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1149 {
1142 } 1150 }
1143 } 1151 }
1144} 1152}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d5562f2..ee2a94c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2110,14 +2110,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2110 public LSL_Integer llRotTarget(LSL_Rotation rot, double error) 2110 public LSL_Integer llRotTarget(LSL_Rotation rot, double error)
2111 { 2111 {
2112 m_host.AddScriptLPS(1); 2112 m_host.AddScriptLPS(1);
2113 NotImplemented("llRotTarget"); 2113 return m_host.registerRotTargetWaypoint(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error);
2114 return 0;
2115 } 2114 }
2116 2115
2117 public void llRotTargetRemove(int number) 2116 public void llRotTargetRemove(int number)
2118 { 2117 {
2119 m_host.AddScriptLPS(1); 2118 m_host.AddScriptLPS(1);
2120 NotImplemented("llRotTargetRemove"); 2119 m_host.unregisterRotTargetWaypoint(number);
2121 } 2120 }
2122 2121
2123 public void llMoveToTarget(LSL_Vector target, double tau) 2122 public void llMoveToTarget(LSL_Vector target, double tau)
@@ -7286,23 +7285,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7286 public LSL_Integer llGetNumberOfPrims() 7285 public LSL_Integer llGetNumberOfPrims()
7287 { 7286 {
7288 m_host.AddScriptLPS(1); 7287 m_host.AddScriptLPS(1);
7289 ScenePresence[] presences = World.GetScenePresences();
7290 if (presences.Length == 0)
7291 return 0;
7292
7293 int avatarCount = 0; 7288 int avatarCount = 0;
7294 for (int i = 0; i < presences.Length; i++) 7289 World.ForEachScenePresence(delegate(ScenePresence presence)
7295 { 7290 {
7296 ScenePresence presence = presences[i]; 7291 if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
7297
7298 if (!presence.IsChildAgent && presence.ParentID != 0)
7299 {
7300 if (m_host.ParentGroup.HasChildPrim(presence.ParentID))
7301 {
7302 avatarCount++; 7292 avatarCount++;
7303 } 7293 });
7304 }
7305 }
7306 7294
7307 return m_host.ParentGroup.PrimCount + avatarCount; 7295 return m_host.ParentGroup.PrimCount + avatarCount;
7308 } 7296 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 0ed7f51..7462ba0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1981,6 +1981,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1981 1981
1982 return (int)pws; 1982 return (int)pws;
1983 } 1983 }
1984
1984 public void osSetSpeed(string UUID, float SpeedModifier) 1985 public void osSetSpeed(string UUID, float SpeedModifier)
1985 { 1986 {
1986 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); 1987 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
@@ -1988,6 +1989,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1988 ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); 1989 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
1989 avatar.SpeedModifier = SpeedModifier; 1990 avatar.SpeedModifier = SpeedModifier;
1990 } 1991 }
1992
1991 public void osKickAvatar(string FirstName,string SurName,string alert) 1993 public void osKickAvatar(string FirstName,string SurName,string alert)
1992 { 1994 {
1993 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); 1995 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
@@ -2008,6 +2010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2008 } 2010 }
2009 } 2011 }
2010 } 2012 }
2013
2011 public void osCauseDamage(string avatar, double damage) 2014 public void osCauseDamage(string avatar, double damage)
2012 { 2015 {
2013 CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); 2016 CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
@@ -2035,6 +2038,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2035 } 2038 }
2036 } 2039 }
2037 } 2040 }
2041
2038 public void osCauseHealing(string avatar, double healing) 2042 public void osCauseHealing(string avatar, double healing)
2039 { 2043 {
2040 CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); 2044 CheckThreatLevel(ThreatLevel.High, "osCauseHealing");
@@ -2059,4 +2063,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2059 } 2063 }
2060 } 2064 }
2061 } 2065 }
2062} 2066} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
index 7f67599..9615315 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
@@ -62,6 +62,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
62 land_collision_end = 4096, 62 land_collision_end = 4096,
63 land_collision_start = 8192, 63 land_collision_start = 8192,
64 at_target = 16384, 64 at_target = 16384,
65 at_rot_target = 16777216,
65 listen = 32768, 66 listen = 32768,
66 money = 65536, 67 money = 65536,
67 moving_end = 131072, 68 moving_end = 131072,
@@ -203,7 +204,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
203 } 204 }
204 205
205 m_eventFlagsMap.Add("attach", scriptEvents.attach); 206 m_eventFlagsMap.Add("attach", scriptEvents.attach);
206 // m_eventFlagsMap.Add("at_rot_target",(long)scriptEvents.at_rot_target); 207 m_eventFlagsMap.Add("at_rot_target", scriptEvents.at_rot_target);
207 m_eventFlagsMap.Add("at_target", scriptEvents.at_target); 208 m_eventFlagsMap.Add("at_target", scriptEvents.at_target);
208 // m_eventFlagsMap.Add("changed",(long)scriptEvents.changed); 209 // m_eventFlagsMap.Add("changed",(long)scriptEvents.changed);
209 m_eventFlagsMap.Add("collision", scriptEvents.collision); 210 m_eventFlagsMap.Add("collision", scriptEvents.collision);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 8195f33..16309ef 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -59,10 +59,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
59 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; 59 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
60 myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; 60 myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target;
61 myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; 61 myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target;
62 myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target;
63 myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target;
62 myScriptEngine.World.EventManager.OnScriptControlEvent += control; 64 myScriptEngine.World.EventManager.OnScriptControlEvent += control;
63 myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; 65 myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start;
64 myScriptEngine.World.EventManager.OnScriptColliding += collision; 66 myScriptEngine.World.EventManager.OnScriptColliding += collision;
65 myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; 67 myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end;
68 myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start;
69 myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision;
70 myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end;
66 IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); 71 IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
67 if (money != null) 72 if (money != null)
68 { 73 {
@@ -285,29 +290,63 @@ namespace OpenSim.Region.ScriptEngine.XEngine
285 det.ToArray())); 290 det.ToArray()));
286 } 291 }
287 292
288 public void land_collision_start(uint localID, UUID itemID) 293 public void land_collision_start(uint localID, ColliderArgs col)
289 { 294 {
290 myScriptEngine.PostObjectEvent(localID, new EventParams( 295 List<DetectParams> det = new List<DetectParams>();
291 "land_collision_start", 296
292 new object[0], 297 foreach (DetectedObject detobj in col.Colliders)
293 new DetectParams[0])); 298 {
299 DetectParams d = new DetectParams();
300 d.Position = new LSL_Types.Vector3(detobj.posVector.X,
301 detobj.posVector.Y,
302 detobj.posVector.Z);
303 d.Populate(myScriptEngine.World);
304 det.Add(d);
305 myScriptEngine.PostObjectEvent(localID, new EventParams(
306 "land_collision_start",
307 new Object[] { new LSL_Types.Vector3(d.Position) },
308 det.ToArray()));
309 }
310
294 } 311 }
295 312
296 public void land_collision(uint localID, UUID itemID) 313 public void land_collision(uint localID, ColliderArgs col)
297 { 314 {
298 myScriptEngine.PostObjectEvent(localID, new EventParams( 315 List<DetectParams> det = new List<DetectParams>();
299 "land_collision", 316
300 new object[0], 317 foreach (DetectedObject detobj in col.Colliders)
301 new DetectParams[0])); 318 {
319 DetectParams d = new DetectParams();
320 d.Position = new LSL_Types.Vector3(detobj.posVector.X,
321 detobj.posVector.Y,
322 detobj.posVector.Z);
323 d.Populate(myScriptEngine.World);
324 det.Add(d);
325 myScriptEngine.PostObjectEvent(localID, new EventParams(
326 "land_collision",
327 new Object[] { new LSL_Types.Vector3(d.Position) },
328 det.ToArray()));
329 }
302 } 330 }
303 331
304 public void land_collision_end(uint localID, UUID itemID) 332 public void land_collision_end(uint localID, ColliderArgs col)
305 { 333 {
306 myScriptEngine.PostObjectEvent(localID, new EventParams( 334 List<DetectParams> det = new List<DetectParams>();
307 "land_collision_end", 335
308 new object[0], 336 foreach (DetectedObject detobj in col.Colliders)
309 new DetectParams[0])); 337 {
310 } 338 DetectParams d = new DetectParams();
339 d.Position = new LSL_Types.Vector3(detobj.posVector.X,
340 detobj.posVector.Y,
341 detobj.posVector.Z);
342 d.Populate(myScriptEngine.World);
343 det.Add(d);
344 myScriptEngine.PostObjectEvent(localID, new EventParams(
345 "land_collision_end",
346 new Object[] { new LSL_Types.Vector3(d.Position) },
347 det.ToArray()));
348 }
349 }
311 350
312 // timer: not handled here 351 // timer: not handled here
313 // listen: not handled here 352 // listen: not handled here
@@ -353,14 +392,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
353 new DetectParams[0])); 392 new DetectParams[0]));
354 } 393 }
355 394
356 public void at_rot_target(uint localID, UUID itemID) 395 public void at_rot_target(uint localID, uint handle, Quaternion targetrot,
396 Quaternion atrot)
357 { 397 {
358 myScriptEngine.PostObjectEvent(localID, new EventParams( 398 myScriptEngine.PostObjectEvent(localID, new EventParams(
359 "at_rot_target",new object[0], 399 "at_rot_target", new object[] {
400 new LSL_Types.LSLInteger(handle),
401 new LSL_Types.Quaternion(targetrot.X,targetrot.Y,targetrot.Z,targetrot.W),
402 new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) },
360 new DetectParams[0])); 403 new DetectParams[0]));
361 } 404 }
362 405
363 public void not_at_rot_target(uint localID, UUID itemID) 406 public void not_at_rot_target(uint localID)
364 { 407 {
365 myScriptEngine.PostObjectEvent(localID, new EventParams( 408 myScriptEngine.PostObjectEvent(localID, new EventParams(
366 "not_at_rot_target",new object[0], 409 "not_at_rot_target",new object[0],
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs
index ed0210f..77184a4 100644
--- a/OpenSim/Server/Base/HttpServerBase.cs
+++ b/OpenSim/Server/Base/HttpServerBase.cs
@@ -49,6 +49,7 @@ namespace OpenSim.Server.Base
49 protected uint m_Port = 0; 49 protected uint m_Port = 0;
50 protected Dictionary<uint, BaseHttpServer> m_Servers = 50 protected Dictionary<uint, BaseHttpServer> m_Servers =
51 new Dictionary<uint, BaseHttpServer>(); 51 new Dictionary<uint, BaseHttpServer>();
52 protected uint m_consolePort = 0;
52 53
53 public IHttpServer HttpServer 54 public IHttpServer HttpServer
54 { 55 {
@@ -98,6 +99,7 @@ namespace OpenSim.Server.Base
98 Thread.CurrentThread.Abort(); 99 Thread.CurrentThread.Abort();
99 } 100 }
100 101
102 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
101 m_Port = port; 103 m_Port = port;
102 104
103 m_HttpServer = new BaseHttpServer(port); 105 m_HttpServer = new BaseHttpServer(port);
@@ -111,7 +113,10 @@ namespace OpenSim.Server.Base
111 113
112 if (MainConsole.Instance is RemoteConsole) 114 if (MainConsole.Instance is RemoteConsole)
113 { 115 {
114 ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); 116 if (m_consolePort == 0)
117 ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer);
118 else
119 ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort));
115 } 120 }
116 } 121 }
117 } 122 }
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index 1601575..318ce85 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -162,14 +162,14 @@ namespace OpenSim.Server.Handlers.Grid
162 m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e); 162 m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e);
163 } 163 }
164 164
165 bool result = false; 165 string result = "Error communicating with grid service";
166 if (rinfo != null) 166 if (rinfo != null)
167 result = m_GridService.RegisterRegion(scopeID, rinfo); 167 result = m_GridService.RegisterRegion(scopeID, rinfo);
168 168
169 if (result) 169 if (result == String.Empty)
170 return SuccessResult(); 170 return SuccessResult();
171 else 171 else
172 return FailureResult(); 172 return FailureResult(result);
173 } 173 }
174 174
175 byte[] Deregister(Dictionary<string, object> request) 175 byte[] Deregister(Dictionary<string, object> request)
@@ -509,6 +509,11 @@ namespace OpenSim.Server.Handlers.Grid
509 509
510 private byte[] FailureResult() 510 private byte[] FailureResult()
511 { 511 {
512 return FailureResult(String.Empty);
513 }
514
515 private byte[] FailureResult(string msg)
516 {
512 XmlDocument doc = new XmlDocument(); 517 XmlDocument doc = new XmlDocument();
513 518
514 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, 519 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
@@ -526,6 +531,11 @@ namespace OpenSim.Server.Handlers.Grid
526 531
527 rootElement.AppendChild(result); 532 rootElement.AppendChild(result);
528 533
534 XmlElement message = doc.CreateElement("", "Message", "");
535 message.AppendChild(doc.CreateTextNode(msg));
536
537 rootElement.AppendChild(message);
538
529 return DocToBytes(doc); 539 return DocToBytes(doc);
530 } 540 }
531 541
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
new file mode 100644
index 0000000..c7d5ff1
--- /dev/null
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -0,0 +1,456 @@
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.Reflection;
30using System.Text;
31using System.Xml;
32using System.Collections.Generic;
33using System.IO;
34using Nini.Config;
35using OpenSim.Framework;
36using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces;
38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Server.Handlers.Base;
40using log4net;
41using OpenMetaverse;
42
43namespace OpenSim.Server.Handlers.Asset
44{
45 public class XInventoryInConnector : ServiceConnector
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private IInventoryService m_InventoryService;
50 private string m_ConfigName = "InventoryService";
51
52 public XInventoryInConnector(IConfigSource config, IHttpServer server, string configName) :
53 base(config, server, configName)
54 {
55 if (configName != String.Empty)
56 m_ConfigName = configName;
57
58 IConfig serverConfig = config.Configs[m_ConfigName];
59 if (serverConfig == null)
60 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
61
62 string inventoryService = serverConfig.GetString("LocalServiceModule",
63 String.Empty);
64
65 if (inventoryService == String.Empty)
66 throw new Exception("No InventoryService in config file");
67
68 Object[] args = new Object[] { config };
69 m_InventoryService =
70 ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args);
71
72 server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService));
73 }
74 }
75
76 public class XInventoryConnectorPostHandler : BaseStreamHandler
77 {
78 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
79
80 private IInventoryService m_InventoryService;
81
82 public XInventoryConnectorPostHandler(IInventoryService service) :
83 base("POST", "/xinventory")
84 {
85 m_InventoryService = service;
86 }
87
88 public override byte[] Handle(string path, Stream requestData,
89 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
90 {
91 StreamReader sr = new StreamReader(requestData);
92 string body = sr.ReadToEnd();
93 sr.Close();
94 body = body.Trim();
95
96 m_log.DebugFormat("[XXX]: query String: {0}", body);
97
98 try
99 {
100 Dictionary<string, object> request =
101 ServerUtils.ParseQueryString(body);
102
103 if (!request.ContainsKey("METHOD"))
104 return FailureResult();
105
106 string method = request["METHOD"].ToString();
107 request.Remove("METHOD");
108
109 switch (method)
110 {
111 case "CREATEUSERINVENTORY":
112 return HandleCreateUserInventory(request);
113 case "GETINVENTORYSKELETON":
114 return HandleGetInventorySkeleton(request);
115 case "GETROOTFOLDER":
116 return HandleGetRootFolder(request);
117 case "GETFOLDERFORTYPE":
118 return HandleGetFolderForType(request);
119 case "GETFOLDERCONTENT":
120 return HandleGetFolderContent(request);
121 case "GETFOLDERITEMS":
122 return HandleGetFolderItems(request);
123 case "ADDFOLDER":
124 return HandleAddFolder(request);
125 case "UPDATEFOLDER":
126 return HandleUpdateFolder(request);
127 case "MOVEFOLDER":
128 return HandleMoveFolder(request);
129 case "DELETEFOLDERS":
130 return HandleDeleteFolders(request);
131 case "PURGEFOLDER":
132 return HandlePurgeFolder(request);
133 case "ADDITEM":
134 return HandleAddItem(request);
135 case "UPDATEITEM":
136 return HandleUpdateItem(request);
137 case "MOVEITEMS":
138 return HandleMoveItems(request);
139 case "DELETEITEMS":
140 return HandleDeleteItems(request);
141 case "GETITEM":
142 return HandleGetItem(request);
143 case "GETFOLDER":
144 return HandleGetFolder(request);
145 case "GETACTIVEGESTURES":
146 return HandleGetActiveGestures(request);
147 case "GETASSETPERMISSIONS":
148 return HandleGetAssetPermissions(request);
149 }
150 m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
151 }
152 catch (Exception e)
153 {
154 m_log.Debug("[XINVENTORY HANDLER]: Exception {0}" + e);
155 }
156
157 return FailureResult();
158 }
159
160 private byte[] FailureResult()
161 {
162 XmlDocument doc = new XmlDocument();
163
164 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
165 "", "");
166
167 doc.AppendChild(xmlnode);
168
169 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
170 "");
171
172 doc.AppendChild(rootElement);
173
174 XmlElement result = doc.CreateElement("", "RESULT", "");
175 result.AppendChild(doc.CreateTextNode("False"));
176
177 rootElement.AppendChild(result);
178
179 return DocToBytes(doc);
180 }
181
182 private byte[] DocToBytes(XmlDocument doc)
183 {
184 MemoryStream ms = new MemoryStream();
185 XmlTextWriter xw = new XmlTextWriter(ms, null);
186 xw.Formatting = Formatting.Indented;
187 doc.WriteTo(xw);
188 xw.Flush();
189
190 return ms.ToArray();
191 }
192
193 byte[] HandleCreateUserInventory(Dictionary<string,object> request)
194 {
195 Dictionary<string,object> result = new Dictionary<string,object>();
196
197 if (!request.ContainsKey("PRINCIPAL"))
198 return FailureResult();
199
200 if(m_InventoryService.CreateUserInventory(new UUID(request["PRINCIPAL"].ToString())))
201 result["RESULT"] = "True";
202 else
203 result["RESULT"] = "False";
204
205 string xmlString = ServerUtils.BuildXmlResponse(result);
206 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
207 UTF8Encoding encoding = new UTF8Encoding();
208 return encoding.GetBytes(xmlString);
209 }
210
211 byte[] HandleGetInventorySkeleton(Dictionary<string,object> request)
212 {
213 Dictionary<string,object> result = new Dictionary<string,object>();
214
215 if (!request.ContainsKey("PRINCIPAL"))
216 return FailureResult();
217
218
219 List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString()));
220
221 foreach (InventoryFolderBase f in folders)
222 result[f.ID.ToString()] = EncodeFolder(f);
223
224 string xmlString = ServerUtils.BuildXmlResponse(result);
225 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
226 UTF8Encoding encoding = new UTF8Encoding();
227 return encoding.GetBytes(xmlString);
228 }
229
230 byte[] HandleGetRootFolder(Dictionary<string,object> request)
231 {
232 Dictionary<string,object> result = new Dictionary<string,object>();
233
234 string xmlString = ServerUtils.BuildXmlResponse(result);
235 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
236 UTF8Encoding encoding = new UTF8Encoding();
237 return encoding.GetBytes(xmlString);
238 }
239
240 byte[] HandleGetFolderForType(Dictionary<string,object> request)
241 {
242 Dictionary<string,object> result = new Dictionary<string,object>();
243
244 string xmlString = ServerUtils.BuildXmlResponse(result);
245 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
246 UTF8Encoding encoding = new UTF8Encoding();
247 return encoding.GetBytes(xmlString);
248 }
249
250 byte[] HandleGetFolderContent(Dictionary<string,object> request)
251 {
252 Dictionary<string,object> result = new Dictionary<string,object>();
253
254 string xmlString = ServerUtils.BuildXmlResponse(result);
255 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
256 UTF8Encoding encoding = new UTF8Encoding();
257 return encoding.GetBytes(xmlString);
258 }
259
260 byte[] HandleGetFolderItems(Dictionary<string,object> request)
261 {
262 Dictionary<string,object> result = new Dictionary<string,object>();
263
264 string xmlString = ServerUtils.BuildXmlResponse(result);
265 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
266 UTF8Encoding encoding = new UTF8Encoding();
267 return encoding.GetBytes(xmlString);
268 }
269
270 byte[] HandleAddFolder(Dictionary<string,object> request)
271 {
272 Dictionary<string,object> result = new Dictionary<string,object>();
273
274 string xmlString = ServerUtils.BuildXmlResponse(result);
275 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
276 UTF8Encoding encoding = new UTF8Encoding();
277 return encoding.GetBytes(xmlString);
278 }
279
280 byte[] HandleUpdateFolder(Dictionary<string,object> request)
281 {
282 Dictionary<string,object> result = new Dictionary<string,object>();
283
284 string xmlString = ServerUtils.BuildXmlResponse(result);
285 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
286 UTF8Encoding encoding = new UTF8Encoding();
287 return encoding.GetBytes(xmlString);
288 }
289
290 byte[] HandleMoveFolder(Dictionary<string,object> request)
291 {
292 Dictionary<string,object> result = new Dictionary<string,object>();
293
294 string xmlString = ServerUtils.BuildXmlResponse(result);
295 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
296 UTF8Encoding encoding = new UTF8Encoding();
297 return encoding.GetBytes(xmlString);
298 }
299
300 byte[] HandleDeleteFolders(Dictionary<string,object> request)
301 {
302 Dictionary<string,object> result = new Dictionary<string,object>();
303
304 string xmlString = ServerUtils.BuildXmlResponse(result);
305 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
306 UTF8Encoding encoding = new UTF8Encoding();
307 return encoding.GetBytes(xmlString);
308 }
309
310 byte[] HandlePurgeFolder(Dictionary<string,object> request)
311 {
312 Dictionary<string,object> result = new Dictionary<string,object>();
313
314 string xmlString = ServerUtils.BuildXmlResponse(result);
315 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
316 UTF8Encoding encoding = new UTF8Encoding();
317 return encoding.GetBytes(xmlString);
318 }
319
320 byte[] HandleAddItem(Dictionary<string,object> request)
321 {
322 Dictionary<string,object> result = new Dictionary<string,object>();
323
324 string xmlString = ServerUtils.BuildXmlResponse(result);
325 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
326 UTF8Encoding encoding = new UTF8Encoding();
327 return encoding.GetBytes(xmlString);
328 }
329
330 byte[] HandleUpdateItem(Dictionary<string,object> request)
331 {
332 Dictionary<string,object> result = new Dictionary<string,object>();
333
334 string xmlString = ServerUtils.BuildXmlResponse(result);
335 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
336 UTF8Encoding encoding = new UTF8Encoding();
337 return encoding.GetBytes(xmlString);
338 }
339
340 byte[] HandleMoveItems(Dictionary<string,object> request)
341 {
342 Dictionary<string,object> result = new Dictionary<string,object>();
343
344 string xmlString = ServerUtils.BuildXmlResponse(result);
345 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
346 UTF8Encoding encoding = new UTF8Encoding();
347 return encoding.GetBytes(xmlString);
348 }
349
350 byte[] HandleDeleteItems(Dictionary<string,object> request)
351 {
352 Dictionary<string,object> result = new Dictionary<string,object>();
353
354 string xmlString = ServerUtils.BuildXmlResponse(result);
355 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
356 UTF8Encoding encoding = new UTF8Encoding();
357 return encoding.GetBytes(xmlString);
358 }
359
360 byte[] HandleGetItem(Dictionary<string,object> request)
361 {
362 Dictionary<string,object> result = new Dictionary<string,object>();
363
364 string xmlString = ServerUtils.BuildXmlResponse(result);
365 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
366 UTF8Encoding encoding = new UTF8Encoding();
367 return encoding.GetBytes(xmlString);
368 }
369
370 byte[] HandleGetFolder(Dictionary<string,object> request)
371 {
372 Dictionary<string,object> result = new Dictionary<string,object>();
373
374 string xmlString = ServerUtils.BuildXmlResponse(result);
375 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
376 UTF8Encoding encoding = new UTF8Encoding();
377 return encoding.GetBytes(xmlString);
378 }
379
380 byte[] HandleGetActiveGestures(Dictionary<string,object> request)
381 {
382 Dictionary<string,object> result = new Dictionary<string,object>();
383
384 string xmlString = ServerUtils.BuildXmlResponse(result);
385 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
386 UTF8Encoding encoding = new UTF8Encoding();
387 return encoding.GetBytes(xmlString);
388 }
389
390 byte[] HandleGetAssetPermissions(Dictionary<string,object> request)
391 {
392 Dictionary<string,object> result = new Dictionary<string,object>();
393
394 string xmlString = ServerUtils.BuildXmlResponse(result);
395 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
396 UTF8Encoding encoding = new UTF8Encoding();
397 return encoding.GetBytes(xmlString);
398 }
399
400 private Dictionary<string, object> EncodeFolder(InventoryFolderBase f)
401 {
402 Dictionary<string, object> ret = new Dictionary<string, object>();
403
404 ret["ParentID"] = f.ParentID.ToString();
405 ret["Type"] = f.Type.ToString();
406 ret["Version"] = f.Version.ToString();
407 ret["Name"] = f.Name;
408 ret["Owner"] = f.Owner.ToString();
409 ret["ID"] = f.ID.ToString();
410
411 return ret;
412 }
413
414 private InventoryFolderBase BuildFolder(Dictionary<string,object> data)
415 {
416 InventoryFolderBase folder = new InventoryFolderBase();
417
418 folder.ParentID = new UUID(data["ParentID"].ToString());
419 folder.Type = short.Parse(data["Type"].ToString());
420 folder.Version = ushort.Parse(data["Version"].ToString());
421 folder.Name = data["Name"].ToString();
422 folder.Owner = new UUID(data["Owner"].ToString());
423 folder.ID = new UUID(data["ID"].ToString());
424
425 return folder;
426 }
427
428 private InventoryItemBase BuildItem(Dictionary<string,object> data)
429 {
430 InventoryItemBase item = new InventoryItemBase();
431
432 item.AssetID = new UUID(data["AssetID"].ToString());
433 item.AssetType = int.Parse(data["AssetType"].ToString());
434 item.Name = data["Name"].ToString();
435 item.Owner = new UUID(data["Owner"].ToString());
436 item.ID = new UUID(data["ID"].ToString());
437 item.InvType = int.Parse(data["InvType"].ToString());
438 item.Folder = new UUID(data["Folder"].ToString());
439 item.CreatorId = data["CreatorId"].ToString();
440 item.Description = data["Description"].ToString();
441 item.NextPermissions = uint.Parse(data["NextPermissions"].ToString());
442 item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString());
443 item.BasePermissions = uint.Parse(data["BasePermissions"].ToString());
444 item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString());
445 item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString());
446 item.GroupID = new UUID(data["GroupID"].ToString());
447 item.GroupOwned = bool.Parse(data["GroupOwned"].ToString());
448 item.SalePrice = int.Parse(data["SalePrice"].ToString());
449 item.SaleType = byte.Parse(data["SaleType"].ToString());
450 item.Flags = uint.Parse(data["Flags"].ToString());
451 item.CreationDate = int.Parse(data["CreationDate"].ToString());
452
453 return item;
454 }
455 }
456}
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
index a1c032e..4eb4bd2 100644
--- a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Services.Connectors
67 IConfig authorizationConfig = source.Configs["AuthorizationService"]; 67 IConfig authorizationConfig = source.Configs["AuthorizationService"];
68 if (authorizationConfig == null) 68 if (authorizationConfig == null)
69 { 69 {
70 m_log.Info("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini"); 70 //m_log.Info("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini");
71 throw new Exception("Authorization connector init error"); 71 throw new Exception("Authorization connector init error");
72 } 72 }
73 73
@@ -86,6 +86,7 @@ namespace OpenSim.Services.Connectors
86 bool responseOnFailure = authorizationConfig.GetBoolean("ResponseOnFailure",true); 86 bool responseOnFailure = authorizationConfig.GetBoolean("ResponseOnFailure",true);
87 87
88 m_ResponseOnFailure = responseOnFailure; 88 m_ResponseOnFailure = responseOnFailure;
89 m_log.Info("[AUTHORIZATION CONNECTOR]: AuthorizationService initialized");
89 } 90 }
90 91
91 public bool IsAuthorizedForRegion(string userID, string firstname, string surname, string email, string regionName, string regionID, out string message) 92 public bool IsAuthorizedForRegion(string userID, string firstname, string surname, string email, string regionName, string regionID, out string message)
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index cf112e1..a1ca58e 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors
86 86
87 #region IGridService 87 #region IGridService
88 88
89 public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 89 public virtual string RegisterRegion(UUID scopeID, GridRegion regionInfo)
90 { 90 {
91 Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs(); 91 Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
92 Dictionary<string, object> sendData = new Dictionary<string,object>(); 92 Dictionary<string, object> sendData = new Dictionary<string,object>();
@@ -110,11 +110,23 @@ namespace OpenSim.Services.Connectors
110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
111 111
112 if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success")) 112 if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
113 return true; 113 {
114 return String.Empty;
115 }
116 else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure"))
117 {
118 m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString());
119 return replyData["Message"].ToString();
120 }
114 else if (!replyData.ContainsKey("Result")) 121 else if (!replyData.ContainsKey("Result"))
122 {
115 m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field"); 123 m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
124 }
116 else 125 else
126 {
117 m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); 127 m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
128 return "Unexpected result "+replyData["Result"].ToString();
129 }
118 130
119 } 131 }
120 else 132 else
@@ -125,7 +137,7 @@ namespace OpenSim.Services.Connectors
125 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); 137 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
126 } 138 }
127 139
128 return false; 140 return "Error communicating with grid service";
129 } 141 }
130 142
131 public virtual bool DeregisterRegion(UUID regionID) 143 public virtual bool DeregisterRegion(UUID regionID)
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
new file mode 100644
index 0000000..b9ccd7e
--- /dev/null
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -0,0 +1,535 @@
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 log4net;
29using System;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces;
39using OpenSim.Server.Base;
40using OpenMetaverse;
41
42namespace OpenSim.Services.Connectors
43{
44 public class XInventoryServicesConnector : IInventoryService
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 private string m_ServerURI = String.Empty;
51
52 public XInventoryServicesConnector()
53 {
54 }
55
56 public XInventoryServicesConnector(string serverURI)
57 {
58 m_ServerURI = serverURI.TrimEnd('/');
59 }
60
61 public XInventoryServicesConnector(IConfigSource source)
62 {
63 Initialise(source);
64 }
65
66 public virtual void Initialise(IConfigSource source)
67 {
68 IConfig assetConfig = source.Configs["InventoryService"];
69 if (assetConfig == null)
70 {
71 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpanSim.ini");
72 throw new Exception("Inventory connector init error");
73 }
74
75 string serviceURI = assetConfig.GetString("InventoryServerURI",
76 String.Empty);
77
78 if (serviceURI == String.Empty)
79 {
80 m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
81 throw new Exception("Inventory connector init error");
82 }
83 m_ServerURI = serviceURI;
84 }
85
86 public bool CreateUserInventory(UUID principalID)
87 {
88 Dictionary<string,object> ret = MakeRequest("CREATEUSERINVENTORY",
89 new Dictionary<string,object> {
90 { "PRINCIPAL", principalID.ToString() }
91 });
92
93 if (ret == null)
94 return false;
95
96 return bool.Parse(ret["RESULT"].ToString());
97 }
98
99 public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
100 {
101 Dictionary<string,object> ret = MakeRequest("GETINVENTORYSKELETON",
102 new Dictionary<string,object> {
103 { "PRINCIPAL", principalID.ToString() }
104 });
105
106 if (ret == null)
107 return null;
108
109 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
110
111 foreach (Object o in ret.Values)
112 folders.Add(BuildFolder((Dictionary<string,object>)o));
113
114 return folders;
115 }
116
117 public InventoryFolderBase GetRootFolder(UUID principalID)
118 {
119 Dictionary<string,object> ret = MakeRequest("GETROOTFOLDER",
120 new Dictionary<string,object> {
121 { "PRINCIPAL", principalID.ToString() }
122 });
123
124 if (ret == null)
125 return null;
126
127 if (ret.Count == 0)
128 return null;
129
130 return BuildFolder(ret);
131 }
132
133 public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
134 {
135 Dictionary<string,object> ret = MakeRequest("GETFOLDERFORTYPE",
136 new Dictionary<string,object> {
137 { "PRINCIPAL", principalID.ToString() },
138 { "TYPE", ((int)type).ToString() }
139 });
140
141 if (ret == null)
142 return null;
143
144 if (ret.Count == 0)
145 return null;
146
147 return BuildFolder(ret);
148 }
149
150 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
151 {
152 Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
153 new Dictionary<string,object> {
154 { "PRINCIPAL", principalID.ToString() },
155 { "FOLDER", folderID.ToString() }
156 });
157
158 if (ret == null)
159 return null;
160
161 if (ret.Count == 0)
162 return null;
163
164
165 InventoryCollection inventory = new InventoryCollection();
166 inventory.Folders = new List<InventoryFolderBase>();
167 inventory.Items = new List<InventoryItemBase>();
168 inventory.UserID = principalID;
169
170 Dictionary<string,object> folders =
171 (Dictionary<string,object>)ret["FOLDERS"];
172 Dictionary<string,object> items =
173 (Dictionary<string,object>)ret["ITEMS"];
174
175 foreach (Object o in folders.Values)
176 inventory.Folders.Add(BuildFolder((Dictionary<string,object>)o));
177 foreach (Object o in items.Values)
178 inventory.Items.Add(BuildItem((Dictionary<string,object>)o));
179
180 return inventory;
181 }
182
183 public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
184 {
185 Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
186 new Dictionary<string,object> {
187 { "PRINCIPAL", principalID.ToString() },
188 { "FOLDER", folderID.ToString() }
189 });
190
191 if (ret == null)
192 return null;
193
194 if (ret.Count == 0)
195 return null;
196
197
198 List<InventoryItemBase> items = new List<InventoryItemBase>();
199
200 foreach (Object o in ret.Values)
201 items.Add(BuildItem((Dictionary<string,object>)o));
202
203 return items;
204 }
205
206 public bool AddFolder(InventoryFolderBase folder)
207 {
208 Dictionary<string,object> ret = MakeRequest("ADDFOLDER",
209 new Dictionary<string,object> {
210 { "ParentID", folder.ParentID.ToString() },
211 { "Type", folder.Type.ToString() },
212 { "Version", folder.Version.ToString() },
213 { "Name", folder.Name.ToString() },
214 { "Owner", folder.Owner.ToString() },
215 { "ID", folder.ID.ToString() }
216 });
217
218 if (ret == null)
219 return false;
220
221 return bool.Parse(ret["RESULT"].ToString());
222 }
223
224 public bool UpdateFolder(InventoryFolderBase folder)
225 {
226 Dictionary<string,object> ret = MakeRequest("UPDATEFOLDER",
227 new Dictionary<string,object> {
228 { "ParentID", folder.ParentID.ToString() },
229 { "Type", folder.Type.ToString() },
230 { "Version", folder.Version.ToString() },
231 { "Name", folder.Name.ToString() },
232 { "Owner", folder.Owner.ToString() },
233 { "ID", folder.ID.ToString() }
234 });
235
236 if (ret == null)
237 return false;
238
239 return bool.Parse(ret["RESULT"].ToString());
240 }
241
242 public bool MoveFolder(InventoryFolderBase folder)
243 {
244 Dictionary<string,object> ret = MakeRequest("MOVEFOLDER",
245 new Dictionary<string,object> {
246 { "ParentID", folder.ParentID.ToString() },
247 { "ID", folder.ID.ToString() }
248 });
249
250 if (ret == null)
251 return false;
252
253 return bool.Parse(ret["RESULT"].ToString());
254 }
255
256 public bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
257 {
258 List<string> slist = new List<string>();
259
260 foreach (UUID f in folderIDs)
261 slist.Add(f.ToString());
262
263 Dictionary<string,object> ret = MakeRequest("DELETEFOLDERS",
264 new Dictionary<string,object> {
265 { "PRINCIPAL", principalID.ToString() },
266 { "FOLDERS", slist }
267 });
268
269 if (ret == null)
270 return false;
271
272 return bool.Parse(ret["RESULT"].ToString());
273 }
274
275 public bool PurgeFolder(InventoryFolderBase folder)
276 {
277 Dictionary<string,object> ret = MakeRequest("PURGEFOLDER",
278 new Dictionary<string,object> {
279 { "ID", folder.ID.ToString() }
280 });
281
282 if (ret == null)
283 return false;
284
285 return bool.Parse(ret["RESULT"].ToString());
286 }
287
288 public bool AddItem(InventoryItemBase item)
289 {
290 Dictionary<string,object> ret = MakeRequest("ADDITEM",
291 new Dictionary<string,object> {
292 { "AssetID", item.AssetID.ToString() },
293 { "AssetType", item.AssetType.ToString() },
294 { "Name", item.Name.ToString() },
295 { "Owner", item.Owner.ToString() },
296 { "ID", item.ID.ToString() },
297 { "InvType", item.InvType.ToString() },
298 { "Folder", item.Folder.ToString() },
299 { "CreatorId", item.CreatorId.ToString() },
300 { "Description", item.Description.ToString() },
301 { "NextPermissions", item.NextPermissions.ToString() },
302 { "CurrentPermissions", item.CurrentPermissions.ToString() },
303 { "BasePermissions", item.BasePermissions.ToString() },
304 { "EveryOnePermissions", item.EveryOnePermissions.ToString() },
305 { "GroupPermissions", item.GroupPermissions.ToString() },
306 { "GroupID", item.GroupID.ToString() },
307 { "GroupOwned", item.GroupOwned.ToString() },
308 { "SalePrice", item.SalePrice.ToString() },
309 { "SaleType", item.SaleType.ToString() },
310 { "Flags", item.Flags.ToString() },
311 { "CreationDate", item.CreationDate.ToString() }
312 });
313
314 if (ret == null)
315 return false;
316
317 return bool.Parse(ret["RESULT"].ToString());
318 }
319
320 public bool UpdateItem(InventoryItemBase item)
321 {
322 Dictionary<string,object> ret = MakeRequest("UPDATEITEM",
323 new Dictionary<string,object> {
324 { "AssetID", item.AssetID.ToString() },
325 { "AssetType", item.AssetType.ToString() },
326 { "Name", item.Name.ToString() },
327 { "Owner", item.Owner.ToString() },
328 { "ID", item.ID.ToString() },
329 { "InvType", item.InvType.ToString() },
330 { "Folder", item.Folder.ToString() },
331 { "CreatorId", item.CreatorId.ToString() },
332 { "Description", item.Description.ToString() },
333 { "NextPermissions", item.NextPermissions.ToString() },
334 { "CurrentPermissions", item.CurrentPermissions.ToString() },
335 { "BasePermissions", item.BasePermissions.ToString() },
336 { "EveryOnePermissions", item.EveryOnePermissions.ToString() },
337 { "GroupPermissions", item.GroupPermissions.ToString() },
338 { "GroupID", item.GroupID.ToString() },
339 { "GroupOwned", item.GroupOwned.ToString() },
340 { "SalePrice", item.SalePrice.ToString() },
341 { "SaleType", item.SaleType.ToString() },
342 { "Flags", item.Flags.ToString() },
343 { "CreationDate", item.CreationDate.ToString() }
344 });
345
346 if (ret == null)
347 return false;
348
349 return bool.Parse(ret["RESULT"].ToString());
350 }
351
352 public bool MoveItems(UUID principalID, List<InventoryItemBase> items)
353 {
354 List<string> idlist = new List<string>();
355 List<string> destlist = new List<string>();
356
357 foreach (InventoryItemBase item in items)
358 {
359 idlist.Add(item.ID.ToString());
360 destlist.Add(item.Folder.ToString());
361 }
362
363 Dictionary<string,object> ret = MakeRequest("MOVEITEMS",
364 new Dictionary<string,object> {
365 { "PrincipalID", principalID.ToString() },
366 { "IDLIST", idlist },
367 { "DESTLIST", destlist }
368 });
369
370 if (ret == null)
371 return false;
372
373 return bool.Parse(ret["RESULT"].ToString());
374 }
375
376 public bool DeleteItems(UUID principalID, List<UUID> itemIDs)
377 {
378 List<string> slist = new List<string>();
379
380 foreach (UUID f in itemIDs)
381 slist.Add(f.ToString());
382
383 Dictionary<string,object> ret = MakeRequest("DELETEITEMS",
384 new Dictionary<string,object> {
385 { "PRINCIPAL", principalID.ToString() },
386 { "ITEMS", slist }
387 });
388
389 if (ret == null)
390 return false;
391
392 return bool.Parse(ret["RESULT"].ToString());
393 }
394
395 public InventoryItemBase GetItem(InventoryItemBase item)
396 {
397 Dictionary<string,object> ret = MakeRequest("GETITEM",
398 new Dictionary<string,object> {
399 { "ID", item.ID.ToString() }
400 });
401
402 if (ret == null)
403 return null;
404
405 if (ret.Count == 0)
406 return null;
407
408 return BuildItem(ret);
409 }
410
411 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
412 {
413 Dictionary<string,object> ret = MakeRequest("GETFOLDER",
414 new Dictionary<string,object> {
415 { "ID", folder.ID.ToString() }
416 });
417
418 if (ret == null)
419 return null;
420
421 if (ret.Count == 0)
422 return null;
423
424 return BuildFolder(ret);
425 }
426
427 public List<InventoryItemBase> GetActiveGestures(UUID principalID)
428 {
429 Dictionary<string,object> ret = MakeRequest("GETACTIVEGESTURES",
430 new Dictionary<string,object> {
431 { "PRINCIPAL", principalID.ToString() }
432 });
433
434 if (ret == null)
435 return null;
436
437 List<InventoryItemBase> items = new List<InventoryItemBase>();
438
439 foreach (Object o in ret.Values)
440 items.Add(BuildItem((Dictionary<string,object>)o));
441
442 return items;
443 }
444
445 public int GetAssetPermissions(UUID principalID, UUID assetID)
446 {
447 Dictionary<string,object> ret = MakeRequest("GETASSETPERMISSIONS",
448 new Dictionary<string,object> {
449 { "PRINCIPAL", principalID.ToString() },
450 { "ASSET", assetID.ToString() }
451 });
452
453 if (ret == null)
454 return 0;
455
456 return int.Parse(ret["RESULT"].ToString());
457 }
458
459
460 // These are either obsolete or unused
461 //
462 public InventoryCollection GetUserInventory(UUID principalID)
463 {
464 return null;
465 }
466
467 public void GetUserInventory(UUID principalID, InventoryReceiptCallback callback)
468 {
469 }
470
471 public bool HasInventoryForUser(UUID principalID)
472 {
473 return false;
474 }
475
476 // Helpers
477 //
478 private Dictionary<string,object> MakeRequest(string method,
479 Dictionary<string,object> sendData)
480 {
481 sendData["METHOD"] = method;
482
483 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
484 m_ServerURI + "/xinventory",
485 ServerUtils.BuildQueryString(sendData));
486
487 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
488 reply);
489
490 return replyData;
491 }
492
493 private InventoryFolderBase BuildFolder(Dictionary<string,object> data)
494 {
495 InventoryFolderBase folder = new InventoryFolderBase();
496
497 folder.ParentID = new UUID(data["ParentID"].ToString());
498 folder.Type = short.Parse(data["Type"].ToString());
499 folder.Version = ushort.Parse(data["Version"].ToString());
500 folder.Name = data["Name"].ToString();
501 folder.Owner = new UUID(data["Owner"].ToString());
502 folder.ID = new UUID(data["ID"].ToString());
503
504 return folder;
505 }
506
507 private InventoryItemBase BuildItem(Dictionary<string,object> data)
508 {
509 InventoryItemBase item = new InventoryItemBase();
510
511 item.AssetID = new UUID(data["AssetID"].ToString());
512 item.AssetType = int.Parse(data["AssetType"].ToString());
513 item.Name = data["Name"].ToString();
514 item.Owner = new UUID(data["Owner"].ToString());
515 item.ID = new UUID(data["ID"].ToString());
516 item.InvType = int.Parse(data["InvType"].ToString());
517 item.Folder = new UUID(data["Folder"].ToString());
518 item.CreatorId = data["CreatorId"].ToString();
519 item.Description = data["Description"].ToString();
520 item.NextPermissions = uint.Parse(data["NextPermissions"].ToString());
521 item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString());
522 item.BasePermissions = uint.Parse(data["BasePermissions"].ToString());
523 item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString());
524 item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString());
525 item.GroupID = new UUID(data["GroupID"].ToString());
526 item.GroupOwned = bool.Parse(data["GroupOwned"].ToString());
527 item.SalePrice = int.Parse(data["SalePrice"].ToString());
528 item.SaleType = byte.Parse(data["SaleType"].ToString());
529 item.Flags = uint.Parse(data["Flags"].ToString());
530 item.CreationDate = int.Parse(data["CreationDate"].ToString());
531
532 return item;
533 }
534 }
535}
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 5c55c0b..e912705 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Services.GridService
52 protected IConfigSource m_config; 52 protected IConfigSource m_config;
53 53
54 protected IAuthenticationService m_AuthenticationService = null; 54 protected IAuthenticationService m_AuthenticationService = null;
55 protected bool m_AllowDuplicateNames = false;
55 56
56 public GridService(IConfigSource config) 57 public GridService(IConfigSource config)
57 : base(config) 58 : base(config)
@@ -71,6 +72,7 @@ namespace OpenSim.Services.GridService
71 Object[] args = new Object[] { config }; 72 Object[] args = new Object[] { config };
72 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); 73 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
73 } 74 }
75 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
74 } 76 }
75 77
76 if (m_RootInstance == null) 78 if (m_RootInstance == null)
@@ -95,7 +97,7 @@ namespace OpenSim.Services.GridService
95 97
96 #region IGridService 98 #region IGridService
97 99
98 public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) 100 public string RegisterRegion(UUID scopeID, GridRegion regionInfos)
99 { 101 {
100 IConfig gridConfig = m_config.Configs["GridService"]; 102 IConfig gridConfig = m_config.Configs["GridService"];
101 // This needs better sanity testing. What if regionInfo is registering in 103 // This needs better sanity testing. What if regionInfo is registering in
@@ -116,7 +118,7 @@ namespace OpenSim.Services.GridService
116 // Regions reserved for the null key cannot be taken. 118 // Regions reserved for the null key cannot be taken.
117 // 119 //
118 if (region.Data["PrincipalID"] == UUID.Zero.ToString()) 120 if (region.Data["PrincipalID"] == UUID.Zero.ToString())
119 return false; 121 return "Region location us reserved";
120 122
121 // Treat it as an auth request 123 // Treat it as an auth request
122 // 124 //
@@ -132,12 +134,10 @@ namespace OpenSim.Services.GridService
132 // Can we authenticate at all? 134 // Can we authenticate at all?
133 // 135 //
134 if (m_AuthenticationService == null) 136 if (m_AuthenticationService == null)
135 return false; 137 return "No authentication possible";
136 138
137 if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30)) 139 if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30))
138 return false; 140 return "Bad authentication";
139
140 return false;
141 } 141 }
142 } 142 }
143 143
@@ -145,13 +145,13 @@ namespace OpenSim.Services.GridService
145 { 145 {
146 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", 146 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
147 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 147 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
148 return false; 148 return "Region overlaps another region";
149 } 149 }
150 if ((region != null) && (region.RegionID == regionInfos.RegionID) && 150 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
151 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) 151 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
152 { 152 {
153 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) 153 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0)
154 return false; 154 return "Can't move this region";
155 155
156 // Region reregistering in other coordinates. Delete the old entry 156 // Region reregistering in other coordinates. Delete the old entry
157 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", 157 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
@@ -167,6 +167,23 @@ namespace OpenSim.Services.GridService
167 } 167 }
168 } 168 }
169 169
170 if (!m_AllowDuplicateNames)
171 {
172 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
173 if (dupe != null && dupe.Count > 0)
174 {
175 foreach (RegionData d in dupe)
176 {
177 if (d.RegionID != regionInfos.RegionID)
178 {
179 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
180 regionInfos.RegionName, regionInfos.RegionID);
181 return "Duplicate region name";
182 }
183 }
184 }
185 }
186
170 // Everything is ok, let's register 187 // Everything is ok, let's register
171 RegionData rdata = RegionInfo2RegionData(regionInfos); 188 RegionData rdata = RegionInfo2RegionData(regionInfos);
172 rdata.ScopeID = scopeID; 189 rdata.ScopeID = scopeID;
@@ -175,7 +192,7 @@ namespace OpenSim.Services.GridService
175 { 192 {
176 int oldFlags = Convert.ToInt32(region.Data["flags"]); 193 int oldFlags = Convert.ToInt32(region.Data["flags"]);
177 if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) 194 if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0)
178 return false; 195 return "Region locked out";
179 196
180 oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; 197 oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation;
181 198
@@ -211,7 +228,7 @@ namespace OpenSim.Services.GridService
211 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", 228 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
212 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 229 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
213 230
214 return true; 231 return String.Empty;
215 } 232 }
216 233
217 public bool DeregisterRegion(UUID regionID) 234 public bool DeregisterRegion(UUID regionID)
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 6b6b347..6186d80 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Services.Interfaces
42 /// <param name="regionInfos"> </param> 42 /// <param name="regionInfos"> </param>
43 /// <returns></returns> 43 /// <returns></returns>
44 /// <exception cref="System.Exception">Thrown if region registration failed</exception> 44 /// <exception cref="System.Exception">Thrown if region registration failed</exception>
45 bool RegisterRegion(UUID scopeID, GridRegion regionInfos); 45 string RegisterRegion(UUID scopeID, GridRegion regionInfos);
46 46
47 /// <summary> 47 /// <summary>
48 /// Deregister a region with the grid service. 48 /// Deregister a region with the grid service.
diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs
index 972c0aa..8e33373 100644
--- a/OpenSim/Tests/Clients/Grid/GridClient.cs
+++ b/OpenSim/Tests/Clients/Grid/GridClient.cs
@@ -63,27 +63,28 @@ namespace OpenSim.Tests.Clients.GridClient
63 GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000); 63 GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000);
64 64
65 Console.WriteLine("[GRID CLIENT]: *** Registering region 1"); 65 Console.WriteLine("[GRID CLIENT]: *** Registering region 1");
66 bool success = m_Connector.RegisterRegion(UUID.Zero, r1); 66 string msg = m_Connector.RegisterRegion(UUID.Zero, r1);
67 if (success) 67 if (msg == String.Empty)
68 Console.WriteLine("[GRID CLIENT]: Successfully registered region 1"); 68 Console.WriteLine("[GRID CLIENT]: Successfully registered region 1");
69 else 69 else
70 Console.WriteLine("[GRID CLIENT]: region 1 failed to register"); 70 Console.WriteLine("[GRID CLIENT]: region 1 failed to register");
71 71
72 Console.WriteLine("[GRID CLIENT]: *** Registering region 2"); 72 Console.WriteLine("[GRID CLIENT]: *** Registering region 2");
73 success = m_Connector.RegisterRegion(UUID.Zero, r2); 73 msg = m_Connector.RegisterRegion(UUID.Zero, r2);
74 if (success) 74 if (msg == String.Empty)
75 Console.WriteLine("[GRID CLIENT]: Successfully registered region 2"); 75 Console.WriteLine("[GRID CLIENT]: Successfully registered region 2");
76 else 76 else
77 Console.WriteLine("[GRID CLIENT]: region 2 failed to register"); 77 Console.WriteLine("[GRID CLIENT]: region 2 failed to register");
78 78
79 Console.WriteLine("[GRID CLIENT]: *** Registering region 3"); 79 Console.WriteLine("[GRID CLIENT]: *** Registering region 3");
80 success = m_Connector.RegisterRegion(UUID.Zero, r3); 80 msg = m_Connector.RegisterRegion(UUID.Zero, r3);
81 if (success) 81 if (msg == String.Empty)
82 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); 82 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
83 else 83 else
84 Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); 84 Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
85 85
86 86
87 bool success;
87 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3"); 88 Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
88 success = m_Connector.DeregisterRegion(r3.RegionID); 89 success = m_Connector.DeregisterRegion(r3.RegionID);
89 if (success) 90 if (success)
@@ -91,8 +92,8 @@ namespace OpenSim.Tests.Clients.GridClient
91 else 92 else
92 Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister"); 93 Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
93 Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again"); 94 Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again");
94 success = m_Connector.RegisterRegion(UUID.Zero, r3); 95 msg = m_Connector.RegisterRegion(UUID.Zero, r3);
95 if (success) 96 if (msg == String.Empty)
96 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3"); 97 Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
97 else 98 else
98 Console.WriteLine("[GRID CLIENT]: region 3 failed to register"); 99 Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 1a22bdc..8b79502 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -288,25 +288,25 @@ namespace OpenSim.Tests.Common.Mock
288 288
289 public event PlacesQuery OnPlacesQuery; 289 public event PlacesQuery OnPlacesQuery;
290 290
291 public event FindAgentUpdate OnFindAgentEvent; 291 public event FindAgentUpdate OnFindAgent;
292 public event TrackAgentUpdate OnTrackAgentEvent; 292 public event TrackAgentUpdate OnTrackAgent;
293 public event NewUserReport OnUserReportEvent; 293 public event NewUserReport OnUserReport;
294 public event SaveStateHandler OnSaveStateEvent; 294 public event SaveStateHandler OnSaveState;
295 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest; 295 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
296 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest; 296 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
297 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest; 297 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
298 public event FreezeUserUpdate OnParcelFreezeUserEvent; 298 public event FreezeUserUpdate OnParcelFreezeUser;
299 public event EjectUserUpdate OnParcelEjectUserEvent; 299 public event EjectUserUpdate OnParcelEjectUser;
300 public event ParcelBuyPass OnParcelBuyPass; 300 public event ParcelBuyPass OnParcelBuyPass;
301 public event ParcelGodMark OnParcelGodMark; 301 public event ParcelGodMark OnParcelGodMark;
302 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest; 302 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
303 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 303 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
304 public event SimWideDeletesDelegate OnSimWideDeletes; 304 public event SimWideDeletesDelegate OnSimWideDeletes;
305 public event SendPostcard OnSendPostcard; 305 public event SendPostcard OnSendPostcard;
306 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent; 306 public event MuteListEntryUpdate OnUpdateMuteListEntry;
307 public event MuteListEntryRemove OnRemoveMuteListEntryEvent; 307 public event MuteListEntryRemove OnRemoveMuteListEntry;
308 public event GodlikeMessage onGodlikeMessageEvent; 308 public event GodlikeMessage onGodlikeMessage;
309 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent; 309 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
310 310
311#pragma warning restore 67 311#pragma warning restore 67
312 312
@@ -924,7 +924,7 @@ namespace OpenSim.Tests.Common.Mock
924 { 924 {
925 } 925 }
926 926
927 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) 927 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
928 { 928 {
929 } 929 }
930 930
@@ -1194,6 +1194,14 @@ namespace OpenSim.Tests.Common.Mock
1194 1194
1195 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) 1195 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1196 { 1196 {
1197 }
1198
1199 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1200 {
1201 }
1202
1203 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1204 {
1197 } 1205 }
1198 } 1206 }
1199} 1207}