aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/PresenceService/PresenceService.cs
diff options
context:
space:
mode:
authorMelanie2009-12-27 03:00:54 +0000
committerMelanie2009-12-27 03:00:54 +0000
commit8b9332e321d14815dbac8fcdc145480cddaf412c (patch)
treec8597cdc206200cb582c9f27e6a14e97f9f3af21 /OpenSim/Services/PresenceService/PresenceService.cs
parentJust make it compile :) (diff)
downloadopensim-SC_OLD-8b9332e321d14815dbac8fcdc145480cddaf412c.zip
opensim-SC_OLD-8b9332e321d14815dbac8fcdc145480cddaf412c.tar.gz
opensim-SC_OLD-8b9332e321d14815dbac8fcdc145480cddaf412c.tar.bz2
opensim-SC_OLD-8b9332e321d14815dbac8fcdc145480cddaf412c.tar.xz
Finish the presence service
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/PresenceService/PresenceService.cs78
1 files changed, 73 insertions, 5 deletions
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs
index 9f0e4da..56ec504 100644
--- a/OpenSim/Services/PresenceService/PresenceService.cs
+++ b/OpenSim/Services/PresenceService/PresenceService.cs
@@ -53,33 +53,101 @@ namespace OpenSim.Services.PresenceService
53 public bool LoginAgent(UUID principalID, UUID sessionID, 53 public bool LoginAgent(UUID principalID, UUID sessionID,
54 UUID secureSessionID) 54 UUID secureSessionID)
55 { 55 {
56 return false; 56 // We have just logged in. If there is any info in the table
57 // it's OK to overwrite. So we won't bother reading it first
58 //
59 PresenceData data = new PresenceData();
60
61 data.PrincipalID = principalID;
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);
68
69 return true;
57 } 70 }
58 71
59 public bool LogoutAgent(UUID sessionID) 72 public bool LogoutAgent(UUID sessionID)
60 { 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);
82
61 return false; 83 return false;
62 } 84 }
63 85
64 public bool LogoutRegionAgents(UUID regionID) 86 public bool LogoutRegionAgents(UUID regionID)
65 { 87 {
66 return false; 88 m_Database.LogoutRegionAgents(regionID);
89
90 return true;
67 } 91 }
68 92
69 93
70 public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) 94 public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
71 { 95 {
72 return false; 96 return m_Database.ReportAgent(sessionID, regionID,
97 position.ToString(), lookAt.ToString());
73 } 98 }
74 99
75 public PresenceInfo GetAgent(UUID sessionID) 100 public PresenceInfo GetAgent(UUID sessionID)
76 { 101 {
77 return null; 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;
78 } 119 }
79 120
80 public PresenceInfo[] GetAgents(UUID[] PrincipalIDs) 121 public PresenceInfo[] GetAgents(UUID[] PrincipalIDs)
81 { 122 {
82 return null; 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();
83 } 151 }
84 } 152 }
85} 153}