diff options
Diffstat (limited to 'OpenSim/Services/Interfaces/IGridUserService.cs')
-rw-r--r-- | OpenSim/Services/Interfaces/IGridUserService.cs | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs new file mode 100644 index 0000000..e629dff --- /dev/null +++ b/OpenSim/Services/Interfaces/IGridUserService.cs | |||
@@ -0,0 +1,115 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Records user information specific to a grid but which is not part of a user's account. | ||
36 | /// </summary> | ||
37 | public class GridUserInfo | ||
38 | { | ||
39 | public string UserID; | ||
40 | |||
41 | public UUID HomeRegionID; | ||
42 | public Vector3 HomePosition; | ||
43 | public Vector3 HomeLookAt; | ||
44 | |||
45 | public UUID LastRegionID; | ||
46 | public Vector3 LastPosition; | ||
47 | public Vector3 LastLookAt; | ||
48 | |||
49 | public bool Online; | ||
50 | public DateTime Login; | ||
51 | public DateTime Logout; | ||
52 | |||
53 | public GridUserInfo() {} | ||
54 | |||
55 | public GridUserInfo(Dictionary<string, object> kvp) | ||
56 | { | ||
57 | if (kvp.ContainsKey("UserID")) | ||
58 | UserID = kvp["UserID"].ToString(); | ||
59 | |||
60 | if (kvp.ContainsKey("HomeRegionID")) | ||
61 | UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID); | ||
62 | if (kvp.ContainsKey("HomePosition")) | ||
63 | Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition); | ||
64 | if (kvp.ContainsKey("HomeLookAt")) | ||
65 | Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt); | ||
66 | |||
67 | if (kvp.ContainsKey("LastRegionID")) | ||
68 | UUID.TryParse(kvp["LastRegionID"].ToString(), out HomeRegionID); | ||
69 | if (kvp.ContainsKey("LastPosition")) | ||
70 | Vector3.TryParse(kvp["LastPosition"].ToString(), out LastPosition); | ||
71 | if (kvp.ContainsKey("LastLookAt")) | ||
72 | Vector3.TryParse(kvp["LastLookAt"].ToString(), out LastLookAt); | ||
73 | |||
74 | if (kvp.ContainsKey("Login")) | ||
75 | DateTime.TryParse(kvp["Login"].ToString(), out Login); | ||
76 | if (kvp.ContainsKey("Logout")) | ||
77 | DateTime.TryParse(kvp["Logout"].ToString(), out Logout); | ||
78 | if (kvp.ContainsKey("Online")) | ||
79 | Boolean.TryParse(kvp["Online"].ToString(), out Online); | ||
80 | |||
81 | } | ||
82 | |||
83 | public Dictionary<string, object> ToKeyValuePairs() | ||
84 | { | ||
85 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
86 | result["UserID"] = UserID; | ||
87 | |||
88 | result["HomeRegionID"] = HomeRegionID.ToString(); | ||
89 | result["HomePosition"] = HomePosition.ToString(); | ||
90 | result["HomeLookAt"] = HomeLookAt.ToString(); | ||
91 | |||
92 | result["LastRegionID"] = LastRegionID.ToString(); | ||
93 | result["LastPosition"] = LastPosition.ToString(); | ||
94 | result["LastLookAt"] = LastLookAt.ToString(); | ||
95 | |||
96 | result["Online"] = Online.ToString(); | ||
97 | result["Login"] = Login.ToString(); | ||
98 | result["Logout"] = Logout.ToString(); | ||
99 | |||
100 | |||
101 | return result; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | public interface IGridUserService | ||
106 | { | ||
107 | GridUserInfo LoggedIn(string userID); | ||
108 | bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt); | ||
109 | |||
110 | bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt); | ||
111 | bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt); | ||
112 | |||
113 | GridUserInfo GetGridUserInfo(string userID); | ||
114 | } | ||
115 | } \ No newline at end of file | ||