aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs16
-rw-r--r--OpenSim/Services/Interfaces/IPresenceService.cs18
-rw-r--r--OpenSim/Services/PresenceService/PresenceService.cs100
4 files changed, 120 insertions, 20 deletions
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
index 50e817e..19bb3e2 100644
--- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
@@ -84,7 +84,7 @@ namespace OpenSim.Services.Connectors
84 84
85 public string Authenticate(UUID principalID, string password, int lifetime) 85 public string Authenticate(UUID principalID, string password, int lifetime)
86 { 86 {
87 Dictionary<string, string> sendData = new Dictionary<string, string>(); 87 Dictionary<string, object> sendData = new Dictionary<string, object>();
88 sendData["LIFETIME"] = lifetime.ToString(); 88 sendData["LIFETIME"] = lifetime.ToString();
89 sendData["PRINCIPAL"] = principalID.ToString(); 89 sendData["PRINCIPAL"] = principalID.ToString();
90 sendData["PASSWORD"] = password; 90 sendData["PASSWORD"] = password;
@@ -106,7 +106,7 @@ namespace OpenSim.Services.Connectors
106 106
107 public bool Verify(UUID principalID, string token, int lifetime) 107 public bool Verify(UUID principalID, string token, int lifetime)
108 { 108 {
109 Dictionary<string, string> sendData = new Dictionary<string, string>(); 109 Dictionary<string, object> sendData = new Dictionary<string, object>();
110 sendData["LIFETIME"] = lifetime.ToString(); 110 sendData["LIFETIME"] = lifetime.ToString();
111 sendData["PRINCIPAL"] = principalID.ToString(); 111 sendData["PRINCIPAL"] = principalID.ToString();
112 sendData["TOKEN"] = token; 112 sendData["TOKEN"] = token;
@@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors
128 128
129 public bool Release(UUID principalID, string token) 129 public bool Release(UUID principalID, string token)
130 { 130 {
131 Dictionary<string, string> sendData = new Dictionary<string, string>(); 131 Dictionary<string, object> sendData = new Dictionary<string, object>();
132 sendData["PRINCIPAL"] = principalID.ToString(); 132 sendData["PRINCIPAL"] = principalID.ToString();
133 sendData["TOKEN"] = token; 133 sendData["TOKEN"] = token;
134 134
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 02f2b79..99aa3fb 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Services.Connectors
89 public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo) 89 public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo)
90 { 90 {
91 Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs(); 91 Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
92 Dictionary<string, string> sendData = new Dictionary<string,string>(); 92 Dictionary<string, object> sendData = new Dictionary<string,object>();
93 foreach (KeyValuePair<string, object> kvp in rinfo) 93 foreach (KeyValuePair<string, object> kvp in rinfo)
94 sendData[kvp.Key] = (string)kvp.Value; 94 sendData[kvp.Key] = (string)kvp.Value;
95 95
@@ -130,7 +130,7 @@ namespace OpenSim.Services.Connectors
130 130
131 public virtual bool DeregisterRegion(UUID regionID) 131 public virtual bool DeregisterRegion(UUID regionID)
132 { 132 {
133 Dictionary<string, string> sendData = new Dictionary<string, string>(); 133 Dictionary<string, object> sendData = new Dictionary<string, object>();
134 134
135 sendData["REGIONID"] = regionID.ToString(); 135 sendData["REGIONID"] = regionID.ToString();
136 136
@@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors
162 162
163 public virtual List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) 163 public virtual List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
164 { 164 {
165 Dictionary<string, string> sendData = new Dictionary<string, string>(); 165 Dictionary<string, object> sendData = new Dictionary<string, object>();
166 166
167 sendData["SCOPEID"] = scopeID.ToString(); 167 sendData["SCOPEID"] = scopeID.ToString();
168 sendData["REGIONID"] = regionID.ToString(); 168 sendData["REGIONID"] = regionID.ToString();
@@ -212,7 +212,7 @@ namespace OpenSim.Services.Connectors
212 212
213 public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) 213 public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
214 { 214 {
215 Dictionary<string, string> sendData = new Dictionary<string, string>(); 215 Dictionary<string, object> sendData = new Dictionary<string, object>();
216 216
217 sendData["SCOPEID"] = scopeID.ToString(); 217 sendData["SCOPEID"] = scopeID.ToString();
218 sendData["REGIONID"] = regionID.ToString(); 218 sendData["REGIONID"] = regionID.ToString();
@@ -258,7 +258,7 @@ namespace OpenSim.Services.Connectors
258 258
259 public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 259 public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
260 { 260 {
261 Dictionary<string, string> sendData = new Dictionary<string, string>(); 261 Dictionary<string, object> sendData = new Dictionary<string, object>();
262 262
263 sendData["SCOPEID"] = scopeID.ToString(); 263 sendData["SCOPEID"] = scopeID.ToString();
264 sendData["X"] = x.ToString(); 264 sendData["X"] = x.ToString();
@@ -303,7 +303,7 @@ namespace OpenSim.Services.Connectors
303 303
304 public virtual GridRegion GetRegionByName(UUID scopeID, string regionName) 304 public virtual GridRegion GetRegionByName(UUID scopeID, string regionName)
305 { 305 {
306 Dictionary<string, string> sendData = new Dictionary<string, string>(); 306 Dictionary<string, object> sendData = new Dictionary<string, object>();
307 307
308 sendData["SCOPEID"] = scopeID.ToString(); 308 sendData["SCOPEID"] = scopeID.ToString();
309 sendData["NAME"] = regionName; 309 sendData["NAME"] = regionName;
@@ -344,7 +344,7 @@ namespace OpenSim.Services.Connectors
344 344
345 public virtual List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) 345 public virtual List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
346 { 346 {
347 Dictionary<string, string> sendData = new Dictionary<string, string>(); 347 Dictionary<string, object> sendData = new Dictionary<string, object>();
348 348
349 sendData["SCOPEID"] = scopeID.ToString(); 349 sendData["SCOPEID"] = scopeID.ToString();
350 sendData["NAME"] = name; 350 sendData["NAME"] = name;
@@ -396,7 +396,7 @@ namespace OpenSim.Services.Connectors
396 396
397 public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) 397 public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
398 { 398 {
399 Dictionary<string, string> sendData = new Dictionary<string, string>(); 399 Dictionary<string, object> sendData = new Dictionary<string, object>();
400 400
401 sendData["SCOPEID"] = scopeID.ToString(); 401 sendData["SCOPEID"] = scopeID.ToString();
402 sendData["XMIN"] = xmin.ToString(); 402 sendData["XMIN"] = xmin.ToString();
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs
index aa1c5bf..d86e50c 100644
--- a/OpenSim/Services/Interfaces/IPresenceService.cs
+++ b/OpenSim/Services/Interfaces/IPresenceService.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using OpenSim.Framework; 29using OpenSim.Framework;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using OpenMetaverse; 31using OpenMetaverse;
@@ -35,11 +36,24 @@ namespace OpenSim.Services.Interfaces
35 { 36 {
36 public UUID PrincipalID; 37 public UUID PrincipalID;
37 public UUID RegionID; 38 public UUID RegionID;
38 public Dictionary<string, string> Data; 39 public UUID SessionID;
40 public UUID SecureSessionID;
41 public bool Online;
42 public DateTime Login;
43 public DateTime Logout;
44 public Vector3 Position;
45 public Vector3 LookAt;
39 } 46 }
40 47
41 public interface IPresenceService 48 public interface IPresenceService
42 { 49 {
43 bool Report(PresenceInfo presence); 50 bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID);
51 bool LogoutAgent(UUID sessionID);
52 bool LogoutRegionAgents(UUID regionID);
53
54 bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt);
55
56 PresenceInfo GetAgent(UUID sessionID);
57 PresenceInfo[] GetAgents(UUID[] PrincipalIDs);
44 } 58 }
45} 59}
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs
index 2157462..56ec504 100644
--- a/OpenSim/Services/PresenceService/PresenceService.cs
+++ b/OpenSim/Services/PresenceService/PresenceService.cs
@@ -50,18 +50,104 @@ namespace OpenSim.Services.PresenceService
50 { 50 {
51 } 51 }
52 52
53 public bool Report(PresenceInfo presence) 53 public bool LoginAgent(UUID principalID, UUID sessionID,
54 UUID secureSessionID)
54 { 55 {
55 PresenceData p = new PresenceData(); 56 // We have just logged in. If there is any info in the table
56 p.Data = new Dictionary<string, string>(); 57 // it's OK to overwrite. So we won't bother reading it first
58 //
59 PresenceData data = new PresenceData();
57 60
58 p.UUID = presence.PrincipalID; 61 data.PrincipalID = principalID;
59 p.currentRegion = presence.RegionID; 62 data.RegionID = UUID.Zero;
63 data.SessionID = sessionID;
64 data.Data["SecureSessionID"] = secureSessionID.ToString();
65 data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString();
66
67 m_Database.Store(data);
60 68
61 foreach (KeyValuePair<string, string> kvp in presence.Data) 69 return true;
62 p.Data[kvp.Key] = kvp.Value; 70 }
71
72 public bool LogoutAgent(UUID sessionID)
73 {
74 PresenceData data = m_Database.Get(sessionID);
75 if (data == null)
76 return false;
77
78 data.Data["Online"] = "false";
79 data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString();
80
81 m_Database.Store(data);
63 82
64 return false; 83 return false;
65 } 84 }
85
86 public bool LogoutRegionAgents(UUID regionID)
87 {
88 m_Database.LogoutRegionAgents(regionID);
89
90 return true;
91 }
92
93
94 public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
95 {
96 return m_Database.ReportAgent(sessionID, regionID,
97 position.ToString(), lookAt.ToString());
98 }
99
100 public PresenceInfo GetAgent(UUID sessionID)
101 {
102 PresenceInfo ret = new PresenceInfo();
103
104 PresenceData data = m_Database.Get(sessionID);
105 if (data == null)
106 return null;
107
108 ret.PrincipalID = data.PrincipalID;
109 ret.RegionID = data.RegionID;
110 ret.SessionID = data.SessionID;
111 ret.SecureSessionID = new UUID(data.Data["SecureSessionID"]);
112 ret.Online = bool.Parse(data.Data["Online"]);
113 ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"]));
114 ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"]));
115 ret.Position = Vector3.Parse(data.Data["Position"]);
116 ret.LookAt = Vector3.Parse(data.Data["LookAt"]);
117
118 return ret;
119 }
120
121 public PresenceInfo[] GetAgents(UUID[] PrincipalIDs)
122 {
123 List<PresenceInfo> info = new List<PresenceInfo>();
124
125 foreach (UUID principalID in PrincipalIDs)
126 {
127 PresenceData[] data = m_Database.Get("PrincipalID",
128 principalID.ToString());
129
130 foreach (PresenceData d in data)
131 {
132 PresenceInfo ret = new PresenceInfo();
133
134 ret.PrincipalID = d.PrincipalID;
135 ret.RegionID = d.RegionID;
136 ret.SessionID = d.SessionID;
137 ret.SecureSessionID = new UUID(d.Data["SecureSessionID"]);
138 ret.Online = bool.Parse(d.Data["Online"]);
139 ret.Login = Util.ToDateTime(Convert.ToInt32(
140 d.Data["Login"]));
141 ret.Logout = Util.ToDateTime(Convert.ToInt32(
142 d.Data["Logout"]));
143 ret.Position = Vector3.Parse(d.Data["Position"]);
144 ret.LookAt = Vector3.Parse(d.Data["LookAt"]);
145
146 info.Add(ret);
147 }
148 }
149
150 return info.ToArray();
151 }
66 } 152 }
67} 153}