diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/IFriendsData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLFriendsData.cs | 11 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFriendsData.cs | 14 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/FriendsStore.migrations | 6 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullFriendsData.cs | 18 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteFriendsData.cs | 12 |
6 files changed, 59 insertions, 6 deletions
diff --git a/OpenSim/Data/IFriendsData.cs b/OpenSim/Data/IFriendsData.cs index 1f1a031..3fdf87b 100644 --- a/OpenSim/Data/IFriendsData.cs +++ b/OpenSim/Data/IFriendsData.cs | |||
@@ -34,7 +34,7 @@ namespace OpenSim.Data | |||
34 | { | 34 | { |
35 | public class FriendsData | 35 | public class FriendsData |
36 | { | 36 | { |
37 | public UUID PrincipalID; | 37 | public string PrincipalID; |
38 | public string Friend; | 38 | public string Friend; |
39 | public Dictionary<string, string> Data; | 39 | public Dictionary<string, string> Data; |
40 | } | 40 | } |
@@ -46,6 +46,8 @@ namespace OpenSim.Data | |||
46 | { | 46 | { |
47 | bool Store(FriendsData data); | 47 | bool Store(FriendsData data); |
48 | bool Delete(UUID ownerID, string friend); | 48 | bool Delete(UUID ownerID, string friend); |
49 | bool Delete(string ownerID, string friend); | ||
49 | FriendsData[] GetFriends(UUID principalID); | 50 | FriendsData[] GetFriends(UUID principalID); |
51 | FriendsData[] GetFriends(string principalID); | ||
50 | } | 52 | } |
51 | } | 53 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs index af4fd9b..0b178f1 100644 --- a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs +++ b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs | |||
@@ -52,6 +52,11 @@ namespace OpenSim.Data.MSSQL | |||
52 | 52 | ||
53 | public bool Delete(UUID principalID, string friend) | 53 | public bool Delete(UUID principalID, string friend) |
54 | { | 54 | { |
55 | return Delete(principalID.ToString(), friend); | ||
56 | } | ||
57 | |||
58 | public bool Delete(string principalID, string friend) | ||
59 | { | ||
55 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | 60 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) |
56 | using (SqlCommand cmd = new SqlCommand()) | 61 | using (SqlCommand cmd = new SqlCommand()) |
57 | { | 62 | { |
@@ -68,6 +73,11 @@ namespace OpenSim.Data.MSSQL | |||
68 | 73 | ||
69 | public FriendsData[] GetFriends(UUID principalID) | 74 | public FriendsData[] GetFriends(UUID principalID) |
70 | { | 75 | { |
76 | return GetFriends(principalID.ToString()); | ||
77 | } | ||
78 | |||
79 | public FriendsData[] GetFriends(string principalID) | ||
80 | { | ||
71 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | 81 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) |
72 | using (SqlCommand cmd = new SqlCommand()) | 82 | using (SqlCommand cmd = new SqlCommand()) |
73 | { | 83 | { |
@@ -79,5 +89,6 @@ namespace OpenSim.Data.MSSQL | |||
79 | return DoQuery(cmd); | 89 | return DoQuery(cmd); |
80 | } | 90 | } |
81 | } | 91 | } |
92 | |||
82 | } | 93 | } |
83 | } | 94 | } |
diff --git a/OpenSim/Data/MySQL/MySQLFriendsData.cs b/OpenSim/Data/MySQL/MySQLFriendsData.cs index 663fad6..130ba5e 100644 --- a/OpenSim/Data/MySQL/MySQLFriendsData.cs +++ b/OpenSim/Data/MySQL/MySQLFriendsData.cs | |||
@@ -44,6 +44,11 @@ namespace OpenSim.Data.MySQL | |||
44 | 44 | ||
45 | public bool Delete(UUID principalID, string friend) | 45 | public bool Delete(UUID principalID, string friend) |
46 | { | 46 | { |
47 | return Delete(principalID.ToString(), friend); | ||
48 | } | ||
49 | |||
50 | public bool Delete(string principalID, string friend) | ||
51 | { | ||
47 | MySqlCommand cmd = new MySqlCommand(); | 52 | MySqlCommand cmd = new MySqlCommand(); |
48 | 53 | ||
49 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm); | 54 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm); |
@@ -64,5 +69,14 @@ namespace OpenSim.Data.MySQL | |||
64 | 69 | ||
65 | return DoQuery(cmd); | 70 | return DoQuery(cmd); |
66 | } | 71 | } |
72 | |||
73 | public FriendsData[] GetFriends(string principalID) | ||
74 | { | ||
75 | MySqlCommand cmd = new MySqlCommand(); | ||
76 | |||
77 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm); | ||
78 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%'); | ||
79 | return DoQuery(cmd); | ||
80 | } | ||
67 | } | 81 | } |
68 | } | 82 | } |
diff --git a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations index ce713bd..35e5e93 100644 --- a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations +++ b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations | |||
@@ -21,5 +21,11 @@ INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userf | |||
21 | 21 | ||
22 | COMMIT; | 22 | COMMIT; |
23 | 23 | ||
24 | :VERSION 3 # ------------------------- | ||
24 | 25 | ||
26 | BEGIN; | ||
27 | |||
28 | ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
29 | |||
30 | COMMIT; | ||
25 | 31 | ||
diff --git a/OpenSim/Data/Null/NullFriendsData.cs b/OpenSim/Data/Null/NullFriendsData.cs index e7f7fd3..d90788a 100644 --- a/OpenSim/Data/Null/NullFriendsData.cs +++ b/OpenSim/Data/Null/NullFriendsData.cs | |||
@@ -42,6 +42,11 @@ namespace OpenSim.Data.Null | |||
42 | { | 42 | { |
43 | } | 43 | } |
44 | 44 | ||
45 | public FriendsData[] GetFriends(UUID principalID) | ||
46 | { | ||
47 | return GetFriends(principalID.ToString()); | ||
48 | } | ||
49 | |||
45 | /// <summary> | 50 | /// <summary> |
46 | /// Tries to implement the Get [] semantics, but it cuts corners. | 51 | /// Tries to implement the Get [] semantics, but it cuts corners. |
47 | /// Specifically, it gets all friendships even if they weren't accepted yet. | 52 | /// Specifically, it gets all friendships even if they weren't accepted yet. |
@@ -49,11 +54,11 @@ namespace OpenSim.Data.Null | |||
49 | /// <param name="fields"></param> | 54 | /// <param name="fields"></param> |
50 | /// <param name="values"></param> | 55 | /// <param name="values"></param> |
51 | /// <returns></returns> | 56 | /// <returns></returns> |
52 | public FriendsData[] GetFriends(UUID userID) | 57 | public FriendsData[] GetFriends(string userID) |
53 | { | 58 | { |
54 | List<FriendsData> lst = m_Data.FindAll(delegate (FriendsData fdata) | 59 | List<FriendsData> lst = m_Data.FindAll(delegate (FriendsData fdata) |
55 | { | 60 | { |
56 | return fdata.PrincipalID == userID; | 61 | return fdata.PrincipalID == userID.ToString(); |
57 | }); | 62 | }); |
58 | 63 | ||
59 | if (lst != null) | 64 | if (lst != null) |
@@ -72,9 +77,14 @@ namespace OpenSim.Data.Null | |||
72 | return true; | 77 | return true; |
73 | } | 78 | } |
74 | 79 | ||
75 | public bool Delete(UUID userID, string friendID) | 80 | public bool Delete(UUID principalID, string friend) |
81 | { | ||
82 | return Delete(principalID.ToString(), friend); | ||
83 | } | ||
84 | |||
85 | public bool Delete(string userID, string friendID) | ||
76 | { | 86 | { |
77 | List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID; }); | 87 | List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID.ToString(); }); |
78 | if (lst != null) | 88 | if (lst != null) |
79 | { | 89 | { |
80 | FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; }); | 90 | FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; }); |
diff --git a/OpenSim/Data/SQLite/SQLiteFriendsData.cs b/OpenSim/Data/SQLite/SQLiteFriendsData.cs index 4bfd228..b14c348 100644 --- a/OpenSim/Data/SQLite/SQLiteFriendsData.cs +++ b/OpenSim/Data/SQLite/SQLiteFriendsData.cs | |||
@@ -46,7 +46,12 @@ namespace OpenSim.Data.SQLite | |||
46 | { | 46 | { |
47 | } | 47 | } |
48 | 48 | ||
49 | public FriendsData[] GetFriends(UUID userID) | 49 | public FriendsData[] GetFriends(UUID principalID) |
50 | { | ||
51 | return GetFriends(principalID.ToString()); | ||
52 | } | ||
53 | |||
54 | public FriendsData[] GetFriends(string userID) | ||
50 | { | 55 | { |
51 | SqliteCommand cmd = new SqliteCommand(); | 56 | SqliteCommand cmd = new SqliteCommand(); |
52 | 57 | ||
@@ -59,6 +64,11 @@ namespace OpenSim.Data.SQLite | |||
59 | 64 | ||
60 | public bool Delete(UUID principalID, string friend) | 65 | public bool Delete(UUID principalID, string friend) |
61 | { | 66 | { |
67 | return Delete(principalID.ToString(), friend); | ||
68 | } | ||
69 | |||
70 | public bool Delete(string principalID, string friend) | ||
71 | { | ||
62 | SqliteCommand cmd = new SqliteCommand(); | 72 | SqliteCommand cmd = new SqliteCommand(); |
63 | 73 | ||
64 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); | 74 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); |