aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2012-09-25 20:03:49 -0700
committerDiva Canto2012-09-25 20:03:49 -0700
commitae58cf42242433c786162b53a2724962f4a8380b (patch)
treeb6011d3ea34e838138a63279ec5bf270c464d04d /OpenSim
parentOops, that should be inside the curly bracket. (diff)
downloadopensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.zip
opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.gz
opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.bz2
opensim-SC_OLD-ae58cf42242433c786162b53a2724962f4a8380b.tar.xz
TOS module. WARNING: migration in GridUser table.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/Resources/GridUserStore.migrations8
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs13
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs46
-rw-r--r--OpenSim/Services/Interfaces/IGridUserService.cs8
-rw-r--r--OpenSim/Services/UserAccountService/GridUserService.cs2
5 files changed, 72 insertions, 5 deletions
diff --git a/OpenSim/Data/MySQL/Resources/GridUserStore.migrations b/OpenSim/Data/MySQL/Resources/GridUserStore.migrations
index 32b85ee..440d076 100644
--- a/OpenSim/Data/MySQL/Resources/GridUserStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/GridUserStore.migrations
@@ -17,3 +17,11 @@ CREATE TABLE `GridUser` (
17) ENGINE=InnoDB; 17) ENGINE=InnoDB;
18 18
19COMMIT; 19COMMIT;
20
21:VERSION 2 # --------------------------
22
23BEGIN;
24
25ALTER TABLE `GridUser` ADD COLUMN TOS CHAR(36);
26
27COMMIT;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
index b0edce7..dd8a8ef 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
@@ -68,8 +68,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
68// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); 68// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
69 69
70 if (sp.PresenceType != PresenceType.Npc) 70 if (sp.PresenceType != PresenceType.Npc)
71 {
72 string userid = sp.Scene.UserManagementModule.GetUserUUI(sp.UUID);
71 m_GridUserService.SetLastPosition( 73 m_GridUserService.SetLastPosition(
72 sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 74 userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
75 }
73 } 76 }
74 77
75 public void OnNewClient(IClientAPI client) 78 public void OnNewClient(IClientAPI client)
@@ -83,8 +86,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
83 return; 86 return;
84 87
85// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); 88// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
89 string userId = client.AgentId.ToString();
90 if (client.Scene is Scene)
91 {
92 Scene s = (Scene)client.Scene;
93 userId = s.UserManagementModule.GetUserUUI(client.AgentId);
94 }
86 m_GridUserService.LoggedOut( 95 m_GridUserService.LoggedOut(
87 client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, 96 userId, client.SessionId, client.Scene.RegionInfo.RegionID,
88 client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat); 97 client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
89 } 98 }
90 } 99 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs
index badb552..04acf67 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs
@@ -44,6 +44,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 private const int KEEPTIME = 30; // 30 secs
48 private ExpiringCache<string, GridUserInfo> m_Infos = new ExpiringCache<string, GridUserInfo>();
49
47 #region ISharedRegionModule 50 #region ISharedRegionModule
48 51
49 private bool m_Enabled = false; 52 private bool m_Enabled = false;
@@ -128,23 +131,60 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
128 131
129 public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat) 132 public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat)
130 { 133 {
134 if (m_Infos.Contains(userID))
135 m_Infos.Remove(userID);
136
131 return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat); 137 return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat);
132 } 138 }
133 139
134 140
135 public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) 141 public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
136 { 142 {
137 return m_RemoteConnector.SetHome(userID, regionID, position, lookAt); 143 if (m_RemoteConnector.SetHome(userID, regionID, position, lookAt))
144 {
145 // Update the cache too
146 GridUserInfo info = null;
147 if (m_Infos.TryGetValue(userID, out info))
148 {
149 info.HomeRegionID = regionID;
150 info.HomePosition = position;
151 info.HomeLookAt = lookAt;
152 }
153 return true;
154 }
155
156 return false;
138 } 157 }
139 158
140 public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) 159 public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
141 { 160 {
142 return m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt); 161 if (m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt))
162 {
163 // Update the cache too
164 GridUserInfo info = null;
165 if (m_Infos.TryGetValue(userID, out info))
166 {
167 info.LastRegionID = regionID;
168 info.LastPosition = position;
169 info.LastLookAt = lookAt;
170 }
171 return true;
172 }
173
174 return false;
143 } 175 }
144 176
145 public GridUserInfo GetGridUserInfo(string userID) 177 public GridUserInfo GetGridUserInfo(string userID)
146 { 178 {
147 return m_RemoteConnector.GetGridUserInfo(userID); 179 GridUserInfo info = null;
180 if (m_Infos.TryGetValue(userID, out info))
181 return info;
182
183 info = m_RemoteConnector.GetGridUserInfo(userID);
184
185 m_Infos.AddOrUpdate(userID, info, KEEPTIME);
186
187 return info;
148 } 188 }
149 189
150 public GridUserInfo[] GetGridUserInfo(string[] userID) 190 public GridUserInfo[] GetGridUserInfo(string[] userID)
diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs
index 0a52bfa..620ed3a 100644
--- a/OpenSim/Services/Interfaces/IGridUserService.cs
+++ b/OpenSim/Services/Interfaces/IGridUserService.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Services.Interfaces
50 public DateTime Login; 50 public DateTime Login;
51 public DateTime Logout; 51 public DateTime Logout;
52 52
53 public string TOS = string.Empty;
54
53 public GridUserInfo() {} 55 public GridUserInfo() {}
54 56
55 public GridUserInfo(Dictionary<string, object> kvp) 57 public GridUserInfo(Dictionary<string, object> kvp)
@@ -78,6 +80,11 @@ namespace OpenSim.Services.Interfaces
78 if (kvp.ContainsKey("Online")) 80 if (kvp.ContainsKey("Online"))
79 Boolean.TryParse(kvp["Online"].ToString(), out Online); 81 Boolean.TryParse(kvp["Online"].ToString(), out Online);
80 82
83 if (kvp.ContainsKey("TOS"))
84 TOS = kvp["TOS"].ToString();
85 else
86 TOS = string.Empty;
87
81 } 88 }
82 89
83 public Dictionary<string, object> ToKeyValuePairs() 90 public Dictionary<string, object> ToKeyValuePairs()
@@ -97,6 +104,7 @@ namespace OpenSim.Services.Interfaces
97 result["Login"] = Login.ToString(); 104 result["Login"] = Login.ToString();
98 result["Logout"] = Logout.ToString(); 105 result["Logout"] = Logout.ToString();
99 106
107 result["TOS"] = TOS;
100 108
101 return result; 109 return result;
102 } 110 }
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs
index ac3d8fd..8eae859 100644
--- a/OpenSim/Services/UserAccountService/GridUserService.cs
+++ b/OpenSim/Services/UserAccountService/GridUserService.cs
@@ -70,6 +70,8 @@ namespace OpenSim.Services.UserAccountService
70 info.Login = Util.ToDateTime(Convert.ToInt32(d.Data["Login"])); 70 info.Login = Util.ToDateTime(Convert.ToInt32(d.Data["Login"]));
71 info.Logout = Util.ToDateTime(Convert.ToInt32(d.Data["Logout"])); 71 info.Logout = Util.ToDateTime(Convert.ToInt32(d.Data["Logout"]));
72 72
73 info.TOS = d.Data["TOS"];
74
73 return info; 75 return info;
74 } 76 }
75 77