aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorHomer Horwitz2008-11-01 22:09:48 +0000
committerHomer Horwitz2008-11-01 22:09:48 +0000
commit38e8853e5761d09a7e8f580dd277d9b99b834696 (patch)
tree653fe4c9075a03c05a4b5782f7309afa83062e5c /OpenSim/Data
parent* minor: Remove mono compiler warning (diff)
downloadopensim-SC_OLD-38e8853e5761d09a7e8f580dd277d9b99b834696.zip
opensim-SC_OLD-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.gz
opensim-SC_OLD-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.bz2
opensim-SC_OLD-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.xz
Megapatch that fixes/adds: friend offer/deny/accept, friendship termination,
on-/offline updates, calling cards for friends. This adds methods in the DB layer and changes the MessagingServer, so a full update (incl. UGAIM) is necessary to get it working. Older regions shouldn't break, nor should older UGAIM break newer regions, but friends/presence will only work with all concerned parts (UGAIM, source region and destination region) at this revision (or later). I added the DB code for MSSQL, too, but couldn't test that. BEWARE: May contain bugs.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserData.cs33
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs43
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs1
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs22
-rw-r--r--OpenSim/Data/UserDataBase.cs1
5 files changed, 99 insertions, 1 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs
index ee7765f..4d4b3bc 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs
@@ -570,6 +570,39 @@ namespace OpenSim.Data.MSSQL
570 return friendList; 570 return friendList;
571 } 571 }
572 572
573 override public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
574 {
575 Dictionary<UUID, FriendRegionInfo> infos = new Dictionary<UUID,FriendRegionInfo>();
576 try
577 {
578 foreach (UUID uuid in uuids)
579 {
580 using (AutoClosingSqlCommand command = database.Query(
581 "select agentOnline,currentHandle from " + m_agentsTableName + " where UUID = @uuid"))
582 {
583 command.Parameters.Add(database.CreateParameter("@uuid", uuid));
584
585 using (IDataReader reader = command.ExecuteReader())
586 {
587 while (reader.Read())
588 {
589 FriendRegionInfo fri = new FriendRegionInfo();
590 fri.isOnline = (sbyte)reader["agentOnline"] != 0;
591 fri.regionHandle = (ulong)reader["currentHandle"];
592
593 infos[uuid] = fri;
594 }
595 }
596 }
597 }
598 }
599 catch (Exception e)
600 {
601 m_log.Warn("[MSSQL]: Got exception on trying to find friends regions:", e);
602 }
603
604 return infos;
605 }
573 #endregion 606 #endregion
574 607
575 #region Money functions (not used) 608 #region Money functions (not used)
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index e671989..c3aade0 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -365,6 +365,49 @@ namespace OpenSim.Data.MySQL
365 return Lfli; 365 return Lfli;
366 } 366 }
367 367
368 override public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
369 {
370 MySQLSuperManager dbm = GetLockedConnection("GetFriendRegionInfos");
371 Dictionary<UUID, FriendRegionInfo> infos = new Dictionary<UUID,FriendRegionInfo>();
372
373 try
374 {
375 foreach (UUID uuid in uuids)
376 {
377 Dictionary<string, string> param = new Dictionary<string, string>();
378 param["?uuid"] = uuid.ToString();
379 IDbCommand result =
380 dbm.Manager.Query("select agentOnline,currentHandle from " + m_agentsTableName +
381 " where UUID = ?uuid", param);
382
383 IDataReader reader = result.ExecuteReader();
384 while (reader.Read())
385 {
386 FriendRegionInfo fri = new FriendRegionInfo();
387 fri.isOnline = (sbyte)reader["agentOnline"] != 0;
388 fri.regionHandle = (ulong)reader["currentHandle"];
389
390 infos[uuid] = fri;
391 }
392
393 reader.Dispose();
394 result.Dispose();
395 }
396 }
397 catch (Exception e)
398 {
399 m_log.Warn("[MYSQL]: Got exception on trying to find friends regions:", e);
400 dbm.Manager.Reconnect();
401 m_log.Error(e.ToString());
402 }
403 finally
404 {
405 dbm.Release();
406 }
407
408 return infos;
409 }
410
368 #endregion 411 #endregion
369 412
370 public override void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle) 413 public override void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle)
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index 459b8e7..5ef48c8 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -255,6 +255,7 @@ namespace OpenSim.Data.NHibernate
255 public override void RemoveUserFriend(UUID friendlistowner, UUID friend) { return; } 255 public override void RemoveUserFriend(UUID friendlistowner, UUID friend) { return; }
256 public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) { return; } 256 public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) { return; }
257 public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return new List<FriendListItem>(); } 257 public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return new List<FriendListItem>(); }
258 public override Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids) { return new Dictionary<UUID, FriendRegionInfo>(); }
258 public override bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return true; } 259 public override bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return true; }
259 public override bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return true; } 260 public override bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return true; }
260 261
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 82db481..2f0863e 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -332,8 +332,28 @@ namespace OpenSim.Data.SQLite
332 return returnlist; 332 return returnlist;
333 } 333 }
334 334
335 override public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
336 {
337 Dictionary<UUID, FriendRegionInfo> infos = new Dictionary<UUID,FriendRegionInfo>();
335 338
336 339 DataTable agents = ds.Tables["useragents"];
340 foreach (UUID uuid in uuids)
341 {
342 lock (ds)
343 {
344 DataRow row = agents.Rows.Find(Util.ToRawUuidString(uuid));
345 if (row == null) infos[uuid] = null;
346 else
347 {
348 FriendRegionInfo fri = new FriendRegionInfo();
349 fri.isOnline = (bool)row["agentOnline"];
350 fri.regionHandle = Convert.ToUInt64(row["currentHandle"]);
351 infos[uuid] = fri;
352 }
353 }
354 }
355 return infos;
356 }
337 357
338 #endregion 358 #endregion
339 359
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs
index 33b8a94..a5fc8c8 100644
--- a/OpenSim/Data/UserDataBase.cs
+++ b/OpenSim/Data/UserDataBase.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Data
53 public abstract void RemoveUserFriend(UUID friendlistowner, UUID friend); 53 public abstract void RemoveUserFriend(UUID friendlistowner, UUID friend);
54 public abstract void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms); 54 public abstract void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
55 public abstract List<FriendListItem> GetUserFriendList(UUID friendlistowner); 55 public abstract List<FriendListItem> GetUserFriendList(UUID friendlistowner);
56 public abstract Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids);
56 public abstract bool MoneyTransferRequest(UUID from, UUID to, uint amount); 57 public abstract bool MoneyTransferRequest(UUID from, UUID to, uint amount);
57 public abstract bool InventoryTransferRequest(UUID from, UUID to, UUID inventory); 58 public abstract bool InventoryTransferRequest(UUID from, UUID to, UUID inventory);
58 public abstract List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query); 59 public abstract List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query);