aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Interfaces/IPresenceService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Interfaces/IPresenceService.cs')
-rw-r--r--OpenSim/Services/Interfaces/IPresenceService.cs62
1 files changed, 59 insertions, 3 deletions
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs
index aa1c5bf..abbae2c 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;
@@ -33,13 +34,68 @@ namespace OpenSim.Services.Interfaces
33{ 34{
34 public class PresenceInfo 35 public class PresenceInfo
35 { 36 {
36 public UUID PrincipalID; 37 public string UserID;
37 public UUID RegionID; 38 public UUID RegionID;
38 public Dictionary<string, string> Data; 39 public bool Online;
40 public DateTime Login;
41 public DateTime Logout;
42 public Vector3 Position;
43 public Vector3 LookAt;
44 public UUID HomeRegionID;
45 public Vector3 HomePosition;
46 public Vector3 HomeLookAt;
47
48 public PresenceInfo()
49 {
50 }
51
52 public PresenceInfo(Dictionary<string, object> kvp)
53 {
54 if (kvp.ContainsKey("UserID"))
55 UserID = kvp["UserID"].ToString();
56 if (kvp.ContainsKey("RegionID"))
57 UUID.TryParse(kvp["RegionID"].ToString(), out RegionID);
58 }
59
60 public Dictionary<string, object> ToKeyValuePairs()
61 {
62 Dictionary<string, object> result = new Dictionary<string, object>();
63 result["UserID"] = UserID;
64 result["RegionID"] = RegionID.ToString();
65
66 return result;
67 }
68
69 public static PresenceInfo[] GetOnlinePresences(PresenceInfo[] pinfos)
70 {
71 if (pinfos == null)
72 return null;
73
74 List<PresenceInfo> lst = new List<PresenceInfo>(pinfos);
75 lst = lst.FindAll(delegate(PresenceInfo each) { return each.Online; });
76
77 return lst.ToArray();
78 }
79
80 public static PresenceInfo GetOnlinePresence(PresenceInfo[] pinfos)
81 {
82 pinfos = GetOnlinePresences(pinfos);
83 if (pinfos != null && pinfos.Length >= 1)
84 return pinfos[0];
85
86 return null;
87 }
39 } 88 }
40 89
41 public interface IPresenceService 90 public interface IPresenceService
42 { 91 {
43 bool Report(PresenceInfo presence); 92 bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID);
93 bool LogoutAgent(UUID sessionID);
94 bool LogoutRegionAgents(UUID regionID);
95
96 bool ReportAgent(UUID sessionID, UUID regionID);
97
98 PresenceInfo GetAgent(UUID sessionID);
99 PresenceInfo[] GetAgents(string[] userIDs);
44 } 100 }
45} 101}