aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLFriendsData.cs
diff options
context:
space:
mode:
authorDiva Canto2011-05-22 16:51:03 -0700
committerDiva Canto2011-05-22 16:51:03 -0700
commit336665e03532cf9d7a1ad65d5071e7050bf6ecd0 (patch)
tree45c7c1145de1b5af3ff198bcb29564a2547e4575 /OpenSim/Data/MySQL/MySQLFriendsData.cs
parentFile to be removed (diff)
downloadopensim-SC_OLD-336665e03532cf9d7a1ad65d5071e7050bf6ecd0.zip
opensim-SC_OLD-336665e03532cf9d7a1ad65d5071e7050bf6ecd0.tar.gz
opensim-SC_OLD-336665e03532cf9d7a1ad65d5071e7050bf6ecd0.tar.bz2
opensim-SC_OLD-336665e03532cf9d7a1ad65d5071e7050bf6ecd0.tar.xz
More on HG Friends. Added Delete(string, string) across the board. Added security to friendship identifiers so that they can safely be deleted across worlds. Had to change Get(string) to use LIKE because the secret in the identifier is not always known -- affects only HG visitors. BOTTOM LINE SO FAR: HG friendships established and deleted safely across grids, local rights working but not (yet?) being transmitted back.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLFriendsData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLFriendsData.cs17
1 files changed, 13 insertions, 4 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFriendsData.cs b/OpenSim/Data/MySQL/MySQLFriendsData.cs
index 69fac9d..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);
@@ -57,16 +62,20 @@ namespace OpenSim.Data.MySQL
57 62
58 public FriendsData[] GetFriends(UUID principalID) 63 public FriendsData[] GetFriends(UUID principalID)
59 { 64 {
60 return GetFriends(principalID.ToString()); 65 MySqlCommand cmd = new MySqlCommand();
66
67 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 = ?PrincipalID", m_Realm);
68 cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
69
70 return DoQuery(cmd);
61 } 71 }
62 72
63 public FriendsData[] GetFriends(string principalID) 73 public FriendsData[] GetFriends(string principalID)
64 { 74 {
65 MySqlCommand cmd = new MySqlCommand(); 75 MySqlCommand cmd = new MySqlCommand();
66 76
67 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 = ?PrincipalID", m_Realm); 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);
68 cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); 78 cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%');
69
70 return DoQuery(cmd); 79 return DoQuery(cmd);
71 } 80 }
72 } 81 }