aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-01 06:12:04 +0000
committerTeravus Ovares2008-01-01 06:12:04 +0000
commitb4c9b6bd19c0725ae5bf60172db75ebc63ba72c6 (patch)
treed7e9e370371edbcbebb8436791ba8b1cd940ab69 /OpenSim/Framework
parentMake it possible for new inventory 'libraries' to be added without changing t... (diff)
downloadopensim-SC_OLD-b4c9b6bd19c0725ae5bf60172db75ebc63ba72c6.zip
opensim-SC_OLD-b4c9b6bd19c0725ae5bf60172db75ebc63ba72c6.tar.gz
opensim-SC_OLD-b4c9b6bd19c0725ae5bf60172db75ebc63ba72c6.tar.bz2
opensim-SC_OLD-b4c9b6bd19c0725ae5bf60172db75ebc63ba72c6.tar.xz
* You can add and remove a friend in standalone now within the same simulator. It saves.
* You can add and remove a friend in grid mode now within the same simulator. It doesn't save yet. * I got rid of Mr. OpenSim as a friend.. he bothers me /:b...
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs43
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs7
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteUserData.cs44
-rw-r--r--OpenSim/Framework/GridInstantMessage.cs64
-rw-r--r--OpenSim/Framework/IClientAPI.cs13
-rw-r--r--OpenSim/Framework/IUserService.cs30
-rw-r--r--OpenSim/Framework/sLLVector3.cs6
7 files changed, 196 insertions, 11 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 02c54e1..0c6d53f 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -152,6 +152,49 @@ namespace OpenSim.Framework.Communications
152 } 152 }
153 } 153 }
154 154
155 #region Friend Methods
156 /// <summary>
157 /// Adds a new friend to the database for XUser
158 /// </summary>
159 /// <param name="friendlistowner">The agent that who's friends list is being added to</param>
160 /// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
161 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
162 public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
163 {
164 m_userService.AddNewUserFriend(friendlistowner, friend, perms);
165 }
166
167 /// <summary>
168 /// Delete friend on friendlistowner's friendlist.
169 /// </summary>
170 /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
171 /// <param name="friend">The Ex-friend agent</param>
172 public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
173 {
174 m_userService.RemoveUserFriend(friendlistowner, friend);
175 }
176
177 /// <summary>
178 /// Update permissions for friend on friendlistowner's friendlist.
179 /// </summary>
180 /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
181 /// <param name="friend">The agent that is getting or loosing permissions</param>
182 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
183 public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
184 {
185 m_userService.UpdateUserFriendPerms(friendlistowner, friend, perms);
186 }
187 /// <summary>
188 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
189 /// </summary>
190 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
191 public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
192 {
193 return m_userService.GetUserFriendList(friendlistowner);
194 }
195
196 #endregion
197
155 #region Packet Handlers 198 #region Packet Handlers
156 199
157 public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client) 200 public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 779d050..a5e6da4 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -226,6 +226,13 @@ namespace OpenSim.Framework.Data.MySQL
226 param); 226 param);
227 updater.ExecuteNonQuery(); 227 updater.ExecuteNonQuery();
228 228
229 updater =
230 database.Query(
231 "delete from userfriends " +
232 "where ownerID = ?friendID and friendID = ?ownerID",
233 param);
234 updater.ExecuteNonQuery();
235
229 } 236 }
230 } 237 }
231 catch (Exception e) 238 catch (Exception e)
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
index c97dc52..e9a8eca 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
@@ -47,16 +47,20 @@ namespace OpenSim.Framework.Data.SQLite
47 /// </summary> 47 /// </summary>
48 private const string userSelect = "select * from users"; 48 private const string userSelect = "select * from users";
49 private const string userFriendsSelect = "select a.ownerID as ownerID,a.friendID as friendID,a.friendPerms as friendPerms,b.friendPerms as ownerperms, b.ownerID as fownerID, b.friendID as ffriendID from userfriends as a, userfriends as b"; 49 private const string userFriendsSelect = "select a.ownerID as ownerID,a.friendID as friendID,a.friendPerms as friendPerms,b.friendPerms as ownerperms, b.ownerID as fownerID, b.friendID as ffriendID from userfriends as a, userfriends as b";
50 50
51 private DataSet ds; 51 private DataSet ds;
52 private SqliteDataAdapter da; 52 private SqliteDataAdapter da;
53 private SqliteDataAdapter daf; 53 private SqliteDataAdapter daf;
54 SqliteConnection g_conn;
54 55
55 public void Initialise() 56 public void Initialise()
56 { 57 {
57 SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3"); 58 SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3");
58 TestTables(conn); 59 TestTables(conn);
59 60
61 // This sucks, but It doesn't seem to work with the dataset Syncing :P
62 g_conn = conn;
63
60 ds = new DataSet(); 64 ds = new DataSet();
61 da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); 65 da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn));
62 daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn)); 66 daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn));
@@ -147,11 +151,11 @@ namespace OpenSim.Framework.Data.SQLite
147 151
148 152
149 DataRow row = friends.NewRow(); 153 DataRow row = friends.NewRow();
150 fillFriendRow(row, friendlistowner,friend,perms); 154 fillFriendRow(row, friendlistowner.UUID.ToString(),friend.UUID.ToString(),perms);
151 friends.Rows.Add(row); 155 friends.Rows.Add(row);
152 156
153 row = friends.NewRow(); 157 row = friends.NewRow();
154 fillFriendRow(row, friend, friendlistowner, perms); 158 fillFriendRow(row, friend.UUID.ToString(), friendlistowner.UUID.ToString(), perms);
155 friends.Rows.Add(row); 159 friends.Rows.Add(row);
156 160
157 MainLog.Instance.Verbose("SQLITE", 161 MainLog.Instance.Verbose("SQLITE",
@@ -164,7 +168,7 @@ namespace OpenSim.Framework.Data.SQLite
164 public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) 168 public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
165 { 169 {
166 DataTable ua = ds.Tables["userfriends"]; 170 DataTable ua = ds.Tables["userfriends"];
167 string select = "a.ownernID '" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "';"; 171 string select = "`ownerID` ='" + friendlistowner.UUID.ToString() + "' and `friendID` ='" + friend.UUID.ToString() + "'";
168 lock (ds) 172 lock (ds)
169 { 173 {
170 DataRow[] rows = ds.Tables["userfriends"].Select(select); 174 DataRow[] rows = ds.Tables["userfriends"].Select(select);
@@ -175,20 +179,44 @@ namespace OpenSim.Framework.Data.SQLite
175 { 179 {
176 for (int i = 0; i < rows.Length; i++) 180 for (int i = 0; i < rows.Length; i++)
177 { 181 {
178 FriendListItem user = new FriendListItem();
179 DataRow row = rows[i]; 182 DataRow row = rows[i];
180 row.Delete(); 183 row.Delete();
181 } 184 }
182 daf.Update(ds, "userfriends"); 185
186 }
187 }
188 }
189 select = "`ownerID` ='" + friend.UUID.ToString() + "' and `friendID` ='" + friendlistowner.UUID.ToString() + "'";
190 lock (ds)
191 {
192 DataRow[] rows = ds.Tables["userfriends"].Select(select);
193
194 if (rows != null)
195 {
196 if (rows.Length > 0)
197 {
198 for (int i = 0; i < rows.Length; i++)
199 {
200 DataRow row = rows[i];
201 row.Delete();
202 }
203
183 } 204 }
184 } 205 }
185 } 206 }
207 SqliteCommand deletecommand = new SqliteCommand("delete from userfriends where `ownerID`='" + friendlistowner.UUID.ToString() + "' and `friendID` ='" + friend.UUID.ToString() + "'", g_conn);
208 g_conn.Open();
209 deletecommand.ExecuteNonQuery();
210 deletecommand = new SqliteCommand("delete from userfriends where `ownerID`='" + friend.UUID.ToString() + "' and `friendID` ='" + friendlistowner.UUID.ToString() + "'", g_conn);
211 deletecommand.ExecuteNonQuery();
212 g_conn.Close();
213
186 MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called"); 214 MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called");
187 } 215 }
188 public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) 216 public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
189 { 217 {
190 DataTable ua = ds.Tables["userfriends"]; 218 DataTable ua = ds.Tables["userfriends"];
191 string select = "a.ownernID '" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "';"; 219 string select = "a.ownerID ='" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "'";
192 lock (ds) 220 lock (ds)
193 { 221 {
194 DataRow[] rows = ds.Tables["userfriends"].Select(select); 222 DataRow[] rows = ds.Tables["userfriends"].Select(select);
@@ -737,7 +765,7 @@ namespace OpenSim.Framework.Data.SQLite
737 daf.UpdateCommand = createUpdateCommand("userfriends", "ownerID=:ownerID and friendID=:friendID", ds.Tables["userfriends"]); 765 daf.UpdateCommand = createUpdateCommand("userfriends", "ownerID=:ownerID and friendID=:friendID", ds.Tables["userfriends"]);
738 daf.UpdateCommand.Connection = conn; 766 daf.UpdateCommand.Connection = conn;
739 767
740 SqliteCommand delete = new SqliteCommand("delete from users where ownerID=:ownerID and friendID=:friendID"); 768 SqliteCommand delete = new SqliteCommand("delete from userfriends where ownerID=:ownerID and friendID=:friendID");
741 delete.Parameters.Add(createSqliteParameter("ownerID", typeof(String))); 769 delete.Parameters.Add(createSqliteParameter("ownerID", typeof(String)));
742 delete.Parameters.Add(createSqliteParameter("friendID", typeof(String))); 770 delete.Parameters.Add(createSqliteParameter("friendID", typeof(String)));
743 delete.Connection = conn; 771 delete.Connection = conn;
diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs
new file mode 100644
index 0000000..6ae3424
--- /dev/null
+++ b/OpenSim/Framework/GridInstantMessage.cs
@@ -0,0 +1,64 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using OpenSim.Framework;
31
32
33namespace OpenSim.Framework
34{
35
36 [Serializable]
37 public class GridInstantMessage
38 {
39 public Guid fromAgentID;
40 public Guid fromAgentSession;
41 public Guid toAgentID;
42 public Guid imSessionID;
43 public uint timestamp;
44 public string fromAgentName;
45
46 public string message;
47 public byte dialog;
48 public bool fromGroup;
49 public byte offline;
50
51 public uint ParentEstateID;
52
53 public sLLVector3 Position;
54
55 public Guid RegionID;
56
57 public byte[] binaryBucket;
58
59 public GridInstantMessage()
60 {
61
62 }
63 }
64}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 61a713a..c5e4809 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -395,6 +395,14 @@ namespace OpenSim.Framework
395 395
396 public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); 396 public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID);
397 397
398 public delegate void FriendActionDelegate(IClientAPI remoteClient,LLUUID agentID,LLUUID transactionID,List<LLUUID> callingCardFolders);
399
400 public delegate void FriendshipTermination(IClientAPI remoteClient,LLUUID agentID, LLUUID ExID);
401
402
403
404
405
398 public delegate void ObjectPermissions( 406 public delegate void ObjectPermissions(
399 IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, 407 IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID,
400 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges); 408 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges);
@@ -490,6 +498,11 @@ namespace OpenSim.Framework
490 event RegionInfoRequest OnRegionInfoRequest; 498 event RegionInfoRequest OnRegionInfoRequest;
491 event EstateCovenantRequest OnEstateCovenantRequest; 499 event EstateCovenantRequest OnEstateCovenantRequest;
492 500
501 event FriendActionDelegate OnApproveFriendRequest;
502 event FriendActionDelegate OnDenyFriendRequest;
503 event FriendshipTermination OnTerminateFriendship;
504
505
493 LLVector3 StartPos { get; set; } 506 LLVector3 StartPos { get; set; }
494 507
495 LLUUID AgentId { get; } 508 LLUUID AgentId { get; }
diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs
index 2b08582..2b59c25 100644
--- a/OpenSim/Framework/IUserService.cs
+++ b/OpenSim/Framework/IUserService.cs
@@ -47,5 +47,35 @@ namespace OpenSim.Framework
47 /// </summary> 47 /// </summary>
48 /// <param name="user"></param> 48 /// <param name="user"></param>
49 LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); 49 LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
50
51
52 /// <summary>
53 /// Adds a new friend to the database for XUser
54 /// </summary>
55 /// <param name="friendlistowner">The agent that who's friends list is being added to</param>
56 /// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
57 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
58 void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms);
59
60 /// <summary>
61 /// Delete friend on friendlistowner's friendlist.
62 /// </summary>
63 /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
64 /// <param name="friend">The Ex-friend agent</param>
65 void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend);
66
67 /// <summary>
68 /// Update permissions for friend on friendlistowner's friendlist.
69 /// </summary>
70 /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
71 /// <param name="friend">The agent that is getting or loosing permissions</param>
72 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
73 void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms);
74
75 /// <summary>
76 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
77 /// </summary>
78 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
79 List<FriendListItem> GetUserFriendList(LLUUID friendlistowner);
50 } 80 }
51} \ No newline at end of file 81} \ No newline at end of file
diff --git a/OpenSim/Framework/sLLVector3.cs b/OpenSim/Framework/sLLVector3.cs
index 2e2c005..8187597 100644
--- a/OpenSim/Framework/sLLVector3.cs
+++ b/OpenSim/Framework/sLLVector3.cs
@@ -45,8 +45,8 @@ namespace OpenSim.Framework
45 z = v.Z; 45 z = v.Z;
46 } 46 }
47 47
48 public float x; 48 public float x=0;
49 public float y; 49 public float y=0;
50 public float z; 50 public float z=0;
51 } 51 }
52} \ No newline at end of file 52} \ No newline at end of file