diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/IFriendsData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFriendsData.cs | 19 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/001_FriendsStore.sql | 5 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/002_FriendsStore.sql | 5 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IFriendsService.cs | 5 |
5 files changed, 27 insertions, 11 deletions
diff --git a/OpenSim/Data/IFriendsData.cs b/OpenSim/Data/IFriendsData.cs index 7618976..1f1a031 100644 --- a/OpenSim/Data/IFriendsData.cs +++ b/OpenSim/Data/IFriendsData.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Data | |||
45 | public interface IFriendsData | 45 | public interface IFriendsData |
46 | { | 46 | { |
47 | bool Store(FriendsData data); | 47 | bool Store(FriendsData data); |
48 | bool Delete(UUID ownerID, UUID friendID); | 48 | bool Delete(UUID ownerID, string friend); |
49 | FriendsData[] GetFriends(UUID owner); | 49 | FriendsData[] GetFriends(UUID principalID); |
50 | } | 50 | } |
51 | } | 51 | } |
diff --git a/OpenSim/Data/MySQL/MySQLFriendsData.cs b/OpenSim/Data/MySQL/MySQLFriendsData.cs index 923810b..9f7e850 100644 --- a/OpenSim/Data/MySQL/MySQLFriendsData.cs +++ b/OpenSim/Data/MySQL/MySQLFriendsData.cs | |||
@@ -38,19 +38,26 @@ namespace OpenSim.Data.MySQL | |||
38 | public class MySqlFriendsData : MySQLGenericTableHandler<FriendsData>, IFriendsData | 38 | public class MySqlFriendsData : MySQLGenericTableHandler<FriendsData>, IFriendsData |
39 | { | 39 | { |
40 | public MySqlFriendsData(string connectionString, string realm) | 40 | public MySqlFriendsData(string connectionString, string realm) |
41 | : base(connectionString, realm, "Friends") | 41 | : base(connectionString, realm, "FriendsStore") |
42 | { | 42 | { |
43 | } | 43 | } |
44 | 44 | ||
45 | public bool Delete(UUID principalID, UUID friendID) | 45 | public bool Delete(UUID principalID, string friend) |
46 | { | 46 | { |
47 | // We need to delete the row where PrincipalID=principalID AND FriendID=firnedID | 47 | MySqlCommand cmd = new MySqlCommand(); |
48 | return false; | 48 | |
49 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm); | ||
50 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | ||
51 | cmd.Parameters.AddWithValue("?Friend", friend); | ||
52 | |||
53 | ExecuteNonQuery(cmd); | ||
54 | |||
55 | return true; | ||
49 | } | 56 | } |
50 | 57 | ||
51 | public FriendsData[] GetFriends(UUID userID) | 58 | public FriendsData[] GetFriends(UUID principalID) |
52 | { | 59 | { |
53 | return Get("PrincipalID =\'" + userID.ToString() + "'"); | 60 | return Get("PrincipalID", principalID.ToString()); |
54 | } | 61 | } |
55 | } | 62 | } |
56 | } | 63 | } |
diff --git a/OpenSim/Data/MySQL/Resources/001_FriendsStore.sql b/OpenSim/Data/MySQL/Resources/001_FriendsStore.sql new file mode 100644 index 0000000..da2c59c --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/001_FriendsStore.sql | |||
@@ -0,0 +1,5 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | CREATE TABLE `Friends` (`PrincipalID` CHAR(36) NOT NULL, `Friend` VARCHAR(255) NOT NULL, `Flags` VARCHAR(16) NOT NULL DEFAULT 0, `Offered` VARCHAR(32) NOT NULL DEFAULT 0, PRIMARY KEY(`PrincipalID`, `Friend`), KEY(`PrincipalID`)); | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/MySQL/Resources/002_FriendsStore.sql b/OpenSim/Data/MySQL/Resources/002_FriendsStore.sql new file mode 100644 index 0000000..a363867 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/002_FriendsStore.sql | |||
@@ -0,0 +1,5 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userfriends`; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs index ed77c1a..4e665cd 100644 --- a/OpenSim/Services/Interfaces/IFriendsService.cs +++ b/OpenSim/Services/Interfaces/IFriendsService.cs | |||
@@ -35,15 +35,14 @@ namespace OpenSim.Region.Framework.Interfaces | |||
35 | { | 35 | { |
36 | public UUID PrincipalID; | 36 | public UUID PrincipalID; |
37 | public string Friend; | 37 | public string Friend; |
38 | int MyRights; | 38 | int MyFlags; |
39 | int TheirRights; | 39 | int TheirFlags; |
40 | } | 40 | } |
41 | 41 | ||
42 | public interface IFriendsService | 42 | public interface IFriendsService |
43 | { | 43 | { |
44 | FriendInfo[] GetFriends(UUID PrincipalID); | 44 | FriendInfo[] GetFriends(UUID PrincipalID); |
45 | bool StoreFriend(UUID PrincipalID, string Friend, int flags); | 45 | bool StoreFriend(UUID PrincipalID, string Friend, int flags); |
46 | bool SetFlags(UUID PrincipalID, int flags); | ||
47 | bool Delete(UUID PrincipalID, string Friend); | 46 | bool Delete(UUID PrincipalID, string Friend); |
48 | } | 47 | } |
49 | } | 48 | } |