mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
* 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...
This commit is contained in:
@@ -152,6 +152,49 @@ namespace OpenSim.Framework.Communications
|
||||
}
|
||||
}
|
||||
|
||||
#region Friend Methods
|
||||
/// <summary>
|
||||
/// Adds a new friend to the database for XUser
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being added to</param>
|
||||
/// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
|
||||
/// <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>
|
||||
public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||
{
|
||||
m_userService.AddNewUserFriend(friendlistowner, friend, perms);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete friend on friendlistowner's friendlist.
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
||||
/// <param name="friend">The Ex-friend agent</param>
|
||||
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
||||
{
|
||||
m_userService.RemoveUserFriend(friendlistowner, friend);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update permissions for friend on friendlistowner's friendlist.
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
||||
/// <param name="friend">The agent that is getting or loosing permissions</param>
|
||||
/// <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>
|
||||
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||
{
|
||||
m_userService.UpdateUserFriendPerms(friendlistowner, friend, perms);
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
||||
public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
|
||||
{
|
||||
return m_userService.GetUserFriendList(friendlistowner);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Packet Handlers
|
||||
|
||||
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
|
||||
|
||||
@@ -226,6 +226,13 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
param);
|
||||
updater.ExecuteNonQuery();
|
||||
|
||||
updater =
|
||||
database.Query(
|
||||
"delete from userfriends " +
|
||||
"where ownerID = ?friendID and friendID = ?ownerID",
|
||||
param);
|
||||
updater.ExecuteNonQuery();
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -47,16 +47,20 @@ namespace OpenSim.Framework.Data.SQLite
|
||||
/// </summary>
|
||||
private const string userSelect = "select * from users";
|
||||
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";
|
||||
|
||||
|
||||
private DataSet ds;
|
||||
private SqliteDataAdapter da;
|
||||
private SqliteDataAdapter daf;
|
||||
SqliteConnection g_conn;
|
||||
|
||||
public void Initialise()
|
||||
{
|
||||
SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3");
|
||||
TestTables(conn);
|
||||
|
||||
// This sucks, but It doesn't seem to work with the dataset Syncing :P
|
||||
g_conn = conn;
|
||||
|
||||
ds = new DataSet();
|
||||
da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn));
|
||||
daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn));
|
||||
@@ -147,11 +151,11 @@ namespace OpenSim.Framework.Data.SQLite
|
||||
|
||||
|
||||
DataRow row = friends.NewRow();
|
||||
fillFriendRow(row, friendlistowner,friend,perms);
|
||||
fillFriendRow(row, friendlistowner.UUID.ToString(),friend.UUID.ToString(),perms);
|
||||
friends.Rows.Add(row);
|
||||
|
||||
row = friends.NewRow();
|
||||
fillFriendRow(row, friend, friendlistowner, perms);
|
||||
fillFriendRow(row, friend.UUID.ToString(), friendlistowner.UUID.ToString(), perms);
|
||||
friends.Rows.Add(row);
|
||||
|
||||
MainLog.Instance.Verbose("SQLITE",
|
||||
@@ -164,7 +168,7 @@ namespace OpenSim.Framework.Data.SQLite
|
||||
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
||||
{
|
||||
DataTable ua = ds.Tables["userfriends"];
|
||||
string select = "a.ownernID '" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "';";
|
||||
string select = "`ownerID` ='" + friendlistowner.UUID.ToString() + "' and `friendID` ='" + friend.UUID.ToString() + "'";
|
||||
lock (ds)
|
||||
{
|
||||
DataRow[] rows = ds.Tables["userfriends"].Select(select);
|
||||
@@ -175,20 +179,44 @@ namespace OpenSim.Framework.Data.SQLite
|
||||
{
|
||||
for (int i = 0; i < rows.Length; i++)
|
||||
{
|
||||
FriendListItem user = new FriendListItem();
|
||||
DataRow row = rows[i];
|
||||
row.Delete();
|
||||
}
|
||||
daf.Update(ds, "userfriends");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
select = "`ownerID` ='" + friend.UUID.ToString() + "' and `friendID` ='" + friendlistowner.UUID.ToString() + "'";
|
||||
lock (ds)
|
||||
{
|
||||
DataRow[] rows = ds.Tables["userfriends"].Select(select);
|
||||
|
||||
if (rows != null)
|
||||
{
|
||||
if (rows.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < rows.Length; i++)
|
||||
{
|
||||
DataRow row = rows[i];
|
||||
row.Delete();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
SqliteCommand deletecommand = new SqliteCommand("delete from userfriends where `ownerID`='" + friendlistowner.UUID.ToString() + "' and `friendID` ='" + friend.UUID.ToString() + "'", g_conn);
|
||||
g_conn.Open();
|
||||
deletecommand.ExecuteNonQuery();
|
||||
deletecommand = new SqliteCommand("delete from userfriends where `ownerID`='" + friend.UUID.ToString() + "' and `friendID` ='" + friendlistowner.UUID.ToString() + "'", g_conn);
|
||||
deletecommand.ExecuteNonQuery();
|
||||
g_conn.Close();
|
||||
|
||||
MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called");
|
||||
}
|
||||
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||
{
|
||||
DataTable ua = ds.Tables["userfriends"];
|
||||
string select = "a.ownernID '" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "';";
|
||||
string select = "a.ownerID ='" + friendlistowner.UUID.ToString() + "' and b.friendID ='" + friend.UUID.ToString() + "'";
|
||||
lock (ds)
|
||||
{
|
||||
DataRow[] rows = ds.Tables["userfriends"].Select(select);
|
||||
@@ -737,7 +765,7 @@ namespace OpenSim.Framework.Data.SQLite
|
||||
daf.UpdateCommand = createUpdateCommand("userfriends", "ownerID=:ownerID and friendID=:friendID", ds.Tables["userfriends"]);
|
||||
daf.UpdateCommand.Connection = conn;
|
||||
|
||||
SqliteCommand delete = new SqliteCommand("delete from users where ownerID=:ownerID and friendID=:friendID");
|
||||
SqliteCommand delete = new SqliteCommand("delete from userfriends where ownerID=:ownerID and friendID=:friendID");
|
||||
delete.Parameters.Add(createSqliteParameter("ownerID", typeof(String)));
|
||||
delete.Parameters.Add(createSqliteParameter("friendID", typeof(String)));
|
||||
delete.Connection = conn;
|
||||
|
||||
64
OpenSim/Framework/GridInstantMessage.cs
Normal file
64
OpenSim/Framework/GridInstantMessage.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenSim.Framework;
|
||||
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public class GridInstantMessage
|
||||
{
|
||||
public Guid fromAgentID;
|
||||
public Guid fromAgentSession;
|
||||
public Guid toAgentID;
|
||||
public Guid imSessionID;
|
||||
public uint timestamp;
|
||||
public string fromAgentName;
|
||||
|
||||
public string message;
|
||||
public byte dialog;
|
||||
public bool fromGroup;
|
||||
public byte offline;
|
||||
|
||||
public uint ParentEstateID;
|
||||
|
||||
public sLLVector3 Position;
|
||||
|
||||
public Guid RegionID;
|
||||
|
||||
public byte[] binaryBucket;
|
||||
|
||||
public GridInstantMessage()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -395,6 +395,14 @@ namespace OpenSim.Framework
|
||||
|
||||
public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID);
|
||||
|
||||
public delegate void FriendActionDelegate(IClientAPI remoteClient,LLUUID agentID,LLUUID transactionID,List<LLUUID> callingCardFolders);
|
||||
|
||||
public delegate void FriendshipTermination(IClientAPI remoteClient,LLUUID agentID, LLUUID ExID);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public delegate void ObjectPermissions(
|
||||
IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID,
|
||||
List<ObjectPermissionsPacket.ObjectDataBlock> permChanges);
|
||||
@@ -490,6 +498,11 @@ namespace OpenSim.Framework
|
||||
event RegionInfoRequest OnRegionInfoRequest;
|
||||
event EstateCovenantRequest OnEstateCovenantRequest;
|
||||
|
||||
event FriendActionDelegate OnApproveFriendRequest;
|
||||
event FriendActionDelegate OnDenyFriendRequest;
|
||||
event FriendshipTermination OnTerminateFriendship;
|
||||
|
||||
|
||||
LLVector3 StartPos { get; set; }
|
||||
|
||||
LLUUID AgentId { get; }
|
||||
|
||||
@@ -47,5 +47,35 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new friend to the database for XUser
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being added to</param>
|
||||
/// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
|
||||
/// <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>
|
||||
void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms);
|
||||
|
||||
/// <summary>
|
||||
/// Delete friend on friendlistowner's friendlist.
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
||||
/// <param name="friend">The Ex-friend agent</param>
|
||||
void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend);
|
||||
|
||||
/// <summary>
|
||||
/// Update permissions for friend on friendlistowner's friendlist.
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
||||
/// <param name="friend">The agent that is getting or loosing permissions</param>
|
||||
/// <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>
|
||||
void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
||||
List<FriendListItem> GetUserFriendList(LLUUID friendlistowner);
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,8 @@ namespace OpenSim.Framework
|
||||
z = v.Z;
|
||||
}
|
||||
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
public float x=0;
|
||||
public float y=0;
|
||||
public float z=0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user