diff options
author | Melanie | 2009-11-18 08:21:28 +0000 |
---|---|---|
committer | Melanie | 2009-11-18 08:21:28 +0000 |
commit | 06ecdf1967848e3f0c6b6f98aba61c7ad099f65d (patch) | |
tree | 56275806fb3df065c1734bd10d179ebfcea64c89 | |
parent | Change PresenceData to PresenceInfo to remove a naming conflict in the (diff) | |
download | opensim-SC-06ecdf1967848e3f0c6b6f98aba61c7ad099f65d.zip opensim-SC-06ecdf1967848e3f0c6b6f98aba61c7ad099f65d.tar.gz opensim-SC-06ecdf1967848e3f0c6b6f98aba61c7ad099f65d.tar.bz2 opensim-SC-06ecdf1967848e3f0c6b6f98aba61c7ad099f65d.tar.xz |
Tweak presence handling and whip up a database connector and handler
for testign the new generic table handling
-rw-r--r-- | OpenSim/Data/IPresenceData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 4 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 27 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IPresenceService.cs | 2 | ||||
-rw-r--r-- | OpenSim/Services/PresenceService/PresenceService.cs | 9 |
5 files changed, 42 insertions, 4 deletions
diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index 891b590..020ba5d 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs | |||
@@ -32,11 +32,11 @@ using OpenSim.Framework; | |||
32 | 32 | ||
33 | namespace OpenSim.Data | 33 | namespace OpenSim.Data |
34 | { | 34 | { |
35 | public class PresenceData | 35 | public struct PresenceData |
36 | { | 36 | { |
37 | public UUID UUID; | 37 | public UUID UUID; |
38 | public UUID currentRegion; | 38 | public UUID currentRegion; |
39 | public Dictionary<string, object> Data; | 39 | public Dictionary<string, string> Data; |
40 | } | 40 | } |
41 | 41 | ||
42 | /// <summary> | 42 | /// <summary> |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 4eb4a24..1521dc7 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -190,11 +190,13 @@ namespace OpenSim.Data.MySQL | |||
190 | return DoQuery(cmd); | 190 | return DoQuery(cmd); |
191 | } | 191 | } |
192 | 192 | ||
193 | public void Store(T row) | 193 | public bool Store(T row) |
194 | { | 194 | { |
195 | MySqlCommand cmd = new MySqlCommand(); | 195 | MySqlCommand cmd = new MySqlCommand(); |
196 | 196 | ||
197 | string query = ""; | 197 | string query = ""; |
198 | |||
199 | return false; | ||
198 | } | 200 | } |
199 | } | 201 | } |
200 | } | 202 | } |
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 9ca5120..2558fa0 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | |||
@@ -94,6 +94,33 @@ namespace OpenSim.Server.Handlers.Presence | |||
94 | 94 | ||
95 | byte[] Report(Dictionary<string, string> request) | 95 | byte[] Report(Dictionary<string, string> request) |
96 | { | 96 | { |
97 | PresenceInfo info = new PresenceInfo(); | ||
98 | info.Data = new Dictionary<string, string>(); | ||
99 | |||
100 | if (request["PrincipalID"] == null || request["RegionID"] == null) | ||
101 | return FailureResult(); | ||
102 | |||
103 | if (!UUID.TryParse(request["PrincipalID"].ToString(), | ||
104 | out info.PrincipalID)) | ||
105 | return FailureResult(); | ||
106 | |||
107 | if (!UUID.TryParse(request["RegionID"].ToString(), | ||
108 | out info.RegionID)) | ||
109 | return FailureResult(); | ||
110 | |||
111 | foreach (KeyValuePair<string, string> kvp in request) | ||
112 | { | ||
113 | if (kvp.Key == "METHOD" || | ||
114 | kvp.Key == "PrincipalID" || | ||
115 | kvp.Key == "RegionID") | ||
116 | continue; | ||
117 | |||
118 | info.Data[kvp.Key] = kvp.Value; | ||
119 | } | ||
120 | |||
121 | if (m_PresenceService.Report(info)) | ||
122 | return SuccessResult(); | ||
123 | |||
97 | return FailureResult(); | 124 | return FailureResult(); |
98 | } | 125 | } |
99 | 126 | ||
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index 6ceeb45..aa1c5bf 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs | |||
@@ -35,7 +35,7 @@ namespace OpenSim.Services.Interfaces | |||
35 | { | 35 | { |
36 | public UUID PrincipalID; | 36 | public UUID PrincipalID; |
37 | public UUID RegionID; | 37 | public UUID RegionID; |
38 | public Dictionary<string, object> Data; | 38 | public Dictionary<string, string> Data; |
39 | } | 39 | } |
40 | 40 | ||
41 | public interface IPresenceService | 41 | public interface IPresenceService |
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 8931a26..2157462 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs | |||
@@ -52,6 +52,15 @@ namespace OpenSim.Services.PresenceService | |||
52 | 52 | ||
53 | public bool Report(PresenceInfo presence) | 53 | public bool Report(PresenceInfo presence) |
54 | { | 54 | { |
55 | PresenceData p = new PresenceData(); | ||
56 | p.Data = new Dictionary<string, string>(); | ||
57 | |||
58 | p.UUID = presence.PrincipalID; | ||
59 | p.currentRegion = presence.RegionID; | ||
60 | |||
61 | foreach (KeyValuePair<string, string> kvp in presence.Data) | ||
62 | p.Data[kvp.Key] = kvp.Value; | ||
63 | |||
55 | return false; | 64 | return false; |
56 | } | 65 | } |
57 | } | 66 | } |