diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/MessageServerConfig.cs | 116 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/MessageServerInfo.cs | 17 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/Main.cs | 88 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 18 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/MessageServersConnector.cs | 157 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/UserLoginService.cs | 9 |
6 files changed, 330 insertions, 75 deletions
diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs new file mode 100644 index 0000000..2859c25 --- /dev/null +++ b/OpenSim/Framework/MessageServerConfig.cs | |||
@@ -0,0 +1,116 @@ | |||
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 OpenSim 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 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Framework | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Message Server Config - Configuration of the Message Server | ||
36 | /// </summary> | ||
37 | public class MessageServerConfig | ||
38 | { | ||
39 | public string DefaultStartupMsg = ""; | ||
40 | public string UserServerURL = ""; | ||
41 | public string UserSendKey = ""; | ||
42 | public string UserRecvKey = ""; | ||
43 | |||
44 | public string DatabaseProvider = ""; | ||
45 | public string GridCommsProvider = ""; | ||
46 | |||
47 | public static uint DefaultHttpPort = 8006; | ||
48 | public static bool DefaultHttpSSL = false; | ||
49 | public uint HttpPort = DefaultHttpPort; | ||
50 | public bool HttpSSL = DefaultHttpSSL; | ||
51 | |||
52 | private ConfigurationMember configMember; | ||
53 | |||
54 | public MessageServerConfig(string description, string filename) | ||
55 | { | ||
56 | configMember = | ||
57 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true); | ||
58 | configMember.performConfigurationRetrieve(); | ||
59 | } | ||
60 | public void loadConfigurationOptions() | ||
61 | { | ||
62 | |||
63 | configMember.addConfigurationOption("default_user_server", | ||
64 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
65 | "Default User Server URI", | ||
66 | "http://127.0.0.1:" + MessageServerConfig.DefaultHttpPort.ToString() + "/", false); | ||
67 | configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
68 | "Key to send to user server", "null", false); | ||
69 | configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
70 | "Key to expect from user server", "null", false); | ||
71 | |||
72 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
73 | "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | ||
74 | |||
75 | configMember.addConfigurationOption("region_comms_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
76 | "DLL for comms provider", "OpenSim.Region.Communications.OGS1.dll", false); | ||
77 | |||
78 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
79 | "Http Listener port", DefaultHttpPort.ToString(), false); | ||
80 | configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, | ||
81 | "Use SSL? true/false", DefaultHttpSSL.ToString(), false); | ||
82 | |||
83 | } | ||
84 | |||
85 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
86 | { | ||
87 | switch (configuration_key) | ||
88 | { | ||
89 | |||
90 | case "default_user_server": | ||
91 | UserServerURL = (string)configuration_result; | ||
92 | break; | ||
93 | case "user_send_key": | ||
94 | UserSendKey = (string)configuration_result; | ||
95 | break; | ||
96 | case "user_recv_key": | ||
97 | UserRecvKey = (string)configuration_result; | ||
98 | break; | ||
99 | case "database_provider": | ||
100 | DatabaseProvider = (string)configuration_result; | ||
101 | break; | ||
102 | case "http_port": | ||
103 | HttpPort = (uint)configuration_result; | ||
104 | break; | ||
105 | case "http_ssl": | ||
106 | HttpSSL = (bool)configuration_result; | ||
107 | break; | ||
108 | case "region_comms_provider": | ||
109 | GridCommsProvider = (string)configuration_result; | ||
110 | break; | ||
111 | } | ||
112 | |||
113 | return true; | ||
114 | } | ||
115 | } | ||
116 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Servers/MessageServerInfo.cs b/OpenSim/Framework/Servers/MessageServerInfo.cs new file mode 100644 index 0000000..13d65f9 --- /dev/null +++ b/OpenSim/Framework/Servers/MessageServerInfo.cs | |||
@@ -0,0 +1,17 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework.Servers | ||
6 | { | ||
7 | public class MessageServerInfo | ||
8 | { | ||
9 | public string URI; | ||
10 | public string sendkey; | ||
11 | public string recvkey; | ||
12 | public List<ulong> responsibleForRegions; | ||
13 | public MessageServerInfo() | ||
14 | { | ||
15 | } | ||
16 | } | ||
17 | } | ||
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index a69cef3..8f64113 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs | |||
@@ -39,9 +39,9 @@ namespace OpenSim.Grid.MessagingServer | |||
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// </summary> | 41 | /// </summary> |
42 | public class OpenUser_Main : conscmd_callback | 42 | public class OpenMessage_Main : conscmd_callback |
43 | { | 43 | { |
44 | private UserConfig Cfg; | 44 | private MessageServerConfig Cfg; |
45 | 45 | ||
46 | //public UserManager m_userManager; | 46 | //public UserManager m_userManager; |
47 | //public UserLoginService m_loginService; | 47 | //public UserLoginService m_loginService; |
@@ -52,22 +52,22 @@ namespace OpenSim.Grid.MessagingServer | |||
52 | [STAThread] | 52 | [STAThread] |
53 | public static void Main(string[] args) | 53 | public static void Main(string[] args) |
54 | { | 54 | { |
55 | Console.WriteLine("Launching UserServer..."); | 55 | Console.WriteLine("Launching MessagingServer..."); |
56 | 56 | ||
57 | OpenUser_Main userserver = new OpenUser_Main(); | 57 | OpenMessage_Main messageserver = new OpenMessage_Main(); |
58 | 58 | ||
59 | userserver.Startup(); | 59 | messageserver.Startup(); |
60 | userserver.Work(); | 60 | messageserver.Work(); |
61 | } | 61 | } |
62 | 62 | ||
63 | private OpenUser_Main() | 63 | private OpenMessage_Main() |
64 | { | 64 | { |
65 | if (!Directory.Exists(Util.logDir())) | 65 | if (!Directory.Exists(Util.logDir())) |
66 | { | 66 | { |
67 | Directory.CreateDirectory(Util.logDir()); | 67 | Directory.CreateDirectory(Util.logDir()); |
68 | } | 68 | } |
69 | m_console = | 69 | m_console = |
70 | new LogBase((Path.Combine(Util.logDir(), "opengrid-messagingserver-console.log")), "OpenUser", this, true); | 70 | new LogBase((Path.Combine(Util.logDir(), "opengrid-messagingserver-console.log")), "OpenMessage", this, true); |
71 | MainLog.Instance = m_console; | 71 | MainLog.Instance = m_console; |
72 | } | 72 | } |
73 | 73 | ||
@@ -83,9 +83,9 @@ namespace OpenSim.Grid.MessagingServer | |||
83 | 83 | ||
84 | public void Startup() | 84 | public void Startup() |
85 | { | 85 | { |
86 | Cfg = new UserConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); | 86 | Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); |
87 | 87 | ||
88 | MainLog.Instance.Verbose("REGION", "Establishing data connection"); | 88 | //MainLog.Instance.Verbose("REGION", "Establishing data connection"); |
89 | //m_userManager = new UserManager(); | 89 | //m_userManager = new UserManager(); |
90 | //m_userManager._config = Cfg; | 90 | //m_userManager._config = Cfg; |
91 | //m_userManager.AddPlugin(Cfg.DatabaseProvider); | 91 | //m_userManager.AddPlugin(Cfg.DatabaseProvider); |
@@ -120,21 +120,7 @@ namespace OpenSim.Grid.MessagingServer | |||
120 | switch (what) | 120 | switch (what) |
121 | { | 121 | { |
122 | case "user": | 122 | case "user": |
123 | string tempfirstname; | 123 | |
124 | string templastname; | ||
125 | string tempMD5Passwd; | ||
126 | uint regX = 1000; | ||
127 | uint regY = 1000; | ||
128 | |||
129 | tempfirstname = m_console.CmdPrompt("First name"); | ||
130 | templastname = m_console.CmdPrompt("Last name"); | ||
131 | tempMD5Passwd = m_console.PasswdPrompt("Password"); | ||
132 | regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); | ||
133 | regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); | ||
134 | |||
135 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | ||
136 | |||
137 | LLUUID userID = new LLUUID(); | ||
138 | try | 124 | try |
139 | { | 125 | { |
140 | //userID = | 126 | //userID = |
@@ -153,7 +139,7 @@ namespace OpenSim.Grid.MessagingServer | |||
153 | { | 139 | { |
154 | m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); | 140 | m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); |
155 | } | 141 | } |
156 | m_lastCreatedUser = userID; | 142 | // m_lastCreatedUser = userID; |
157 | break; | 143 | break; |
158 | } | 144 | } |
159 | } | 145 | } |
@@ -163,64 +149,18 @@ namespace OpenSim.Grid.MessagingServer | |||
163 | switch (cmd) | 149 | switch (cmd) |
164 | { | 150 | { |
165 | case "help": | 151 | case "help": |
166 | m_console.Notice("create user - create a new user"); | 152 | m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)"); |
167 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | ||
168 | break; | ||
169 | |||
170 | case "create": | ||
171 | do_create(cmdparams[0]); | ||
172 | break; | 153 | break; |
173 | 154 | ||
174 | case "shutdown": | 155 | case "shutdown": |
175 | m_console.Close(); | 156 | m_console.Close(); |
176 | Environment.Exit(0); | 157 | Environment.Exit(0); |
177 | break; | 158 | break; |
178 | |||
179 | case "test-inventory": | ||
180 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); | ||
181 | // requester.ReturnResponseVal = TestResponse; | ||
182 | // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); | ||
183 | //List<InventoryFolderBase> folders = | ||
184 | //SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST", | ||
185 | //m_userManager. | ||
186 | //_config. | ||
187 | //InventoryUrl + | ||
188 | //"RootFolders/", | ||
189 | //m_lastCreatedUser); | ||
190 | break; | ||
191 | } | 159 | } |
192 | } | 160 | } |
193 | 161 | ||
194 | public void TestResponse(List<InventoryFolderBase> resp) | ||
195 | { | ||
196 | Console.WriteLine("response got"); | ||
197 | } | ||
198 | |||
199 | /*private void ConfigDB(IGenericConfig configData) | ||
200 | { | ||
201 | try | ||
202 | { | ||
203 | string attri = ""; | ||
204 | attri = configData.GetAttribute("DataBaseProvider"); | ||
205 | if (attri == "") | ||
206 | { | ||
207 | StorageDll = "OpenSim.Framework.Data.DB4o.dll"; | ||
208 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | ||
209 | } | ||
210 | else | ||
211 | { | ||
212 | StorageDll = attri; | ||
213 | } | ||
214 | configData.Commit(); | ||
215 | } | ||
216 | catch | ||
217 | { | ||
218 | |||
219 | } | ||
220 | }*/ | ||
221 | |||
222 | public void Show(string ShowWhat) | 162 | public void Show(string ShowWhat) |
223 | { | 163 | { |
224 | } | 164 | } |
225 | } | 165 | } |
226 | } \ No newline at end of file | 166 | } |
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 5264870..8e6817d 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -42,9 +42,11 @@ namespace OpenSim.Grid.UserServer | |||
42 | public class OpenUser_Main : conscmd_callback | 42 | public class OpenUser_Main : conscmd_callback |
43 | { | 43 | { |
44 | private UserConfig Cfg; | 44 | private UserConfig Cfg; |
45 | |||
45 | 46 | ||
46 | public UserManager m_userManager; | 47 | public UserManager m_userManager; |
47 | public UserLoginService m_loginService; | 48 | public UserLoginService m_loginService; |
49 | public MessageServersConnector m_messagesService; | ||
48 | 50 | ||
49 | private LogBase m_console; | 51 | private LogBase m_console; |
50 | private LLUUID m_lastCreatedUser = LLUUID.Random(); | 52 | private LLUUID m_lastCreatedUser = LLUUID.Random(); |
@@ -93,6 +95,10 @@ namespace OpenSim.Grid.UserServer | |||
93 | m_loginService = new UserLoginService( | 95 | m_loginService = new UserLoginService( |
94 | m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); | 96 | m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); |
95 | 97 | ||
98 | m_messagesService = new MessageServersConnector(MainLog.Instance); | ||
99 | |||
100 | m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation; | ||
101 | |||
96 | MainLog.Instance.Verbose("REGION", "Starting HTTP process"); | 102 | MainLog.Instance.Verbose("REGION", "Starting HTTP process"); |
97 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); | 103 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); |
98 | 104 | ||
@@ -106,7 +112,12 @@ namespace OpenSim.Grid.UserServer | |||
106 | httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend); | 112 | httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend); |
107 | httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); | 113 | httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); |
108 | httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); | 114 | httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); |
109 | 115 | ||
116 | // Message Server ---> User Server | ||
117 | httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer); | ||
118 | httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion); | ||
119 | httpServer.AddXmlRPCHandler("deregister_messageserver", m_messagesService.XmlRPCDeRegisterMessageServer); | ||
120 | |||
110 | 121 | ||
111 | httpServer.AddStreamHandler( | 122 | httpServer.AddStreamHandler( |
112 | new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); | 123 | new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); |
@@ -173,6 +184,7 @@ namespace OpenSim.Grid.UserServer | |||
173 | break; | 184 | break; |
174 | 185 | ||
175 | case "shutdown": | 186 | case "shutdown": |
187 | m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; | ||
176 | m_console.Close(); | 188 | m_console.Close(); |
177 | Environment.Exit(0); | 189 | Environment.Exit(0); |
178 | break; | 190 | break; |
@@ -196,6 +208,10 @@ namespace OpenSim.Grid.UserServer | |||
196 | { | 208 | { |
197 | Console.WriteLine("response got"); | 209 | Console.WriteLine("response got"); |
198 | } | 210 | } |
211 | public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) | ||
212 | { | ||
213 | m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, Position); | ||
214 | } | ||
199 | 215 | ||
200 | /*private void ConfigDB(IGenericConfig configData) | 216 | /*private void ConfigDB(IGenericConfig configData) |
201 | { | 217 | { |
diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs new file mode 100644 index 0000000..deec739 --- /dev/null +++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs | |||
@@ -0,0 +1,157 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using System.Threading; | ||
6 | using libsecondlife; | ||
7 | using Nwc.XmlRpc; | ||
8 | using OpenSim.Framework; | ||
9 | using OpenSim.Framework.Communications.Cache; | ||
10 | using OpenSim.Framework.Console; | ||
11 | using OpenSim.Framework.Servers; | ||
12 | |||
13 | namespace OpenSim.Grid.UserServer | ||
14 | { | ||
15 | |||
16 | public class MessageServersConnector | ||
17 | { | ||
18 | private LogBase m_log; | ||
19 | public Dictionary<string, MessageServerInfo> MessageServers; | ||
20 | |||
21 | public MessageServersConnector(LogBase log) | ||
22 | { | ||
23 | m_log=log; | ||
24 | MessageServers = new Dictionary<string, MessageServerInfo>(); | ||
25 | } | ||
26 | |||
27 | public void RegisterMessageServer(string URI, MessageServerInfo serverData) | ||
28 | { | ||
29 | MessageServers.Add(URI, serverData); | ||
30 | } | ||
31 | |||
32 | public void DeRegisterMessageServer(string URI) | ||
33 | { | ||
34 | MessageServers.Remove(URI); | ||
35 | } | ||
36 | |||
37 | public void AddResponsibleRegion(string URI, ulong regionhandle) | ||
38 | { | ||
39 | if (!MessageServers.ContainsKey(URI)) | ||
40 | { | ||
41 | m_log.Warn("MSGSERVER", "Got addResponsibleRegion Request for a MessageServer that isn't registered"); | ||
42 | } | ||
43 | else | ||
44 | { | ||
45 | MessageServerInfo msginfo = MessageServers["URI"]; | ||
46 | msginfo.responsibleForRegions.Add(regionhandle); | ||
47 | MessageServers["URI"] = msginfo; | ||
48 | } | ||
49 | } | ||
50 | public void RemoveResponsibleRegion(string URI, ulong regionhandle) | ||
51 | { | ||
52 | if (!MessageServers.ContainsKey(URI)) | ||
53 | { | ||
54 | m_log.Warn("MSGSERVER", "Got RemoveResponsibleRegion Request for a MessageServer that isn't registered"); | ||
55 | } | ||
56 | else | ||
57 | { | ||
58 | MessageServerInfo msginfo = MessageServers["URI"]; | ||
59 | if (msginfo.responsibleForRegions.Contains(regionhandle)) | ||
60 | { | ||
61 | msginfo.responsibleForRegions.Remove(regionhandle); | ||
62 | MessageServers["URI"] = msginfo; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | } | ||
67 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) | ||
68 | { | ||
69 | XmlRpcResponse response = new XmlRpcResponse(); | ||
70 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
71 | Hashtable responseData = new Hashtable(); | ||
72 | |||
73 | if (requestData.Contains("uri")) | ||
74 | { | ||
75 | string URI = (string)requestData["URI"]; | ||
76 | string sendkey=(string)requestData["sendkey"]; | ||
77 | string recvkey=(string)requestData["recvkey"]; | ||
78 | MessageServerInfo m = new MessageServerInfo(); | ||
79 | m.URI = URI; | ||
80 | m.sendkey = sendkey; | ||
81 | m.recvkey = recvkey; | ||
82 | RegisterMessageServer(URI, m); | ||
83 | responseData["responsestring"] = "TRUE"; | ||
84 | response.Value = responseData; | ||
85 | } | ||
86 | return response; | ||
87 | } | ||
88 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) | ||
89 | { | ||
90 | XmlRpcResponse response = new XmlRpcResponse(); | ||
91 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
92 | Hashtable responseData = new Hashtable(); | ||
93 | |||
94 | if (requestData.Contains("uri")) | ||
95 | { | ||
96 | string URI = (string)requestData["URI"]; | ||
97 | |||
98 | DeRegisterMessageServer(URI); | ||
99 | responseData["responsestring"] = "TRUE"; | ||
100 | response.Value = responseData; | ||
101 | } | ||
102 | return response; | ||
103 | } | ||
104 | public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request) | ||
105 | { | ||
106 | XmlRpcResponse response = new XmlRpcResponse(); | ||
107 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
108 | Hashtable responseData = new Hashtable(); | ||
109 | |||
110 | if (requestData.Contains("fromuri")) | ||
111 | { | ||
112 | string sURI = (string)requestData["fromuri"]; | ||
113 | string sagentID = (string)requestData["agentid"]; | ||
114 | string ssessionID = (string)requestData["sessionid"]; | ||
115 | string scurrentRegionID = (string)requestData["regionid"]; | ||
116 | string sregionhandle = (string)requestData["regionhandle"]; | ||
117 | string scurrentpos = (string)requestData["currentpos"]; | ||
118 | //LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); | ||
119 | // TODO: Okay now raise event so the user server can pass this data to the Usermanager | ||
120 | |||
121 | responseData["responsestring"] = "TRUE"; | ||
122 | response.Value = responseData; | ||
123 | } | ||
124 | return response; | ||
125 | } | ||
126 | |||
127 | public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) | ||
128 | { | ||
129 | // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D ) | ||
130 | foreach (MessageServerInfo serv in MessageServers.Values) | ||
131 | { | ||
132 | NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, regionhandle, Position); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | private void NotifyMessageServerAboutUser(MessageServerInfo serv, LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) | ||
137 | { | ||
138 | Hashtable reqparams = new Hashtable(); | ||
139 | reqparams["sendkey"] = serv.sendkey; | ||
140 | reqparams["agentid"] = agentID.ToString(); | ||
141 | reqparams["sessionid"] = sessionID.ToString(); | ||
142 | reqparams["regionid"] = RegionID.ToString(); | ||
143 | reqparams["regionhandle"] = regionhandle.ToString(); | ||
144 | reqparams["position"] = Position.ToString(); | ||
145 | |||
146 | ArrayList SendParams = new ArrayList(); | ||
147 | SendParams.Add(reqparams); | ||
148 | |||
149 | XmlRpcRequest GridReq = new XmlRpcRequest("user_login", SendParams); | ||
150 | XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000); | ||
151 | m_log.Verbose("LOGIN","Notified : " + serv.URI + " about user login"); | ||
152 | |||
153 | } | ||
154 | |||
155 | |||
156 | } | ||
157 | } | ||
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 1a3bf2e..98d19f7 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -43,8 +43,13 @@ using InventoryFolder=OpenSim.Framework.InventoryFolder; | |||
43 | 43 | ||
44 | namespace OpenSim.Grid.UserServer | 44 | namespace OpenSim.Grid.UserServer |
45 | { | 45 | { |
46 | public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position); | ||
47 | |||
48 | |||
46 | public class UserLoginService : LoginService | 49 | public class UserLoginService : LoginService |
47 | { | 50 | { |
51 | public event UserLoggedInAtLocation OnUserLoggedInAtLocation; | ||
52 | |||
48 | public UserConfig m_config; | 53 | public UserConfig m_config; |
49 | 54 | ||
50 | public UserLoginService( | 55 | public UserLoginService( |
@@ -198,6 +203,10 @@ namespace OpenSim.Grid.UserServer | |||
198 | // Send | 203 | // Send |
199 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | 204 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); |
200 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | 205 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); |
206 | if (OnUserLoggedInAtLocation != null) | ||
207 | { | ||
208 | OnUserLoggedInAtLocation(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos); | ||
209 | } | ||
201 | } | 210 | } |
202 | 211 | ||
203 | catch (Exception e) | 212 | catch (Exception e) |